Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
25187e60
Commit
25187e60
authored
Apr 27, 2015
by
Don Gagne
Browse files
Local 3d View no longer supported
Only QtLocation based mapping supported in future
parent
0dbb002d
Changes
52
Expand all
Hide whitespace changes
Inline
Side-by-side
src/ui/map3D/CameraParams.cc
deleted
100644 → 0
View file @
0dbb002d
#include
"CameraParams.h"
CameraParams
::
CameraParams
()
:
mMinZoomRange
(
2.0
f
)
,
mFov
(
30.0
f
)
,
mMinClipRange
(
1.0
f
)
,
mMaxClipRange
(
10000.0
f
)
{
}
float
&
CameraParams
::
minZoomRange
(
void
)
{
return
mMinZoomRange
;
}
float
CameraParams
::
minZoomRange
(
void
)
const
{
return
mMinZoomRange
;
}
float
&
CameraParams
::
fov
(
void
)
{
return
mFov
;
}
float
CameraParams
::
fov
(
void
)
const
{
return
mFov
;
}
float
&
CameraParams
::
minClipRange
(
void
)
{
return
mMinClipRange
;
}
float
CameraParams
::
minClipRange
(
void
)
const
{
return
mMinClipRange
;
}
float
&
CameraParams
::
maxClipRange
(
void
)
{
return
mMaxClipRange
;
}
float
CameraParams
::
maxClipRange
(
void
)
const
{
return
mMaxClipRange
;
}
src/ui/map3D/CameraParams.h
deleted
100644 → 0
View file @
0dbb002d
#ifndef CAMERAPARAMS_H
#define CAMERAPARAMS_H
class
CameraParams
{
public:
CameraParams
();
float
&
minZoomRange
(
void
);
float
minZoomRange
(
void
)
const
;
float
&
fov
(
void
);
float
fov
(
void
)
const
;
float
&
minClipRange
(
void
);
float
minClipRange
(
void
)
const
;
float
&
maxClipRange
(
void
);
float
maxClipRange
(
void
)
const
;
private:
float
mMinZoomRange
;
float
mFov
;
float
mMinClipRange
;
float
mMaxClipRange
;
};
#endif // CAMERAPARAMS_H
src/ui/map3D/GCManipulator.cc
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class GCManipulator.
*
* @author Lionel Heng <hengli@inf.ethz.ch>
*
*/
#include
"GCManipulator.h"
#include
<osg/Version>
GCManipulator
::
GCManipulator
()
{
_moveSensitivity
=
0.05
;
_zoomSensitivity
=
1.0
;
_minZoomRange
=
2.0
;
}
void
GCManipulator
::
setMinZoomRange
(
double
minZoomRange
)
{
_minZoomRange
=
minZoomRange
;
}
void
GCManipulator
::
move
(
double
dx
,
double
dy
,
double
dz
)
{
_center
+=
osg
::
Vec3d
(
dx
,
dy
,
dz
);
}
bool
GCManipulator
::
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
us
)
{
using
namespace
osgGA
;
switch
(
ea
.
getEventType
())
{
case
GUIEventAdapter
::
PUSH
:
{
flushMouseEventStack
();
addMouseEvent
(
ea
);
if
(
calcMovement
())
{
us
.
requestRedraw
();
}
us
.
requestContinuousUpdate
(
false
);
_thrown
=
false
;
return
true
;
}
case
GUIEventAdapter
::
RELEASE
:
{
if
(
ea
.
getButtonMask
()
==
0
)
{
if
(
isMouseMoving
())
{
if
(
calcMovement
())
{
us
.
requestRedraw
();
us
.
requestContinuousUpdate
(
false
);
_thrown
=
false
;
}
}
else
{
flushMouseEventStack
();
addMouseEvent
(
ea
);
if
(
calcMovement
())
{
us
.
requestRedraw
();
}
us
.
requestContinuousUpdate
(
false
);
_thrown
=
false
;
}
}
else
{
flushMouseEventStack
();
addMouseEvent
(
ea
);
if
(
calcMovement
())
{
us
.
requestRedraw
();
}
us
.
requestContinuousUpdate
(
false
);
_thrown
=
false
;
}
return
true
;
}
case
GUIEventAdapter
::
DRAG
:
{
addMouseEvent
(
ea
);
if
(
calcMovement
())
{
us
.
requestRedraw
();
}
us
.
requestContinuousUpdate
(
false
);
_thrown
=
false
;
return
true
;
}
case
GUIEventAdapter
::
SCROLL
:
{
// zoom model
double
scale
=
1.0
;
if
(
ea
.
getScrollingMotion
()
==
GUIEventAdapter
::
SCROLL_UP
)
{
scale
-=
_zoomSensitivity
*
0.1
;
}
else
{
scale
+=
_zoomSensitivity
*
0.1
;
}
if
(
_distance
*
scale
>
_minZoomRange
)
{
_distance
*=
scale
;
}
return
true
;
}
case
GUIEventAdapter
::
KEYDOWN
:
// pan model
switch
(
ea
.
getKey
())
{
case
GUIEventAdapter
::
KEY_Space
:
{
flushMouseEventStack
();
_thrown
=
false
;
home
(
ea
,
us
);
us
.
requestRedraw
();
us
.
requestContinuousUpdate
(
false
);
return
true
;
}
case
GUIEventAdapter
::
KEY_Left
:
{
double
scale
=
-
_moveSensitivity
*
_distance
;
osg
::
Matrix
rotation_matrix
;
rotation_matrix
.
makeRotate
(
_rotation
);
osg
::
Vec3d
dv
(
scale
,
0.0
,
0.0
);
_center
+=
dv
*
rotation_matrix
;
return
true
;
}
case
GUIEventAdapter
::
KEY_Right
:
{
double
scale
=
_moveSensitivity
*
_distance
;
osg
::
Matrix
rotation_matrix
;
rotation_matrix
.
makeRotate
(
_rotation
);
osg
::
Vec3d
dv
(
scale
,
0.0
,
0.0
);
_center
+=
dv
*
rotation_matrix
;
return
true
;
}
case
GUIEventAdapter
::
KEY_Up
:
{
double
scale
=
_moveSensitivity
*
_distance
;
osg
::
Matrix
rotation_matrix
;
rotation_matrix
.
makeRotate
(
_rotation
);
osg
::
Vec3d
dv
(
0.0
,
scale
,
0.0
);
_center
+=
dv
*
rotation_matrix
;
return
true
;
}
case
GUIEventAdapter
::
KEY_Down
:
{
double
scale
=
-
_moveSensitivity
*
_distance
;
osg
::
Matrix
rotation_matrix
;
rotation_matrix
.
makeRotate
(
_rotation
);
osg
::
Vec3d
dv
(
0.0
,
scale
,
0.0
);
_center
+=
dv
*
rotation_matrix
;
return
true
;
}
return
false
;
}
case
GUIEventAdapter
::
FRAME
:
if
(
_thrown
)
{
if
(
calcMovement
())
{
us
.
requestRedraw
();
}
}
return
false
;
default:
return
false
;
}
}
bool
GCManipulator
::
calcMovement
(
void
)
{
using
namespace
osgGA
;
// return if less then two events have been added.
if
(
_ga_t0
.
get
()
==
NULL
||
_ga_t1
.
get
()
==
NULL
)
{
return
false
;
}
double
dx
=
_ga_t0
->
getXnormalized
()
-
_ga_t1
->
getXnormalized
();
double
dy
=
_ga_t0
->
getYnormalized
()
-
_ga_t1
->
getYnormalized
();
// return if there is no movement.
if
(
dx
==
0.0
&&
dy
==
0.0
)
{
return
false
;
}
unsigned
int
buttonMask
=
_ga_t1
->
getButtonMask
();
if
(
buttonMask
==
GUIEventAdapter
::
LEFT_MOUSE_BUTTON
)
{
// rotate camera
#if ((OPENSCENEGRAPH_MAJOR_VERSION == 2) & (OPENSCENEGRAPH_MINOR_VERSION > 8)) | (OPENSCENEGRAPH_MAJOR_VERSION > 2)
osg
::
Vec3d
axis
;
#else
osg
::
Vec3
axis
;
#endif
float
angle
;
float
px0
=
_ga_t0
->
getXnormalized
();
float
py0
=
_ga_t0
->
getYnormalized
();
float
px1
=
_ga_t1
->
getXnormalized
();
float
py1
=
_ga_t1
->
getYnormalized
();
trackball
(
axis
,
angle
,
px1
,
py1
,
px0
,
py0
);
osg
::
Quat
new_rotate
;
new_rotate
.
makeRotate
(
angle
,
axis
);
_rotation
=
_rotation
*
new_rotate
;
return
true
;
}
else
if
(
buttonMask
==
GUIEventAdapter
::
MIDDLE_MOUSE_BUTTON
||
buttonMask
==
(
GUIEventAdapter
::
LEFT_MOUSE_BUTTON
|
GUIEventAdapter
::
RIGHT_MOUSE_BUTTON
))
{
// pan model
double
scale
=
-
_moveSensitivity
*
_distance
;
osg
::
Matrix
rotation_matrix
;
rotation_matrix
.
makeRotate
(
_rotation
);
osg
::
Vec3d
dv
(
dx
*
scale
,
dy
*
scale
,
0.0
);
_center
+=
dv
*
rotation_matrix
;
return
true
;
}
else
if
(
buttonMask
==
GUIEventAdapter
::
RIGHT_MOUSE_BUTTON
)
{
// zoom model
double
scale
=
1.0
+
dy
*
_zoomSensitivity
;
if
(
_distance
*
scale
>
_minZoomRange
)
{
_distance
*=
scale
;
}
return
true
;
}
return
false
;
}
src/ui/map3D/GCManipulator.h
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class GCManipulator.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#ifndef GCMANIPULATOR_H
#define GCMANIPULATOR_H
#include
<osgGA/TrackballManipulator>
class
GCManipulator
:
public
osgGA
::
TrackballManipulator
{
public:
GCManipulator
();
void
setMinZoomRange
(
double
minZoomRange
);
virtual
void
move
(
double
dx
,
double
dy
,
double
dz
);
/**
* @brief Handle events.
* @return True if event is handled; false otherwise.
*/
virtual
bool
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
us
);
protected:
bool
calcMovement
(
void
);
double
_moveSensitivity
;
double
_zoomSensitivity
;
double
_minZoomRange
;
};
#endif // GCMANIPULATOR_H
src/ui/map3D/GLOverlayGeode.cc
deleted
100644 → 0
View file @
0dbb002d
#include
"GLOverlayGeode.h"
GLOverlayGeode
::
GLOverlayGeode
()
:
mDrawable
(
new
GLOverlayDrawable
)
,
mMessageTimestamp
(
0.0
)
{
setCullingActive
(
false
);
addDrawable
(
mDrawable
);
}
void
GLOverlayGeode
::
setOverlay
(
px
::
GLOverlay
&
overlay
)
{
mDrawable
->
setOverlay
(
overlay
);
mCoordinateFrameType
=
overlay
.
coordinateframetype
();
dirtyBound
();
}
px
::
GLOverlay
::
CoordinateFrameType
GLOverlayGeode
::
coordinateFrameType
(
void
)
const
{
return
mCoordinateFrameType
;
}
void
GLOverlayGeode
::
setMessageTimestamp
(
qreal
timestamp
)
{
mMessageTimestamp
=
timestamp
;
}
qreal
GLOverlayGeode
::
messageTimestamp
(
void
)
const
{
return
mMessageTimestamp
;
}
GLOverlayGeode
::
GLOverlayDrawable
::
GLOverlayDrawable
()
{
setUseDisplayList
(
false
);
setUseVertexBufferObjects
(
true
);
}
GLOverlayGeode
::
GLOverlayDrawable
::
GLOverlayDrawable
(
const
GLOverlayDrawable
&
drawable
,
const
osg
::
CopyOp
&
copyop
)
:
osg
::
Drawable
(
drawable
,
copyop
)
{
setUseDisplayList
(
false
);
setUseVertexBufferObjects
(
true
);
}
void
GLOverlayGeode
::
GLOverlayDrawable
::
setOverlay
(
px
::
GLOverlay
&
overlay
)
{
if
(
!
overlay
.
IsInitialized
())
{
return
;
}
mOverlay
=
overlay
;
mBBox
.
init
();
const
std
::
string
&
data
=
mOverlay
.
data
();
for
(
size_t
i
=
0
;
i
<
data
.
size
();
++
i
)
{
switch
(
data
.
at
(
i
))
{
case
px
::
GLOverlay
::
POINTS
:
break
;
case
px
::
GLOverlay
::
LINES
:
break
;
case
px
::
GLOverlay
::
LINE_STRIP
:
break
;
case
px
::
GLOverlay
::
LINE_LOOP
:
break
;
case
px
::
GLOverlay
::
TRIANGLES
:
break
;
case
px
::
GLOverlay
::
TRIANGLE_STRIP
:
break
;
case
px
::
GLOverlay
::
TRIANGLE_FAN
:
break
;
case
px
::
GLOverlay
::
QUADS
:
break
;
case
px
::
GLOverlay
::
QUAD_STRIP
:
break
;
case
px
::
GLOverlay
::
POLYGON
:
break
;
case
px
::
GLOverlay
::
WIRE_CIRCLE
:
i
+=
sizeof
(
float
)
*
4
;
break
;
case
px
::
GLOverlay
::
SOLID_CIRCLE
:
i
+=
sizeof
(
float
)
*
4
;
break
;
case
px
::
GLOverlay
::
SOLID_CUBE
:
i
+=
sizeof
(
float
)
*
5
;
break
;
case
px
::
GLOverlay
::
WIRE_CUBE
:
i
+=
sizeof
(
float
)
*
5
;
break
;
case
px
::
GLOverlay
::
END
:
break
;
case
px
::
GLOverlay
::
VERTEX2F
:
i
+=
sizeof
(
float
)
*
2
;
break
;
case
px
::
GLOverlay
::
VERTEX3F
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
mBBox
.
expandBy
(
x
,
y
,
z
);
}
break
;
case
px
::
GLOverlay
::
ROTATEF
:
i
+=
sizeof
(
float
)
*
4
;
break
;
case
px
::
GLOverlay
::
TRANSLATEF
:
i
+=
sizeof
(
float
)
*
3
;
break
;
case
px
::
GLOverlay
::
SCALEF
:
i
+=
sizeof
(
float
)
*
3
;
break
;
case
px
::
GLOverlay
::
PUSH_MATRIX
:
break
;
case
px
::
GLOverlay
::
POP_MATRIX
:
break
;
case
px
::
GLOverlay
::
COLOR3F
:
i
+=
sizeof
(
float
)
*
3
;
break
;
case
px
::
GLOverlay
::
COLOR4F
:
i
+=
sizeof
(
float
)
*
4
;
break
;
case
px
::
GLOverlay
::
POINTSIZE
:
i
+=
sizeof
(
float
);
break
;
case
px
::
GLOverlay
::
LINEWIDTH
:
i
+=
sizeof
(
float
);
break
;
}
}
}
void
GLOverlayGeode
::
GLOverlayDrawable
::
drawImplementation
(
osg
::
RenderInfo
&
)
const
{
if
(
!
mOverlay
.
IsInitialized
())
{
return
;
}
glMatrixMode
(
GL_MODELVIEW
);
glDisable
(
GL_LIGHTING
);
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
glPushMatrix
();
glScalef
(
-
1.0
f
,
1.0
f
,
-
1.0
f
);
glRotatef
(
90.0
f
,
0.0
f
,
0.0
f
,
1.0
f
);
const
std
::
string
&
data
=
mOverlay
.
data
();
for
(
size_t
i
=
0
;
i
<
data
.
size
();
++
i
)
{
switch
(
data
.
at
(
i
))
{
case
px
::
GLOverlay
::
POINTS
:
glBegin
(
GL_POINTS
);
break
;
case
px
::
GLOverlay
::
LINES
:
glBegin
(
GL_LINES
);
break
;
case
px
::
GLOverlay
::
LINE_STRIP
:
glBegin
(
GL_LINE_STRIP
);
break
;
case
px
::
GLOverlay
::
LINE_LOOP
:
glBegin
(
GL_LINE_LOOP
);
break
;
case
px
::
GLOverlay
::
TRIANGLES
:
glBegin
(
GL_TRIANGLES
);
break
;
case
px
::
GLOverlay
::
TRIANGLE_STRIP
:
glBegin
(
GL_TRIANGLE_STRIP
);
break
;
case
px
::
GLOverlay
::
TRIANGLE_FAN
:
glBegin
(
GL_TRIANGLE_FAN
);
break
;
case
px
::
GLOverlay
::
QUADS
:
glBegin
(
GL_QUADS
);
break
;
case
px
::
GLOverlay
::
QUAD_STRIP
:
glBegin
(
GL_QUAD_STRIP
);
break
;
case
px
::
GLOverlay
::
POLYGON
:
glBegin
(
GL_POLYGON
);
break
;
case
px
::
GLOverlay
::
WIRE_CIRCLE
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
float
r
=
getFloatValue
(
data
,
i
);
glBegin
(
GL_LINE_LOOP
);
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
float
angle
=
i
/
20.0
f
*
M_PI
*
2.0
f
;
glVertex3f
(
x
+
r
*
cosf
(
angle
),
y
+
r
*
sinf
(
angle
),
z
);
}
glEnd
();
}
break
;
case
px
::
GLOverlay
::
SOLID_CIRCLE
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
float
r
=
getFloatValue
(
data
,
i
);
glBegin
(
GL_POLYGON
);
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
float
angle
=
i
/
20.0
f
*
M_PI
*
2.0
f
;
glVertex3f
(
x
+
r
*
cosf
(
angle
),
y
+
r
*
sinf
(
angle
),
z
);
}
glEnd
();
}
break
;
case
px
::
GLOverlay
::
SOLID_CUBE
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
float
w
=
getFloatValue
(
data
,
i
);
float
h
=
getFloatValue
(
data
,
i
);
float
w_2
=
w
/
2.0
f
;
float
h_2
=
h
/
2.0
f
;
glBegin
(
GL_QUADS
);
// face 1
glNormal3f
(
1.0
f
,
0.0
f
,
0.0
f
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
+
h_2
);
// face 2
glNormal3f
(
0.0
f
,
1.0
f
,
0.0
f
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
+
h_2
);
// face 3
glNormal3f
(
0.0
f
,
0.0
f
,
1.0
f
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
+
h_2
);
// face 4
glNormal3f
(
-
1.0
f
,
0.0
f
,
0.0
f
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
-
h_2
);
// face 5
glNormal3f
(
0.0
f
,
-
1.0
f
,
0.0
f
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
+
h_2
);
// face 6
glNormal3f
(
0.0
f
,
0.0
f
,
-
1.0
f
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
-
h_2
);
glEnd
();
}
break
;
case
px
::
GLOverlay
::
WIRE_CUBE
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
float
w
=
getFloatValue
(
data
,
i
);
float
h
=
getFloatValue
(
data
,
i
);
float
w_2
=
w
/
2.0
f
;
float
h_2
=
h
/
2.0
f
;
// face 1
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
+
h_2
);
glEnd
();
// face 2
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
+
h_2
);
glEnd
();
// face 3
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
+
h_2
);
glEnd
();
// face 4
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
-
h_2
);
glEnd
();
// face 5
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
+
h_2
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
+
h_2
);
glEnd
();
// face 6
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
x
-
w_2
,
y
-
w_2
,
z
-
h_2
);
glVertex3f
(
x
-
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
+
w_2
,
z
-
h_2
);
glVertex3f
(
x
+
w_2
,
y
-
w_2
,
z
-
h_2
);
glEnd
();
}
break
;
case
px
::
GLOverlay
::
END
:
glEnd
();
break
;
case
px
::
GLOverlay
::
VERTEX2F
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
glVertex2f
(
x
,
y
);
}
break
;
case
px
::
GLOverlay
::
VERTEX3F
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
glVertex3f
(
x
,
y
,
z
);
}
break
;
case
px
::
GLOverlay
::
ROTATEF
:
{
float
angle
=
getFloatValue
(
data
,
i
);
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
glRotatef
(
angle
,
x
,
y
,
z
);
}
break
;
case
px
::
GLOverlay
::
TRANSLATEF
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
glTranslatef
(
x
,
y
,
z
);
}
break
;
case
px
::
GLOverlay
::
SCALEF
:
{
float
x
=
getFloatValue
(
data
,
i
);
float
y
=
getFloatValue
(
data
,
i
);
float
z
=
getFloatValue
(
data
,
i
);
glScalef
(
x
,
y
,
z
);
}
break
;
case
px
::
GLOverlay
::
PUSH_MATRIX
:
glPushMatrix
();
break
;
case
px
::
GLOverlay
::
POP_MATRIX
:
glPopMatrix
();
break
;
case
px
::
GLOverlay
::
COLOR3F
:
{
float
red
=
getFloatValue
(
data
,
i
);
float
green
=
getFloatValue
(
data
,
i
);
float
blue
=
getFloatValue
(
data
,
i
);
glColor3f
(
red
,
green
,
blue
);
}
break
;
case
px
::
GLOverlay
::
COLOR4F
:
{
float
red
=
getFloatValue
(
data
,
i
);
float
green
=
getFloatValue
(
data
,
i
);
float
blue
=
getFloatValue
(
data
,
i
);
float
alpha
=
getFloatValue
(
data
,
i
);
glColor4f
(
red
,
green
,
blue
,
alpha
);
}
break
;
case
px
::
GLOverlay
::
POINTSIZE
:
glPointSize
(
getFloatValue
(
data
,
i
));
break
;
case
px
::
GLOverlay
::
LINEWIDTH
:
glLineWidth
(
getFloatValue
(
data
,
i
));
break
;
}
}
glPopMatrix
();
glEnable
(
GL_LIGHTING
);
glDisable
(
GL_BLEND
);
}
osg
::
BoundingBox
GLOverlayGeode
::
GLOverlayDrawable
::
computeBound
()
const
{
return
mBBox
;
}
float
GLOverlayGeode
::
GLOverlayDrawable
::
getFloatValue
(
const
std
::
string
&
data
,
size_t
&
mark
)
const
{
char
temp
[
4
];
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
++
mark
;
temp
[
i
]
=
data
.
at
(
mark
);
}
char
*
cp
=
&
(
temp
[
0
]);
float
*
fp
=
reinterpret_cast
<
float
*>
(
cp
);
return
*
fp
;
}
src/ui/map3D/GLOverlayGeode.h
deleted
100644 → 0
View file @
0dbb002d
#ifndef GLOVERLAYGEODE_H
#define GLOVERLAYGEODE_H
#include
<mavlink_protobuf_manager.hpp>
#include
<osg/Geode>
#include
<QtGlobal>
class
GLOverlayGeode
:
public
osg
::
Geode
{
public:
GLOverlayGeode
();
void
setOverlay
(
px
::
GLOverlay
&
overlay
);
px
::
GLOverlay
::
CoordinateFrameType
coordinateFrameType
(
void
)
const
;
void
setMessageTimestamp
(
qreal
timestamp
);
qreal
messageTimestamp
(
void
)
const
;
private:
class
GLOverlayDrawable
:
public
osg
::
Drawable
{
public:
GLOverlayDrawable
();
GLOverlayDrawable
(
const
GLOverlayDrawable
&
drawable
,
const
osg
::
CopyOp
&
copyop
=
osg
::
CopyOp
::
SHALLOW_COPY
);
void
setOverlay
(
px
::
GLOverlay
&
overlay
);
META_Object
(
GLOverlayDrawableApp
,
GLOverlayDrawable
)
virtual
void
drawImplementation
(
osg
::
RenderInfo
&
)
const
;
virtual
osg
::
BoundingBox
computeBound
()
const
;
private:
float
getFloatValue
(
const
std
::
string
&
data
,
size_t
&
mark
)
const
;
px
::
GLOverlay
mOverlay
;
osg
::
BoundingBox
mBBox
;
};
osg
::
ref_ptr
<
GLOverlayDrawable
>
mDrawable
;
px
::
GLOverlay
::
CoordinateFrameType
mCoordinateFrameType
;
qreal
mMessageTimestamp
;
};
#endif // GLOVERLAYGEODE_H
src/ui/map3D/GlobalViewParams.cc
deleted
100644 → 0
View file @
0dbb002d
#include
"GlobalViewParams.h"
#include
<QStringList>
GlobalViewParams
::
GlobalViewParams
()
:
mDisplayTerrain
(
true
)
,
mDisplayWorldGrid
(
true
)
,
mImageryType
(
Imagery
::
BLANK_MAP
)
,
mFollowCameraId
(
-
1
)
,
mFrame
(
MAV_FRAME_LOCAL_NED
)
{
}
bool
&
GlobalViewParams
::
displayTerrain
(
void
)
{
return
mDisplayTerrain
;
}
bool
GlobalViewParams
::
displayTerrain
(
void
)
const
{
return
mDisplayTerrain
;
}
bool
&
GlobalViewParams
::
displayWorldGrid
(
void
)
{
return
mDisplayWorldGrid
;
}
bool
GlobalViewParams
::
displayWorldGrid
(
void
)
const
{
return
mDisplayWorldGrid
;
}
QVector3D
&
GlobalViewParams
::
imageryOffset
(
void
)
{
return
mImageryOffset
;
}
QVector3D
GlobalViewParams
::
imageryOffset
(
void
)
const
{
return
mImageryOffset
;
}
QString
&
GlobalViewParams
::
imageryPath
(
void
)
{
return
mImageryPath
;
}
QString
GlobalViewParams
::
imageryPath
(
void
)
const
{
return
mImageryPath
;
}
Imagery
::
Type
&
GlobalViewParams
::
imageryType
(
void
)
{
return
mImageryType
;
}
Imagery
::
Type
GlobalViewParams
::
imageryType
(
void
)
const
{
return
mImageryType
;
}
int
&
GlobalViewParams
::
followCameraId
(
void
)
{
return
mFollowCameraId
;
}
int
GlobalViewParams
::
followCameraId
(
void
)
const
{
return
mFollowCameraId
;
}
MAV_FRAME
&
GlobalViewParams
::
frame
(
void
)
{
return
mFrame
;
}
MAV_FRAME
GlobalViewParams
::
frame
(
void
)
const
{
return
mFrame
;
}
void
GlobalViewParams
::
signalImageryParamsChanged
(
void
)
{
emit
imageryParamsChanged
();
}
QVector3D
&
GlobalViewParams
::
terrainPositionOffset
(
void
)
{
return
mTerrainPositionOffset
;
}
QVector3D
GlobalViewParams
::
terrainPositionOffset
(
void
)
const
{
return
mTerrainPositionOffset
;
}
QVector3D
&
GlobalViewParams
::
terrainAttitudeOffset
(
void
)
{
return
mTerrainAttitudeOffset
;
}
QVector3D
GlobalViewParams
::
terrainAttitudeOffset
(
void
)
const
{
return
mTerrainAttitudeOffset
;
}
void
GlobalViewParams
::
followCameraChanged
(
const
QString
&
text
)
{
int
followCameraId
=
-
1
;
if
(
text
.
compare
(
"None"
)
==
0
)
{
followCameraId
=
-
1
;
}
else
{
QStringList
list
=
text
.
split
(
" "
,
QString
::
SkipEmptyParts
);
followCameraId
=
list
.
back
().
toInt
();
}
if
(
followCameraId
!=
mFollowCameraId
)
{
mFollowCameraId
=
followCameraId
;
emit
followCameraChanged
(
mFollowCameraId
);
}
}
void
GlobalViewParams
::
frameChanged
(
const
QString
&
text
)
{
if
(
text
.
compare
(
"Global"
)
==
0
)
{
mFrame
=
MAV_FRAME_GLOBAL
;
}
else
if
(
text
.
compare
(
"Local"
)
==
0
)
{
mFrame
=
MAV_FRAME_LOCAL_NED
;
}
}
void
GlobalViewParams
::
toggleWorldGrid
(
int
state
)
{
if
(
state
==
Qt
::
Checked
)
{
mDisplayWorldGrid
=
true
;
}
else
{
mDisplayWorldGrid
=
false
;
}
}
void
GlobalViewParams
::
toggleTerrain
(
int
state
)
{
if
(
state
==
Qt
::
Checked
)
{
mDisplayTerrain
=
true
;
}
else
{
mDisplayTerrain
=
false
;
}
}
src/ui/map3D/GlobalViewParams.h
deleted
100644 → 0
View file @
0dbb002d
#ifndef GLOBALVIEWPARAMS_H
#define GLOBALVIEWPARAMS_H
#include
<QObject>
#include
<QString>
#include
<QVector3D>
#include
"QGCMAVLink.h"
#include
"Imagery.h"
class
GlobalViewParams
:
public
QObject
{
Q_OBJECT
public:
GlobalViewParams
();
bool
&
displayTerrain
(
void
);
bool
displayTerrain
(
void
)
const
;
bool
&
displayWorldGrid
(
void
);
bool
displayWorldGrid
(
void
)
const
;
QVector3D
&
imageryOffset
(
void
);
QVector3D
imageryOffset
(
void
)
const
;
QString
&
imageryPath
(
void
);
QString
imageryPath
(
void
)
const
;
Imagery
::
Type
&
imageryType
(
void
);
Imagery
::
Type
imageryType
(
void
)
const
;
int
&
followCameraId
(
void
);
int
followCameraId
(
void
)
const
;
MAV_FRAME
&
frame
(
void
);
MAV_FRAME
frame
(
void
)
const
;
void
signalImageryParamsChanged
(
void
);
QVector3D
&
terrainPositionOffset
(
void
);
QVector3D
terrainPositionOffset
(
void
)
const
;
QVector3D
&
terrainAttitudeOffset
(
void
);
QVector3D
terrainAttitudeOffset
(
void
)
const
;
public
slots
:
void
followCameraChanged
(
const
QString
&
text
);
void
frameChanged
(
const
QString
&
text
);
void
toggleTerrain
(
int
state
);
void
toggleWorldGrid
(
int
state
);
signals:
void
followCameraChanged
(
int
systemId
);
void
imageryParamsChanged
(
void
);
private:
bool
mDisplayTerrain
;
bool
mDisplayWorldGrid
;
QVector3D
mImageryOffset
;
QString
mImageryPath
;
Imagery
::
Type
mImageryType
;
int
mFollowCameraId
;
MAV_FRAME
mFrame
;
QVector3D
mTerrainPositionOffset
;
QVector3D
mTerrainAttitudeOffset
;
};
typedef
QSharedPointer
<
GlobalViewParams
>
GlobalViewParamsPtr
;
#endif // GLOBALVIEWPARAMS_H
src/ui/map3D/HUDScaleGeode.cc
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class HUDScaleGeode.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#include
"HUDScaleGeode.h"
#include
<osg/Geometry>
#include
<osg/LineWidth>
HUDScaleGeode
::
HUDScaleGeode
()
{
}
void
HUDScaleGeode
::
init
(
osg
::
ref_ptr
<
osgText
::
Font
>&
font
)
{
osg
::
ref_ptr
<
osg
::
Vec2Array
>
outlineVertices
(
new
osg
::
Vec2Array
);
outlineVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
50.0
f
));
outlineVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
70.0
f
));
outlineVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
60.0
f
));
outlineVertices
->
push_back
(
osg
::
Vec2
(
100.0
f
,
60.0
f
));
outlineVertices
->
push_back
(
osg
::
Vec2
(
100.0
f
,
50.0
f
));
outlineVertices
->
push_back
(
osg
::
Vec2
(
100.0
f
,
70.0
f
));
osg
::
ref_ptr
<
osg
::
Geometry
>
outlineGeometry
(
new
osg
::
Geometry
);
outlineGeometry
->
setVertexArray
(
outlineVertices
);
osg
::
ref_ptr
<
osg
::
Vec4Array
>
outlineColor
(
new
osg
::
Vec4Array
);
outlineColor
->
push_back
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
outlineGeometry
->
setColorArray
(
outlineColor
);
outlineGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
outlineGeometry
->
addPrimitiveSet
(
new
osg
::
DrawArrays
(
osg
::
PrimitiveSet
::
LINES
,
0
,
6
));
osg
::
ref_ptr
<
osg
::
LineWidth
>
outlineWidth
(
new
osg
::
LineWidth
());
outlineWidth
->
setWidth
(
4.0
f
);
outlineGeometry
->
getOrCreateStateSet
()
->
setAttributeAndModes
(
outlineWidth
,
osg
::
StateAttribute
::
ON
);
addDrawable
(
outlineGeometry
);
osg
::
ref_ptr
<
osg
::
Vec2Array
>
markerVertices
(
new
osg
::
Vec2Array
);
markerVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
50.0
f
));
markerVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
70.0
f
));
markerVertices
->
push_back
(
osg
::
Vec2
(
20.0
f
,
60.0
f
));
markerVertices
->
push_back
(
osg
::
Vec2
(
100.0
f
,
60.0
f
));
markerVertices
->
push_back
(
osg
::
Vec2
(
100.0
f
,
50.0
f
));
markerVertices
->
push_back
(
osg
::
Vec2
(
100.0
f
,
70.0
f
));
osg
::
ref_ptr
<
osg
::
Geometry
>
markerGeometry
(
new
osg
::
Geometry
);
markerGeometry
->
setVertexArray
(
markerVertices
);
osg
::
ref_ptr
<
osg
::
Vec4Array
>
markerColor
(
new
osg
::
Vec4Array
);
markerColor
->
push_back
(
osg
::
Vec4
(
0.0
f
,
0.0
f
,
0.0
f
,
1.0
f
));
markerGeometry
->
setColorArray
(
markerColor
);
markerGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
markerGeometry
->
addPrimitiveSet
(
new
osg
::
DrawArrays
(
osg
::
PrimitiveSet
::
LINES
,
0
,
6
));
osg
::
ref_ptr
<
osg
::
LineWidth
>
markerWidth
(
new
osg
::
LineWidth
());
markerWidth
->
setWidth
(
1.5
f
);
markerGeometry
->
getOrCreateStateSet
()
->
setAttributeAndModes
(
markerWidth
,
osg
::
StateAttribute
::
ON
);
addDrawable
(
markerGeometry
);
text
=
new
osgText
::
Text
;
text
->
setCharacterSize
(
11
);
text
->
setFont
(
font
);
text
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
text
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
text
->
setPosition
(
osg
::
Vec3
(
40.0
f
,
45.0
f
,
-
1.5
f
));
addDrawable
(
text
);
}
void
HUDScaleGeode
::
update
(
int
windowHeight
,
float
cameraFov
,
float
cameraDistance
,
bool
darkBackground
)
{
float
f
=
static_cast
<
float
>
(
windowHeight
)
/
2.0
f
/
tanf
(
cameraFov
/
180.0
f
*
M_PI
/
2.0
f
);
float
dist
=
cameraDistance
/
f
*
80.0
f
;
if
(
darkBackground
)
{
text
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
}
else
{
text
->
setColor
(
osg
::
Vec4
(
0.0
f
,
0.0
f
,
0.0
f
,
1.0
f
));
}
text
->
setText
(
QString
(
"%1 m"
).
arg
(
dist
,
0
,
'f'
,
2
).
toStdString
());
}
src/ui/map3D/HUDScaleGeode.h
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class HUDScaleGeode.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#ifndef HUDSCALEGEODE_H
#define HUDSCALEGEODE_H
#include
<osg/Geode>
#include
<osgText/Text>
#include
<QString>
class
HUDScaleGeode
:
public
osg
::
Geode
{
public:
HUDScaleGeode
();
void
init
(
osg
::
ref_ptr
<
osgText
::
Font
>&
font
);
void
update
(
int
windowHeight
,
float
cameraFov
,
float
cameraDistance
,
bool
darkBackground
);
private:
osg
::
ref_ptr
<
osgText
::
Text
>
text
;
};
#endif // HUDSCALEGEODE_H
src/ui/map3D/ImageWindowGeode.cc
deleted
100644 → 0
View file @
0dbb002d
///*=====================================================================
//
//QGroundControl Open Source Ground Control Station
//
//(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
//
//This file is part of the QGROUNDCONTROL project
//
// QGROUNDCONTROL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// QGROUNDCONTROL is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
//
//======================================================================*/
/**
* @file
* @brief Definition of the class ImageWindowGeode.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#include
"ImageWindowGeode.h"
ImageWindowGeode
::
ImageWindowGeode
()
:
mBorder
(
5
)
,
mImage
(
new
osg
::
Image
)
{
}
void
ImageWindowGeode
::
init
(
const
QString
&
caption
,
const
osg
::
Vec4
&
backgroundColor
,
osg
::
ref_ptr
<
osgText
::
Font
>&
font
)
{
// image
osg
::
ref_ptr
<
osg
::
Geometry
>
imageGeometry
=
new
osg
::
Geometry
;
mImageVertices
=
new
osg
::
Vec3Array
(
4
);
osg
::
ref_ptr
<
osg
::
Vec2Array
>
textureCoords
=
new
osg
::
Vec2Array
;
textureCoords
->
push_back
(
osg
::
Vec2
(
0.0
f
,
1.0
f
));
textureCoords
->
push_back
(
osg
::
Vec2
(
1.0
f
,
1.0
f
));
textureCoords
->
push_back
(
osg
::
Vec2
(
1.0
f
,
0.0
f
));
textureCoords
->
push_back
(
osg
::
Vec2
(
0.0
f
,
0.0
f
));
osg
::
ref_ptr
<
osg
::
Vec4Array
>
imageColors
(
new
osg
::
Vec4Array
);
imageColors
->
push_back
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
imageGeometry
->
setColorArray
(
imageColors
);
imageGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
imageGeometry
->
setVertexArray
(
mImageVertices
);
imageGeometry
->
setTexCoordArray
(
0
,
textureCoords
);
imageGeometry
->
addPrimitiveSet
(
new
osg
::
DrawArrays
(
osg
::
PrimitiveSet
::
POLYGON
,
0
,
mImageVertices
->
size
()));
osg
::
ref_ptr
<
osg
::
Texture2D
>
texture
=
new
osg
::
Texture2D
;
texture
->
setDataVariance
(
osg
::
Object
::
DYNAMIC
);
texture
->
setImage
(
mImage
);
texture
->
setResizeNonPowerOfTwoHint
(
false
);
imageGeometry
->
getOrCreateStateSet
()
->
setTextureAttributeAndModes
(
0
,
texture
,
osg
::
StateAttribute
::
ON
);
imageGeometry
->
setUseDisplayList
(
false
);
// background
osg
::
ref_ptr
<
osg
::
Geometry
>
backgroundGeometry
=
new
osg
::
Geometry
;
mBackgroundVertices
=
new
osg
::
Vec3Array
(
4
);
backgroundGeometry
->
setVertexArray
(
mBackgroundVertices
);
backgroundGeometry
->
addPrimitiveSet
(
new
osg
::
DrawArrays
(
osg
::
PrimitiveSet
::
POLYGON
,
0
,
mBackgroundVertices
->
size
()));
osg
::
ref_ptr
<
osg
::
Vec4Array
>
backgroundColors
(
new
osg
::
Vec4Array
);
backgroundColors
->
push_back
(
backgroundColor
);
backgroundGeometry
->
setColorArray
(
backgroundColors
);
backgroundGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
backgroundGeometry
->
setUseDisplayList
(
false
);
// caption
mText
=
new
osgText
::
Text
;
mText
->
setText
(
caption
.
toStdString
().
c_str
());
mText
->
setCharacterSize
(
11
);
mText
->
setFont
(
font
);
mText
->
setAxisAlignment
(
osgText
::
Text
::
SCREEN
);
mText
->
setColor
(
osg
::
Vec4
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
addDrawable
(
imageGeometry
);
addDrawable
(
backgroundGeometry
);
addDrawable
(
mText
);
setAttributes
(
0
,
0
,
0
,
0
);
}
void
ImageWindowGeode
::
setAttributes
(
int
x
,
int
y
,
int
width
,
int
height
)
{
int
imageWidth
=
width
-
mBorder
*
2
;
int
imageHeight
=
height
-
mBorder
*
2
-
15
;
int
imageXPosition
=
x
+
mBorder
;
int
imageYPosition
=
y
+
mBorder
;
mImageVertices
->
at
(
0
)
=
osg
::
Vec3
(
imageXPosition
,
imageYPosition
,
0
);
mImageVertices
->
at
(
1
)
=
osg
::
Vec3
(
imageXPosition
+
imageWidth
,
imageYPosition
,
0
);
mImageVertices
->
at
(
2
)
=
osg
::
Vec3
(
imageXPosition
+
imageWidth
,
imageYPosition
+
imageHeight
,
0
);
mImageVertices
->
at
(
3
)
=
osg
::
Vec3
(
imageXPosition
,
imageYPosition
+
imageHeight
,
0
);
mText
->
setPosition
(
osg
::
Vec3
(
imageXPosition
,
imageYPosition
+
imageHeight
+
5
,
0
));
mBackgroundVertices
->
at
(
0
)
=
osg
::
Vec3
(
x
,
y
,
-
1
);
mBackgroundVertices
->
at
(
1
)
=
osg
::
Vec3
(
x
+
width
,
y
,
-
1
);
mBackgroundVertices
->
at
(
2
)
=
osg
::
Vec3
(
x
+
width
,
y
+
height
,
-
1
);
mBackgroundVertices
->
at
(
3
)
=
osg
::
Vec3
(
x
,
y
+
height
,
-
1
);
}
osg
::
ref_ptr
<
osg
::
Image
>&
ImageWindowGeode
::
image
(
void
)
{
return
mImage
;
}
src/ui/map3D/ImageWindowGeode.h
deleted
100644 → 0
View file @
0dbb002d
///*=====================================================================
//
//QGroundControl Open Source Ground Control Station
//
//(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
//
//This file is part of the QGROUNDCONTROL project
//
// QGROUNDCONTROL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// QGROUNDCONTROL is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
//
//======================================================================*/
/**
* @file
* @brief Definition of the class ImageWindowGeode.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#ifndef IMAGEWINDOWGEODE_H
#define IMAGEWINDOWGEODE_H
#include
<osg/Geode>
#include
<osg/Geometry>
#include
<osgText/Text>
#include
<QString>
class
ImageWindowGeode
:
public
osg
::
Geode
{
public:
ImageWindowGeode
();
void
init
(
const
QString
&
caption
,
const
osg
::
Vec4
&
backgroundColor
,
osg
::
ref_ptr
<
osgText
::
Font
>&
font
);
void
setAttributes
(
int
x
,
int
y
,
int
width
,
int
height
);
osg
::
ref_ptr
<
osg
::
Image
>&
image
(
void
);
private:
int
mBorder
;
osg
::
ref_ptr
<
osg
::
Image
>
mImage
;
osg
::
ref_ptr
<
osg
::
Vec3Array
>
mImageVertices
;
osg
::
ref_ptr
<
osg
::
Vec3Array
>
mBackgroundVertices
;
osg
::
ref_ptr
<
osgText
::
Text
>
mText
;
};
#endif // IMAGEWINDOWGEODE_H
src/ui/map3D/Imagery.cc
deleted
100644 → 0
View file @
0dbb002d
This diff is collapsed.
Click to expand it.
src/ui/map3D/Imagery.h
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class Imagery.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#ifndef IMAGERY_H
#define IMAGERY_H
#include
<osg/Geode>
#include
<QScopedPointer>
#include
<QString>
#include
"TextureCache.h"
class
Imagery
:
public
osg
::
Geode
{
public:
enum
Type
{
BLANK_MAP
=
0
,
GOOGLE_MAP
=
1
,
GOOGLE_SATELLITE
=
2
,
OFFLINE_SATELLITE
=
3
};
Imagery
();
Type
getImageryType
(
void
)
const
;
void
setImageryType
(
Type
type
);
void
setOffset
(
double
xOffset
,
double
yOffset
,
double
zOffset
=
0.0
);
void
setPath
(
const
QString
&
path
);
void
prefetch2D
(
double
windowWidth
,
double
windowHeight
,
double
zoom
,
double
xOrigin
,
double
yOrigin
,
const
QString
&
utmZone
);
void
draw2D
(
double
windowWidth
,
double
windowHeight
,
double
zoom
,
double
xOrigin
,
double
yOrigin
,
const
QString
&
utmZone
);
void
prefetch3D
(
double
radius
,
double
tileResolution
,
double
xOrigin
,
double
yOrigin
,
const
QString
&
utmZone
);
void
draw3D
(
double
radius
,
double
tileResolution
,
double
xOrigin
,
double
yOrigin
,
double
xOffset
,
double
yOffset
,
const
QString
&
utmZone
);
bool
update
(
void
);
static
void
LLtoUTM
(
double
latitude
,
double
longitude
,
double
&
utmNorthing
,
double
&
utmEasting
,
QString
&
utmZone
);
static
void
UTMtoLL
(
double
utmNorthing
,
double
utmEasting
,
const
QString
&
utmZone
,
double
&
latitude
,
double
&
longitude
);
private:
void
imageBounds
(
int
tileX
,
int
tileY
,
double
tileResolution
,
double
&
x1
,
double
&
y1
,
double
&
x2
,
double
&
y2
,
double
&
x3
,
double
&
y3
,
double
&
x4
,
double
&
y4
)
const
;
void
tileBounds
(
double
tileResolution
,
double
minUtmX
,
double
minUtmY
,
double
maxUtmX
,
double
maxUtmY
,
const
QString
&
utmZone
,
int
&
minTileX
,
int
&
minTileY
,
int
&
maxTileX
,
int
&
maxTileY
,
int
&
zoomLevel
)
const
;
double
tileXToLongitude
(
int
tileX
,
int
numTiles
)
const
;
double
tileYToLatitude
(
int
tileY
,
int
numTiles
)
const
;
int
longitudeToTileX
(
double
longitude
,
int
numTiles
)
const
;
int
latitudeToTileY
(
double
latitude
,
int
numTiles
)
const
;
void
UTMtoTile
(
double
northing
,
double
easting
,
const
QString
&
utmZone
,
double
tileResolution
,
int
&
tileX
,
int
&
tileY
,
int
&
zoomLevel
)
const
;
static
QChar
UTMLetterDesignator
(
double
latitude
);
QString
getTileLocation
(
int
tileX
,
int
tileY
,
int
zoomLevel
,
double
tileResolution
)
const
;
QScopedPointer
<
TextureCache
>
mTextureCache
;
Type
mImageryType
;
std
::
string
mImageryPath
;
double
mXOffset
;
double
mYOffset
;
double
mZOffset
;
};
#endif // IMAGERY_H
src/ui/map3D/ImageryParamDialog.cc
deleted
100644 → 0
View file @
0dbb002d
#include
"ImageryParamDialog.h"
#include
<QStandardPaths>
#include
<QFormLayout>
#include
<QGroupBox>
#include
<QPushButton>
#include
"QGCFileDialog.h"
ImageryParamDialog
::
ImageryParamDialog
(
QWidget
*
parent
)
:
QDialog
(
parent
)
{
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
setLayout
(
layout
);
setWindowTitle
(
tr
(
"Imagery Parameters"
));
setModal
(
true
);
buildLayout
(
layout
);
}
void
ImageryParamDialog
::
getImageryParams
(
GlobalViewParamsPtr
&
globalViewParams
)
{
ImageryParamDialog
dialog
;
switch
(
globalViewParams
->
imageryType
())
{
case
Imagery
::
BLANK_MAP
:
dialog
.
mImageryTypeComboBox
->
setCurrentIndex
(
0
);
break
;
case
Imagery
::
GOOGLE_MAP
:
dialog
.
mImageryTypeComboBox
->
setCurrentIndex
(
1
);
break
;
case
Imagery
::
GOOGLE_SATELLITE
:
dialog
.
mImageryTypeComboBox
->
setCurrentIndex
(
2
);
break
;
case
Imagery
::
OFFLINE_SATELLITE
:
dialog
.
mImageryTypeComboBox
->
setCurrentIndex
(
3
);
break
;
}
dialog
.
mPathLineEdit
->
setText
(
globalViewParams
->
imageryPath
());
QVector3D
&
imageryOffset
=
globalViewParams
->
imageryOffset
();
dialog
.
mXOffsetSpinBox
->
setValue
(
imageryOffset
.
x
());
dialog
.
mYOffsetSpinBox
->
setValue
(
imageryOffset
.
y
());
dialog
.
mZOffsetSpinBox
->
setValue
(
imageryOffset
.
z
());
if
(
dialog
.
exec
()
==
QDialog
::
Accepted
)
{
switch
(
dialog
.
mImageryTypeComboBox
->
currentIndex
())
{
case
0
:
globalViewParams
->
imageryType
()
=
Imagery
::
BLANK_MAP
;
break
;
case
1
:
globalViewParams
->
imageryType
()
=
Imagery
::
GOOGLE_MAP
;
break
;
case
2
:
globalViewParams
->
imageryType
()
=
Imagery
::
GOOGLE_SATELLITE
;
break
;
case
3
:
globalViewParams
->
imageryType
()
=
Imagery
::
OFFLINE_SATELLITE
;
break
;
}
globalViewParams
->
imageryPath
()
=
dialog
.
mPathLineEdit
->
text
();
imageryOffset
.
setX
(
dialog
.
mXOffsetSpinBox
->
value
());
imageryOffset
.
setY
(
dialog
.
mYOffsetSpinBox
->
value
());
imageryOffset
.
setZ
(
dialog
.
mZOffsetSpinBox
->
value
());
globalViewParams
->
signalImageryParamsChanged
();
}
}
void
ImageryParamDialog
::
selectPath
(
void
)
{
QString
filename
=
QGCFileDialog
::
getExistingDirectory
(
this
,
"Imagery path"
,
QStandardPaths
::
writableLocation
(
QStandardPaths
::
DesktopLocation
));
if
(
filename
.
isNull
())
{
return
;
}
else
{
mPathLineEdit
->
setText
(
filename
);
}
}
void
ImageryParamDialog
::
closeWithSaving
(
void
)
{
done
(
QDialog
::
Accepted
);
}
void
ImageryParamDialog
::
closeWithoutSaving
(
void
)
{
done
(
QDialog
::
Rejected
);
}
void
ImageryParamDialog
::
buildLayout
(
QVBoxLayout
*
layout
)
{
QFormLayout
*
formLayout
=
new
QFormLayout
;
mImageryTypeComboBox
=
new
QComboBox
(
this
);
mImageryTypeComboBox
->
addItem
(
"None"
);
mImageryTypeComboBox
->
addItem
(
"Map (Google)"
);
mImageryTypeComboBox
->
addItem
(
"Satellite (Google)"
);
mImageryTypeComboBox
->
addItem
(
"Satellite (Offline)"
);
mPathLineEdit
=
new
QLineEdit
(
this
);
mPathLineEdit
->
setReadOnly
(
true
);
QPushButton
*
pathButton
=
new
QPushButton
(
this
);
pathButton
->
setText
(
tr
(
".."
));
QHBoxLayout
*
pathLayout
=
new
QHBoxLayout
;
pathLayout
->
addWidget
(
mPathLineEdit
);
pathLayout
->
addWidget
(
pathButton
);
formLayout
->
addRow
(
tr
(
"Imagery Type"
),
mImageryTypeComboBox
);
formLayout
->
addRow
(
tr
(
"Path"
),
pathLayout
);
layout
->
addLayout
(
formLayout
);
QGroupBox
*
offsetGroupBox
=
new
QGroupBox
(
tr
(
"Offset"
),
this
);
mXOffsetSpinBox
=
new
QDoubleSpinBox
(
this
);
mXOffsetSpinBox
->
setDecimals
(
1
);
mXOffsetSpinBox
->
setRange
(
-
1000.0
,
1000.0
);
mXOffsetSpinBox
->
setValue
(
0.0
);
mYOffsetSpinBox
=
new
QDoubleSpinBox
(
this
);
mYOffsetSpinBox
->
setDecimals
(
1
);
mYOffsetSpinBox
->
setRange
(
-
1000.0
,
1000.0
);
mYOffsetSpinBox
->
setValue
(
0.0
);
mZOffsetSpinBox
=
new
QDoubleSpinBox
(
this
);
mZOffsetSpinBox
->
setDecimals
(
1
);
mZOffsetSpinBox
->
setRange
(
-
1000.0
,
1000.0
);
mZOffsetSpinBox
->
setValue
(
0.0
);
formLayout
=
new
QFormLayout
;
formLayout
->
addRow
(
tr
(
"x (m)"
),
mXOffsetSpinBox
);
formLayout
->
addRow
(
tr
(
"y (m)"
),
mYOffsetSpinBox
);
formLayout
->
addRow
(
tr
(
"z (m)"
),
mZOffsetSpinBox
);
offsetGroupBox
->
setLayout
(
formLayout
);
layout
->
addWidget
(
offsetGroupBox
);
layout
->
addItem
(
new
QSpacerItem
(
10
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
));
QPushButton
*
cancelButton
=
new
QPushButton
(
this
);
cancelButton
->
setText
(
"Cancel"
);
QPushButton
*
saveButton
=
new
QPushButton
(
this
);
saveButton
->
setText
(
"Save"
);
QHBoxLayout
*
buttonLayout
=
new
QHBoxLayout
;
buttonLayout
->
addWidget
(
cancelButton
);
buttonLayout
->
addItem
(
new
QSpacerItem
(
10
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
));
buttonLayout
->
addWidget
(
saveButton
);
layout
->
addLayout
(
buttonLayout
);
connect
(
pathButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
selectPath
()));
connect
(
cancelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
closeWithoutSaving
()));
connect
(
saveButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
closeWithSaving
()));
}
src/ui/map3D/ImageryParamDialog.h
deleted
100644 → 0
View file @
0dbb002d
#ifndef IMAGERYPARAMDIALOG_H
#define IMAGERYPARAMDIALOG_H
#include
<QComboBox>
#include
<QDoubleSpinBox>
#include
<QDialog>
#include
<QLineEdit>
#include
<QVBoxLayout>
#include
"GlobalViewParams.h"
class
ImageryParamDialog
:
public
QDialog
{
Q_OBJECT
public:
ImageryParamDialog
(
QWidget
*
parent
=
0
);
static
void
getImageryParams
(
GlobalViewParamsPtr
&
globalViewParams
);
private
slots
:
void
selectPath
(
void
);
void
closeWithSaving
(
void
);
void
closeWithoutSaving
(
void
);
private:
void
buildLayout
(
QVBoxLayout
*
layout
);
QComboBox
*
mImageryTypeComboBox
;
QLineEdit
*
mPathLineEdit
;
QDoubleSpinBox
*
mXOffsetSpinBox
;
QDoubleSpinBox
*
mYOffsetSpinBox
;
QDoubleSpinBox
*
mZOffsetSpinBox
;
};
#endif // IMAGERYPARAMDIALOG_H
src/ui/map3D/ObstacleGroupNode.cc
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class ObstacleGroupNode.
*
* @author Lionel Heng <hengli@inf.ethz.ch>
*
*/
#include
"ObstacleGroupNode.h"
#include
<limits>
#include
<osg/PositionAttitudeTransform>
#include
<osg/ShapeDrawable>
#include
"gpl.h"
#include
"Imagery.h"
ObstacleGroupNode
::
ObstacleGroupNode
()
{
}
void
ObstacleGroupNode
::
init
(
void
)
{
}
void
ObstacleGroupNode
::
clear
(
void
)
{
if
(
getNumChildren
()
>
0
)
{
removeChild
(
0
,
getNumChildren
());
}
}
void
ObstacleGroupNode
::
update
(
double
robotX
,
double
robotY
,
double
robotZ
,
const
px
::
ObstacleList
&
obstacleList
)
{
clear
();
osg
::
ref_ptr
<
osg
::
Geode
>
geode
=
new
osg
::
Geode
;
// find minimum and maximum height
float
zMin
=
std
::
numeric_limits
<
float
>::
max
();
float
zMax
=
std
::
numeric_limits
<
float
>::
min
();
for
(
int
i
=
0
;
i
<
obstacleList
.
obstacles_size
();
++
i
)
{
const
px
::
Obstacle
&
obs
=
obstacleList
.
obstacles
(
i
);
float
z
=
robotZ
-
obs
.
z
();
if
(
zMin
>
z
)
{
zMin
=
z
;
}
if
(
zMax
<
z
)
{
zMax
=
z
;
}
}
for
(
int
i
=
0
;
i
<
obstacleList
.
obstacles_size
();
++
i
)
{
const
px
::
Obstacle
&
obs
=
obstacleList
.
obstacles
(
i
);
osg
::
Vec3d
obsPos
(
obs
.
y
()
-
robotY
,
obs
.
x
()
-
robotX
,
robotZ
-
obs
.
z
());
osg
::
ref_ptr
<
osg
::
Box
>
box
=
new
osg
::
Box
(
obsPos
,
obs
.
width
(),
obs
.
width
(),
obs
.
height
());
osg
::
ref_ptr
<
osg
::
ShapeDrawable
>
sd
=
new
osg
::
ShapeDrawable
(
box
);
int
idx
=
(
obsPos
.
z
()
-
zMin
)
/
(
zMax
-
zMin
)
*
127.0
f
;
float
r
,
g
,
b
;
qgc
::
colormap
(
"jet"
,
idx
,
r
,
g
,
b
);
sd
->
getOrCreateStateSet
()
->
setMode
(
GL_BLEND
,
osg
::
StateAttribute
::
ON
);
sd
->
setColor
(
osg
::
Vec4
(
r
,
g
,
b
,
1.0
f
));
sd
->
setUseDisplayList
(
false
);
geode
->
addDrawable
(
sd
);
}
addChild
(
geode
);
}
src/ui/map3D/ObstacleGroupNode.h
deleted
100644 → 0
View file @
0dbb002d
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class ObstacleGroupNode.
*
* @author Lionel Heng <hengli@inf.ethz.ch>
*
*/
#ifndef OBSTACLEGROUPNODE_H
#define OBSTACLEGROUPNODE_H
#include
<osg/Group>
#include
"UASInterface.h"
class
ObstacleGroupNode
:
public
osg
::
Group
{
public:
ObstacleGroupNode
();
void
init
(
void
);
void
clear
(
void
);
void
update
(
double
robotX
,
double
robotY
,
double
robotZ
,
const
px
::
ObstacleList
&
obstacleList
);
};
#endif // OBSTACLEGROUPNODE_H
src/ui/map3D/Pixhawk3DWidget.cc
deleted
100644 → 0
View file @
0dbb002d
This diff is collapsed.
Click to expand it.
src/ui/map3D/Pixhawk3DWidget.h
deleted
100644 → 0
View file @
0dbb002d
///*=====================================================================
//
//QGroundControl Open Source Ground Control Station
//
//(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
//
//This file is part of the QGROUNDCONTROL project
//
// QGROUNDCONTROL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// QGROUNDCONTROL is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
//
//======================================================================*/
/**
* @file
* @brief Definition of the class Pixhawk3DWidget.
*
* @author Lionel Heng <hengli@inf.ethz.ch>
*
*/
#ifndef PIXHAWK3DWIDGET_H
#define PIXHAWK3DWIDGET_H
#include
<osgText/Text>
#include
"HUDScaleGeode.h"
#include
"Imagery.h"
#include
"Q3DWidget.h"
#include
"SystemContainer.h"
#include
"ViewParamWidget.h"
class
UASInterface
;
/**
* @brief A 3D View widget which displays vehicle-centric information.
**/
class
Pixhawk3DWidget
:
public
QWidget
{
Q_OBJECT
public:
explicit
Pixhawk3DWidget
(
QWidget
*
parent
=
0
);
~
Pixhawk3DWidget
();
public
slots
:
void
activeSystemChanged
(
UASInterface
*
uas
);
void
systemCreated
(
UASInterface
*
uas
);
void
localPositionChanged
(
UASInterface
*
uas
,
int
component
,
double
x
,
double
y
,
double
z
,
quint64
time
);
void
localPositionChanged
(
UASInterface
*
uas
,
double
x
,
double
y
,
double
z
,
quint64
time
);
void
attitudeChanged
(
UASInterface
*
uas
,
int
component
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
time
);
void
attitudeChanged
(
UASInterface
*
uas
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
time
);
void
homePositionChanged
(
int
uasId
,
double
lat
,
double
lon
,
double
alt
);
void
setpointChanged
(
int
uasId
,
float
x
,
float
y
,
float
z
,
float
yaw
);
signals:
void
systemCreatedSignal
(
UASInterface
*
uas
);
void
overlayCreatedSignal
(
int
systemId
,
const
QString
&
name
);
private
slots
:
void
clearData
(
void
);
void
showTerrainParamWindow
(
void
);
void
showViewParamWindow
(
void
);
void
followCameraChanged
(
int
systemId
);
void
imageryParamsChanged
(
void
);
void
recenterActiveCamera
(
void
);
void
modelChanged
(
int
systemId
,
int
index
);
void
setBirdEyeView
(
void
);
void
loadTerrainModel
(
void
);
void
selectTargetHeading
(
void
);
void
selectTarget
(
void
);
void
setTarget
(
void
);
void
insertWaypoint
(
void
);
void
moveWaypointPosition
(
void
);
void
moveWaypointHeading
(
void
);
void
deleteWaypoint
(
void
);
void
setWaypointAltitude
(
void
);
void
clearAllWaypoints
(
void
);
void
moveImagery
(
void
);
void
moveTerrain
(
void
);
void
rotateTerrain
(
void
);
void
sizeChanged
(
int
width
,
int
height
);
void
updateWidget
(
void
);
protected:
void
addModels
(
QVector
<
osg
::
ref_ptr
<
osg
::
Node
>
>&
models
,
const
QColor
&
systemColor
);
void
buildLayout
(
void
);
void
keyPressEvent
(
QKeyEvent
*
event
);
void
keyReleaseEvent
(
QKeyEvent
*
event
);
void
mousePressEvent
(
QMouseEvent
*
event
);
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
void
mouseMoveEvent
(
QMouseEvent
*
event
);
void
wheelEvent
(
QWheelEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
void
hideEvent
(
QHideEvent
*
event
);
signals:
void
visibilityChanged
(
bool
visible
);
private:
void
initializeSystem
(
int
systemId
,
const
QColor
&
systemColor
);
void
getPose
(
UASInterface
*
uas
,
MAV_FRAME
frame
,
double
&
x
,
double
&
y
,
double
&
z
,
double
&
roll
,
double
&
pitch
,
double
&
yaw
,
QString
&
utmZone
)
const
;
void
getPose
(
UASInterface
*
uas
,
MAV_FRAME
frame
,
double
&
x
,
double
&
y
,
double
&
z
,
double
&
roll
,
double
&
pitch
,
double
&
yaw
)
const
;
void
getPosition
(
UASInterface
*
uas
,
MAV_FRAME
frame
,
double
&
x
,
double
&
y
,
double
&
z
,
QString
&
utmZone
)
const
;
void
getPosition
(
UASInterface
*
uas
,
MAV_FRAME
frame
,
double
&
x
,
double
&
y
,
double
&
z
)
const
;
osg
::
ref_ptr
<
osg
::
Geode
>
createLocalGrid
(
void
);
osg
::
ref_ptr
<
osg
::
Geode
>
createWorldGrid
(
void
);
osg
::
ref_ptr
<
osg
::
Geometry
>
createTrail
(
const
osg
::
Vec4
&
color
);
osg
::
ref_ptr
<
osg
::
Geometry
>
createLink
(
const
QColor
&
color
);
osg
::
ref_ptr
<
Imagery
>
createImagery
(
void
);
osg
::
ref_ptr
<
osg
::
Geode
>
createPointCloud
(
void
);
osg
::
ref_ptr
<
osg
::
Node
>
createTarget
(
const
QColor
&
color
);
void
setupHUD
(
void
);
void
resizeHUD
(
int
width
,
int
height
);
void
updateHUD
(
UASInterface
*
uas
,
MAV_FRAME
frame
);
void
updateImagery
(
double
originX
,
double
originY
,
const
QString
&
zone
,
MAV_FRAME
frame
);
void
updateTarget
(
UASInterface
*
uas
,
MAV_FRAME
frame
,
double
robotX
,
double
robotY
,
double
robotZ
,
QVector4D
&
target
,
osg
::
ref_ptr
<
osg
::
Node
>&
targetNode
);
void
updateTrails
(
double
robotX
,
double
robotY
,
double
robotZ
,
osg
::
ref_ptr
<
osg
::
Geode
>&
trailNode
,
osg
::
ref_ptr
<
osg
::
Group
>&
orientationNode
,
QMap
<
int
,
QVector
<
osg
::
Vec3d
>
>&
trailMap
,
QMap
<
int
,
int
>&
trailIndexMap
);
void
updateWaypoints
(
UASInterface
*
uas
,
MAV_FRAME
frame
,
osg
::
ref_ptr
<
WaypointGroupNode
>&
waypointGroupNode
);
int
findWaypoint
(
const
QPoint
&
mousePos
);
bool
findTarget
(
int
mouseX
,
int
mouseY
);
bool
findTerrain
(
const
QPoint
&
mousePos
);
void
showInsertWaypointMenu
(
const
QPoint
&
cursorPos
);
void
showEditWaypointMenu
(
const
QPoint
&
cursorPos
);
void
showTerrainMenu
(
const
QPoint
&
cursorPos
);
const
qreal
kMessageTimeout
;
// message timeout in seconds
enum
Mode
{
DEFAULT_MODE
,
MOVE_WAYPOINT_POSITION_MODE
,
MOVE_WAYPOINT_HEADING_MODE
,
SELECT_TARGET_HEADING_MODE
,
MOVE_TERRAIN_MODE
,
ROTATE_TERRAIN_MODE
,
MOVE_IMAGERY_MODE
};
Mode
mMode
;
int
mSelectedWpIndex
;
int
mActiveSystemId
;
UASInterface
*
mActiveUAS
;
GlobalViewParamsPtr
mGlobalViewParams
;
// maps system id to system-specific view parameters
QMap
<
int
,
SystemViewParamsPtr
>
mSystemViewParamMap
;
// maps system id to system-specific data
QMap
<
int
,
SystemContainer
>
mSystemContainerMap
;
osg
::
ref_ptr
<
osg
::
Geometry
>
mHudBackgroundGeometry
;
osg
::
ref_ptr
<
Imagery
>
mImageryNode
;
osg
::
ref_ptr
<
HUDScaleGeode
>
mScaleGeode
;
osg
::
ref_ptr
<
osgText
::
Text
>
mStatusText
;
osg
::
ref_ptr
<
osg
::
Node
>
mTerrainNode
;
osg
::
ref_ptr
<
osg
::
PositionAttitudeTransform
>
mTerrainPAT
;
osg
::
ref_ptr
<
osg
::
Geode
>
mWorldGridNode
;
QPoint
mCachedMousePos
;
int
mFollowCameraId
;
QVector3D
mCameraPos
;
bool
mInitCameraPos
;
Q3DWidget
*
m3DWidget
;
ViewParamWidget
*
mViewParamWidget
;
};
#endif // PIXHAWK3DWIDGET_H
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment