Commit 191c32b6 authored by claes's avatar claes

XY_Curve added

parent 3d29cada
This diff is collapsed.
/*
* Proview $Id: ge_attrnav.cpp,v 1.17 2007-05-07 14:35:03 claes Exp $
* Proview $Id: ge_attrnav.cpp,v 1.18 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -81,6 +81,7 @@ static attrnav_sEnumElement elem_dyn_type[] = {
{ (int) ge_mDynType_Bar , "Bar"},
{ (int) ge_mDynType_Trend , "Trend"},
{ (int) ge_mDynType_FastCurve , "FastCurve"},
{ (int) ge_mDynType_XY_Curve , "XY_Curve"},
{ (int) ge_mDynType_SliderBackground , "SliderBackground"},
{ (int) ge_mDynType_Video , "Video"},
{ (int) ge_mDynType_Table , "Table"},
......@@ -112,6 +113,7 @@ static attrnav_sEnumElement elem_dyn_type_tone[] = {
{ (int) ge_mDynType_Bar , "Bar"},
{ (int) ge_mDynType_Trend , "Trend"},
{ (int) ge_mDynType_FastCurve , "FastCurve"},
{ (int) ge_mDynType_XY_Curve , "XY_Curve"},
{ (int) ge_mDynType_SliderBackground , "SliderBackground"},
{ (int) ge_mDynType_Video , "Video"},
{ (int) ge_mDynType_Table , "Table"},
......@@ -903,6 +905,12 @@ static attrnav_sEnumElement elem_scale_type[] = {
{ (int) glow_eScaleType_Center, "Center"},
{ 0, ""}};
static attrnav_sEnumElement elem_curve_datatype[] = {
{ (int) ge_eCurveDataType_XYArrays, "XYArrays"},
{ (int) ge_eCurveDataType_PointArray, "PointArray"},
{ (int) ge_eCurveDataType_TableObject, "TableObject"},
{ 0, ""}};
static attrnav_sEnum enum_types[] = {
{ (int) glow_eType_Direction, (attrnav_sEnumElement *) &elem_direction},
{ (int) glow_eType_Color, (attrnav_sEnumElement *) &elem_color},
......@@ -918,6 +926,7 @@ static attrnav_sEnum enum_types[] = {
{ (int) ge_eAttrType_ScaleType, (attrnav_sEnumElement *) &elem_scale_type},
{ (int) glow_eType_Adjustment, (attrnav_sEnumElement *) &elem_adjustment},
{ (int) glow_eType_Font, (attrnav_sEnumElement *) &elem_font},
{ (int) ge_eAttrType_CurveDataType, (attrnav_sEnumElement *) &elem_curve_datatype},
{ 0, NULL}};
static attrnav_sEnum mask_types[] = {
......@@ -988,6 +997,7 @@ int attrnav_attr_string_to_value( int type_id, char *value_str,
case ge_eAttrType_InstanceMask:
case ge_eAttrType_InputFocus:
case ge_eAttrType_ScaleType:
case ge_eAttrType_CurveDataType:
{
if ( sscanf( value_str, "%u", (int *)buffer_ptr) != 1)
return ATTRNAV__INPUT_SYNTAX;
......@@ -1064,6 +1074,7 @@ void attrnav_attrvalue_to_string( int type_id, void *value_ptr,
case ge_eAttrType_AnimSequence:
case ge_eAttrType_LimitType:
case ge_eAttrType_ScaleType:
case ge_eAttrType_CurveDataType:
{
attrnav_sEnumElement *elem_p;
attrnav_sEnum *enum_p;
......@@ -2123,6 +2134,7 @@ ItemLocal::ItemLocal( AttrNav *attrnav, char *item_name, char *attr,
case ge_eAttrType_InstanceMask:
case ge_eAttrType_InputFocus:
case ge_eAttrType_ScaleType:
case ge_eAttrType_CurveDataType:
if ( !noedit)
{
brow_SetAnnotPixmap( node, 0, attrnav->brow->pixmap_attrarray);
......
This diff is collapsed.
/*
* Proview $Id: ge_dyn.h,v 1.32 2007-04-25 13:36:13 claes Exp $
* Proview $Id: ge_dyn.h,v 1.33 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -71,6 +71,13 @@
ge_mInputFocus_LastVertical = 1 << 5 //!< Last vertical input focus.
} ge_mInputFocus;
//! Types of animation sequences.
typedef enum {
ge_eCurveDataType_XYArrays, //!< One x array and one y array.
ge_eCurveDataType_PointArray, //!< One point array.
ge_eCurveDataType_TableObject //!< Table object syntax.
} ge_eCurveDataType;
//! Dyn attributes displayed in attribute editor
typedef enum {
ge_eDynAttr_All,
......@@ -111,6 +118,7 @@
ge_eDynPrio_Bar,
ge_eDynPrio_Trend,
ge_eDynPrio_FastCurve,
ge_eDynPrio_XY_Curve,
ge_eDynPrio_AnalogText,
ge_eDynPrio_Table,
ge_eDynPrio_SliderBackground,
......@@ -169,7 +177,8 @@
ge_mDynType_Table = 1 << 24,
ge_mDynType_StatusColor = 1 << 25,
ge_mDynType_HostObject = 1 << 26,
ge_mDynType_DigSound = 1 << 27
ge_mDynType_DigSound = 1 << 27,
ge_mDynType_XY_Curve = 1 << 28
} ge_mDynType;
//! Action types.
......@@ -266,6 +275,7 @@
ge_eSave_StatusColor = 31,
ge_eSave_HostObject = 32,
ge_eSave_DigSound = 33,
ge_eSave_XY_Curve = 34,
ge_eSave_PopupMenu = 50,
ge_eSave_SetDig = 51,
ge_eSave_ResetDig = 52,
......@@ -410,6 +420,24 @@
ge_eSave_DigSound_interval = 3303,
ge_eSave_DigSound_instance = 3304,
ge_eSave_DigSound_instance_mask = 3305,
ge_eSave_XY_Curve_x_attr = 3400,
ge_eSave_XY_Curve_y_attr = 3401,
ge_eSave_XY_Curve_y_min_value = 3402,
ge_eSave_XY_Curve_y_max_value = 3403,
ge_eSave_XY_Curve_x_min_value = 3404,
ge_eSave_XY_Curve_x_max_value = 3405,
ge_eSave_XY_Curve_y_minvalue_attr = 3406,
ge_eSave_XY_Curve_y_maxvalue_attr = 3407,
ge_eSave_XY_Curve_x_minvalue_attr = 3408,
ge_eSave_XY_Curve_x_maxvalue_attr = 3409,
ge_eSave_XY_Curve_noofpoints = 3410,
ge_eSave_XY_Curve_noofpoints_attr = 3411,
ge_eSave_XY_Curve_update_attr = 3412,
ge_eSave_XY_Curve_datatype = 3413,
ge_eSave_XY_Curve_instance = 3414,
ge_eSave_XY_Curve_instance_mask = 3415,
ge_eSave_XY_Curve_curve_color = 3416,
ge_eSave_XY_Curve_fill_color = 3417,
ge_eSave_PopupMenu_ref_object = 5000,
ge_eSave_SetDig_attribute = 5100,
ge_eSave_SetDig_instance = 5101,
......@@ -2076,6 +2104,81 @@ class GeTrend : public GeDynElem {
void replace_attribute( char *from, char *to, int *cnt, int strict);
};
//! Dynamics for a xy curve object.
class GeXY_Curve : public GeDynElem {
public:
pwr_tAName x_attr;
pwr_tAName y_attr;
pwr_tAName y_minvalue_attr;
pwr_tAName y_maxvalue_attr;
pwr_tAName x_minvalue_attr;
pwr_tAName x_maxvalue_attr;
pwr_tAName noofpoints_attr;
pwr_tAName update_attr;
double y_min_value;
double y_max_value;
double x_min_value;
double x_max_value;
int noofpoints;
int datatype;
glow_eDrawType curve_color;
glow_eDrawType fill_color;
bool first_scan;
pwr_tBoolean *update_p;
pwr_tSubid update_subid;
pwr_tBoolean old_update;
pwr_tInt32 *noofpoints_p;
pwr_tSubid noofpoints_subid;
pwr_tInt32 old_noofpoints;
int curve_typeid;
pwr_tFloat32 *y_min_value_p;
pwr_tFloat32 *y_max_value_p;
pwr_tFloat32 *x_min_value_p;
pwr_tFloat32 *x_max_value_p;
pwr_tFloat32 old_y_min_value;
pwr_tFloat32 old_y_max_value;
pwr_tFloat32 old_x_min_value;
pwr_tFloat32 old_x_max_value;
pwr_tSubid y_min_value_subid;
pwr_tSubid y_max_value_subid;
pwr_tSubid x_min_value_subid;
pwr_tSubid x_max_value_subid;
int curve_number;
GeXY_Curve( GeDyn *e_dyn, ge_mInstance e_instance = ge_mInstance_1) :
GeDynElem(e_dyn, ge_mDynType_XY_Curve, (ge_mActionType) 0, ge_eDynPrio_XY_Curve),
y_min_value(0), y_max_value(100), x_min_value(0), x_max_value(100),
noofpoints(100), datatype(0), curve_color(glow_eDrawType_Inherit),
fill_color(glow_eDrawType_Inherit), update_p(0), old_update(0),
noofpoints_p(0), old_noofpoints(0),
y_min_value_p(0), y_max_value_p(0), x_min_value_p(0), x_max_value_p(0),
old_y_min_value(0), old_y_max_value(0), old_x_min_value(0), old_x_max_value(0)
{ instance = e_instance; strcpy( x_attr, ""); strcpy( y_attr, "");
strcpy( y_minvalue_attr, ""); strcpy( y_maxvalue_attr, "");
strcpy( x_minvalue_attr, ""); strcpy( x_maxvalue_attr, "");
strcpy( noofpoints_attr, ""); strcpy( update_attr, "");}
GeXY_Curve( const GeXY_Curve& x) :
GeDynElem(x.dyn,x.dyn_type,x.action_type,x.prio),
y_min_value(x.y_min_value), y_max_value(x.y_max_value),
x_min_value(x.x_min_value), x_max_value(x.x_max_value),
noofpoints(x.noofpoints), datatype(x.datatype), curve_color(x.curve_color),
fill_color(x.fill_color)
{ instance = x.instance; instance_mask = x.instance_mask;
strcpy( x_attr, x.x_attr); strcpy( y_attr, x.y_attr);
strcpy( y_minvalue_attr, x.y_minvalue_attr); strcpy( y_maxvalue_attr, x.y_maxvalue_attr);
strcpy( x_minvalue_attr, x.x_minvalue_attr); strcpy( x_maxvalue_attr, x.x_maxvalue_attr);
strcpy( noofpoints_attr, x.noofpoints_attr); strcpy( update_attr, x.update_attr);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
void open( ifstream& fp);
int connect( grow_tObject object, glow_sTraceData *trace_data);
int disconnect( grow_tObject object);
int scan( grow_tObject object);
void set_attribute( grow_tObject object, char *attr_name, int *cnt);
void replace_attribute( char *from, char *to, int *cnt, int strict);
};
//! Dynamics for a trend object.
class GeFastCurve : public GeDynElem {
public:
......
/*
* Proview $Id: ge_graph.cpp,v 1.42 2007-07-18 09:26:43 claes Exp $
* Proview $Id: ge_graph.cpp,v 1.43 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1133,7 +1133,7 @@ int Graph::is_authorized( unsigned int access)
int Graph::get_attr_items( grow_tObject object, attr_sItem **itemlist,
int *item_cnt, void **client_data)
{
static attr_sItem items[100];
static attr_sItem items[200];
int i;
grow_sAttrInfo *grow_info, *grow_info_p;
int grow_info_cnt;
......@@ -1408,6 +1408,29 @@ int Graph::get_attr_items( grow_tObject object, attr_sItem **itemlist,
*item_cnt = 0;
dyn->get_attributes( object, items, item_cnt);
}
if ( dyn->dyn_type & ge_mDynType_XY_Curve) {
char transtab[][32] = { "NoOfPoints", "XY_Curve.NoOfPoints",
"ScanTime", "",
"CurveWidth", "XY_Curve.CurveLineWidth",
"FillCurve", "XY_Curve.FillCurve",
"HorizontalLines", "XY_Curve.HorizontalLines",
"VerticalLines", "XY_Curve.VerticalLines",
"MaxValue1", "",
"MinValue1", "",
"CurveColor1", "",
"CurveFillColor1", "",
"MaxValue2", "",
"MinValue2", "",
"CurveColor2", "",
"CurveFillColor2", "",
"Dynamic", "",
""};
grow_GetObjectAttrInfo( object, (char *)transtab, &grow_info,
&grow_info_cnt);
*item_cnt = 0;
dyn->get_attributes( object, items, item_cnt);
}
else {
char transtab[][32] = { "NoOfPoints", "Trend.NoOfPoints",
"ScanTime", "Trend.ScanTime",
......@@ -2193,6 +2216,12 @@ static int graph_grow_cb( GlowCtx *ctx, glow_tEvent event)
event->create_grow_object.y,
(unsigned int)ge_mDynType_FastCurve);
}
if ( strcmp( sub_name, "pwr_xycurve") == 0) {
grow_tObject t1;
graph->create_trend( &t1, event->create_grow_object.x,
event->create_grow_object.y,
(unsigned int)ge_mDynType_XY_Curve);
}
else if ( strcmp( sub_name, "pwr_bar") == 0) {
grow_tObject t1;
graph->create_bar( &t1, event->create_grow_object.x, event->create_grow_object.y);
......@@ -4122,16 +4151,17 @@ void Graph::create_trend( grow_tObject *object, double x, double y,
dyn->update_elements();
grow_SetUserData( *object, (void *)dyn);
info.mode = glow_eTrendMode_Trend;
info.no_of_points = 100;
info.scan_time = 0.5;
info.fill_curve = 0;
info.curve_width = 1;
info.horizontal_lines = 4;
info.vertical_lines = 4;
info.min_value[0] = 0;
info.min_value[1] = 0;
info.max_value[0] = 100;
info.max_value[1] = 100;
info.y_min_value[0] = 0;
info.y_min_value[1] = 0;
info.y_max_value[0] = 100;
info.y_max_value[1] = 100;
info.curve_drawtype[0] = glow_eDrawType_Color145;
info.curve_drawtype[1] = glow_eDrawType_Color295;
info.curve_fill_drawtype[0] = glow_eDrawType_Color139;
......
/*
* Proview $Id: ge_graph.h,v 1.28 2007-07-17 12:40:50 claes Exp $
* Proview $Id: ge_graph.h,v 1.29 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -75,7 +75,8 @@ typedef enum {
ge_eAttrType_InstanceMask = 1005, //!< Instance mask.
ge_eAttrType_InputFocus = 1006, //!< Initial input focus mask.
ge_eAttrType_Dyn = 1007, //!< Dynamic data.
ge_eAttrType_ScaleType = 1008 //!< Scale type.
ge_eAttrType_ScaleType = 1008, //!< Scale type.
ge_eAttrType_CurveDataType = 1009 //!< Data type for XY_Curve.
} ge_eAttrType;
//! Graph mode.
......
/*
* Proview $Id: ge_graph_object.cpp,v 1.16 2007-05-07 14:35:03 claes Exp $
* Proview $Id: ge_graph_object.cpp,v 1.17 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -709,9 +709,9 @@ static void graph_object_PID_scan( Graph *graph)
double(*od->set_max_show_p));
grow_SetBarRange( od->proc_bar_object, double(*od->set_min_show_p),
double(*od->set_max_show_p));
grow_SetTrendRange( od->set_trend_object, 0, double(*od->set_min_show_p),
grow_SetTrendRangeY( od->set_trend_object, 0, double(*od->set_min_show_p),
double(*od->set_max_show_p));
grow_SetTrendRange( od->set_trend_object, 1, double(*od->set_min_show_p),
grow_SetTrendRangeY( od->set_trend_object, 1, double(*od->set_min_show_p),
double(*od->set_max_show_p));
}
od->set_min_show_old = *od->set_min_show_p;
......@@ -726,7 +726,7 @@ static void graph_object_PID_scan( Graph *graph)
{
grow_SetBarRange( od->out_bar_object, double(*od->out_min_show_p),
double(*od->out_max_show_p));
grow_SetTrendRange( od->out_trend_object, 0, double(*od->out_min_show_p),
grow_SetTrendRangeY( od->out_trend_object, 0, double(*od->out_min_show_p),
double(*od->out_max_show_p));
}
od->out_min_show_old = *od->out_min_show_p;
......@@ -845,8 +845,8 @@ static int graph_object_PID( Graph *graph, pwr_sAttrRef *arp)
if ( min_limit != max_limit)
{
grow_SetTrendRange( od->set_trend_object, 0, double(min_limit), double(max_limit));
grow_SetTrendRange( od->set_trend_object, 1, double(min_limit), double(max_limit));
grow_SetTrendRangeY( od->set_trend_object, 0, double(min_limit), double(max_limit));
grow_SetTrendRangeY( od->set_trend_object, 1, double(min_limit), double(max_limit));
}
// Get values for OutMinShow and OutMaxShow
......@@ -894,7 +894,7 @@ static int graph_object_PID( Graph *graph, pwr_sAttrRef *arp)
if ( EVEN(sts)) return sts;
if ( min_limit != max_limit)
grow_SetTrendRange( od->out_trend_object, 0, double(min_limit), double(max_limit));
grow_SetTrendRangeY( od->out_trend_object, 0, double(min_limit), double(max_limit));
// Set scantime variable in local database
grow_GetTrendScanTime( od->set_trend_object, &scan_time);
......@@ -1362,7 +1362,7 @@ void Graph::trend_scan( graph_sObjectTrend *td)
grow_GetUserData( td->slider_object, (void **)&dyn);
dyn->update();
}
grow_SetTrendRange( td->trend_object, 0, double(*td->pres_min_limit_p),
grow_SetTrendRangeY( td->trend_object, 0, double(*td->pres_min_limit_p),
double(*td->pres_max_limit_p));
}
td->pres_min_limit_old = *td->pres_min_limit_p;
......@@ -1486,7 +1486,7 @@ int Graph::trend_init( graph_sObjectTrend *td, pwr_sAttrRef *arp)
if ( td->pres_min_limit_p && td->pres_max_limit_p)
{
if ( min_limit != max_limit)
grow_SetTrendRange( td->trend_object, 0, double(min_limit), double(max_limit));
grow_SetTrendRangeY( td->trend_object, 0, double(min_limit), double(max_limit));
}
// Configure slider
......@@ -1903,9 +1903,9 @@ static void graph_object_PlcThread_scan( Graph *graph)
if ( *od->set_max_show_p != *od->set_min_show_p) {
grow_SetBarRange( od->set_bar_object, double(*od->set_min_show_p),
double(*od->set_max_show_p));
grow_SetTrendRange( od->set_trend_object, 0, double(*od->set_min_show_p),
grow_SetTrendRangeY( od->set_trend_object, 0, double(*od->set_min_show_p),
double(*od->set_max_show_p));
grow_SetTrendRange( od->set_trend_object, 1, double(*od->set_min_show_p),
grow_SetTrendRangeY( od->set_trend_object, 1, double(*od->set_min_show_p),
double(*od->set_max_show_p));
}
od->set_min_show_old = *od->set_min_show_p;
......@@ -1997,8 +1997,8 @@ static int graph_object_PlcThread( Graph *graph, pwr_sAttrRef *arp)
if ( EVEN(sts)) return sts;
if ( min_limit != max_limit) {
grow_SetTrendRange( od->set_trend_object, 0, double(min_limit), double(max_limit));
grow_SetTrendRange( od->set_trend_object, 1, double(min_limit), double(max_limit));
grow_SetTrendRangeY( od->set_trend_object, 0, double(min_limit), double(max_limit));
grow_SetTrendRangeY( od->set_trend_object, 1, double(min_limit), double(max_limit));
}
// Set scantime variable in local database
......
......@@ -14,6 +14,7 @@ menu Analog
{
subgraph Trend pwr_trend.component 25
subgraph FastCurve pwr_fastcurve.component 25
subgraph XYCurve pwr_xycurve.component 25
subgraph Bar pwr_bar.component 26
subgraph Axis pwr_axis.component 27
}
......
/*
* Proview $Id: glow.h,v 1.23 2007-09-04 07:23:06 claes Exp $
* Proview $Id: glow.h,v 1.24 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -342,6 +342,12 @@ typedef enum {
glow_eRelief_Down //!< The shadow is darker on the left-upper side, and lighter on the left-lower side
} glow_eRelief;
//! Trend modes
typedef enum {
glow_eTrendMode_Trend, //!< Trend with time x-axis
glow_eTrendMode_XY_Curve //!< Curve of (x,y) points
} glow_eTrendMode;
//! Color index for a color
/*! The drawtype is index in an array that contains the gc for colors in the color palette.
The 300 first are the colors in the color palette, the seven last are used for erase, and texts. */
......@@ -1398,8 +1404,8 @@ typedef enum {
glow_eSave_GrowBar_cycle = 3121,
glow_eSave_GrowBar_ref_object = 3122,
glow_eSave_GrowBar_userdata_cb = 3123,
glow_eSave_GrowTrend_max_value_0 = 3200,
glow_eSave_GrowTrend_min_value_0 = 3201,
glow_eSave_GrowTrend_y_max_value_0 = 3200,
glow_eSave_GrowTrend_y_min_value_0 = 3201,
glow_eSave_GrowTrend_curve_drawtype_0 = 3202,
glow_eSave_GrowTrend_rect_part = 3203,
glow_eSave_GrowTrend_trace_data1 = 3204,
......@@ -1413,8 +1419,8 @@ typedef enum {
glow_eSave_GrowTrend_no_of_points = 3212,
glow_eSave_GrowTrend_curve_width = 3213,
glow_eSave_GrowTrend_scan_time = 3214,
glow_eSave_GrowTrend_max_value_1 = 3215,
glow_eSave_GrowTrend_min_value_1 = 3216,
glow_eSave_GrowTrend_y_max_value_1 = 3215,
glow_eSave_GrowTrend_y_min_value_1 = 3216,
glow_eSave_GrowTrend_curve_drawtype_1 = 3217,
glow_eSave_GrowTrend_curve_fill_drawtype_1 = 3218,
glow_eSave_GrowTrend_trace_data3 = 3219,
......@@ -1429,6 +1435,11 @@ typedef enum {
glow_eSave_GrowTrend_cycle = 3228,
glow_eSave_GrowTrend_ref_object = 3229,
glow_eSave_GrowTrend_userdata_cb = 3230,
glow_eSave_GrowTrend_x_max_value_0 = 3231,
glow_eSave_GrowTrend_x_min_value_0 = 3232,
glow_eSave_GrowTrend_x_max_value_1 = 3233,
glow_eSave_GrowTrend_x_min_value_1 = 3234,
glow_eSave_GrowTrend_mode = 3235,
glow_eSave_GrowSlider_grownode_part = 3300,
glow_eSave_GrowSlider_direction = 3301,
glow_eSave_GrowSlider_max_value = 3302,
......@@ -1906,8 +1917,11 @@ typedef struct {
//! Data for a GrowTrend object
typedef struct {
double max_value[TREND_MAX_CURVES];
double min_value[TREND_MAX_CURVES];
glow_eTrendMode mode;
double y_max_value[TREND_MAX_CURVES];
double y_min_value[TREND_MAX_CURVES];
double x_max_value[TREND_MAX_CURVES];
double x_min_value[TREND_MAX_CURVES];
double scan_time;
int horizontal_lines;
int vertical_lines;
......
/*
* Proview $Id: glow_growapi.cpp,v 1.33 2007-09-04 07:23:06 claes Exp $
* Proview $Id: glow_growapi.cpp,v 1.34 2007-09-12 08:56:36 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1604,17 +1604,17 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab,
if ( (name = growapi_translate( transtab, "MaxValue1")))
{
strcpy( attrinfo[i].name, name);
attrinfo[i].value_p = &op->max_value[0];
attrinfo[i].value_p = &op->y_max_value[0];
attrinfo[i].type = glow_eType_Double;
attrinfo[i++].size = sizeof( op->max_value[0]);
attrinfo[i++].size = sizeof( op->y_max_value[0]);
}
if ( (name = growapi_translate( transtab, "MinValue1")))
{
strcpy( attrinfo[i].name, name);
attrinfo[i].value_p = &op->min_value[0];
attrinfo[i].value_p = &op->y_min_value[0];
attrinfo[i].type = glow_eType_Double;
attrinfo[i++].size = sizeof( op->min_value[0]);
attrinfo[i++].size = sizeof( op->y_min_value[0]);
}
if ( (name = growapi_translate( transtab, "CurveColor1")))
......@@ -1636,17 +1636,17 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab,
if ( (name = growapi_translate( transtab, "MaxValue2")))
{
strcpy( attrinfo[i].name, name);
attrinfo[i].value_p = &op->max_value[1];
attrinfo[i].value_p = &op->y_max_value[1];
attrinfo[i].type = glow_eType_Double;
attrinfo[i++].size = sizeof( op->max_value[1]);
attrinfo[i++].size = sizeof( op->y_max_value[1]);
}
if ( (name = growapi_translate( transtab, "MinValue2")))
{
strcpy( attrinfo[i].name, name);
attrinfo[i].value_p = &op->min_value[1];
attrinfo[i].value_p = &op->y_min_value[1];
attrinfo[i].type = glow_eType_Double;
attrinfo[i++].size = sizeof( op->min_value[1]);
attrinfo[i++].size = sizeof( op->y_min_value[1]);
}
if ( (name = growapi_translate( transtab, "CurveColor2")))
......@@ -3864,10 +3864,27 @@ void grow_SetBarRange( grow_tObject object, double min, double max)
((GrowBar *)object)->set_range( min, max);
}
void grow_SetTrendRange( grow_tObject object, int curve,
void grow_SetTrendRangeY( grow_tObject object, int curve,
double min, double max)
{
((GrowTrend *)object)->set_range( curve, min, max);
((GrowTrend *)object)->set_range_y( curve, min, max);
}
void grow_SetTrendXYRangeY( grow_tObject object, int curve,
double min, double max)
{
((GrowTrend *)object)->set_xy_range_y( curve, min, max);
}
void grow_SetTrendXYRangeX( grow_tObject object, int curve,
double min, double max)
{
((GrowTrend *)object)->set_xy_range_x( curve, min, max);
}
void grow_SetTrendXYNoOfCurves( grow_tObject object, int noofcurves)
{
((GrowTrend *)object)->set_xy_noofcurves( noofcurves);
}
void grow_SetTrendFillCurve( grow_tObject object, int fill)
......@@ -4311,11 +4328,28 @@ void grow_InputFocusInitEvent( grow_tCtx ctx)
((GrowCtx *)ctx)->inputfocus_init_event();
}
int grow_GetTrendNoOfPoints( grow_tObject object)
{
return ((GrowTrend *)object)->get_no_of_points();
}
void grow_SetTrendData( grow_tObject object, double *data[3], int data_curves, int data_points)
{
((GrowTrend *)object)->set_data( data, data_curves, data_points);
}
void grow_SetTrendXYCurveColor( grow_tObject object, int curve, glow_eDrawType curve_color,
glow_eDrawType fill_color)
{
((GrowTrend *)object)->set_xy_curve_color( curve, curve_color, fill_color);
}
void grow_SetTrendXYData( grow_tObject object, double *y_data, double *x_data, int curve_idx,
int data_points)
{
((GrowTrend *)object)->set_xy_data( y_data, x_data, curve_idx, data_points);
}
int grow_GetObjectAnnotInfo( grow_tObject object, int num, int *text_size, glow_eDrawType *text_drawtype,
glow_eDrawType *text_color, glow_eDrawType *bg_color, double *scale)
{
......
/*
* Proview $Id: glow_growapi.h,v 1.27 2007-07-18 09:26:43 claes Exp $
* Proview $Id: glow_growapi.h,v 1.28 2007-09-12 08:56:37 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2114,9 +2114,36 @@ extern "C" {
\param min Minimum value of range.
\param max Maximum value of range.
*/
void grow_SetTrendRange( grow_tObject object, int curve,
void grow_SetTrendRangeY( grow_tObject object, int curve,
double min, double max);
//! Set the range of a xy curve object.
/*!
\param object Trend object.
\param curve Curve number.
\param min Minimum value of range.
\param max Maximum value of range.
*/
void grow_SetTrendXYRangeY( grow_tObject object, int curve,
double min, double max);
//! Set the range of a xy curve object.
/*!
\param object Trend object.
\param curve Curve number.
\param min Minimum value of range.
\param max Maximum value of range.
*/
void grow_SetTrendXYRangeX( grow_tObject object, int curve,
double min, double max);
//! Set number of curves a xy curve object.
/*!
\param object Trend object.
\param noofcurve Number of curves.
*/
void grow_SetTrendXYNoOfCurves( grow_tObject object, int noofcurves);
//! Get the scantime of a trend object.
/*!
\param object Trend object.
......@@ -2792,6 +2819,8 @@ extern "C" {
/*! \param ctx Grow context. */
void grow_InputFocusInitEvent( grow_tCtx ctx);
int grow_GetTrendNoOfPoints( grow_tObject object);
//! Set fast curve data for a GrowTrend object.
/*!
\param object GrowTrend object.
......@@ -2800,6 +2829,10 @@ extern "C" {
\param data_points Number of points in each curve.
*/
void grow_SetTrendData( grow_tObject object, double *data[3], int data_curves, int data_points);
void grow_SetTrendXYCurveColor( grow_tObject object, int curve, glow_eDrawType curve_color,
glow_eDrawType fill_color);
void grow_SetTrendXYData( grow_tObject object, double *y_data, double *x_data, int curve_idx,
int data_points);
//! Get text size and color for an annotation.
/*!
......
/*
* Proview $Id: glow_growcurve.cpp,v 1.4 2007-01-04 07:57:38 claes Exp $
* Proview $Id: glow_growcurve.cpp,v 1.5 2007-09-12 08:56:37 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -68,8 +68,8 @@ void GrowCurve::configure_curves( glow_sCurveData *data)
no_of_points = data->rows;
for ( i = 0; i < curve_cnt; i++) {
max_value[i] = data->max_value[i+1];
min_value[i] = data->min_value[i+1];
y_max_value[i] = data->max_value[i+1];
y_min_value[i] = data->min_value[i+1];
curve_drawtype[i] = data->color[i+1];
curve_fill_drawtype[i] = data->fillcolor[i+1];
}
......@@ -94,8 +94,8 @@ void GrowCurve::configure_curves( glow_sCurveData *data)
x_value = max( ll.x, min( x_value, ur.x));
y_value = ur.y - (data->data[idx+1][i] - min_value[idx]) /
(max_value[idx] - min_value[idx]) * (ur.y - ll.y);
y_value = ur.y - (data->data[idx+1][i] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_value = max( ll.y, min( y_value, ur.y));
......@@ -134,8 +134,8 @@ void GrowCurve::configure_curves( glow_sCurveData *data)
x_value = max( ll.x, min( x_value, ur.x));
y_value = ur.y - (data->data[idx+1][i-1] - min_value[idx]) /
(max_value[idx] - min_value[idx]) * (ur.y - ll.y);
y_value = ur.y - (data->data[idx+1][i-1] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_value = max( ll.y, min( y_value, ur.y));
......@@ -176,8 +176,8 @@ void GrowCurve::add_points( glow_sCurveData *data)
// Remove old curves
ctx->nodraw++;
for ( idx = 0; idx < curve_cnt; idx++) {
y_value = ur.y - (data->data[idx+1][0] - min_value[idx]) /
(max_value[idx] - min_value[idx]) * (ur.y - ll.y);
y_value = ur.y - (data->data[idx+1][0] - y_min_value[idx]) /
(y_max_value[idx] - y_min_value[idx]) * (ur.y - ll.y);
y_value = max( ll.y, min( y_value, ur.y));
......
This diff is collapsed.
/*
* Proview $Id: glow_growtrend.h,v 1.4 2007-01-04 07:57:39 claes Exp $
* Proview $Id: glow_growtrend.h,v 1.5 2007-09-12 08:56:37 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -42,22 +42,6 @@
class GrowTrend : public GrowRect {
public:
//! Constuctor
/*!
\param glow_ctx The glow context.
\param name Name (max 31 char).
\param x x coordinate for position.
\param y y coordinate for position.
\param w Width.
\param h Height.
\param border_d_type Border color.
\param line_w Linewidth of border.
\param display_lev Displaylevel when this object is visible.
\param fill_rect Rectangle is filled.
\param display_border Border is visible.
\param fill_d_type Fill color.
\param nodraw Don't draw the object now.
*/
GrowTrend( GrowCtx *glow_ctx, char *name, double x = 0, double y = 0,
double w = 0, double h = 0,
glow_eDrawType border_d_type = glow_eDrawType_Line,
......@@ -66,53 +50,20 @@ class GrowTrend : public GrowRect {
int fill_rect = 0, int display_border = 1,
glow_eDrawType fill_d_type = glow_eDrawType_Line, int nodraw = 0);
//! Destructor
/*! Remove the object from context, and erase it from the screen.
*/
~GrowTrend();
//! Save the content of the object to file.
/*!
\param fp Ouput file.
\param mode Not used.
*/
void save( ofstream& fp, glow_eSaveMode mode);
//! Read the content of the object from file.
/*!
\param fp Input file.
*/
void open( ifstream& fp);
//! Erase the object
void erase( GlowWind *w)
{ erase( w, (GlowTransform *)NULL, hot, NULL);};
//! Draw the objects if any part is inside the drawing area.
/*!
\param ll_x Lower left x coordinate of drawing area.
\param ll_y Lower left y coordinate of drawing area.
\param ur_x Upper right x coordinate of drawing area.
\param ur_y Upper right y coordinate of drawing area.
*/
void draw( GlowWind *w, int ll_x, int ll_y, int ur_x, int ur_y);
//! Draw the objects if any part is inside the drawing area, and extends the drawing area.
/*!
\param ll_x Lower left x coordinate of drawing area.
\param ll_y Lower left y coordinate of drawing area.
\param ur_x Upper right x coordinate of drawing area.
\param ur_y Upper right y coordinate of drawing area.
If some part of object is inside the drawing area, and also outside the drawing area,
the drawingarea is extended so it contains the whole objects.
*/
void draw( GlowWind *w, int *ll_x, int *ll_y, int *ur_x, int *ur_y);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
*/
void set_highlight( int on);
//! Get the object type
......@@ -131,8 +82,10 @@ class GrowTrend : public GrowRect {
*/
void set_lines( int v, int h) { vertical_lines = v; horizontal_lines = h;};
double max_value[TREND_MAX_CURVES]; //!< Max values of the curves.
double min_value[TREND_MAX_CURVES]; //!< Min values of the curves.
double y_max_value[TREND_MAX_CURVES]; //!< Max y values of the curves.
double y_min_value[TREND_MAX_CURVES]; //!< Min y values of the curves.
double x_max_value[TREND_MAX_CURVES]; //!< Max x values of the curves.
double x_min_value[TREND_MAX_CURVES]; //!< Min x values of the curves.
int horizontal_lines; //!< Number of horizontal lines.
int vertical_lines; //!< Number of vertical lines.
int fill_curve; //!< The curves are filled.
......@@ -145,72 +98,26 @@ class GrowTrend : public GrowRect {
int curve_cnt; //!< Number of curves.
double scan_time; //!< Scantime. Time interval between two points.
void *user_data; //!< User data.
glow_eTrendMode mode; //!< Type of curve.
//! Draw the object.
/*!
\param t Transform of parent node. Can be zero.
\param highlight Draw with highlight colors.
\param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero.
\param colornode The node that controls the color of the object. Can be zero.
The object is drawn with border, fill and shadow. If t is not zero, the current tranform is
multiplied with the parentnodes transform, to give the appropriate coordinates for the drawing.
*/
void draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void *node, void *colornode);
//! Erase the object.
/*!
\param t Transform of parent node.
\param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero.
*/
void erase( GlowWind *w, GlowTransform *t, int hot, void *node);
//! Redraw the area inside the objects border.
void draw();
//! Scan trace
/*! Calls the trace scan callback for the object.
*/
void trace_scan();
//! Init trace
/*! Calls the trace connect callback for the object.
*/
int trace_init();
//! Close trace
/*! Calls the trace disconnect callback for the object.
*/
void trace_close();
//! Add a new value to the specified curve
/*!
\param value New value.
\param idx Curve number.
Add the new value first in the curve, and shift the other values one step forward.
*/
void add_value( double value, int idx);
//! Configure the curves
/*! Calculate position of the points of the curves and create a polyline for each curve.
*/
void configure_curves();
//! Moves object to alignment line or point.
/*!
\param x x coordinate of alignment point.
\param y y coordinate of alignment point.
\param direction Type of alignment.
*/
void align( double x, double y, glow_eAlignDirection direction);
//! Set scantime
/*!
\param time Scantime in seconds.
*/
void set_scan_time( double time);
//! Get scantime
......@@ -219,13 +126,7 @@ class GrowTrend : public GrowRect {
*/
void get_scan_time( double *time) { *time = scan_time;};
//! Set the range for the specified curve.
/*!
\param curve Number of curve.
\param min Min value.
\param max Max value.
*/
void set_range( int curve, double min, double max);
void set_range_y( int curve, double min, double max);
//! Set fill for curves.
/*!
......@@ -245,35 +146,22 @@ class GrowTrend : public GrowRect {
*/
void get_user_data( void **data) { *data = user_data;};
//! Set parameters for the trend.
/*!
\param info Info struct.
*/
void set_trend_info( glow_sTrendInfo *info);
//! Export the object as a javabean.
/*!
\param t Transform of parent node. Can be zero.
\param node Parent node. Can be zero.
\param pass Export pass.
\param shape_cnt Current index in a shape vector.
\param node_cnt Counter used for javabean name. Not used for this kind of object.
\param in_nc Member of a nodeclass. Not used for this kind of object.
\param fp Output file.
The object is transformed to the current zoom factor, and GlowExportJBean is used to generate
java code for the bean.
*/
void export_javabean( GlowTransform *t, void *node,
glow_eExportPass pass, int *shape_cnt, int node_cnt, int in_nc, ofstream &fp);
//! Conversion between different versions of Glow
/*!
\param version Version to convert to.
*/
void convert( glow_eConvert version);
void set_data( double *data[3], int data_curves, int data_points);
int get_no_of_points() { return no_of_points;}
void set_xy_range_x( int curve, double min, double max);
void set_xy_range_y( int curve, double min, double max);
void set_xy_noofcurves( int noofcurves);
void set_xy_curve_color( int curve, glow_eDrawType curve_color,
glow_eDrawType fill_color);
void set_xy_data( double *y_data, double *x_data, int curve_idx, int data_points);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment