21 #include <QTreeWidget>
22 #include <QTreeWidgetItem>
40 QTreeWidgetItem::addChild(
new CPointerPoint( tr(
"Mouse") ) );
41 QTreeWidgetItem::addChild(
new CPointerPoint( tr(
"Target") ) );
46 QTreeWidgetItem* __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 0 );
47 while( __pqTreeWidgetItem )
50 __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 0 );
67 __poPointerPoint->
draw( _poChart, _pqPainter );
70 __poPointerPoint = (
CPointerPoint*)QTreeWidgetItem::child( 1 );
71 __poPointerPoint->
draw( _poChart, _pqPainter );
73 if( __poVesselPoint ) __poPointerPoint->
drawLine( _poChart, _pqPainter, __poVesselPoint );
76 int __iCount = QTreeWidgetItem::childCount();
77 if( __iCount < 4 )
return;
80 for(
int __i = 3; __i < __iCount; __i++ )
82 __poPointerPathTo = (
CPointerPoint*)QTreeWidgetItem::child( __i );
83 __poPointerPathFrom->
drawLine( _poChart, _pqPainter, __poPointerPathTo );
84 __poPointerPathFrom = __poPointerPathTo;
90 if( !_pqTreeWidgetItem )
return;
91 switch( _pqTreeWidgetItem->type() )
124 return QTreeWidgetItem::childCount() > 2;
129 int __iCount = QTreeWidgetItem::childCount() - 3;
130 if( __iCount < 0 ) __iCount = 0;
155 __qColor.setAlpha( 128 );
157 __qColor.setAlpha( 192 );
158 qPenText.setColor( QColor::fromHsv( __qColor.hue(), __qColor.saturation(), std::min( 128, __qColor.value() ), 192 ) );
195 QTreeWidgetItem::addChild( __poPointerPoint );
200 int __iCount = QTreeWidgetItem::childCount();
201 if( __iCount < 4 )
return 0.0;
204 double __fdLength = 0;
205 for(
int __i = 3; __i < __iCount; __i++ )
207 __poPointerPathTo = (
CPointerPoint*)QTreeWidgetItem::child( __i );
209 __poPointerPathFrom = __poPointerPathTo;
216 int __iCount = QTreeWidgetItem::childCount();
217 if( __iCount < 4 )
return 0.0;
225 QTreeWidgetItem* __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 2 );
226 while( __pqTreeWidgetItem )
229 __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 2 );
CVesselPoint * getVesselPointSynchronize() const
Returns the vessel defined to synchronize the chart reference (geographical) position.
void setGeoPosition(const CDataPosition &_roGeoPosition, bool _bSkipCurrent=false)
Sets the reference chart (geographical) position.
CDataPosition toGeoPosition(const QPointF &_rqPointFDrawPosition) const
Converts the given chart draw position to geographical position.
(Geographical) Position data [long,lat,elev]
static double distanceRL(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the rhumb-line distance between two points, in meters.
static const CDataPosition UNDEFINED
Specific value for an undefined position.
void resetElevation()
Resets the elevation (to an undefined elevation)
void setPosition(double _fdLongitude, double _fdLatitude, double _fdElevation=UNDEFINED_ELEVATION)
Sets new coordinates.
static double distanceGC(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the WGS84-corrected great-circle distance between two points, in meters.
Generic overlay base (non-widget)
virtual void drawLine(const CChart *_poChart, QPainter *_pqPainter, const COverlayPoint *_poOverlayPoint)
Draws a line (between this and the other specified point), including distance/bearing data.
QPen qPenLine
QPen used to draw lines on this overlay.
QPen qPenText
QPen used to draw text on this overlay.
bool bVisible
Overlay items' global visibility status.
QBrush qBrushMarker
QBrush used to draw markers on this overlay.
QPen qPenMarker
QPen used to draw markers on this overlay.
void setPath(const CChart *_poChart, const QPointF &_rqPointFScrPosition)
Adds the given screen position to the pointer path.
double getPathLengthRL()
Returns the pointer path (rhumb-line) length along its segments.
virtual void setPosition(const QTreeWidgetItem *_pqTreeWidgetItem) const
Centers the chart on the given overlay object's position.
bool hasPath() const
Returns whether a pointer path has been defined.
int getPathSegments() const
Returns the quantity of segments along the pointer path (0 if no path is defined)
double getPathLengthGC()
Returns the equivalent (great-circle) length between the first and last position of the pointer path.
void importSettings()
Imports settings from the application's global settings.
CPointerPoint * usePointerTarget()
Returns the pointer point corresponding to the target.
virtual void drawContent(const CChart *_poChart, QPainter *_pqPainter) const
Draws this overlay's content.
void clearPath()
Clears the pointer path.
virtual ~CPointerOverlay()
void clearPosition(bool _bTarget=false)
Clears the mouse pointer or target.
virtual void showDetail(const QTreeWidgetItem *_pqTreeWidgetItem) const
Displays the given overlay object's details (in the appropriate widget/view)
CPointerPoint * usePointerPoint()
Returns the pointer point corresponding to the mouse pointer.
[UI] Pointer overlay point (item)
virtual void draw(const CChart *_poChart, QPainter *_pqPainter)
Draws this object (itself or its content)
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
QColor getColorPointer()
[Color] Returns the pointer overlay's base color
[UI] Vessel overlay point (item) / vessel
static CChartTable * useChartTable()
static CSettings * useSettings()