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
5f497743
Commit
5f497743
authored
Jan 11, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed low-altitude google maps support, reconfigured map widget to maximize map visibility
parent
de439a7c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
111 additions
and
31 deletions
+111
-31
googlesatmapadapter.cpp
lib/QMapControl/src/googlesatmapadapter.cpp
+1
-1
mapcontrol.cpp
lib/QMapControl/src/mapcontrol.cpp
+14
-3
mapcontrol.h
lib/QMapControl/src/mapcontrol.h
+8
-0
mapnetwork.cpp
lib/QMapControl/src/mapnetwork.cpp
+2
-0
HUD.cc
src/ui/HUD.cc
+1
-1
MainWindow.ui
src/ui/MainWindow.ui
+18
-5
MapWidget.cc
src/ui/MapWidget.cc
+58
-12
MapWidget.h
src/ui/MapWidget.h
+2
-0
QGCParamSlider.cc
src/ui/designer/QGCParamSlider.cc
+7
-9
No files found.
lib/QMapControl/src/googlesatmapadapter.cpp
View file @
5f497743
...
...
@@ -29,7 +29,7 @@
namespace
qmapcontrol
{
GoogleSatMapAdapter
::
GoogleSatMapAdapter
()
:
TileMapAdapter
(
"khm.google.com"
,
"/kh?v=51&x=%2&s=&y=%3&z=%1"
,
256
,
0
,
18
)
:
TileMapAdapter
(
"khm.google.com"
,
"/kh?v=51&x=%2&s=&y=%3&z=%1"
,
256
,
9
,
21
)
{
// // name = "googlesat";
//
...
...
lib/QMapControl/src/mapcontrol.cpp
View file @
5f497743
...
...
@@ -27,7 +27,7 @@
namespace
qmapcontrol
{
MapControl
::
MapControl
(
QSize
size
,
MouseMode
mousemode
)
:
size
(
size
),
mymousemode
(
mousemode
),
scaleVisible
(
false
),
cursorPosVisible
(
false
)
:
size
(
size
),
mymousemode
(
mousemode
),
scaleVisible
(
false
),
cursorPosVisible
(
false
)
,
mapPen
(
Qt
::
black
)
{
layermanager
=
new
LayerManager
(
this
,
size
);
screen_middle
=
QPoint
(
size
.
width
()
/
2
,
size
.
height
()
/
2
);
...
...
@@ -126,6 +126,11 @@ namespace qmapcontrol
}
}
void
MapControl
::
setPen
(
QPen
pen
)
{
this
->
mapPen
=
pen
;
}
void
MapControl
::
paintEvent
(
QPaintEvent
*
evnt
)
{
QWidget
::
paintEvent
(
evnt
);
...
...
@@ -160,7 +165,7 @@ namespace qmapcontrol
line
=
distanceList
.
at
(
currentZoom
()
)
/
pow
(
2.0
,
18
-
currentZoom
()
)
/
0.597164
;
// draw the scale
painter
.
setPen
(
Qt
::
black
);
painter
.
setPen
(
mapPen
);
QPoint
p1
(
10
,
size
.
height
()
-
20
);
QPoint
p2
((
int
)
line
,
size
.
height
()
-
20
);
painter
.
drawLine
(
p1
,
p2
);
...
...
@@ -209,7 +214,10 @@ namespace qmapcontrol
// Draw the Lat and Lon if needed
if
(
cursorPosVisible
)
{
// FIXME Mariano
if
(
cursorPosVisible
&&
currentZoom
()
<
19
)
{
line
=
distanceList
.
at
(
currentZoom
()
)
/
pow
(
2.0
,
18
-
currentZoom
()
)
/
0.597164
;
QString
str
;
...
...
@@ -336,6 +344,9 @@ namespace qmapcontrol
void
MapControl
::
setZoom
(
int
zoomlevel
)
{
layermanager
->
setZoom
(
zoomlevel
);
qDebug
()
<<
"MAPCONTROL: Set zoomlevel to:"
<<
zoomlevel
<<
"at "
<<
__FILE__
<<
__LINE__
;
update
();
}
int
MapControl
::
currentZoom
()
const
...
...
lib/QMapControl/src/mapcontrol.h
View file @
5f497743
...
...
@@ -222,6 +222,13 @@ namespace qmapcontrol
*/
void
showCoord
(
bool
show
);
//! Set the pen for overlay text
/*!
*
* @param pen The new QPen
*/
void
setPen
(
QPen
pen
);
private:
LayerManager
*
layermanager
;
QPoint
screen_middle
;
// middle of the widget (half size)
...
...
@@ -239,6 +246,7 @@ namespace qmapcontrol
MouseMode
mymousemode
;
bool
scaleVisible
;
bool
cursorPosVisible
;
QPen
mapPen
;
bool
m_loadingFlag
;
...
...
lib/QMapControl/src/mapnetwork.cpp
View file @
5f497743
...
...
@@ -98,6 +98,8 @@ namespace qmapcontrol
// QGC FIXME Error is currently undetected
// TODO Error is currently undetected
//qDebug() << "NETWORK_PIXMAP_ERROR: " << ax;
qDebug
()
<<
"QMapControl external library: ERROR loading map:"
<<
"width:"
<<
pm
.
width
()
<<
"heigh:"
<<
pm
.
height
()
<<
"at "
<<
__FILE__
<<
__LINE__
;
qDebug
()
<<
"HTML ERROR MESSAGE:"
<<
ax
<<
"at "
<<
__FILE__
<<
__LINE__
;
}
}
...
...
src/ui/HUD.cc
View file @
5f497743
...
...
@@ -194,7 +194,7 @@ HUD::~HUD()
QSize
HUD
::
sizeHint
()
const
{
return
QSize
(
800
,
600
);
return
QSize
(
width
(),
(
width
()
*
3.0
f
)
/
4
);
}
void
HUD
::
showEvent
(
QShowEvent
*
event
)
...
...
src/ui/MainWindow.ui
View file @
5f497743
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
10
00
</width>
<height>
8
00
</height>
<width>
8
00
</width>
<height>
5
00
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
...
...
@@ -31,14 +31,27 @@
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
</property>
<widget
class=
"QWidget"
name=
"centralWidget"
/>
<widget
class=
"QWidget"
name=
"centralWidget"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"MinimumExpanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
200
</width>
<height>
150
</height>
</size>
</property>
</widget>
<widget
class=
"QMenuBar"
name=
"menuBar"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
10
00
</width>
<height>
2
2
</height>
<width>
8
00
</width>
<height>
2
5
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menuMGround"
>
...
...
src/ui/MapWidget.cc
View file @
5f497743
...
...
@@ -14,6 +14,7 @@
#include <QGridLayout>
#include <QDir>
#include "QGC.h"
#include "MapWidget.h"
#include "ui_MapWidget.h"
#include "UASInterface.h"
...
...
@@ -34,6 +35,19 @@ MapWidget::MapWidget(QWidget *parent) :
m_ui
(
new
Ui
::
MapWidget
)
{
m_ui
->
setupUi
(
this
);
mc
=
new
qmapcontrol
::
MapControl
(
QSize
(
320
,
240
));
// VISUAL MAP STYLE
QString
buttonStyle
(
"QAbstractButton { background-color: rgba(20, 20, 20, 45%); border-color: rgba(10, 10, 10, 50%)}"
);
mc
->
setPen
(
QGC
::
colorCyan
.
darker
(
400
));
waypointIsDrag
=
false
;
...
...
@@ -41,7 +55,7 @@ MapWidget::MapWidget(QWidget *parent) :
this
->
setFocusPolicy
(
Qt
::
StrongFocus
);
// create MapControl
mc
=
new
qmapcontrol
::
MapControl
(
QSize
(
320
,
240
));
mc
->
showScale
(
true
);
mc
->
showCoord
(
true
);
mc
->
enablePersistentCache
();
...
...
@@ -126,32 +140,35 @@ MapWidget::MapWidget(QWidget *parent) :
mapButton
=
new
QPushButton
(
this
);
mapButton
->
setText
(
"Map Source"
);
mapButton
->
setMenu
(
mapMenu
);
mapButton
->
setStyleSheet
(
buttonStyle
);
// display the MapControl in the application
QGridLayout
*
layout
=
new
QGridLayout
(
this
);
layout
->
setMargin
(
0
);
layout
->
setSpacing
(
2
);
layout
->
addWidget
(
mc
,
0
,
0
,
1
,
2
);
layout
->
addWidget
(
mapButton
,
1
,
0
);
layout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
1
,
1
);
layout
->
setRowStretch
(
0
,
100
);
layout
->
setRowStretch
(
1
,
1
);
layout
->
setColumnStretch
(
0
,
1
);
layout
->
setColumnStretch
(
1
,
50
);
layout
->
setSpacing
(
0
);
layout
->
addWidget
(
mc
,
0
,
0
);
setLayout
(
layout
);
// create buttons to control the map (zoom, GPS tracking and WP capture)
QPushButton
*
zoomin
=
new
QPushButton
(
QIcon
(
":/images/actions/list-add.svg"
),
""
,
this
);
zoomin
->
setStyleSheet
(
buttonStyle
);
QPushButton
*
zoomout
=
new
QPushButton
(
QIcon
(
":/images/actions/list-remove.svg"
),
""
,
this
);
zoomout
->
setStyleSheet
(
buttonStyle
);
createPath
=
new
QPushButton
(
QIcon
(
":/images/actions/go-bottom.svg"
),
""
,
this
);
createPath
->
setStyleSheet
(
buttonStyle
);
clearTracking
=
new
QPushButton
(
QIcon
(
""
),
""
,
this
);
clearTracking
->
setStyleSheet
(
buttonStyle
);
followgps
=
new
QPushButton
(
QIcon
(
":/images/actions/system-lock-screen.svg"
),
""
,
this
);
followgps
->
setStyleSheet
(
buttonStyle
);
QPushButton
*
goToButton
=
new
QPushButton
(
QIcon
(
""
),
"T"
,
this
);
goToButton
->
setStyleSheet
(
buttonStyle
);
zoomin
->
setMaximumWidth
(
30
);
zoomout
->
setMaximumWidth
(
30
);
createPath
->
setMaximumWidth
(
30
);
clearTracking
->
setMaximumWidth
(
30
);
followgps
->
setMaximumWidth
(
30
);
goToButton
->
setMaximumWidth
(
30
);
// Set checkable buttons
// TODO: Currently checked buttons are are very difficult to distinguish when checked.
...
...
@@ -161,8 +178,8 @@ MapWidget::MapWidget(QWidget *parent) :
// add buttons to control the map (zoom, GPS tracking and WP capture)
QGridLayout
*
innerlayout
=
new
QGridLayout
(
mc
);
innerlayout
->
setMargin
(
5
);
innerlayout
->
setSpacing
(
5
);
innerlayout
->
setMargin
(
3
);
innerlayout
->
setSpacing
(
3
);
innerlayout
->
addWidget
(
zoomin
,
0
,
0
);
innerlayout
->
addWidget
(
zoomout
,
1
,
0
);
innerlayout
->
addWidget
(
followgps
,
2
,
0
);
...
...
@@ -170,7 +187,9 @@ MapWidget::MapWidget(QWidget *parent) :
innerlayout
->
addWidget
(
clearTracking
,
4
,
0
);
// Add spacers to compress buttons on the top left
innerlayout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
5
,
0
);
innerlayout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
0
,
1
,
0
,
6
);
innerlayout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
0
,
1
,
0
,
7
);
innerlayout
->
addWidget
(
mapButton
,
0
,
6
);
innerlayout
->
addWidget
(
goToButton
,
0
,
7
);
innerlayout
->
setRowStretch
(
0
,
1
);
innerlayout
->
setRowStretch
(
1
,
100
);
mc
->
setLayout
(
innerlayout
);
...
...
@@ -183,6 +202,8 @@ MapWidget::MapWidget(QWidget *parent) :
connect
(
zoomout
,
SIGNAL
(
clicked
(
bool
)),
mc
,
SLOT
(
zoomOut
()));
connect
(
goToButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
goTo
()));
QList
<
UASInterface
*>
systems
=
UASManager
::
instance
()
->
getUASList
();
foreach
(
UASInterface
*
system
,
systems
)
{
...
...
@@ -229,6 +250,31 @@ MapWidget::MapWidget(QWidget *parent) :
radioCamera
=
10
;
}
void
MapWidget
::
goTo
()
{
bool
ok
;
QString
text
=
QInputDialog
::
getText
(
this
,
tr
(
"Please enter coordinates"
),
tr
(
"Coordinates (Lat,Lon):"
),
QLineEdit
::
Normal
,
QString
(
"%1,%2"
).
arg
(
mc
->
currentCoordinate
().
x
()).
arg
(
mc
->
currentCoordinate
().
y
()),
&
ok
);
if
(
ok
&&
!
text
.
isEmpty
())
{
QStringList
split
=
text
.
split
(
","
);
if
(
split
.
length
()
==
2
)
{
bool
convert
;
double
latitude
=
split
.
first
().
toDouble
(
&
convert
);
ok
&=
convert
;
double
longitude
=
split
.
last
().
toDouble
(
&
convert
);
ok
&=
convert
;
if
(
ok
)
{
mc
->
setView
(
QPointF
(
latitude
,
longitude
));
}
}
}
}
void
MapWidget
::
mapproviderSelected
(
QAction
*
action
)
{
...
...
src/ui/MapWidget.h
View file @
5f497743
...
...
@@ -77,6 +77,8 @@ public slots:
void
clearPath
();
void
changeGlobalWaypointPositionBySpinBox
(
int
index
,
float
lat
,
float
lon
);
void
drawBorderCamAtMap
(
bool
status
);
/** @brief Bring up dialog to go to a specific location */
void
goTo
();
protected:
void
changeEvent
(
QEvent
*
e
);
...
...
src/ui/designer/QGCParamSlider.cc
View file @
5f497743
...
...
@@ -22,7 +22,7 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) :
ui
->
editDoneButton
->
show
();
ui
->
editMaxLabel
->
show
();
ui
->
editMinLabel
->
show
();
ui
->
editNameL
ineEdit
->
show
();
ui
->
editNameL
abel
->
show
();
ui
->
editInstructionsLabel
->
show
();
ui
->
editRefreshParamsButton
->
show
();
ui
->
editSelectParamComboBox
->
show
();
...
...
@@ -30,7 +30,6 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) :
ui
->
editStatusLabel
->
show
();
ui
->
editMinSpinBox
->
show
();
ui
->
editMaxSpinBox
->
show
();
ui
->
editTypeComboBox
->
show
();
connect
(
ui
->
editDoneButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
endEditMode
()));
}
...
...
@@ -44,7 +43,7 @@ void QGCParamSlider::startEditMode()
ui
->
editDoneButton
->
show
();
ui
->
editMaxLabel
->
show
();
ui
->
editMinLabel
->
show
();
ui
->
editNameL
ineEdit
->
show
();
ui
->
editNameL
abel
->
show
();
ui
->
editInstructionsLabel
->
show
();
ui
->
editRefreshParamsButton
->
show
();
ui
->
editSelectParamComboBox
->
show
();
...
...
@@ -60,7 +59,7 @@ void QGCParamSlider::endEditMode()
ui
->
editDoneButton
->
hide
();
ui
->
editMaxLabel
->
hide
();
ui
->
editMinLabel
->
hide
();
ui
->
editNameL
ineEdit
->
hide
();
ui
->
editNameL
abel
->
hide
();
ui
->
editInstructionsLabel
->
hide
();
ui
->
editRefreshParamsButton
->
hide
();
ui
->
editSelectParamComboBox
->
hide
();
...
...
@@ -68,7 +67,6 @@ void QGCParamSlider::endEditMode()
ui
->
editStatusLabel
->
hide
();
ui
->
editMinSpinBox
->
hide
();
ui
->
editMaxSpinBox
->
hide
();
ui
->
editTypeComboBox
->
hide
();
isInEditMode
=
false
;
emit
editingFinished
();
}
...
...
@@ -138,9 +136,9 @@ void QGCParamSlider::readSettings(const QSettings& settings)
{
ui
->
nameLabel
->
setText
(
settings
.
value
(
"QGC_PARAM_SLIDER_DESCRIPTION"
).
toString
());
//settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
ui
->
editSelectParamComboBox
->
set
Curren
tText
(
settings
.
value
(
"QGC_PARAM_SLIDER_PARAMID"
).
toString
());
ui
->
editSelectComponent
sComboBox
->
setCurren
tText
(
settings
.
value
(
"QGC_PARAM_SLIDER_COMPONENTID"
).
toString
());
ui
->
editMinSpinBox
(
settings
.
value
(
"QGC_PARAM_SLIDER_MIN"
).
toFloat
());
ui
->
editMaxSpinBox
(
settings
.
value
(
"QGC_PARAM_SLIDER_MAX"
).
toFloat
());
ui
->
editSelectParamComboBox
->
set
Edi
tText
(
settings
.
value
(
"QGC_PARAM_SLIDER_PARAMID"
).
toString
());
ui
->
editSelectComponent
ComboBox
->
setEdi
tText
(
settings
.
value
(
"QGC_PARAM_SLIDER_COMPONENTID"
).
toString
());
ui
->
editMinSpinBox
->
setValue
(
settings
.
value
(
"QGC_PARAM_SLIDER_MIN"
).
toFloat
());
ui
->
editMaxSpinBox
->
setValue
(
settings
.
value
(
"QGC_PARAM_SLIDER_MAX"
).
toFloat
());
qDebug
()
<<
"DONE READING SETTINGS"
;
}
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