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
d5f038d7
Commit
d5f038d7
authored
Jan 22, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed last nasty wp management bugs, now first time 2D map is fully synced with WPManager
parent
75a1db30
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
24 deletions
+60
-24
geometry.h
lib/QMapControl/src/geometry.h
+1
-1
linestring.cpp
lib/QMapControl/src/linestring.cpp
+6
-1
linestring.h
lib/QMapControl/src/linestring.h
+4
-1
point.cpp
lib/QMapControl/src/point.cpp
+4
-5
point.h
lib/QMapControl/src/point.h
+2
-1
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+1
-0
MapWidget.cc
src/ui/MapWidget.cc
+35
-15
MapWidget.h
src/ui/MapWidget.h
+1
-0
WaypointView.ui
src/ui/WaypointView.ui
+6
-0
No files found.
lib/QMapControl/src/geometry.h
View file @
d5f038d7
...
...
@@ -119,7 +119,7 @@ namespace qmapcontrol
virtual
bool
hasClickedPoints
()
const
;
virtual
void
setPen
(
QPen
*
pen
);
virtual
QList
<
Geometry
*>
clickedPoints
();
virtual
QList
<
Point
*>
points
()
=
0
;
virtual
QList
<
Point
*>
&
points
()
=
0
;
private:
Geometry
*
myparentGeometry
;
...
...
lib/QMapControl/src/linestring.cpp
View file @
d5f038d7
...
...
@@ -56,7 +56,12 @@ namespace qmapcontrol
vertices
.
append
(
point
);
}
QList
<
Point
*>
LineString
::
points
()
void
LineString
::
clearPoints
()
{
vertices
.
clear
();
}
QList
<
Point
*>&
LineString
::
points
()
{
return
vertices
;
}
...
...
lib/QMapControl/src/linestring.h
View file @
d5f038d7
...
...
@@ -56,7 +56,7 @@ namespace qmapcontrol
/*!
* @return a list with the points of the LineString
*/
QList
<
Point
*>
points
();
QList
<
Point
*>
&
points
();
//! adds a point at the end of the LineString
/*!
...
...
@@ -64,6 +64,9 @@ namespace qmapcontrol
*/
void
addPoint
(
Point
*
point
);
//! Remove all points from the LineString
void
clearPoints
();
//! sets the given list as points of the LineString
/*!
* @param points the points which should be set for the LineString
...
...
lib/QMapControl/src/point.cpp
View file @
d5f038d7
...
...
@@ -293,12 +293,11 @@ namespace qmapcontrol
emit
(
positionChanged
(
this
));
}
QList
<
Point
*>
Point
::
points
()
QList
<
Point
*>
&
Point
::
points
()
{
//TODO: assigning temp?!
QList
<
Point
*>
points
;
points
.
append
(
this
);
return
points
;
// FIXME TODO: THIS IS ABSOLUTELY WRONG IN THE ORIGINAL LIBRARY
// NEEDS AN INHERITANCE REWRITE!!!!
return
m_points
;
}
QWidget
*
Point
::
widget
()
...
...
lib/QMapControl/src/point.h
View file @
d5f038d7
...
...
@@ -139,7 +139,7 @@ namespace qmapcontrol
*/
QPointF
coordinate
()
const
;
virtual
QList
<
Point
*>
points
();
virtual
QList
<
Point
*>
&
points
();
/*! \brief returns the widget of the point
@return the widget of the point
...
...
@@ -191,6 +191,7 @@ namespace qmapcontrol
QSize
displaysize
;
QSize
minsize
;
QSize
maxsize
;
QList
<
Point
*>
m_points
;
void
drawWidget
(
const
MapAdapter
*
mapadapter
,
const
QPoint
offset
);
...
...
src/uas/UASWaypointManager.cc
View file @
d5f038d7
...
...
@@ -267,6 +267,7 @@ void UASWaypointManager::handleWaypointCurrent(quint8 systemId, quint8 compId, m
void
UASWaypointManager
::
notifyOfChange
(
Waypoint
*
wp
)
{
qDebug
()
<<
"WAYPOINT CHANGED: ID:"
<<
wp
->
getId
();
// If only one waypoint was changed, emit only WP signal
if
(
wp
!=
NULL
)
{
...
...
src/ui/MapWidget.cc
View file @
d5f038d7
...
...
@@ -417,6 +417,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
{
str
=
QString
(
"%1"
).
arg
(
waypointPath
->
numberOfPoints
());
tempCirclePoint
=
new
Waypoint2DIcon
(
coordinate
.
x
(),
coordinate
.
y
(),
20
,
str
,
qmapcontrol
::
Point
::
Middle
);
wpIcons
.
append
(
tempCirclePoint
);
mc
->
layer
(
"Waypoints"
)
->
addGeometry
(
tempCirclePoint
);
...
...
@@ -435,7 +436,12 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
void
MapWidget
::
updateWaypoint
(
int
uas
,
Waypoint
*
wp
)
{
//qDebug() << "UPDATING WP" << wp->getId() << __FILE__ << __LINE__;
updateWaypoint
(
uas
,
wp
,
true
);
}
void
MapWidget
::
updateWaypoint
(
int
uas
,
Waypoint
*
wp
,
bool
updateView
)
{
qDebug
()
<<
"UPDATING WP"
<<
wp
->
getId
()
<<
wp
<<
__FILE__
<<
__LINE__
;
if
(
uas
==
this
->
mav
->
getUASID
())
{
int
wpindex
=
UASManager
::
instance
()
->
getUASForId
(
uas
)
->
getWaypointManager
()
->
getIndexOf
(
wp
);
...
...
@@ -448,8 +454,6 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
coordinate
.
setX
(
wp
->
getX
());
coordinate
.
setY
(
wp
->
getY
());
createWaypointGraphAtMap
(
wpindex
,
coordinate
);
qDebug
()
<<
"Waypoint Index did not contain"
<<
str
;
}
else
{
...
...
@@ -478,6 +482,10 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
{
linesegment
=
waypointPath
->
points
().
at
(
wpindex
);
}
else
{
waypointPath
->
addPoint
(
waypoint
);
}
if
(
linesegment
)
{
...
...
@@ -486,7 +494,7 @@ void MapWidget::updateWaypoint(int uas, Waypoint* wp)
//point2Find = dynamic_cast <Point*> (mc->layer("Waypoints")->get_Geometry(wpindex));
//point2Find->setCoordinate(coordinate);
mc
->
updateRequest
(
waypoint
->
boundingBox
().
toRect
());
if
(
updateView
)
mc
->
updateRequest
(
waypoint
->
boundingBox
().
toRect
());
}
}
}
...
...
@@ -642,6 +650,9 @@ void MapWidget::updateWaypointList(int uas)
UASInterface
*
uasInstance
=
UASManager
::
instance
()
->
getUASForId
(
uas
);
if
(
uasInstance
)
{
// Get update rect of old content
QRect
updateRect
=
waypointPath
->
boundingBox
().
toRect
();
QVector
<
Waypoint
*>
wpList
=
uasInstance
->
getWaypointManager
()
->
getWaypointList
();
// Clear if necessary
...
...
@@ -654,28 +665,26 @@ void MapWidget::updateWaypointList(int uas)
// Load all existing waypoints into map view
foreach
(
Waypoint
*
wp
,
wpList
)
{
updateWaypoint
(
mav
->
getUASID
(),
wp
);
// Block updates, since we update everything in the next step
updateWaypoint
(
mav
->
getUASID
(),
wp
,
false
);
}
// Delete now unused wps
if
(
wps
.
count
()
>
wpList
.
count
())
{
mc
->
layer
(
"Waypoints"
)
->
removeGeometry
(
waypointPath
);
for
(
int
i
=
wpList
.
count
();
i
<
wps
.
count
();
++
i
)
{
QRect
updateRect
=
wps
.
at
(
i
)
->
boundingBox
().
toRect
();
wps
.
removeAt
(
i
);
mc
->
layer
(
"Waypoints"
)
->
removeGeometry
(
wpIcons
.
at
(
i
));
waypointPath
->
points
().
removeAt
(
i
);
//Point* linesegment = waypointPath->points().at(mav->getWaypointManager()->getWaypointList().indexOf(wp));
mc
->
updateRequest
(
updateRect
);
}
mc
->
layer
(
"Waypoints"
)
->
addGeometry
(
waypointPath
);
}
//
Clear and rebuild linestring
//
Update view
mc
->
updateRequest
(
updateRect
);
}
}
...
...
@@ -703,7 +712,7 @@ void MapWidget::activeUASSet(UASInterface* uas)
{
// Disconnect the waypoint manager / data storage from the UI
disconnect
(
mav
->
getWaypointManager
(),
SIGNAL
(
waypointListChanged
(
int
)),
this
,
SLOT
(
updateWaypointList
(
int
)));
disconnect
(
mav
->
getWaypointManager
(),
SIGNAL
(
waypoint
Updat
ed
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
disconnect
(
mav
->
getWaypointManager
(),
SIGNAL
(
waypoint
Chang
ed
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
disconnect
(
this
,
SIGNAL
(
waypointCreated
(
Waypoint
*
)),
mav
->
getWaypointManager
(),
SLOT
(
addWaypoint
(
Waypoint
*
)));
}
...
...
@@ -723,7 +732,7 @@ void MapWidget::activeUASSet(UASInterface* uas)
// Connect the waypoint manager / data storage to the UI
connect
(
mav
->
getWaypointManager
(),
SIGNAL
(
waypointListChanged
(
int
)),
this
,
SLOT
(
updateWaypointList
(
int
)));
connect
(
mav
->
getWaypointManager
(),
SIGNAL
(
waypoint
Updat
ed
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
connect
(
mav
->
getWaypointManager
(),
SIGNAL
(
waypoint
Chang
ed
(
int
,
Waypoint
*
)),
this
,
SLOT
(
updateWaypoint
(
int
,
Waypoint
*
)));
connect
(
this
,
SIGNAL
(
waypointCreated
(
Waypoint
*
)),
mav
->
getWaypointManager
(),
SLOT
(
addWaypoint
(
Waypoint
*
)));
}
}
...
...
@@ -925,12 +934,23 @@ void MapWidget::clearWaypoints(int uas)
//mc->layer("Waypoints")->clearGeometries();
wps
.
clear
();
foreach
(
Point
*
p
,
wpIcons
)
{
mc
->
layer
(
"Waypoints"
)
->
removeGeometry
(
p
);
}
wpIcons
.
clear
();
// Get bounding box of this object BEFORE deleting the content
QRect
box
=
waypointPath
->
boundingBox
().
toRect
();
// Delete the content
waypointPath
->
points
().
clear
();
//delete waypointPath;
//waypointPath = new
mc
->
layer
(
"Waypoints"
)
->
addGeometry
(
waypointPath
);
//
mc->layer("Waypoints")->addGeometry(waypointPath);
//wpIndex.clear();
mc
->
updateRequest
New
(
);
//(waypointPath->boundingBox().toRect());
mc
->
updateRequest
(
box
);
//(waypointPath->boundingBox().toRect());
if
(
createPath
->
isChecked
())
{
...
...
src/ui/MapWidget.h
View file @
d5f038d7
...
...
@@ -87,6 +87,7 @@ public slots:
/** @brief Update waypoint */
void
updateWaypoint
(
int
uas
,
Waypoint
*
wp
);
void
updateWaypoint
(
int
uas
,
Waypoint
*
wp
,
bool
updateView
);
void
drawBorderCamAtMap
(
bool
status
);
/** @brief Bring up dialog to go to a specific location */
...
...
src/ui/WaypointView.ui
View file @
d5f038d7
...
...
@@ -336,6 +336,9 @@ QProgressBar::chunk#thrustBar {
<property
name=
"maximum"
>
<double>
90.000000000000000
</double>
</property>
<property
name=
"singleStep"
>
<double>
0.000010000000000
</double>
</property>
</widget>
</item>
<item>
...
...
@@ -361,6 +364,9 @@ QProgressBar::chunk#thrustBar {
<property
name=
"maximum"
>
<double>
180.000000000000000
</double>
</property>
<property
name=
"singleStep"
>
<double>
0.000010000000000
</double>
</property>
</widget>
</item>
<item>
...
...
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