23 #include <QDataStream>
84 static const QSize __qSizeSelect(32,32);
85 static const QPixmap __qPixmapSelect(
":icons/32x32/select.png" );
91 double __fdZoom = _poChart->
getZoom();
92 if( __fdZoom < 0.5 ) __fdZoom = 0.5;
93 else if( __fdZoom > 2.0 ) __fdZoom = 2.0;
100 __qPen.setWidth( __qPen.width() * __fdZoom );
102 double __fdRadius = 11.0 * __fdZoom;
106 __qPenSelected.setWidth( __qPenSelected.width() * __fdZoom );
107 _pqPainter->setPen( __qPenSelected );
109 _pqPainter->drawEllipse( __qPointF, 1.5*__fdRadius, 1.5*__fdRadius );
111 if( _poDataPositionValidity && !_poDataPositionValidity->
isValidPosition() ) __qPen.setStyle( Qt::DotLine );
112 _pqPainter->setPen( __qPen );
114 _pqPainter->drawEllipse( __qPointF, __fdRadius, __fdRadius );
115 _pqPainter->drawPoint( __qPointF );
119 __fdRadius = 16.0 * __fdZoom;
120 QPointF __qPointFTip = __qPointF + __fdRadius * QPointF( sin( __fdGroundBearing ), -cos( __fdGroundBearing ) );
121 _pqPainter->drawLine( __qPointFTip, __qPointF + __fdRadius * QPointF( sin( __fdGroundBearing+2.5 ), -cos( __fdGroundBearing+2.5 ) ) );
122 _pqPainter->drawLine( __qPointFTip, __qPointF + __fdRadius * QPointF( sin( __fdGroundBearing-2.5 ), -cos( __fdGroundBearing-2.5 ) ) );
125 _pqPainter->drawPixmap( __qPointF, __qPixmapSelect.scaled( __qSizeSelect*(__fdZoom/2.0), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
142 double __fdZoom = _poChart->
getZoom();
143 if( __fdZoom < 0.5 ) __fdZoom = 0.5;
144 else if( __fdZoom > 2.0 ) __fdZoom = 2.0;
160 QPointF __qPointFBearing = QPointF( sin( __fdGroundBearing ), -cos( __fdGroundBearing ) );
161 QPointF __qPointFGround = __qPointF + __fdLength * __qPointFBearing;
162 bool __bInvalid =
false;
166 __qPen.setStyle( Qt::DotLine );
168 __qPen.setWidth( 3.0 * __fdZoom );
169 _pqPainter->setPen( __qPen );
170 _pqPainter->drawLine( __qPointF, __qPointFGround );
174 QString __qsGroundSpeed =
"-";
179 __qBrush.setStyle( Qt::SolidPattern );
183 __qBrush.setStyle( Qt::Dense4Pattern );
185 _pqPainter->setBrush( __qBrush );
186 _pqPainter->setPen( QPen( Qt::transparent ) );
187 double __fdLengthMinute = __fdGroundSpeed * 60.0 * _poChart->
getZoom() / _poChart->
getResolution();
188 if( __fdLengthMinute >= 10 )
190 for(
int __i = 0; __i < 5; __i++ )
192 double __fdLengthTick = (__i+1)*__fdLengthMinute;
193 if( __fdLengthTick > __fdLength )
break;
194 double __fdRadius = ( 10.0 - __i ) * __fdZoom;
195 _pqPainter->drawEllipse( __qPointF + __fdLengthTick * __qPointFBearing, __fdRadius, __fdRadius );
202 QString __qsGroundSpeedVertical =
"-";
208 double __fdBearingOffset = ( 40.0 + 20.0*fabs( pow( sin( __fdGroundBearing ), 3 ) ) ) * __fdZoom;
209 drawText( _poChart, _pqPainter, __qsGroundBearing+QString::fromUtf8(
"ยท")+__qsGroundSpeed+
"\n"+__qsGroundSpeedVertical, __qPointF+QPointF( __fdBearingOffset*sin( __fdGroundBearing ), -__fdBearingOffset*cos( __fdGroundBearing ) ), __bInvalid );
217 QPointF __qPointFApparent = __qPointF + __fdLength * QPointF( sin( __fdApparentBearing ), -cos( __fdApparentBearing ) );
219 __qPen.setWidth( 2.0 * __fdZoom );
220 _pqPainter->setPen( __qPen );
221 _pqPainter->drawLine( __qPointF, __qPointFApparent );
double getZoom() const
Returns the current zoom factor.
double getResolution() const
Returns the resolution of the chart at its current position, in meters per pixel [m/px].
QRectF getDrawArea() const
Returns the viewport draw area.
QPointF toDrawPosition(const CDataPosition &_roGeoPosition) const
Converts the given (geographical) position [long,lat,elev] to chart draw point [px].
Ground and apparent geographical courses container.
void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
CDataCourse ApparentCourse
Apparent course.
CDataCourse GroundCourse
Ground course.
Ground and apparent geographical courses validity container.
CDataCourseValidity GroundCourseValidity
Ground course validity.
CDataCourseValidity ApparentCourseValidity
Apparent course validity.
bool isValidSpeedVertical() const
Returns the vertical speed's (global) validity status.
bool isValidSpeed() const
Returns the horizontal speed's (global) validity status.
bool isValidBearing() const
Returns the bearing's (global) validity status.
(Geographical) Course data [bearing, horizontal/vertical speeds]
double getSpeedVertical() const
Returns this course's vertical speed, in meters per second.
static constexpr double UNDEFINED_BEARING
Specific value for an undefined bearing.
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
double getBearing() const
Returns this course's bearing, in degrees.
double getSpeed() const
Returns this course's horizontal speed, in meters per second.
bool isValidPosition() const
Returns the position's (global) validity status.
(Geographical) Position data [long,lat,elev]
static const CDataPosition UNDEFINED
Specific value for an undefined position.
virtual void drawVector(const CChart *_poChart, QPainter *_pqPainter, const CDataCourseValidityGA *_poDataCourseValidityGA=0)
Draws the course vectors (ground and apparent)
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
COverlayCourse(const QString &_rqsName)
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
virtual void drawMarker(const CChart *_poChart, QPainter *_pqPainter, const CDataPositionValidity *_poDataPositionValidity=0, bool _bSelected=false)
Draws the point (marker)
bool isMultiSelected() const
Returns this item's selection status.
virtual COverlay * useOverlay()=0
Returns this object's (base) overlay.
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
virtual void drawText(const CChart *_poChart, QPainter *_pqPainter, const QString &_rqsText, const QPointF &_rqPointFScrPosition, bool _bItalic=false)
Draws the given text, at the given screen position.
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
bool bVisible
Global (marker) visibility status.
bool bVisibleCourse
Course's visibility status.
const QBrush & getBrushMarker() const
const QPen & getPenMarkerSelected() const
const QPen & getPenVector() const
const QBrush & getBrushMarkerSelected() const
const QPen & getPenMarker() const
int getScreenDpi()
[Misc] Returns the screen Dots-per-Inch (DPI)
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static CSettings * useSettings()
static constexpr double DEG2RAD