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
f0622847
Commit
f0622847
authored
Jul 16, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up MAV icon, made it easier to spot non-selected MAVs on map
parent
68dcf5be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
52 deletions
+21
-52
MAV2DIcon.cc
src/ui/map/MAV2DIcon.cc
+18
-37
MAV2DIcon.h
src/ui/map/MAV2DIcon.h
+3
-15
No files found.
src/ui/map/MAV2DIcon.cc
View file @
f0622847
...
...
@@ -15,31 +15,24 @@ MAV2DIcon::MAV2DIcon(mapcontrol::MapGraphicItem* map,mapcontrol::OPMapWidget* pa
selected
(
uas
->
getSelected
()),
uasid
(
uas
->
getUASID
())
{
//connect
size
=
QSize
(
radius
,
radius
);
mypen
=
new
QPen
(
uas
->
getColor
()
);
drawIcon
(
mypen
);
pic
=
QPixmap
(
size
);
drawIcon
();
}
MAV2DIcon
::
MAV2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
qreal
lat
,
qreal
lon
,
qreal
alt
,
Q
Pen
*
pen
)
MAV2DIcon
::
MAV2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
qreal
lat
,
qreal
lon
,
qreal
alt
,
Q
Color
color
)
:
UAVItem
(
map
,
parent
),
radius
(
20
),
type
(
0
),
airframe
(
0
),
iconColor
(
Qt
::
yellow
),
iconColor
(
color
),
selected
(
false
),
uasid
(
0
)
{
if
(
pen
==
NULL
)
{
mypen
=
new
QPen
(
Qt
::
red
);
drawIcon
(
mypen
);
}
else
{
drawIcon
(
pen
);
}
size
=
QSize
(
radius
,
radius
);
pic
=
QPixmap
(
size
);
drawIcon
();
SetUAVPos
(
internals
::
PointLatLng
(
lat
,
lon
),
alt
,
color
);
}
MAV2DIcon
::~
MAV2DIcon
()
...
...
@@ -47,19 +40,10 @@ MAV2DIcon::~MAV2DIcon()
//delete pic;
}
void
MAV2DIcon
::
setPen
(
QPen
*
pen
)
{
if
(
pen
!=
NULL
)
{
mypen
=
pen
;
drawIcon
(
pen
);
}
}
void
MAV2DIcon
::
setSelectedUAS
(
bool
selected
)
{
this
->
selected
=
selected
;
drawIcon
(
mypen
);
drawIcon
();
}
/**
...
...
@@ -77,14 +61,13 @@ void MAV2DIcon::setYaw(float yaw)
if
(
diff
>
0.1
f
)
{
this
->
yaw
=
yaw
;
drawIcon
(
mypen
);
drawIcon
();
// FIXME
}
}
void
MAV2DIcon
::
drawIcon
(
QPen
*
pen
)
void
MAV2DIcon
::
drawIcon
()
{
Q_UNUSED
(
pen
);
pic
.
fill
(
Qt
::
transparent
);
QPainter
painter
(
&
pic
);
painter
.
setRenderHint
(
QPainter
::
TextAntialiasing
);
...
...
@@ -97,21 +80,19 @@ void MAV2DIcon::drawIcon(QPen* pen)
painter
.
translate
(
radius
/
2
,
radius
/
2
);
// Draw selected indicator
painter
.
setBrush
(
Qt
::
NoBrush
);
if
(
selected
)
{
// qDebug() << "SYSTEM IS NOW SELECTED";
// QColor color(Qt::yellow);
// color.setAlpha(0.3f);
painter
.
setBrush
(
Qt
::
NoBrush
);
// QPen selPen(color);
// int width = 5;
// selPen.setWidth(width);
QPen
pen
(
Qt
::
yellow
);
pen
.
setWidth
(
2
);
painter
.
setPen
(
pen
);
painter
.
drawEllipse
(
QPoint
(
0
,
0
),
radius
/
2
-
1
,
radius
/
2
-
1
);
//qDebug() << "Painting ellipse" << radius/2-width << width;
//selPen->deleteLater();
}
else
{
QPen
pen
(
Qt
::
white
);
pen
.
setWidth
(
1
);
painter
.
setPen
(
pen
);
}
painter
.
drawEllipse
(
QPoint
(
0
,
0
),
radius
/
2
-
1
,
radius
/
2
-
1
);
drawAirframePolygon
(
airframe
,
painter
,
radius
,
iconColor
,
yaw
);
}
...
...
src/ui/map/MAV2DIcon.h
View file @
f0622847
...
...
@@ -27,7 +27,7 @@ public:
* @param alignment alignment (Middle or TopLeft)
* @param pen QPen for drawing
*/
MAV2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
UASInterface
*
uas
,
int
radius
=
1
0
,
int
type
=
0
);
MAV2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
UASInterface
*
uas
,
int
radius
=
4
0
,
int
type
=
0
);
/*!
*
...
...
@@ -37,18 +37,10 @@ public:
* @param alignment alignment (Middle or TopLeft)
* @param pen QPen for drawing
*/
MAV2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
qreal
lat
=
0
,
qreal
lon
=
0
,
qreal
alt
=
0
,
Q
Pen
*
pen
=
0
);
MAV2DIcon
(
mapcontrol
::
MapGraphicItem
*
map
,
mapcontrol
::
OPMapWidget
*
parent
,
qreal
lat
=
0
,
qreal
lon
=
0
,
qreal
alt
=
0
,
Q
Color
color
=
QColor
()
);
virtual
~
MAV2DIcon
();
//! sets the QPen which is used for drawing the circle
/*!
* A QPen can be used to modify the look of the drawn circle
* @param pen the QPen which should be used for drawing
* @see http://doc.trolltech.com/4.3/qpen.html
*/
virtual
void
setPen
(
QPen
*
pen
);
/** @brief Mark this system as selected */
void
setSelectedUAS
(
bool
selected
);
void
setYaw
(
float
yaw
);
...
...
@@ -62,10 +54,7 @@ public:
return
uasid
;
}
void
drawIcon
(
QPen
*
pen
);
void
drawIcon
()
{
drawIcon
(
mypen
);
}
void
drawIcon
();
static
void
drawAirframePolygon
(
int
airframe
,
QPainter
&
painter
,
int
radius
,
QColor
&
iconColor
,
float
yaw
);
protected:
...
...
@@ -76,7 +65,6 @@ protected:
QColor
iconColor
;
///< Color to be used for the icon
bool
selected
;
///< Wether this is the system currently in focus
int
uasid
;
///< ID of tracked system
QPen
*
mypen
;
QSize
size
;
};
...
...
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