24 #include <QDomElement>
27 #include <QXmlStreamWriter>
50 , bDynamic( _bDynamic )
57 , iSatelliteCount( 0 )
60 , iTrackRecordRate( 1 )
61 , bTrackRecord(false )
62 , fdTrackRecordTimeLast( -9999.0 )
63 , fdTrackRecordBearingLast(
CDataCourse::UNDEFINED_BEARING )
65 QTreeWidgetItem::setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled );
82 QTreeWidgetItem::setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled );
90 QTreeWidgetItem* __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 0 );
91 while( __pqTreeWidgetItem )
94 __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 0 );
118 static const QPointF __qPointFSymbol(-32,-32);
119 static const QSize __qSizeSymbol(32,32);
132 COverlayCourse::drawMarker( _poChart, _pqPainter,
this, __poOverlayObjectSelected ==
this || __poOverlayObjectSelected == QTreeWidgetItem::parent() );
153 if( __poVesselPointEditView->exec() == QDialog::Accepted )
159 delete __poVesselPointEditView;
199 int __iCount = QTreeWidgetItem::childCount();
200 if( !__iCount )
return false;
201 for(
int __i = 0; __i < __iCount; __i++ )
221 if( !__poTrackContainer )
223 qCritical(
"ERROR[%s]: Failed to create new track for recording", Q_FUNC_INFO );
227 if( !__poTrackSubContainer )
229 qCritical(
"ERROR[%s]: Failed to create new segment for recording", Q_FUNC_INFO );
245 int __iCount = QTreeWidgetItem::childCount();
246 for(
int __i = 0; __i < __iCount; __i++ )
252 int __iCount = QTreeWidgetItem::childCount();
253 for(
int __i = 0; __i < __iCount; __i++ )
259 bool __bUpdateChart =
false;
270 __bUpdateChart =
true;
289 bool __bSkipBearing =
false;
294 if( __fdDeltaBearing > 180.0 ) __fdDeltaBearing = 360.0 - __fdDeltaBearing;
295 if( __fdDeltaBearing < __poSettings->getMinValueBearing() ) __bSkipBearing =
true;
297 bool __bSkipDistance =
false;
299 if( __poTrackPointLast
301 if( __bSkipBearing && __bSkipDistance )
break;
306 if( __qsName.isEmpty() ) __qsName = __poTrackSubContainer->
newChildName( tr(
"Point"), 3,
true );
317 __bUpdateChart =
true;
337 if( _rqDomElement.hasAttribute(
"longitude" ) && _rqDomElement.hasAttribute(
"longitude" ) )
340 _rqDomElement.attribute(
"latitude" ).toDouble(),
343 QString __qsTime = _rqDomElement.attribute(
"time" );
344 if( !__qsTime.isEmpty() )
350 qsType = _rqDomElement.attribute(
"type" );
351 qsSymbol = _rqDomElement.attribute(
"symbol" );
352 qsUrl = _rqDomElement.attribute(
"url" );
353 qsDescription = _rqDomElement.firstChildElement(
"Description" ).text();
354 qsComment = _rqDomElement.firstChildElement(
"Comment" ).text();
357 QDomElement __qDomElementCourse = _rqDomElement.firstChildElement(
"Course" );
358 if( !__qDomElementCourse.isNull() )
360 QDomElement __qDomElement = __qDomElementCourse.firstChildElement(
"Ground" );
361 if( !__qDomElement.isNull() )
367 __qDomElement = __qDomElementCourse.firstChildElement(
"Apparent" );
368 if( !__qDomElement.isNull() )
388 for( QDomElement __qDomElementDevice = _rqDomElement.firstChildElement(
"Device" );
389 !__qDomElementDevice.isNull();
390 __qDomElementDevice = __qDomElementDevice.nextSiblingElement(
"Device" ) )
392 QString __qsName = __qDomElementDevice.attribute(
"name" );
393 QString __qsSourceName = __qDomElementDevice.attribute(
"source" );
395 if( __poVesselPointDevice ) __poVesselPointDevice->
parseQVCT( __qDomElementDevice );
396 QTreeWidgetItem::addChild( __poVesselPointDevice );
405 _rqXmlStreamWriter.writeStartElement(
"Vessel" );
407 if( !
qsName.isEmpty() ) _rqXmlStreamWriter.writeAttribute(
"name",
qsName );
418 #if QT_VERSION < 0x040800
419 _rqXmlStreamWriter.writeAttribute(
"time", QDateTime::fromTime_t(
CDataTime::getTime() ).toUTC().toString( Qt::ISODate )+
"Z" );
421 _rqXmlStreamWriter.writeAttribute(
"time", QDateTime::fromTime_t(
CDataTime::getTime() ).toUTC().toString( Qt::ISODate ) );
424 if( !
qsType.isEmpty() ) _rqXmlStreamWriter.writeAttribute(
"type",
qsType );
426 if( !
qsSymbol.isEmpty() ) _rqXmlStreamWriter.writeAttribute(
"symbol",
qsSymbol );
428 if( !
qsUrl.isEmpty() ) _rqXmlStreamWriter.writeAttribute(
"url",
qsUrl );
432 _rqXmlStreamWriter.writeStartElement(
"Description" );
434 _rqXmlStreamWriter.writeEndElement();
439 _rqXmlStreamWriter.writeStartElement(
"Comment" );
440 _rqXmlStreamWriter.writeCDATA(
qsComment );
441 _rqXmlStreamWriter.writeEndElement();
446 _rqXmlStreamWriter.writeStartElement(
"Course" );
449 _rqXmlStreamWriter.writeStartElement(
"Ground" );
456 _rqXmlStreamWriter.writeEndElement();
460 _rqXmlStreamWriter.writeStartElement(
"Apparent" );
467 _rqXmlStreamWriter.writeEndElement();
469 _rqXmlStreamWriter.writeEndElement();
472 int __iCount = QTreeWidgetItem::childCount();
473 for(
int __i = 0; __i < __iCount; __i++ )
476 __poVesselPointDevice->
dumpQVCT( _rqXmlStreamWriter );
479 _rqXmlStreamWriter.writeEndElement();
void synchronizeVesselPoint()
Synchronize the reference chart (geographical) position with the designed vessel.
COverlayObject * getOverlayObjectSelected() const
Returns the currently selected overlay object.
void updateChart()
Update the (current) chart content (on screen)
void setOverlayObjectSelected(COverlayObject *_poOverlayObject)
Sets the currently selected overlay object.
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].
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.
void setValiditySpeed(double _fdTimeLastSpeed, double _fdErrorSpeed, bool _bInvalidSpeed=false)
Sets the horizontal speed's validity parameters.
void setValiditySpeedVertical(double _fdTimeLastSpeedVertical, double _fdErrorSpeedVertical, bool _bInvalidSpeedVertical=false)
Sets the vertical speed's validity parameters.
void setValidityBearing(double _fdTimeLastBearing, double _fdErrorBearing, bool _bInvalidBearing=false)
Sets the bearing's validity parameters.
(Geographical) Course data [bearing, horizontal/vertical speeds]
void setBearing(double _fdBearing)
Sets this course's bearing, in degrees.
void setSpeed(double _fdSpeed, double _fdSpeedVertical=UNDEFINED_SPEED)
Sets this course's horizontal 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.
void setSpeedVertical(double _fdSpeedVertical)
Sets this course's vertical speed, in meters per second.
double getBearing() const
Returns this course's bearing, in degrees.
static const CDataCourse UNDEFINED
Specific value for an undefined course.
double getSpeed() const
Returns this course's horizontal speed, in meters per second.
void setValidityElevation(double _fdTimeLastElevation, double _fdErrorElevation, bool _bInvalidElevation=false)
Sets the elevation's validity parameters.
void setValidityPosition(double _fdTimeLastPosition, double _fdErrorPosition, bool _bInvalidPosition=false)
Sets the position's validity parameters.
(Geographical) Position data [long,lat,elev]
double getLongitude() const
Returns this position's longitude, in degrees.
double getElevation() const
Returns this position's elevation, in meters.
static double distanceRL(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the rhumb-line distance between two points, in meters.
double getLatitude() const
Returns this position's latitude, in degrees.
static const CDataPosition UNDEFINED
Specific value for an undefined position.
void setPosition(double _fdLongitude, double _fdLatitude, double _fdElevation=UNDEFINED_ELEVATION)
Sets new coordinates.
static constexpr double UNDEFINED_ELEVATION
Specific value for an undefined elevation.
void setValidityTime(double _fdTimeLastTime, double _fdErrorTime, bool _bInvalidTime=false)
Sets the time's validity parameters.
static const CDataTime UNDEFINED
Specific value for an undefined time object.
void setTime(double _fdTime)
Sets the time, in seconds from Unix epoch.
double getTime() const
Returns this time's time, in seconds from Unix epoch.
static constexpr double UNDEFINED_TIME
Specific value for an undefined time.
static constexpr double UNDEFINED_VALUE
Dilution-of-Precision (DOP) data.
static const double UNDEFINED_VALUE
Specific value for an undefined component.
Fix data [source,time,position,course,DOPs,...].
QString getTypeString() const
Returns the fix type as a human-friendly string.
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.
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)
void switchView(EView eView)
Displays the requested container/item details (switching to the appropriate widget)
@ VESSEL_POINT
Vessel point.
void switchView(EView eView)
Displays the requested overlay (switching to the appropriate tab)
void setOverlayObject(COverlayObject *_poOverlayObject)
Sets the overlay object to be displayed (and refreshes the underlying widget)
QString getName() const
Returns this object's name.
QString newChildName(const QString &_rqsName, int _iZeroPrefix=0, bool _bForceSuffix=false) const
Returns a valid (non-duplicate) name for a new sibling of this object.
QString qsName
Object name.
virtual bool matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns whether this point matches the given screen position.
virtual void drawSymbol(const CChart *_poChart, QPainter *_pqPainter, const QString &_rqsSymbol)
Draws the symbol (user-defined)
virtual void drawTag(const CChart *_poChart, QPainter *_pqPainter, ETagPosition _eTagPosition=TAG_AUTO, const CDataTimeValidity *_poDataTimeValidity=0, const CDataPositionValidity *_poDataPositionValidity=0)
Draws the tag (name)
void setVisibility(int _iVisibilityCode)
Sets the global (coded) visibility status.
virtual void toggleVisibility(bool _bIncludeCourse, bool _bIncludeRouting)
Toggle the visibility status.
bool bVisible
Global (marker) visibility status.
int getVisibility() const
Returns the global (coded) visibility status.
void forceRedraw()
Forces this overlay's rendering (not matter its cache content)
CPointerPoint * usePointerTarget()
Returns the pointer point corresponding to the target.
[UI] Container for the application's settings
double getMinValuePosition()
[MinValue] Returns the minimum (absolute) position (delta), in meters
[UI] Track overlay container
CTrackSubContainer * addSubContainer()
Add a new sub-container to this container.
CTrackContainer * pickContainer(const QString &_rqsName)
Returns a track (container) matching the given name.
CTrackSubContainer * pickSubContainer(const QString &_rqsName)
Returns the last/current segment (sub-container) of the track (container) matching the given name.
[UI] Track overlay point (item)
void setDopPositional(double _fdDopPositional)
Sets this track point's positional Dilution-of-Precision (PDOP)
void setSatelliteCount(int _iSatelliteCount)
Sets this track point's satellite count.
void setFixType(const QString &_rqsFixType)
Sets this track point's fix type.
void setDopVertical(double _fdDopVertical)
Sets this track point's vertical Dilution-of-Precision (VDOP)
void setDopHorizontal(double _fdDopHorizontal)
Sets this track point's horizontal Dilution-of-Precision (HDOP)
[UI] Track overlay sub-container
CTrackPoint * getLastPoint()
Returns the last track (item/point) from this sub-container (0 if none is found)
CTrackPoint * addPoint(const QString &_rqsName, const CDataPosition &_roDataPosition=CDataPosition::UNDEFINED)
Add a new track (item/point) to this sub-container.
static QString toString(double _fdValue, CUnitTimeZone::EUnit _eUnitTimeZone, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
@ SELECT
Vessel selection status.
@ VISIBLE
Vessel visibility status.
virtual void refreshContent()
Refreshes the content of the underlying widget.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
bool connectDevice()
Connects to the actual device.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
[UI] Vessel point's (item) edit view
int eFixType
Vessel point's fix type.
void toggleMultiSelected()
Toggles this vessel's selection status.
void disconnectDevice()
Disconnects all children devices.
double fdTrackRecordBearingLast
Vessel's track last recorded bearing.
bool isDeviceConnected() const
Returns whether this vessel's devices are all connected.
void onDeviceDataFix()
Handled changes triggered by child devices.
double fdTrackRecordTimeLast
Vessel's track last recording time.
double fdDopHorizontal
Vessel point's horizontal Dilution-of-Precision (HDOP)
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
virtual bool matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns whether this point matches the given screen position.
bool bTrackRecord
Vessel's track recording status.
double fdDopVertical
Vessel point's vertical Dilution-of-Precision (VDOP)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
int iTrackRecordRate
Vessel's track recording rate, in seconds.
virtual void toggleVisibility()
int iSatelliteCount
Vessel point's satellites count.
virtual void showEdit()
Displays this object's edit widget/view.
QString qsUrl
Vessel's URL.
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
QString qsComment
Vessel's comment.
QString qsType
Vessel's type.
void connectDevice()
Connects all children devices.
bool bDynamic
Dynamic flag (vessel automatically generated by a dynamic flotilla)
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
bool setTrackRecord(bool _bTrackRecord)
Sets this vessel's track recording status.
CVesselPoint(const QString &_rqsName, bool _bDynamic=false)
QString qsDescription
Vessel's description.
virtual void draw(const CChart *_poChart, QPainter *_pqPainter)
Draws this object (itself or its content)
QString qsSymbol
Vessel's symbol.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
static COverlayDetailView * useOverlayDetailView()
static CVesselPointDetailView * useVesselPointDetailView()
static CPointerOverlay * usePointerOverlay()
static CVesselOverlay * useVesselOverlay()
static COverlayListView * useOverlayListView()
static CChartTable * useChartTable()
static CSettings * useSettings()
static CTrackOverlay * useTrackOverlay()
double microtime()
Returns the system time with microseconds resolution, in seconds.