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
dc7006f2
Commit
dc7006f2
authored
Oct 03, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cursor values view correctly
parent
6830b7e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
119 deletions
+98
-119
xtt/lib/ge/src/ge_curve.cpp
xtt/lib/ge/src/ge_curve.cpp
+96
-118
xtt/lib/ge/src/ge_curve.h
xtt/lib/ge/src/ge_curve.h
+2
-1
No files found.
xtt/lib/ge/src/ge_curve.cpp
View file @
dc7006f2
/*
* Proview $Id: ge_curve.cpp,v 1.2
0 2008-09-18 15:00:21
claes Exp $
* Proview $Id: ge_curve.cpp,v 1.2
1 2008-10-03 14:26:08
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -155,14 +155,34 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event)
}
case
glow_eEvent_SliderMoved
:
{
char
str
[
40
];
int
row
;
double
ll_x
,
ll_y
,
ur_x
,
ur_y
;
double
time
;
double
values
[
CURVE_MAX_COLS
];
grow_MeasureNode
(
curve
->
curve_markobject
,
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
curve
->
last_mark_x
=
event
->
any
.
x
;
curve
->
x_to_points
(
event
->
any
.
x
,
&
time
,
values
);
for
(
int
i
=
1
;
i
<
curve
->
cd
->
cols
;
i
++
)
{
sprintf
(
str
,
"%7.2f"
,
values
[
i
]);
grow_SetAnnotation
(
curve
->
mark_annot
[
i
],
0
,
str
,
strlen
(
str
));
}
if
(
!
(
strcmp
(
curve
->
cd
->
format
[
0
],
"%10t"
)
==
0
||
strcmp
(
curve
->
cd
->
format
[
0
],
"%11t"
)
==
0
))
{
sprintf
(
str
,
"%7.2f"
,
time
);
grow_SetAnnotation
(
curve
->
mark_annot
[
0
],
0
,
str
,
strlen
(
str
));
}
else
{
// Time is a date
pwr_tTime
t
;
time_Float64ToD
(
(
pwr_tDeltaTime
*
)
&
t
,
time
);
time_AtoAscii
(
&
t
,
time_eFormat_DateAndTime
,
str
,
sizeof
(
str
));
grow_SetAnnotation
(
curve
->
mark_annot
[
0
],
0
,
str
,
strlen
(
str
));
}
#if 0
if ( !curve->cd->x_reverse)
time = event->any.x *
(curve->cd->max_value_axis[0] - curve->cd->min_value_axis[0]) / 200;
...
...
@@ -221,135 +241,31 @@ int GeCurve::growcurve_cb( GlowCtx *ctx, glow_tEvent event)
sprintf( str, "%7.2f", curve->cd->data[0][row]);
grow_SetAnnotation( curve->mark_annot[0], 0, str, strlen(str));
#endif
break
;
}
case
glow_eEvent_CursorMotion
:
{
char
str
[
40
];
int
row
;
double
time
;
double
values
[
CURVE_MAX_COLS
];
if
(
!
(
strcmp
(
curve
->
cd
->
format
[
0
],
"%10t"
)
==
0
||
strcmp
(
curve
->
cd
->
format
[
0
],
"%11t"
)
==
0
))
{
curve
->
last_cursor_x
=
event
->
any
.
x
;
if
(
!
curve
->
cd
->
x_reverse
)
time
=
event
->
any
.
x
*
(
curve
->
cd
->
max_value_axis
[
0
]
-
curve
->
cd
->
min_value_axis
[
0
])
/
200
;
else
time
=
(
200.0
-
event
->
any
.
x
)
*
(
curve
->
cd
->
max_value_axis
[
0
]
-
curve
->
cd
->
min_value_axis
[
0
])
/
200
;
curve
->
x_to_points
(
event
->
any
.
x
,
&
time
,
values
);
// Approximate row
row
=
int
((
time
-
curve
->
cd
->
min_value
[
0
])
/
(
curve
->
cd
->
max_value
[
0
]
-
curve
->
cd
->
min_value
[
0
])
*
(
curve
->
cd
->
rows
-
1
)
+
0.5
);
if
(
row
>
curve
->
cd
->
rows
-
1
)
row
=
curve
->
cd
->
rows
-
1
;
else
if
(
row
<
0
)
row
=
0
;
else
{
// Find exact row
double
b1
,
b2
;
int
r
=
row
;
for
(
int
i
=
0
;;
i
++
)
{
if
(
r
==
0
)
{
b2
=
(
curve
->
cd
->
data
[
0
][
row
]
+
curve
->
cd
->
data
[
0
][
r
+
1
])
/
2
;
if
(
time
<
b2
)
break
;
r
++
;
}
else
if
(
r
==
curve
->
cd
->
rows
-
1
)
{
b1
=
(
curve
->
cd
->
data
[
0
][
r
]
+
curve
->
cd
->
data
[
0
][
r
-
1
])
/
2
;
if
(
time
>=
b1
)
break
;
r
--
;
}
else
{
b1
=
(
curve
->
cd
->
data
[
0
][
r
]
+
curve
->
cd
->
data
[
0
][
r
-
1
])
/
2
;
b2
=
(
curve
->
cd
->
data
[
0
][
r
]
+
curve
->
cd
->
data
[
0
][
r
+
1
])
/
2
;
if
(
b1
<=
time
&&
time
<
b2
)
break
;
if
(
b1
<=
time
)
r
++
;
else
r
--
;
}
if
(
i
>
100
)
{
// Corrupt data, se original row
r
=
row
;
break
;
}
}
row
=
r
;
}
for
(
int
i
=
1
;
i
<
curve
->
cd
->
cols
;
i
++
)
{
sprintf
(
str
,
"%7.2f"
,
curve
->
cd
->
data
[
i
][
row
]);
sprintf
(
str
,
"%7.2f"
,
values
[
i
]);
grow_SetAnnotation
(
curve
->
cursor_annot
[
i
],
0
,
str
,
strlen
(
str
));
}
sprintf
(
str
,
"%7.2f"
,
curve
->
cd
->
data
[
0
][
row
]);
if
(
!
(
strcmp
(
curve
->
cd
->
format
[
0
],
"%10t"
)
==
0
||
strcmp
(
curve
->
cd
->
format
[
0
],
"%11t"
)
==
0
))
{
sprintf
(
str
,
"%7.2f"
,
time
);
grow_SetAnnotation
(
curve
->
cursor_annot
[
0
],
0
,
str
,
strlen
(
str
));
}
else
{
// Time is a date
curve
->
last_cursor_x
=
event
->
any
.
x
;
if
(
!
curve
->
cd
->
x_reverse
)
time
=
curve
->
cd
->
min_value_axis
[
0
]
+
event
->
any
.
x
*
(
curve
->
cd
->
max_value_axis
[
0
]
-
curve
->
cd
->
min_value_axis
[
0
])
/
200
;
else
time
=
curve
->
cd
->
min_value_axis
[
0
]
+
(
200.0
-
event
->
any
.
x
)
*
(
curve
->
cd
->
max_value_axis
[
0
]
-
curve
->
cd
->
min_value_axis
[
0
])
/
200
;
// Approximate row
row
=
int
((
time
-
curve
->
cd
->
min_value
[
0
])
/
(
curve
->
cd
->
max_value
[
0
]
-
curve
->
cd
->
min_value
[
0
])
*
(
curve
->
cd
->
rows
-
1
)
+
0.5
);
if
(
row
>
curve
->
cd
->
rows
-
1
)
row
=
curve
->
cd
->
rows
-
1
;
else
if
(
row
<
0
)
row
=
0
;
else
{
// Find exact row
double
b1
,
b2
;
int
r
=
row
;
for
(
int
i
=
0
;;
i
++
)
{
if
(
r
==
0
)
{
b2
=
(
curve
->
cd
->
data
[
0
][
row
]
+
curve
->
cd
->
data
[
0
][
r
+
1
])
/
2
;
if
(
time
<
b2
)
break
;
r
++
;
}
else
if
(
r
==
curve
->
cd
->
rows
-
1
)
{
b1
=
(
curve
->
cd
->
data
[
0
][
r
]
+
curve
->
cd
->
data
[
0
][
r
-
1
])
/
2
;
if
(
time
>=
b1
)
break
;
r
--
;
}
else
{
b1
=
(
curve
->
cd
->
data
[
0
][
r
]
+
curve
->
cd
->
data
[
0
][
r
-
1
])
/
2
;
b2
=
(
curve
->
cd
->
data
[
0
][
r
]
+
curve
->
cd
->
data
[
0
][
r
+
1
])
/
2
;
if
(
b1
<=
time
&&
time
<
b2
)
break
;
if
(
b1
<=
time
)
r
++
;
else
r
--
;
}
if
(
i
>
curve
->
cd
->
rows
)
{
// Corrupt data, se original row
r
=
row
;
break
;
}
}
row
=
r
;
}
for
(
int
i
=
1
;
i
<
curve
->
cd
->
cols
;
i
++
)
{
sprintf
(
str
,
"%7.2f"
,
curve
->
cd
->
data
[
i
][
row
]);
grow_SetAnnotation
(
curve
->
cursor_annot
[
i
],
0
,
str
,
strlen
(
str
));
}
pwr_tTime
t
;
time_Float64ToD
(
(
pwr_tDeltaTime
*
)
&
t
,
curve
->
cd
->
data
[
0
][
row
]
);
time_Float64ToD
(
(
pwr_tDeltaTime
*
)
&
t
,
time
);
time_AtoAscii
(
&
t
,
time_eFormat_DateAndTime
,
str
,
sizeof
(
str
));
grow_SetAnnotation
(
curve
->
cursor_annot
[
0
],
0
,
str
,
strlen
(
str
));
}
...
...
@@ -1667,3 +1583,65 @@ void GeCurveData::scale( int axis_type, int value_type,
return
;
}
void
GeCurve
::
x_to_points
(
double
x
,
double
*
t
,
double
*
values
)
{
int
row
;
double
time
;
// Time is a date
if
(
!
cd
->
x_reverse
)
time
=
cd
->
min_value_axis
[
0
]
+
x
*
(
cd
->
max_value_axis
[
0
]
-
cd
->
min_value_axis
[
0
])
/
200
;
else
time
=
cd
->
min_value_axis
[
0
]
+
(
200.0
-
x
)
*
(
cd
->
max_value_axis
[
0
]
-
cd
->
min_value_axis
[
0
])
/
200
;
// Approximate row
row
=
int
((
time
-
cd
->
min_value
[
0
])
/
(
cd
->
max_value
[
0
]
-
cd
->
min_value
[
0
])
*
(
cd
->
rows
-
1
)
+
0.5
);
if
(
row
>
cd
->
rows
-
1
)
row
=
cd
->
rows
-
1
;
else
if
(
row
<
0
)
row
=
0
;
else
{
// Find exact row
double
b1
,
b2
;
int
r
=
row
;
for
(
int
i
=
0
;;
i
++
)
{
if
(
r
==
0
)
{
b2
=
(
cd
->
data
[
0
][
row
]
+
cd
->
data
[
0
][
r
+
1
])
/
2
;
if
(
time
<
b2
)
break
;
r
++
;
}
else
if
(
r
==
cd
->
rows
-
1
)
{
b1
=
(
cd
->
data
[
0
][
r
]
+
cd
->
data
[
0
][
r
-
1
])
/
2
;
if
(
time
>=
b1
)
break
;
r
--
;
}
else
{
b1
=
(
cd
->
data
[
0
][
r
]
+
cd
->
data
[
0
][
r
-
1
])
/
2
;
b2
=
(
cd
->
data
[
0
][
r
]
+
cd
->
data
[
0
][
r
+
1
])
/
2
;
if
(
b1
<=
time
&&
time
<
b2
)
break
;
if
(
b1
<=
time
)
r
++
;
else
r
--
;
}
if
(
i
>
cd
->
rows
)
{
// Corrupt data, se original row
r
=
row
;
break
;
}
}
row
=
r
;
}
for
(
int
i
=
1
;
i
<
cd
->
cols
;
i
++
)
values
[
i
]
=
cd
->
data
[
i
][
row
];
*
t
=
cd
->
data
[
0
][
row
];
}
xtt/lib/ge/src/ge_curve.h
View file @
dc7006f2
/*
* Proview $Id: ge_curve.h,v 1.1
2 2008-09-18 15:00:21
claes Exp $
* Proview $Id: ge_curve.h,v 1.1
3 2008-10-03 14:26:16
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -165,6 +165,7 @@ class GeCurve {
void
activate_minmax_ok
(
double
min_value
,
double
max_value
);
void
set_curvedata
(
GeCurveData
*
curve_data
);
void
redraw
();
void
x_to_points
(
double
x
,
double
*
time
,
double
*
values
);
static
int
growcurve_cb
(
GlowCtx
*
ctx
,
glow_tEvent
event
);
static
int
init_growcurve_cb
(
GlowCtx
*
fctx
,
void
*
client_data
);
...
...
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