Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
3d4443a9
Commit
3d4443a9
authored
9 years ago
by
Veith Röthlingshöfer
Browse files
Options
Downloads
Patches
Plain Diff
Further worked on bar chart in plotter
parent
4a6885bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/gui-plugins/SensorActorWidgetsPlugin/ArmarXPlotter/ArmarXPlotter.cpp
+35
-23
35 additions, 23 deletions
.../SensorActorWidgetsPlugin/ArmarXPlotter/ArmarXPlotter.cpp
with
35 additions
and
23 deletions
source/RobotAPI/gui-plugins/SensorActorWidgetsPlugin/ArmarXPlotter/ArmarXPlotter.cpp
+
35
−
23
View file @
3d4443a9
...
...
@@ -67,7 +67,7 @@ ArmarXPlotter::ArmarXPlotter() :
setTag
(
"Plotter"
);
ui
.
setupUi
(
getWidget
());
timer
=
new
QTimer
(
getWidget
());
bars
=
new
std
::
vector
<
QwtThermo
*>
();
////////////////
// Setup Plotter
///////////////
...
...
@@ -250,8 +250,6 @@ void ArmarXPlotter::onGraphStyleChanged(int idx)
break
;
case
1
:
//bar chart
createThermos
();
//TODO dont do this every time
stackedLayout
->
setCurrentIndex
(
graphStyle
);
//to test
break
;
default:
...
...
@@ -280,9 +278,10 @@ void ArmarXPlotter::updateGraph()
// int size = shownInterval*1000/updateInterval;
GraphDataMap
::
iterator
it
=
dataMap
.
begin
();
std
::
vector
<
QwtThermo
*>::
iterator
barIt
=
bars
->
begin
();
IceUtil
::
Time
curTime
=
IceUtil
::
Time
::
now
();
for
(;
it
!=
dataMap
.
end
();
++
it
)
for
(;
it
!=
dataMap
.
end
();
++
it
,
++
barIt
)
{
QVector
<
QPointF
>
pointList
;
...
...
@@ -377,7 +376,13 @@ void ArmarXPlotter::updateGraph()
QwtPlotCurve
*
curve
=
curves
[
it
->
first
];
curve
->
setData
(
pointSeries
);
}
}
if
(
barIt
!=
bars
->
end
())
{
(
*
barIt
)
->
setValue
(
p
.
y
());
}
}
ui
.
qwtPlot
->
setAxisScale
(
QwtPlot
::
xBottom
,
shownInterval
*
-
1
,
0.
f
);
...
...
@@ -414,6 +419,11 @@ void ArmarXPlotter::autoScale(bool toggled)
ui
.
qwtPlot
->
setAxisAutoScale
(
QwtPlot
::
yLeft
,
toggled
);
ui
.
qwtPlot
->
replot
();
for
(
u_int
i
=
0
;
i
<
bars
->
size
();
i
++
)
{
bars
->
at
(
i
)
->
setAutoScale
();
}
}
...
...
@@ -480,6 +490,7 @@ void ArmarXPlotter::setupCurves()
{
{
ScopedLock
lock
(
dataMutex
);
QHBoxLayout
*
barlayout
=
new
QHBoxLayout
;
for
(
int
i
=
0
;
i
<
selectedChannels
.
size
();
i
++
)
{
...
...
@@ -493,6 +504,13 @@ void ArmarXPlotter::setupCurves()
{
QwtPlotCurve
*
curve
=
createCurve
(
selectedChannels
.
at
(
i
));
curves
[
selectedChannels
.
at
(
i
).
toStdString
()]
=
curve
;
//create bar graphs
QwtThermo
*
t
=
new
QwtThermo
(
getWidget
());
t
->
setAccessibleName
(
selectedChannels
.
at
(
i
));
bars
->
push_back
(
t
);
barlayout
->
addWidget
(
t
);
}
else
{
...
...
@@ -512,12 +530,24 @@ void ArmarXPlotter::setupCurves()
ARMARX_INFO
<<
key
<<
": "
<<
*
VariantPtr
::
dynamicCast
(
e
.
second
);
QwtPlotCurve
*
curve
=
createCurve
(
QString
::
fromStdString
(
key
));
curves
[
key
]
=
curve
;
//create bar graphs
QwtThermo
*
t
=
new
QwtThermo
(
getWidget
());
t
->
setAccessibleName
(
QString
::
fromStdString
(
key
));
bars
->
push_back
(
t
);
barlayout
->
addWidget
(
t
);
}
}
}
}
ui
.
qwtPlot
->
replot
();
QWidget
*
barsWidget
=
new
QWidget
(
getWidget
());
barsWidget
->
setLayout
(
barlayout
);
barsWidget
->
setAccessibleName
(
"barsWidget"
);
stackedLayout
->
addWidget
(
barsWidget
);
ARMARX_INFO_S
<<
"Created "
<<
bars
->
size
()
<<
" bar charts"
<<
armarx
::
flush
;
}
timer
->
start
(
updateInterval
);
...
...
@@ -671,24 +701,6 @@ void ArmarXPlotter::logToFile(const IceUtil::Time& time, const std::map<std::str
}
}
void
ArmarXPlotter
::
createThermos
()
{
//MEMORY LEAK!!! This gets called every time the combo box is switch to bar chart
bars
=
new
std
::
vector
<
QwtThermo
*>
();
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
for
(
int
i
=
0
;
i
<
selectedChannels
.
size
();
i
++
)
{
QwtThermo
*
t
=
new
QwtThermo
(
getWidget
());
bars
->
push_back
(
t
);
layout
->
addWidget
(
t
);
}
QWidget
*
barsWidget
=
new
QWidget
(
getWidget
());
barsWidget
->
setLayout
(
layout
);
stackedLayout
->
addWidget
(
barsWidget
);
ARMARX_INFO_S
<<
"Created "
<<
bars
->
size
()
<<
" bar charts"
<<
armarx
::
flush
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment