Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
361ac1d7
Commit
361ac1d7
authored
Jul 21, 2011
by
LM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on map menu, fixing plot
parent
875034c0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
17 deletions
+100
-17
QGCDataPlot2D.cc
src/ui/QGCDataPlot2D.cc
+47
-6
QGCDataPlot2D.ui
src/ui/QGCDataPlot2D.ui
+4
-4
QGCMapTool.cc
src/ui/map/QGCMapTool.cc
+2
-0
QGCMapTool.h
src/ui/map/QGCMapTool.h
+1
-0
QGCMapToolBar.cc
src/ui/map/QGCMapToolBar.cc
+33
-0
QGCMapToolBar.h
src/ui/map/QGCMapToolBar.h
+5
-0
QGCMapToolBar.ui
src/ui/map/QGCMapToolBar.ui
+7
-0
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+1
-7
No files found.
src/ui/QGCDataPlot2D.cc
View file @
361ac1d7
...
@@ -405,8 +405,6 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
...
@@ -405,8 +405,6 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
int
curveNameIndex
=
0
;
int
curveNameIndex
=
0
;
//int xValueIndex = curveNames.indexOf(xAxisName);
QString
xAxisFilter
;
QString
xAxisFilter
;
if
(
xAxisName
==
""
)
{
if
(
xAxisName
==
""
)
{
xAxisFilter
=
curveNames
.
first
();
xAxisFilter
=
curveNames
.
first
();
...
@@ -414,6 +412,36 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
...
@@ -414,6 +412,36 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
xAxisFilter
=
xAxisName
;
xAxisFilter
=
xAxisName
;
}
}
// Fill y-axis renaming lookup table
// Allow the user to rename data dimensions in the plot
QMap
<
QString
,
QString
>
renaming
;
QStringList
yCurves
=
yAxisFilter
.
split
(
"|"
,
QString
::
SkipEmptyParts
);
qDebug
()
<<
"YFILTER"
<<
yAxisFilter
;
// Figure out the correct renaming
for
(
int
i
=
0
;
i
<
yCurves
.
count
();
++
i
)
{
qDebug
()
<<
"CURVE:"
<<
yCurves
.
at
(
i
);
if
(
yCurves
.
at
(
i
).
contains
(
":"
))
{
QStringList
parts
=
yCurves
.
at
(
i
).
split
(
":"
,
QString
::
SkipEmptyParts
);
if
(
parts
.
count
()
>
1
)
{
// Insert renaming map
renaming
.
insert
(
parts
.
first
(),
parts
.
last
());
// Replace curve value with first part only
yCurves
.
replace
(
i
,
parts
.
first
());
}
}
// else
// {
// // Insert same value, not renaming anything
// renaming.insert(yCurves.at(i), yCurves.at(i));
// }
}
foreach
(
curveName
,
curveNames
)
{
foreach
(
curveName
,
curveNames
)
{
// Add to plot x axis selection
// Add to plot x axis selection
ui
->
xAxis
->
addItem
(
curveName
);
ui
->
xAxis
->
addItem
(
curveName
);
...
@@ -421,14 +449,19 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
...
@@ -421,14 +449,19 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
ui
->
xRegressionComboBox
->
addItem
(
curveName
);
ui
->
xRegressionComboBox
->
addItem
(
curveName
);
ui
->
yRegressionComboBox
->
addItem
(
curveName
);
ui
->
yRegressionComboBox
->
addItem
(
curveName
);
if
(
curveName
!=
xAxisFilter
)
{
if
(
curveName
!=
xAxisFilter
)
{
if
((
yAxisFilter
==
""
)
||
y
AxisFilter
.
contains
(
curveName
))
{
if
((
yAxisFilter
==
""
)
||
y
Curves
.
contains
(
curveName
))
{
yValues
.
insert
(
curveName
,
new
QVector
<
double
>
());
yValues
.
insert
(
curveName
,
new
QVector
<
double
>
());
xValues
.
insert
(
curveName
,
new
QVector
<
double
>
());
xValues
.
insert
(
curveName
,
new
QVector
<
double
>
());
// Add separator starting with second item
// Add separator starting with second item
if
(
curveNameIndex
>
0
&&
curveNameIndex
<
curveNames
.
count
())
{
if
(
curveNameIndex
>
0
&&
curveNameIndex
<
curveNames
.
count
())
{
ui
->
yAxis
->
setText
(
ui
->
yAxis
->
text
()
+
"|"
);
ui
->
yAxis
->
setText
(
ui
->
yAxis
->
text
()
+
"|"
);
}
}
ui
->
yAxis
->
setText
(
ui
->
yAxis
->
text
()
+
curveName
);
// If this curve was renamed, re-add the renaming to the text field
QString
renamingText
=
""
;
if
(
renaming
.
contains
(
curveName
))
renamingText
=
QString
(
":%1"
).
arg
(
renaming
.
value
(
curveName
));
ui
->
yAxis
->
setText
(
ui
->
yAxis
->
text
()
+
curveName
+
renamingText
);
// Insert same value, not renaming anything
if
(
!
renaming
.
contains
(
curveName
))
renaming
.
insert
(
curveName
,
curveName
);
curveNameIndex
++
;
curveNameIndex
++
;
}
}
}
}
...
@@ -478,7 +511,8 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
...
@@ -478,7 +511,8 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
foreach
(
curveName
,
curveNames
)
foreach
(
curveName
,
curveNames
)
{
{
// Y AXIS HANDLING
// Y AXIS HANDLING
if
(
curveName
!=
xAxisFilter
&&
(
yAxisFilter
==
""
||
yAxisFilter
.
contains
(
curveName
)))
// Only plot non-x curver and those selected in the yAxisFilter (or all if the filter is not set)
if
(
curveName
!=
xAxisFilter
&&
(
yAxisFilter
==
""
||
yCurves
.
contains
(
curveName
)))
{
{
bool
oky
;
bool
oky
;
int
curveNameIndex
=
curveNames
.
indexOf
(
curveName
);
int
curveNameIndex
=
curveNames
.
indexOf
(
curveName
);
...
@@ -504,7 +538,14 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
...
@@ -504,7 +538,14 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
// Add data array of each curve to the plot at once (fast)
// Add data array of each curve to the plot at once (fast)
// Iterates through all x-y curve combinations
// Iterates through all x-y curve combinations
for
(
int
i
=
0
;
i
<
yValues
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
yValues
.
count
();
i
++
)
{
plot
->
appendData
(
yValues
.
keys
().
at
(
i
),
xValues
.
values
().
at
(
i
)
->
data
(),
yValues
.
values
().
at
(
i
)
->
data
(),
xValues
.
values
().
at
(
i
)
->
count
());
if
(
renaming
.
contains
(
yValues
.
keys
().
at
(
i
)))
{
plot
->
appendData
(
renaming
.
value
(
yValues
.
keys
().
at
(
i
)),
xValues
.
values
().
at
(
i
)
->
data
(),
yValues
.
values
().
at
(
i
)
->
data
(),
xValues
.
values
().
at
(
i
)
->
count
());
}
else
{
plot
->
appendData
(
yValues
.
keys
().
at
(
i
),
xValues
.
values
().
at
(
i
)
->
data
(),
yValues
.
values
().
at
(
i
)
->
data
(),
xValues
.
values
().
at
(
i
)
->
count
());
}
}
}
plot
->
updateScale
();
plot
->
updateScale
();
plot
->
setStyleText
(
ui
->
style
->
currentText
());
plot
->
setStyleText
(
ui
->
style
->
currentText
());
...
...
src/ui/QGCDataPlot2D.ui
View file @
361ac1d7
...
@@ -6,14 +6,14 @@
...
@@ -6,14 +6,14 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
1
07
3
</width>
<width>
1
46
3
</width>
<height>
3
08
</height>
<height>
3
11
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Form
</string>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"1,1,1,1,100,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
>
<item
row=
"0"
column=
"0"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<property
name=
"text"
>
...
@@ -303,7 +303,7 @@
...
@@ -303,7 +303,7 @@
</property>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<size>
<width>
40
</width>
<width>
5
</width>
<height>
20
</height>
<height>
20
</height>
</size>
</size>
</property>
</property>
...
...
src/ui/map/QGCMapTool.cc
View file @
361ac1d7
#include "QGCMapTool.h"
#include "QGCMapTool.h"
#include "ui_QGCMapTool.h"
#include "ui_QGCMapTool.h"
#include <QAction>
#include <QMenu>
QGCMapTool
::
QGCMapTool
(
QWidget
*
parent
)
:
QGCMapTool
::
QGCMapTool
(
QWidget
*
parent
)
:
QWidget
(
parent
),
QWidget
(
parent
),
...
...
src/ui/map/QGCMapTool.h
View file @
361ac1d7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define QGCMAPTOOL_H
#define QGCMAPTOOL_H
#include <QWidget>
#include <QWidget>
#include <QMenu>
namespace
Ui
{
namespace
Ui
{
class
QGCMapTool
;
class
QGCMapTool
;
...
...
src/ui/map/QGCMapToolBar.cc
View file @
361ac1d7
...
@@ -29,9 +29,42 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
...
@@ -29,9 +29,42 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
// Edit mode handling
// Edit mode handling
ui
->
editButton
->
hide
();
ui
->
editButton
->
hide
();
const
int
uavTrailTimeList
[]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
};
// seconds
const
int
uavTrailTimeCount
=
10
;
const
int
uavTrailDistanceList
[]
=
{
1
,
2
,
5
,
10
,
20
,
50
,
100
,
200
,
500
};
// meters
const
int
uavTrailDistanceCount
=
9
;
optionsMenu
.
setParent
(
this
);
// Build up menu
//trailPlotMenu(tr("Add trail dot every.."), this);
for
(
int
i
=
0
;
i
<
uavTrailTimeCount
;
++
i
)
{
trailPlotMenu
.
addAction
(
QString
(
"%1 second%2"
).
arg
(
uavTrailTimeList
[
i
]).
arg
((
uavTrailTimeList
[
i
]
>
1
)
?
"s"
:
""
),
this
,
SLOT
(
setUAVTrailTime
()));
}
for
(
int
i
=
0
;
i
<
uavTrailDistanceCount
;
++
i
)
{
trailPlotMenu
.
addAction
(
QString
(
"%1 meter%2"
).
arg
(
uavTrailDistanceList
[
i
]).
arg
((
uavTrailDistanceList
[
i
]
>
1
)
?
"s"
:
""
),
this
,
SLOT
(
setUAVTrailDistance
()));
}
optionsMenu
.
addMenu
(
&
trailPlotMenu
);
ui
->
optionsButton
->
setMenu
(
&
optionsMenu
);
}
}
}
}
void
QGCMapToolBar
::
setUAVTrailTime
()
{
}
void
QGCMapToolBar
::
setUAVTrailDistance
()
{
}
void
QGCMapToolBar
::
tileLoadStart
()
void
QGCMapToolBar
::
tileLoadStart
()
{
{
ui
->
posLabel
->
setText
(
QString
(
"Starting to load tiles.."
));
ui
->
posLabel
->
setText
(
QString
(
"Starting to load tiles.."
));
...
...
src/ui/map/QGCMapToolBar.h
View file @
361ac1d7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define QGCMAPTOOLBAR_H
#define QGCMAPTOOLBAR_H
#include <QWidget>
#include <QWidget>
#include <QMenu>
class
QGCMapWidget
;
class
QGCMapWidget
;
...
@@ -23,9 +24,13 @@ public slots:
...
@@ -23,9 +24,13 @@ public slots:
void
tileLoadStart
();
void
tileLoadStart
();
void
tileLoadEnd
();
void
tileLoadEnd
();
void
tileLoadProgress
(
int
progress
);
void
tileLoadProgress
(
int
progress
);
void
setUAVTrailTime
();
void
setUAVTrailDistance
();
protected:
protected:
QGCMapWidget
*
map
;
QGCMapWidget
*
map
;
QMenu
optionsMenu
;
QMenu
trailPlotMenu
;
private:
private:
Ui
::
QGCMapToolBar
*
ui
;
Ui
::
QGCMapToolBar
*
ui
;
...
...
src/ui/map/QGCMapToolBar.ui
View file @
361ac1d7
...
@@ -69,6 +69,13 @@
...
@@ -69,6 +69,13 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item>
<widget
class=
"QPushButton"
name=
"optionsButton"
>
<property
name=
"text"
>
<string>
Options
</string>
</property>
</widget>
</item>
<item>
<item>
<spacer
name=
"horizontalSpacer"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
...
...
src/ui/map/QGCMapWidget.cc
View file @
361ac1d7
...
@@ -60,12 +60,6 @@ void QGCMapWidget::showEvent(QShowEvent* event)
...
@@ -60,12 +60,6 @@ void QGCMapWidget::showEvent(QShowEvent* event)
// magic_waypoint.time_seconds = 0;
// magic_waypoint.time_seconds = 0;
// magic_waypoint.hold_time_seconds = 0;
// magic_waypoint.hold_time_seconds = 0;
const
int
safe_area_radius_list
[]
=
{
5
,
10
,
20
,
50
,
100
,
200
,
500
,
1000
,
2000
,
5000
};
// meters
const
int
uav_trail_time_list
[]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
};
// seconds
const
int
uav_trail_distance_list
[]
=
{
1
,
2
,
5
,
10
,
20
,
50
,
100
,
200
,
500
};
// meters
SetMouseWheelZoomType
(
internals
::
MouseWheelZoomType
::
MousePositionWithoutCenter
);
// set how the mouse wheel zoom functions
SetMouseWheelZoomType
(
internals
::
MouseWheelZoomType
::
MousePositionWithoutCenter
);
// set how the mouse wheel zoom functions
SetFollowMouse
(
true
);
// we want a contiuous mouse position reading
SetFollowMouse
(
true
);
// we want a contiuous mouse position reading
...
@@ -74,7 +68,7 @@ void QGCMapWidget::showEvent(QShowEvent* event)
...
@@ -74,7 +68,7 @@ void QGCMapWidget::showEvent(QShowEvent* event)
//SetShowDiagnostics(true); // Not needed in flight / production mode
//SetShowDiagnostics(true); // Not needed in flight / production mode
Home
->
SetSafeArea
(
safe_area_radius_list
[
0
]
);
// set radius (meters)
Home
->
SetSafeArea
(
30
);
// set radius (meters)
Home
->
SetShowSafeArea
(
true
);
// show the safe area
Home
->
SetShowSafeArea
(
true
);
// show the safe area
//// UAV->SetTrailTime(uav_trail_time_list[0]); // seconds
//// UAV->SetTrailTime(uav_trail_time_list[0]); // seconds
...
...
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