Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
ee5450fe
Commit
ee5450fe
authored
Aug 27, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preparation for multiple curves with different time scale in curve window
parent
a0710922
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
548 additions
and
447 deletions
+548
-447
xtt/lib/ge/gtk/ge_curve_gtk.cpp
xtt/lib/ge/gtk/ge_curve_gtk.cpp
+12
-7
xtt/lib/ge/src/ge_curve.cpp
xtt/lib/ge/src/ge_curve.cpp
+231
-164
xtt/lib/ge/src/ge_curve.h
xtt/lib/ge/src/ge_curve.h
+38
-24
xtt/lib/glow/src/glow.h
xtt/lib/glow/src/glow.h
+17
-5
xtt/lib/glow/src/glow_growcurve.cpp
xtt/lib/glow/src/glow_growcurve.cpp
+118
-117
xtt/lib/xtt/src/xtt_fast.cpp
xtt/lib/xtt/src/xtt_fast.cpp
+55
-53
xtt/lib/xtt/src/xtt_sevhist.cpp
xtt/lib/xtt/src/xtt_sevhist.cpp
+59
-59
xtt/lib/xtt/src/xtt_trend.cpp
xtt/lib/xtt/src/xtt_trend.cpp
+18
-18
No files found.
xtt/lib/ge/gtk/ge_curve_gtk.cpp
View file @
ee5450fe
...
...
@@ -241,21 +241,26 @@ void GeCurveGtk::axis_set_width( int width)
void
GeCurveGtk
::
open_minmax
(
int
idx
)
{
char
value_str
[
80
];
char
min_value_str
[
80
];
char
max_value_str
[
80
];
gint
pos
=
0
;
create_minmax_dialog
();
sprintf
(
value_str
,
"%f"
,
cd
->
min_value_axis
[
idx
]);
if
(
idx
<
cd
->
cols
)
{
sprintf
(
min_value_str
,
"%f"
,
cd
->
y_min_value_axis
[
idx
]);
sprintf
(
max_value_str
,
"%f"
,
cd
->
y_max_value_axis
[
idx
]);
}
else
{
sprintf
(
min_value_str
,
"%f"
,
cd
->
x_min_value_axis
[
idx
-
cd
->
cols
]);
sprintf
(
max_value_str
,
"%f"
,
cd
->
x_max_value_axis
[
idx
-
cd
->
cols
]);
}
gtk_editable_delete_text
(
GTK_EDITABLE
(
minmax_textmin_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
minmax_textmin_widget
),
value_str
,
strlen
(
value_str
),
&
pos
);
sprintf
(
value_str
,
"%f"
,
cd
->
max_value_axis
[
idx
]);
min_value_str
,
strlen
(
min_value_str
),
&
pos
);
gtk_editable_delete_text
(
GTK_EDITABLE
(
minmax_textmax_widget
),
0
,
-
1
);
gtk_editable_insert_text
(
GTK_EDITABLE
(
minmax_textmax_widget
),
value_str
,
strlen
(
value_str
),
&
pos
);
max_value_str
,
strlen
(
max_value_str
),
&
pos
);
minmax_idx
=
idx
;
}
...
...
xtt/lib/ge/src/ge_curve.cpp
View file @
ee5450fe
This diff is collapsed.
Click to expand it.
xtt/lib/ge/src/ge_curve.h
View file @
ee5450fe
...
...
@@ -58,24 +58,38 @@ class GeCurveData {
curve_eDataType
type
;
int
rows
;
int
cols
;
pwr_tAName
name
[
CURVE_MAX_COLS
];
char
unit
[
CURVE_MAX_COLS
][
16
];
double
*
data
[
CURVE_MAX_COLS
];
double
max_value
[
CURVE_MAX_COLS
];
double
min_value
[
CURVE_MAX_COLS
];
double
max_value_axis
[
CURVE_MAX_COLS
];
double
min_value_axis
[
CURVE_MAX_COLS
];
int
trend_lines
[
CURVE_MAX_COLS
];
int
axis_lines
[
CURVE_MAX_COLS
];
int
axis_linelongq
[
CURVE_MAX_COLS
];
int
axis_valueq
[
CURVE_MAX_COLS
];
pwr_tAName
y_name
[
CURVE_MAX_COLS
];
pwr_tAName
x_name
;
char
y_unit
[
CURVE_MAX_COLS
][
16
];
char
x_unit
[
CURVE_MAX_COLS
][
16
];
double
*
y_data
[
CURVE_MAX_COLS
];
double
*
x_data
[
CURVE_MAX_COLS
];
double
y_max_value
[
CURVE_MAX_COLS
];
double
y_min_value
[
CURVE_MAX_COLS
];
double
x_max_value
[
CURVE_MAX_COLS
];
double
x_min_value
[
CURVE_MAX_COLS
];
double
y_max_value_axis
[
CURVE_MAX_COLS
];
double
y_min_value_axis
[
CURVE_MAX_COLS
];
int
y_trend_lines
[
CURVE_MAX_COLS
];
int
y_axis_lines
[
CURVE_MAX_COLS
];
int
y_axis_linelongq
[
CURVE_MAX_COLS
];
int
y_axis_valueq
[
CURVE_MAX_COLS
];
double
x_max_value_axis
[
CURVE_MAX_COLS
];
double
x_min_value_axis
[
CURVE_MAX_COLS
];
int
x_trend_lines
[
CURVE_MAX_COLS
];
int
x_axis_lines
[
CURVE_MAX_COLS
];
int
x_axis_linelongq
[
CURVE_MAX_COLS
];
int
x_axis_valueq
[
CURVE_MAX_COLS
];
glow_eDrawType
color
[
CURVE_MAX_COLS
];
glow_eDrawType
fillcolor
[
CURVE_MAX_COLS
];
glow_eDrawType
axiscolor
[
CURVE_MAX_COLS
];
pwr_eType
value_type
[
CURVE_MAX_COLS
];
curve_eAxis
axis_type
[
CURVE_MAX_COLS
];
double
axis_width
[
CURVE_MAX_COLS
];
char
format
[
CURVE_MAX_COLS
][
20
];
pwr_eType
y_value_type
[
CURVE_MAX_COLS
];
pwr_eType
x_value_type
[
CURVE_MAX_COLS
];
curve_eAxis
y_axis_type
[
CURVE_MAX_COLS
];
curve_eAxis
x_axis_type
[
CURVE_MAX_COLS
];
double
y_axis_width
[
CURVE_MAX_COLS
];
char
y_format
[
CURVE_MAX_COLS
][
20
];
char
x_format
[
CURVE_MAX_COLS
][
20
];
int
x_reverse
;
curve_eTimeFormat
time_format
;
...
...
@@ -113,15 +127,15 @@ class GeCurve {
GeCurveData
*
cd
;
double
axis_window_width
;
int
hide
[
CURVE_MAX_COLS
];
grow_tObject
name_rect
[
CURVE_MAX_COLS
];
grow_tObject
hide_rect
[
CURVE_MAX_COLS
];
grow_tObject
hide_l1
[
CURVE_MAX_COLS
];
grow_tObject
hide_l2
[
CURVE_MAX_COLS
];
grow_tObject
scale_rect
[
CURVE_MAX_COLS
];
grow_tObject
mark_annot
[
CURVE_MAX_COLS
];
grow_tObject
cursor_annot
[
CURVE_MAX_COLS
];
grow_tObject
axis_rect
[
CURVE_MAX_COLS
];
grow_tObject
axis_object
[
CURVE_MAX_COLS
];
grow_tObject
name_rect
[
CURVE_MAX_COLS
+
1
];
grow_tObject
hide_rect
[
CURVE_MAX_COLS
+
1
];
grow_tObject
hide_l1
[
CURVE_MAX_COLS
+
1
];
grow_tObject
hide_l2
[
CURVE_MAX_COLS
+
1
];
grow_tObject
scale_rect
[
CURVE_MAX_COLS
+
1
];
grow_tObject
mark_annot
[
CURVE_MAX_COLS
+
1
];
grow_tObject
cursor_annot
[
CURVE_MAX_COLS
+
1
];
grow_tObject
axis_rect
[
CURVE_MAX_COLS
+
1
];
grow_tObject
axis_object
[
CURVE_MAX_COLS
+
1
];
grow_tObject
axis_lineobject
;
int
auto_refresh
;
int
axis_displayed
;
...
...
xtt/lib/glow/src/glow.h
View file @
ee5450fe
...
...
@@ -1967,16 +1967,28 @@ typedef struct {
short
y
;
//!< y coordinate
}
glow_sPointX
;
//! Curve data type
typedef
enum
{
glow_eCurveDataType_CommonX
,
glow_eCurveDataType_SeparateX
}
glow_eCurveDataType
;
//! Configuration of curves
typedef
struct
{
glow_eCurveDataType
type
;
int
curves
;
//!< Number of curves
int
rows
;
//!< Number of points
int
x_reverse
;
//!< Reverse the curves when drawing them
double
max_value
[
TREND_MAX_CURVES
+
1
];
//!< Max value for every curve
double
min_value
[
TREND_MAX_CURVES
+
1
];
//!< Min value for every curve
double
*
data
[
TREND_MAX_CURVES
+
1
];
//!< Data for every curve
glow_eDrawType
color
[
TREND_MAX_CURVES
+
1
];
//!< Color of every curve
glow_eDrawType
fillcolor
[
TREND_MAX_CURVES
+
1
];
//!< Fill color for every curve
double
y_max_value
[
TREND_MAX_CURVES
];
//!< Max value for every curve
double
x_max_value
[
TREND_MAX_CURVES
];
//!< Max value for every curve
double
y_min_value
[
TREND_MAX_CURVES
];
//!< Min value for every curve
double
x_min_value
[
TREND_MAX_CURVES
];
//!< Min value for every curve
double
*
y_data
[
TREND_MAX_CURVES
];
//!< y data for every curve
double
*
x_data
[
TREND_MAX_CURVES
];
//!< x data for every curve
glow_eDrawType
color
[
TREND_MAX_CURVES
];
//!< Color of every curve
glow_eDrawType
fillcolor
[
TREND_MAX_CURVES
];
//!< Fill color for every curve
}
glow_sCurveData
;
//! Data for a GrowTrend object
...
...
xtt/lib/glow/src/glow_growcurve.cpp
View file @
ee5450fe
...
...
@@ -62,138 +62,139 @@ void GrowCurve::configure_curves( glow_sCurveData *data)
}
ctx
->
nodraw
--
;
if
(
data
->
type
==
glow_eCurveDataType_CommonX
)
{
curve_cnt
=
data
->
curves
;
no_of_points
=
data
->
rows
;
curve_cnt
=
data
->
curves
-
1
;
no_of_points
=
data
->
rows
;
for
(
i
=
0
;
i
<
curve_cnt
;
i
++
)
{
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
];
}
for
(
i
=
0
;
i
<
curve_cnt
;
i
++
)
{
y_max_value
[
i
]
=
data
->
y_max_value
[
i
];
y_min_value
[
i
]
=
data
->
y_min_value
[
i
];
curve_drawtype
[
i
]
=
data
->
color
[
i
];
curve_fill_drawtype
[
i
]
=
data
->
fillcolor
[
i
];
}
points
=
no_of_points
;
if
(
fill_curve
)
points
+=
2
;
curve_width
=
min
(
DRAW_TYPE_SIZE
,
max
(
1
,
curve_width
));
pointarray
=
(
glow_sPoint
*
)
calloc
(
points
,
sizeof
(
glow_sPoint
));
for
(
idx
=
0
;
idx
<
curve_cnt
;
idx
++
)
{
point_p
=
pointarray
;
for
(
i
=
0
;
i
<
points
;
i
++
)
{
if
(
!
fill_curve
)
{
if
(
data
->
x_reverse
)
x_value
=
ur
.
x
-
(
data
->
data
[
0
][
i
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
x_value
=
ll
.
x
+
(
data
->
data
[
0
][
i
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
x_value
=
max
(
ll
.
x
,
min
(
x_value
,
ur
.
x
));
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
));
point_p
->
y
=
y
_value
;
point_p
->
x
=
x_value
;
}
else
{
if
(
i
==
0
)
{
point_p
->
y
=
ur
.
y
;
// point_p->x = ur.x;
if
(
data
->
x_reverse
)
point_p
->
x
=
ur
.
x
-
(
data
->
data
[
0
][
i
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
point_p
->
x
=
ll
.
x
+
(
data
->
data
[
0
][
i
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
}
else
if
(
i
==
points
-
1
)
{
point_p
->
y
=
ur
.
y
;
if
(
data
->
x_reverse
)
point_p
->
x
=
ur
.
x
-
(
data
->
data
[
0
][
i
-
2
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
point_p
->
x
=
ll
.
x
+
(
data
->
data
[
0
][
i
-
2
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
// point_p->x = ll.x;
}
else
{
if
(
data
->
x_reverse
)
x_value
=
ur
.
x
-
(
data
->
data
[
0
][
i
-
1
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
x_value
=
ll
.
x
+
(
data
->
data
[
0
][
i
-
1
]
-
data
->
min_value
[
0
])
/
(
data
->
max_value
[
0
]
-
data
->
min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
x_value
=
max
(
ll
.
x
,
min
(
x_value
,
ur
.
x
));
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
))
;
point_p
->
y
=
y_value
;
point_p
->
x
=
x_value
;
}
points
=
no_of_points
;
if
(
fill_curve
)
points
+=
2
;
curve_width
=
min
(
DRAW_TYPE_SIZE
,
max
(
1
,
curve_width
));
pointarray
=
(
glow_sPoint
*
)
calloc
(
points
,
sizeof
(
glow_sPoint
));
for
(
idx
=
0
;
idx
<
curve_cnt
;
idx
++
)
{
point_p
=
pointarray
;
for
(
i
=
0
;
i
<
points
;
i
++
)
{
if
(
!
fill_curve
)
{
if
(
data
->
x_reverse
)
x_value
=
ur
.
x
-
(
data
->
x_data
[
0
][
i
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
x_value
=
ll
.
x
+
(
data
->
x_data
[
0
][
i
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
x_value
=
max
(
ll
.
x
,
min
(
x_value
,
ur
.
x
));
y_value
=
ur
.
y
-
(
data
->
y_data
[
idx
][
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
));
point_p
->
y
=
y_value
;
point_p
->
x
=
x
_value
;
}
else
{
if
(
i
==
0
)
{
point_p
->
y
=
ur
.
y
;
// point_p->x = ur.x;
if
(
data
->
x_reverse
)
point_p
->
x
=
ur
.
x
-
(
data
->
x_data
[
0
][
i
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
point_p
->
x
=
ll
.
x
+
(
data
->
x_data
[
0
][
i
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
}
else
if
(
i
==
points
-
1
)
{
point_p
->
y
=
ur
.
y
;
if
(
data
->
x_reverse
)
point_p
->
x
=
ur
.
x
-
(
data
->
x_data
[
0
][
i
-
2
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
point_p
->
x
=
ll
.
x
+
(
data
->
x_data
[
0
][
i
-
2
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
// point_p->x = ll.x;
}
else
{
if
(
data
->
x_reverse
)
x_value
=
ur
.
x
-
(
data
->
x_data
[
0
][
i
-
1
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
else
x_value
=
ll
.
x
+
(
data
->
x_data
[
0
][
i
-
1
]
-
data
->
x_min_value
[
0
])
/
(
data
->
x_max_value
[
0
]
-
data
->
x_min_value
[
0
])
*
(
ur
.
x
-
ll
.
x
);
x_value
=
max
(
ll
.
x
,
min
(
x_value
,
ur
.
x
)
);
y_value
=
ur
.
y
-
(
data
->
y_data
[
idx
][
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
)
);
point_p
->
y
=
y_value
;
point_p
->
x
=
x_value
;
}
}
point_p
++
;
}
point_p
++
;
}
if
(
curve_drawtype
[
idx
]
!=
glow_eDrawType_Inherit
)
dt
=
curve_drawtype
[
idx
];
else
dt
=
draw_type
;
if
(
curve_drawtype
[
idx
]
!=
glow_eDrawType_Inherit
)
dt
=
curve_drawtype
[
idx
];
else
dt
=
draw_type
;
if
(
curve_fill_drawtype
[
idx
]
!=
glow_eDrawType_Inherit
)
dt_fill
=
curve_fill_drawtype
[
idx
];
else
dt_fill
=
draw_type
;
if
(
curve_fill_drawtype
[
idx
]
!=
glow_eDrawType_Inherit
)
dt_fill
=
curve_fill_drawtype
[
idx
];
else
dt_fill
=
draw_type
;
ctx
->
nodraw
++
;
curve
[
idx
]
=
new
GrowPolyLine
(
ctx
,
""
,
pointarray
,
points
,
dt
,
curve_width
,
0
,
fill_curve
,
1
,
0
,
dt_fill
);
ctx
->
nodraw
--
;
}
free
(
(
char
*
)
pointarray
);
ctx
->
nodraw
++
;
curve
[
idx
]
=
new
GrowPolyLine
(
ctx
,
""
,
pointarray
,
points
,
dt
,
curve_width
,
0
,
fill_curve
,
1
,
0
,
dt_fill
);
ctx
->
nodraw
--
;
draw
();
}
free
(
(
char
*
)
pointarray
);
draw
();
}
void
GrowCurve
::
add_points
(
glow_sCurveData
*
data
)
{
int
idx
;
double
y_value
;
if
(
data
->
type
==
glow_eCurveDataType_CommonX
)
{
int
idx
;
double
y_value
;
// Remove old curves
ctx
->
nodraw
++
;
for
(
idx
=
0
;
idx
<
curve_cnt
;
idx
++
)
{
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
));
if
(
!
fill
)
erase
(
&
ctx
->
mw
);
if
(
!
fill_curve
)
curve
[
idx
]
->
add_and_shift_y_value
(
y_value
);
else
curve
[
idx
]
->
add_and_shift_y_value_filled
(
y_value
);
}
ctx
->
nodraw
--
;
// Remove old curves
ctx
->
nodraw
++
;
for
(
idx
=
0
;
idx
<
curve_cnt
;
idx
++
)
{
y_value
=
ur
.
y
-
(
data
->
y_data
[
idx
][
0
]
-
y_min_value
[
idx
])
/
(
y_max_value
[
idx
]
-
y_min_value
[
idx
])
*
(
ur
.
y
-
ll
.
y
);
draw
();
// draw( (GlowTransform *)NULL, highlight, hot, NULL, NULL);
ctx
->
nav_draw
(
&
ctx
->
navw
,
0
,
0
,
ctx
->
navw
.
window_width
,
ctx
->
navw
.
window_height
);
// nav_draw( (GlowTransform *) NULL, highlight, NULL, NULL);
y_value
=
max
(
ll
.
y
,
min
(
y_value
,
ur
.
y
));
if
(
!
fill
)
erase
(
&
ctx
->
mw
);
if
(
!
fill_curve
)
curve
[
idx
]
->
add_and_shift_y_value
(
y_value
);
else
curve
[
idx
]
->
add_and_shift_y_value_filled
(
y_value
);
}
ctx
->
nodraw
--
;
draw
();
// draw( (GlowTransform *)NULL, highlight, hot, NULL, NULL);
ctx
->
nav_draw
(
&
ctx
->
navw
,
0
,
0
,
ctx
->
navw
.
window_width
,
ctx
->
navw
.
window_height
);
// nav_draw( (GlowTransform *) NULL, highlight, NULL, NULL);
}
}
...
...
xtt/lib/xtt/src/xtt_fast.cpp
View file @
ee5450fe
...
...
@@ -99,25 +99,25 @@ XttFast::XttFast( void *parent_ctx,
// Create data for time axis
gcd
=
new
GeCurveData
(
curve_eDataType_DsTrend
);
gcd
->
data
[
0
]
=
(
double
*
)
malloc
(
8
*
max_points
);
strcpy
(
gcd
->
name
[
0
]
,
"Time"
);
gcd
->
axis_type
[
0
]
=
curve_eAxis_x
;
gcd
->
x_
data
[
0
]
=
(
double
*
)
malloc
(
8
*
max_points
);
strcpy
(
gcd
->
x_name
,
"Time"
);
gcd
->
x_
axis_type
[
0
]
=
curve_eAxis_x
;
memcpy
(
&
time_buff
,
&
fp
.
TimeBuffer
,
sizeof
(
time_buff
));
fast_cnt
=
0
;
for
(
i
=
0
;
i
<
FAST_CURVES
;
i
++
)
{
if
(
fp
.
CurveValid
[
i
])
{
gcd
->
data
[
fast_cnt
+
1
]
=
(
double
*
)
calloc
(
1
,
8
*
max_points
);
gcd
->
axis_type
[
fast_cnt
+
1
]
=
curve_eAxis_y
;
gcd
->
y_data
[
fast_cnt
]
=
(
double
*
)
calloc
(
1
,
8
*
max_points
);
gcd
->
y_axis_type
[
fast_cnt
]
=
curve_eAxis_y
;
memcpy
(
&
buff
[
fast_cnt
],
&
fp
.
Buffers
[
i
],
sizeof
(
buff
[
0
]));
type
[
fast_cnt
]
=
(
pwr_eType
)
fp
.
AttributeType
[
i
];
fast_idx
[
i
]
=
fast_cnt
+
1
;
curve_idx
[
fast_cnt
+
1
]
=
i
;
fast_idx
[
i
]
=
fast_cnt
;
curve_idx
[
fast_cnt
]
=
i
;
*
sts
=
gdh_AttrrefToName
(
&
fp
.
Attribute
[
i
],
attr_name
,
sizeof
(
attr_name
),
cdh_mNName
);
if
(
EVEN
(
*
sts
))
continue
;
strcpy
(
gcd
->
name
[
fast_cnt
+
1
],
attr_name
);
strcpy
(
gcd
->
y_name
[
fast_cnt
],
attr_name
);
fast_cnt
++
;
}
}
...
...
@@ -153,7 +153,7 @@ XttFast::XttFast( void *parent_ctx,
element_size
[
i
]
=
4
;
}
}
gcd
->
cols
=
fast_cnt
+
1
;
gcd
->
cols
=
fast_cnt
;
gcd
->
rows
=
max_points
;
axis_configured
=
true
;
...
...
@@ -161,11 +161,11 @@ XttFast::XttFast( void *parent_ctx,
if
(
fp
.
CurveValid
[
i
])
{
j
=
fast_idx
[
i
];
if
(
fp
.
YMinValue
[
i
]
!=
fp
.
YMaxValue
[
i
])
gcd
->
scale
(
gcd
->
axis_type
[
j
],
gcd
->
value_type
[
j
],
gcd
->
scale
(
gcd
->
y_axis_type
[
j
],
gcd
->
y_
value_type
[
j
],
fp
.
YMinValue
[
i
],
fp
.
YMaxValue
[
i
],
&
gcd
->
min_value_axis
[
j
],
&
gcd
->
max_value_axis
[
j
],
&
gcd
->
trend_lines
[
j
],
&
gcd
->
axis_lines
[
j
],
&
gcd
->
axis_linelongq
[
j
],
&
gcd
->
axis_valueq
[
j
],
gcd
->
format
[
j
],
&
gcd
->
axis_width
[
j
],
1
,
1
);
&
gcd
->
y_min_value_axis
[
j
],
&
gcd
->
y_
max_value_axis
[
j
],
&
gcd
->
y_trend_lines
[
j
],
&
gcd
->
y_axis_lines
[
j
],
&
gcd
->
y_
axis_linelongq
[
j
],
&
gcd
->
y_axis_valueq
[
j
],
gcd
->
y_format
[
j
],
&
gcd
->
y_
axis_width
[
j
],
1
,
1
);
else
axis_configured
=
false
;
}
...
...
@@ -248,14 +248,14 @@ void XttFast::fast_scan( void *data)
for
(
j
=
0
;
j
<
fast
->
max_points
;
j
++
)
{
if
(
k
>=
fast
->
max_points
)
k
=
0
;
fast
->
gcd
->
data
[
0
][
j
]
=
tmp
[
k
]
-
tmp
[
trigg_index
];
fast
->
gcd
->
x_
data
[
0
][
j
]
=
tmp
[
k
]
-
tmp
[
trigg_index
];
if
(
k
==
last_index
)
break
;
k
++
;
}
// If to few points, fill with dummy data
for
(
;
j
<
fast
->
max_points
;
j
++
)
{
fast
->
gcd
->
data
[
0
][
j
]
=
tmp
[
k
]
-
tmp
[
trigg_index
];
fast
->
gcd
->
x_
data
[
0
][
j
]
=
tmp
[
k
]
-
tmp
[
trigg_index
];
}
free
(
tmp
);
}
...
...
@@ -266,7 +266,7 @@ void XttFast::fast_scan( void *data)
if
(
EVEN
(
sts
))
return
;
for
(
j
=
0
;
j
<
fast
->
max_points
;
j
++
)
fast
->
gcd
->
data
[
0
][
j
]
=
tmp
[
j
];
fast
->
gcd
->
x_
data
[
0
][
j
]
=
tmp
[
j
];
free
(
tmp
);
}
for
(
i
=
0
;
i
<
fast
->
fast_cnt
;
i
++
)
{
...
...
@@ -283,34 +283,34 @@ void XttFast::fast_scan( void *data)
k
=
0
;
switch
(
fast
->
type
[
i
])
{
case
pwr_eType_Float32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tFloat32
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tFloat32
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Float64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tFloat64
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tFloat64
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt64
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt64
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt64
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt64
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt32
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt32
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt32
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt32
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int16
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt16
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt16
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt16
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt16
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt16
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int8
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt8
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt8
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt8
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt8
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt8
*
)
tmp
)[
k
];
break
;
default:
;
...
...
@@ -323,34 +323,34 @@ void XttFast::fast_scan( void *data)
for
(
;
j
<
fast
->
max_points
;
j
++
)
{
switch
(
fast
->
type
[
i
])
{
case
pwr_eType_Float32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tFloat32
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tFloat32
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Float64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tFloat64
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tFloat64
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt64
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt64
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt64
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt64
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt32
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt32
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt32
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt32
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int16
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt16
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
k
];
break
;
case
pwr_eType_Int8
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt8
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt8
*
)
tmp
)[
k
];
break
;
case
pwr_eType_UInt8
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt8
*
)
tmp
)[
k
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt8
*
)
tmp
)[
k
];
break
;
default:
;
}
...
...
@@ -366,34 +366,34 @@ void XttFast::fast_scan( void *data)
for
(
j
=
0
;
j
<
fast
->
max_points
;
j
++
)
{
switch
(
fast
->
type
[
i
])
{
case
pwr_eType_Float32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tFloat32
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tFloat32
*
)
tmp
)[
j
];
break
;
case
pwr_eType_Float64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tFloat64
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tFloat64
*
)
tmp
)[
j
];
break
;
case
pwr_eType_Int64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt64
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt64
*
)
tmp
)[
j
];
break
;
case
pwr_eType_UInt64
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt64
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt64
*
)
tmp
)[
j
];
break
;
case
pwr_eType_Int32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt32
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt32
*
)
tmp
)[
j
];
break
;
case
pwr_eType_UInt32
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt32
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt32
*
)
tmp
)[
j
];
break
;
case
pwr_eType_Int16
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
j
];
break
;
case
pwr_eType_UInt16
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt16
*
)
tmp
)[
j
];
break
;
case
pwr_eType_Int8
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tInt8
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tInt8
*
)
tmp
)[
j
];
break
;
case
pwr_eType_UInt8
:
fast
->
gcd
->
data
[
i
+
1
][
j
]
=
((
pwr_tUInt8
*
)
tmp
)[
j
];
fast
->
gcd
->
y_data
[
i
][
j
]
=
((
pwr_tUInt8
*
)
tmp
)[
j
];
break
;
default:
;
}
...
...
@@ -418,15 +418,17 @@ void XttFast::fast_scan( void *data)
}
}
else
{
double
axis_width
;
fast
->
gcd
->
get_borders
();
// fast->gcd->get_default_axis();
fast
->
gcd
->
scale
(
fast
->
gcd
->
axis_type
[
0
],
fast
->
gcd
->
value_type
[
0
],
fast
->
gcd
->
min_value
[
0
],
fast
->
gcd
->
max_value
[
0
],
&
fast
->
gcd
->
min_value_axis
[
0
],
&
fast
->
gcd
->
max_value_axis
[
0
],
&
fast
->
gcd
->
trend_lines
[
0
],
&
fast
->
gcd
->
axis_lines
[
0
],
&
fast
->
gcd
->
axis_linelongq
[
0
],
&
fast
->
gcd
->
axis_valueq
[
0
],
fast
->
gcd
->
format
[
0
],
&
fast
->
gcd
->
axis_width
[
0
]
,
1
,
1
);
fast
->
gcd
->
scale
(
fast
->
gcd
->
x_axis_type
[
0
],
fast
->
gcd
->
x_
value_type
[
0
],
fast
->
gcd
->
x_min_value
[
0
],
fast
->
gcd
->
x_
max_value
[
0
],
&
fast
->
gcd
->
x_min_value_axis
[
0
],
&
fast
->
gcd
->
x_
max_value_axis
[
0
],
&
fast
->
gcd
->
x_trend_lines
[
0
],
&
fast
->
gcd
->
x_
axis_lines
[
0
],
&
fast
->
gcd
->
x_
axis_linelongq
[
0
],
&
fast
->
gcd
->
x_axis_valueq
[
0
],
fast
->
gcd
->
x_
format
[
0
],
&
axis_width
,
1
,
1
);
if
(
!
fast
->
first_scan
)
{
fast
->
curve
->
configure_curves
();
// fast->curve->configure_axes();
...
...
xtt/lib/xtt/src/xtt_sevhist.cpp
View file @
ee5450fe
...
...
@@ -90,51 +90,51 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
// Create data for time axis
gcd
=
new
GeCurveData
(
curve_eDataType_DsTrend
);
gcd
->
data
[
0
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
gcd
->
x_
data
[
0
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
gcd
->
data
[
0
][
i
]
=
(
double
)
tbuf
[
i
].
tv_sec
+
(
double
)
1e-9
*
tbuf
[
i
].
tv_nsec
;
gcd
->
x_
data
[
0
][
i
]
=
(
double
)
tbuf
[
i
].
tv_sec
+
(
double
)
1e-9
*
tbuf
[
i
].
tv_nsec
;
strcpy
(
gcd
->
name
[
0
]
,
"Time"
);
gcd
->
axis_type
[
0
]
=
curve_eAxis_x
;
strcpy
(
gcd
->
format
[
0
],
"%10t"
);
strcpy
(
gcd
->
x_name
,
"Time"
);
gcd
->
x_
axis_type
[
0
]
=
curve_eAxis_x
;
strcpy
(
gcd
->
x_
format
[
0
],
"%10t"
);
strcpy
(
gcd
->
name
[
1
],
aname
);
gcd
->
data
[
1
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
strcpy
(
gcd
->
y_name
[
0
],
aname
);
gcd
->
y_data
[
0
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
switch
(
vtype
)
{
case
pwr_eType_Int64
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_Int32
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_Int16
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_Int8
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_UInt64
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_UInt32
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_UInt16
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_UInt8
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tUInt32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_Float32
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tFloat32
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tFloat32
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_Float64
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tFloat64
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tFloat64
*
)
vbuf
)[
i
];
break
;
case
pwr_eType_Boolean
:
gcd
->
data
[
1
][
i
]
=
((
pwr_tBoolean
*
)
vbuf
)[
i
];
gcd
->
y_data
[
0
][
i
]
=
((
pwr_tBoolean
*
)
vbuf
)[
i
];
break
;
default:
*
sts
=
SEV__CURVETYPE
;
...
...
@@ -144,9 +144,9 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
free
(
tbuf
);
free
(
vbuf
);
gcd
->
axis_type
[
1
]
=
curve_eAxis_y
;
gcd
->
y_axis_type
[
0
]
=
curve_eAxis_y
;
gcd
->
cols
=
1
+
1
;
gcd
->
cols
=
1
;
gcd
->
rows
=
rows
;
gcd
->
get_borders
();
...
...
@@ -155,12 +155,12 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
if
(
to
.
tv_sec
!=
0
&&
from
.
tv_sec
!=
0
)
{
time_Adiff
(
&
trange
,
&
to
,
&
from
);
if
(
time_DToFloat
(
0
,
&
trange
)
<
600
)
strcpy
(
gcd
->
format
[
0
],
"%10t"
);
strcpy
(
gcd
->
x_
format
[
0
],
"%10t"
);
else
strcpy
(
gcd
->
format
[
0
],
"%11t"
);
strcpy
(
gcd
->
x_
format
[
0
],
"%11t"
);
}
else
strcpy
(
gcd
->
format
[
0
],
"%11t"
);
strcpy
(
gcd
->
x_
format
[
0
],
"%11t"
);
gcd
->
select_color
(
0
);
...
...
@@ -196,13 +196,13 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
// Create data for time axis
gcd
=
new
GeCurveData
(
curve_eDataType_DsTrend
);
gcd
->
data
[
0
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
gcd
->
x_
data
[
0
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
gcd
->
data
[
0
][
i
]
=
(
double
)
tbuf
[
i
].
tv_sec
+
(
double
)
1e-9
*
tbuf
[
i
].
tv_nsec
;
gcd
->
x_
data
[
0
][
i
]
=
(
double
)
tbuf
[
i
].
tv_sec
+
(
double
)
1e-9
*
tbuf
[
i
].
tv_nsec
;
strcpy
(
gcd
->
name
[
0
]
,
"Time"
);
gcd
->
axis_type
[
0
]
=
curve_eAxis_x
;
strcpy
(
gcd
->
format
[
0
],
"%10t"
);
strcpy
(
gcd
->
x_name
,
"Time"
);
gcd
->
x_
axis_type
[
0
]
=
curve_eAxis_x
;
strcpy
(
gcd
->
x_
format
[
0
],
"%10t"
);
//todo linesize br vi kunna f frn sevcli_get_objectitemdata
int
linesize
=
0
;
...
...
@@ -211,7 +211,7 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
}
void
*
dataptr
=
vbuf
;
int
tmp
=
0
;
gcd
->
cols
=
1
;
gcd
->
cols
=
0
;
for
(
int
i
=
0
;
i
<
numAttributes
;
i
++
)
{
switch
(
histattrbuf
[
i
].
type
)
{
...
...
@@ -232,16 +232,16 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
continue
;
}
if
(
gcd
->
cols
>=
CURVE_MAX_COLS
)
{
if
(
gcd
->
cols
>=
CURVE_MAX_COLS
)
{
printf
(
"To many columns for curve class max:%d
\n
"
,
CURVE_MAX_COLS
);
break
;
}
gcd
->
cols
++
;
strcpy
(
gcd
->
name
[
gcd
->
cols
-
1
],
histattrbuf
[
i
].
aname
);
gcd
->
data
[
gcd
->
cols
-
1
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
gcd
->
axis_type
[
gcd
->
cols
-
1
]
=
curve_eAxis_y
;
strcpy
(
gcd
->
y_
name
[
gcd
->
cols
-
1
],
histattrbuf
[
i
].
aname
);
gcd
->
y_
data
[
gcd
->
cols
-
1
]
=
(
double
*
)
calloc
(
1
,
8
*
rows
);
gcd
->
y_
axis_type
[
gcd
->
cols
-
1
]
=
curve_eAxis_y
;
dataptr
=
(
char
*
)
vbuf
+
tmp
;
//tmp += histattrbuf[i].size;
...
...
@@ -250,37 +250,37 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
dataptr
=
((
char
*
)
vbuf
)
+
j
*
linesize
+
tmp
;
switch
(
histattrbuf
[
i
].
type
)
{
case
pwr_eType_Int64
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt64
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt64
*
)
dataptr
;
break
;
case
pwr_eType_Int32
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt32
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt32
*
)
dataptr
;
break
;
case
pwr_eType_Int16
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt16
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt16
*
)
dataptr
;
break
;
case
pwr_eType_Int8
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt8
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tInt8
*
)
dataptr
;
break
;
case
pwr_eType_UInt64
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt64
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt64
*
)
dataptr
;
break
;
case
pwr_eType_UInt32
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt32
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt32
*
)
dataptr
;
break
;
case
pwr_eType_UInt16
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt16
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt16
*
)
dataptr
;
break
;
case
pwr_eType_UInt8
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt8
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tUInt8
*
)
dataptr
;
break
;
case
pwr_eType_Float32
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tFloat32
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tFloat32
*
)
dataptr
;
break
;
case
pwr_eType_Float64
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tFloat64
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tFloat64
*
)
dataptr
;
break
;
case
pwr_eType_Boolean
:
gcd
->
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tBoolean
*
)
dataptr
;
gcd
->
y_
data
[
gcd
->
cols
-
1
][
j
]
=
*
(
pwr_tBoolean
*
)
dataptr
;
break
;
default:
*
sts
=
SEV__CURVETYPE
;
...
...
@@ -303,12 +303,12 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
if
(
to
.
tv_sec
!=
0
&&
from
.
tv_sec
!=
0
)
{
time_Adiff
(
&
trange
,
&
to
,
&
from
);
if
(
time_DToFloat
(
0
,
&
trange
)
<
600
)
strcpy
(
gcd
->
format
[
0
],
"%10t"
);
strcpy
(
gcd
->
x_
format
[
0
],
"%10t"
);
else
strcpy
(
gcd
->
format
[
0
],
"%11t"
);
strcpy
(
gcd
->
x_
format
[
0
],
"%11t"
);
}
else
strcpy
(
gcd
->
format
[
0
],
"%11t"
);
strcpy
(
gcd
->
x_
format
[
0
],
"%11t"
);
gcd
->
select_color
(
0
);
...
...
@@ -348,11 +348,11 @@ void XttSevHist::sevhist_higher_res_cb( void *ctx)
sevhist
->
curve
->
measure_window
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
t_low
.
tv_sec
=
int
(
sevhist
->
gcd
->
min_value_axis
[
0
]
+
ll_x
/
200
*
(
sevhist
->
gcd
->
max_value_axis
[
0
]
-
sevhist
->
gcd
->
min_value_axis
[
0
]));
t_low
.
tv_sec
=
int
(
sevhist
->
gcd
->
x_
min_value_axis
[
0
]
+
ll_x
/
200
*
(
sevhist
->
gcd
->
x_max_value_axis
[
0
]
-
sevhist
->
gcd
->
x_
min_value_axis
[
0
]));
t_low
.
tv_nsec
=
0
;
t_high
.
tv_sec
=
int
(
sevhist
->
gcd
->
min_value_axis
[
0
]
+
ur_x
/
200
*
(
sevhist
->
gcd
->
max_value_axis
[
0
]
-
sevhist
->
gcd
->
min_value_axis
[
0
]));
t_high
.
tv_sec
=
int
(
sevhist
->
gcd
->
x_
min_value_axis
[
0
]
+
ur_x
/
200
*
(
sevhist
->
gcd
->
x_max_value_axis
[
0
]
-
sevhist
->
gcd
->
x_
min_value_axis
[
0
]));
t_high
.
tv_nsec
=
0
;
{
...
...
@@ -378,18 +378,18 @@ void XttSevHist::sevhist_lower_res_cb( void *ctx)
sevhist
->
curve
->
measure_window
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
t_low
.
tv_sec
=
int
(
sevhist
->
gcd
->
min_value_axis
[
0
]
-
5
*
(
sevhist
->
gcd
->
max_value_axis
[
0
]
-
sevhist
->
gcd
->
min_value_axis
[
0
]));
t_low
.
tv_sec
=
int
(
sevhist
->
gcd
->
x_
min_value_axis
[
0
]
-
5
*
(
sevhist
->
gcd
->
x_max_value_axis
[
0
]
-
sevhist
->
gcd
->
x_
min_value_axis
[
0
]));
t_low
.
tv_nsec
=
0
;
t_high
.
tv_sec
=
int
(
sevhist
->
gcd
->
max_value_axis
[
0
]
+
5
*
(
sevhist
->
gcd
->
max_value_axis
[
0
]
-
sevhist
->
gcd
->
min_value_axis
[
0
]));
t_high
.
tv_sec
=
int
(
sevhist
->
gcd
->
x_
max_value_axis
[
0
]
+
5
*
(
sevhist
->
gcd
->
x_max_value_axis
[
0
]
-
sevhist
->
gcd
->
x_
min_value_axis
[
0
]));
t_high
.
tv_nsec
=
0
;
if
(
t_low
.
tv_sec
==
sevhist
->
time_low_old
&&
t_high
.
tv_sec
==
sevhist
->
time_high_old
)
{
t_low
.
tv_sec
=
int
(
sevhist
->
gcd
->
min_value_axis
[
0
]
-
25
*
(
sevhist
->
gcd
->
max_value_axis
[
0
]
-
sevhist
->
gcd
->
min_value_axis
[
0
]));
t_high
.
tv_sec
=
int
(
sevhist
->
gcd
->
max_value_axis
[
0
]
+
25
*
(
sevhist
->
gcd
->
max_value_axis
[
0
]
-
sevhist
->
gcd
->
min_value_axis
[
0
]));
t_low
.
tv_sec
=
int
(
sevhist
->
gcd
->
x_
min_value_axis
[
0
]
-
25
*
(
sevhist
->
gcd
->
x_max_value_axis
[
0
]
-
sevhist
->
gcd
->
x_
min_value_axis
[
0
]));
t_high
.
tv_sec
=
int
(
sevhist
->
gcd
->
x_
max_value_axis
[
0
]
+
25
*
(
sevhist
->
gcd
->
x_max_value_axis
[
0
]
-
sevhist
->
gcd
->
x_
min_value_axis
[
0
]));
}
{
...
...
xtt/lib/xtt/src/xtt_trend.cpp
View file @
ee5450fe
...
...
@@ -143,15 +143,15 @@ XttTrend::XttTrend( void *parent_ctx,
// Create data for time axis
gcd
=
new
GeCurveData
(
curve_eDataType_DsTrend
);
gcd
->
data
[
0
]
=
(
double
*
)
malloc
(
8
*
max_points
);
strcpy
(
gcd
->
name
[
0
]
,
"Time"
);
gcd
->
x_
data
[
0
]
=
(
double
*
)
malloc
(
8
*
max_points
);
strcpy
(
gcd
->
x_name
,
"Time"
);
for
(
j
=
0
;
j
<
max_points
;
j
++
)
{
gcd
->
data
[
0
][
j
]
=
double
(
j
*
min_interval
);
gcd
->
x_
data
[
0
][
j
]
=
double
(
j
*
min_interval
);
}
gcd
->
axis_type
[
0
]
=
curve_eAxis_x
;
gcd
->
x_
axis_type
[
0
]
=
curve_eAxis_x
;
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
gcd
->
data
[
i
+
1
]
=
(
double
*
)
calloc
(
1
,
8
*
max_points
);
gcd
->
y_data
[
i
]
=
(
double
*
)
calloc
(
1
,
8
*
max_points
);
int
write_buffer
=
(
int
)
tp
[
i
].
WriteBuffer
;
start_idx
=
write_buffer
*
trend_buff_size
/
2
...
...
@@ -170,14 +170,14 @@ XttTrend::XttTrend( void *parent_ctx,
int
idx
=
0
;
for
(
j
=
start_idx
;
j
>=
write_buffer
*
trend_buff_size
/
2
;
j
--
)
{
for
(
k
=
0
;
k
<
interval
[
i
];
k
++
)
{
gcd
->
data
[
i
+
1
][
idx
]
=
tp
[
i
].
DataBuffer
[
j
];
gcd
->
y_data
[
i
][
idx
]
=
tp
[
i
].
DataBuffer
[
j
];
idx
++
;
}
}
for
(
j
=
tp
[
i
].
NoOfSample
-
1
+
(
!
write_buffer
)
*
trend_buff_size
/
2
;
j
>=
(
!
write_buffer
)
*
trend_buff_size
/
2
;
j
--
)
{
for
(
k
=
0
;
k
<
interval
[
i
];
k
++
)
{
gcd
->
data
[
i
+
1
][
idx
]
=
tp
[
i
].
DataBuffer
[
j
];
gcd
->
y_data
[
i
][
idx
]
=
tp
[
i
].
DataBuffer
[
j
];
idx
++
;
}
}
...
...
@@ -186,14 +186,14 @@ XttTrend::XttTrend( void *parent_ctx,
for
(
j
=
tp
[
i
].
NoOfSample
-
1
+
write_buffer
*
trend_buff_size
/
2
;
j
>
start_idx
;
j
--
)
{
for
(
k
=
0
;
k
<
interval
[
i
];
k
++
)
{
gcd
->
data
[
i
+
1
][
idx
]
=
tp
[
i
].
DataBuffer
[
j
];
gcd
->
y_data
[
i
][
idx
]
=
tp
[
i
].
DataBuffer
[
j
];
idx
++
;
}
}
}
last_buffer
[
i
]
=
tp
[
i
].
WriteBuffer
;
last_next_index
[
i
]
=
tp
[
i
].
NextWriteIndex
[
last_buffer
[
i
]];
gcd
->
axis_type
[
i
+
1
]
=
curve_eAxis_y
;
gcd
->
y_axis_type
[
i
]
=
curve_eAxis_y
;
}
// Subscribe to object
...
...
@@ -203,7 +203,7 @@ XttTrend::XttTrend( void *parent_ctx,
&
subid
[
i
],
sizeof
(
pwr_sClass_DsTrend
));
if
(
EVEN
(
*
sts
))
return
;
strcpy
(
gcd
->
name
[
i
+
1
],
object_name
[
i
]);
strcpy
(
gcd
->
y_name
[
i
],
object_name
[
i
]);
switch
(
trend_p
[
i
]
->
DataType
)
{
case
pwr_eType_Float32
:
...
...
@@ -228,7 +228,7 @@ XttTrend::XttTrend( void *parent_ctx,
element_size
[
i
]
=
4
;
}
}
gcd
->
cols
=
trend_cnt
+
1
;
gcd
->
cols
=
trend_cnt
;
gcd
->
rows
=
max_points
;
gcd
->
x_reverse
=
1
;
gcd
->
get_borders
();
...
...
@@ -239,12 +239,12 @@ XttTrend::XttTrend( void *parent_ctx,
// Use axis values from plotgroup object
for
(
i
=
0
;
i
<
trend_cnt
;
i
++
)
{
if
(
plot
.
YMinValue
[
i
]
!=
plot
.
YMaxValue
[
i
])
gcd
->
scale
(
gcd
->
axis_type
[
i
+
1
],
gcd
->
value_type
[
i
+
1
],
gcd
->
scale
(
gcd
->
y_axis_type
[
i
],
gcd
->
y_value_type
[
i
],
plot
.
YMinValue
[
i
],
plot
.
YMaxValue
[
i
],
&
gcd
->
min_value_axis
[
i
+
1
],
&
gcd
->
max_value_axis
[
i
+
1
],
&
gcd
->
trend_lines
[
i
+
1
],
&
gcd
->
axis_lines
[
i
+
1
],
&
gcd
->
axis_linelongq
[
i
+
1
],
&
gcd
->
axis_valueq
[
i
+
1
],
gcd
->
format
[
i
+
1
],
&
gcd
->
axis_width
[
i
+
1
],
1
,
1
);
&
gcd
->
y_min_value_axis
[
i
],
&
gcd
->
y_max_value_axis
[
i
],
&
gcd
->
y_trend_lines
[
i
],
&
gcd
->
y_axis_lines
[
i
],
&
gcd
->
y_axis_linelongq
[
i
],
&
gcd
->
y_axis_valueq
[
i
],
gcd
->
y_format
[
i
],
&
gcd
->
y_axis_width
[
i
],
1
,
1
);
}
}
}
...
...
@@ -303,7 +303,7 @@ void XttTrend::trend_scan( void *data)
for
(
i
=
0
;
i
<
trend
->
trend_cnt
;
i
++
)
{
// Shift data
for
(
j
=
trend
->
max_points
-
1
;
j
>
0
;
j
--
)
trend
->
gcd
->
data
[
i
+
1
][
j
]
=
trend
->
gcd
->
data
[
i
+
1
][
j
-
1
];
trend
->
gcd
->
y_data
[
i
][
j
]
=
trend
->
gcd
->
y_data
[
i
][
j
-
1
];
// Insert new value
write_buffer
=
trend
->
trend_p
[
i
]
->
WriteBuffer
;
idx
=
write_buffer
*
trend_buff_size
/
2
...
...
@@ -314,7 +314,7 @@ void XttTrend::trend_scan( void *data)
else
idx
--
;
trend
->
gcd
->
data
[
i
+
1
][
0
]
=
trend
->
trend_p
[
i
]
->
DataBuffer
[
idx
];
trend
->
gcd
->
y_data
[
i
][
0
]
=
trend
->
trend_p
[
i
]
->
DataBuffer
[
idx
];
}
trend
->
curve
->
points_added
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment