24 #include <QDomDocument>
27 #include <QGestureEvent>
29 #include <QMessageBox>
30 #include <QMouseEvent>
31 #include <QPinchGesture>
33 #include <QPrintDialog>
37 #include <QWheelEvent>
39 #include <QXmlStreamWriter>
58 : QTabWidget( _pqParent )
59 , bProjectModified( false )
60 , oGeoPositionReference()
61 , fdScaleReference( -1.0 )
63 , bIgnoreUpdate( true )
64 , bMousePressed( false )
66 , fdGestureTimeLast( 0.0 )
67 , fdGestureZoomReference( 0.0 )
68 , bPointerTarget( false )
69 , bPointerPath( false )
70 , bPointerPathSingle( false )
71 , poOverlayPointMove( 0 )
72 , poVesselPointSynchronize( 0 )
75 QWidget::setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
76 tabBar()->installEventFilter(
this );
83 QTabWidget::setTabPosition( QTabWidget::South );
84 QTabWidget::setMovable(
true );
85 QTabWidget::setTabsClosable(
true );
86 QTabWidget::setUsesScrollButtons(
true );
87 QTabWidget::setElideMode( Qt::ElideLeft );
88 connect( tabBar(), SIGNAL( tabCloseRequested(
int) ),
this, SLOT(
slotCloseTab(
int) ) );
89 connect( tabBar(), SIGNAL( currentChanged(
int) ),
this, SLOT(
slotChangeTab(
int) ) );
110 switch( _pqEvent->type() )
113 case QEvent::KeyPress:
117 if( _pqObject == tabBar() )
return false;
120 case QEvent::MouseButtonDblClick:
121 case QEvent::MouseButtonPress:
122 case QEvent::MouseButtonRelease:
123 case QEvent::MouseMove:
124 if( _pqObject != (QObject*)QTabWidget::currentWidget() )
return false;
128 case QEvent::Gesture:
129 if( _pqObject != (QObject*)QTabWidget::currentWidget() )
return false;
136 return QTabWidget::eventFilter( _pqObject, _pqEvent );
152 if( __qsFilename.isEmpty() )
return;
155 __pqMutexDataChange->lock();
157 __pqMutexDataChange->unlock();
158 load( __qsFilename );
166 if( __qsFilename.isEmpty() )
return;
167 QFileInfo __qFileInfo( __qsFilename );
168 if( __qFileInfo.suffix().isEmpty() ) __qsFilename +=
".qvct";
170 save( __qsFilename );
177 if( __qsFilename.isEmpty() )
return;
180 __pqMutexDataChange->lock();
182 __pqMutexDataChange->unlock();
193 if( QTabWidget::currentIndex() < 0 )
return;
196 && QMessageBox::warning( 0, tr(
"WARNING"),
197 tr(
"High-resolution printing is enabled!\nPrinting may take several seconds, during which the application will appear frozen.\nDo you want to proceed?"),
198 QMessageBox::Cancel|QMessageBox::Ok, QMessageBox::Cancel ) != QMessageBox::Ok )
return;
199 QPrinter __qPrinter( __bPrintHighRes ? QPrinter::HighResolution : QPrinter::ScreenResolution );
201 QPrintDialog* __pqPrintDialog =
new QPrintDialog( &__qPrinter );
202 __pqPrintDialog->addEnabledOption( QAbstractPrintDialog::PrintToFile );
203 int __iResult = __pqPrintDialog->exec();
204 delete __pqPrintDialog;
205 if( __iResult != QDialog::Accepted )
return;
209 __pqMutexDataChange->lock();
210 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
212 double __fdZoomScreen = __poChart->
getZoom();
215 iDpi = ( __qPrinter.paperRect( QPrinter::DevicePixel ).width() / __qPrinter.paperRect( QPrinter::Inch ).width() );
216 __poChart->
setDrawArea( QRectF( 0, 0, __qPrinter.pageRect( QPrinter::DevicePixel ).width(), __qPrinter.pageRect( QPrinter::DevicePixel ).height() ) );
219 __poChart->
print( &__qPrinter );
223 __poChart->
setZoom( __fdZoomScreen );
224 __pqMutexDataChange->unlock();
229 if( QTabWidget::currentIndex() < 0 )
return;
231 if( __qsFilename.isEmpty() )
return;
234 __pqMutexDataChange->lock();
236 __pqMutexDataChange->unlock();
255 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
267 int __iTabIndex = QTabWidget::currentIndex();
268 if( __iTabIndex >= 0 ) removeTab( __iTabIndex );
275 __pqMutexDataChange->lock();
277 removeTab( _iTabIndex );
279 if( QTabWidget::currentIndex() < 0 )
284 __pqMutexDataChange->unlock();
314 __pqMutexDataChange->lock();
316 __pqMutexDataChange->unlock();
325 __pqMutexDataChange->lock();
327 __pqMutexDataChange->unlock();
346 if( QTabWidget::currentIndex() < 0 )
return false;
347 bool __bReturn =
false;
348 bool __bControlKey = _pqKeyEvent->modifiers() & Qt::ControlModifier;
349 switch( _pqKeyEvent->key() )
353 case Qt::Key_Up:
stepScrPosition(
false,
false, __bControlKey ); __bReturn =
true;
break;
354 case Qt::Key_Right:
stepScrPosition(
true,
true, __bControlKey ); __bReturn =
true;
break;
355 case Qt::Key_Down:
stepScrPosition(
false,
true, __bControlKey ); __bReturn =
true;
break;
356 case Qt::Key_Left:
stepScrPosition(
true,
false, __bControlKey ); __bReturn =
true;
break;
358 case Qt::Key_Plus:
stepScale(
true, __bControlKey ); __bReturn =
true;
break;
359 case Qt::Key_Minus:
stepScale(
false, __bControlKey ); __bReturn =
true;
break;
361 case Qt::Key_Slash:
setScaleFit(); __bReturn =
true;
break;
369 if( QTabWidget::currentIndex() < 0 )
return false;
370 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
371 QPointF __qPointFMouse = _pqMouseEvent->localPos();
373 QPointF __qPointFMouse = _pqMouseEvent->posF();
375 int __iMouseButton = _pqMouseEvent->button();
376 switch( _pqMouseEvent->type() )
379 case QEvent::MouseButtonDblClick:
380 switch( __iMouseButton )
384 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
397 case Qt::RightButton:
405 case QEvent::MouseButtonPress:
406 switch( __iMouseButton )
412 case Qt::RightButton:
414 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
423 case QEvent::MouseButtonRelease:
424 if( __iMouseButton == Qt::LeftButton )
435 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
452 if( __poVesselPoint )
454 __oGeoPosition = *__poVesselPoint;
456 __poVesselOverlay->setCurrentItem( __poVesselPoint );
466 __oGeoPosition = *__poTrackPoint;
468 __poTrackOverlay->setCurrentItem( __poTrackPoint );
478 __oGeoPosition = *__poRoutePoint;
480 __poRouteOverlay->setCurrentItem( __poRoutePoint );
488 if( __poLandmarkPoint )
490 __oGeoPosition = *__poLandmarkPoint;
492 __poLandmarkOverlay->setCurrentItem( __poLandmarkPoint );
530 case QEvent::MouseMove:
540 if( __qPointFDelta.x()*__qPointFDelta.x() + __qPointFDelta.y()*__qPointFDelta.y() > 100 )
bMouseDrag =
true;
544 default:
return false;
552 if( QTabWidget::currentIndex() < 0 )
return false;
553 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
554 int __iMouseDelta = _pqWheelEvent->angleDelta().y() / 120;
556 int __iMouseDelta = _pqWheelEvent->delta() / 120;
558 if( !__iMouseDelta )
return true;
559 bool __bIncrease =
true;
560 if( __iMouseDelta < 0 ) { __bIncrease =
false; __iMouseDelta = -__iMouseDelta; }
561 for(
int __i=0; __i<__iMouseDelta; __i++ )
stepScale( __bIncrease,
true );
568 if( QTabWidget::currentIndex() < 0 )
return false;
569 bool __bReturn =
false;
570 QGesture* __pqGesture = _pqGestureEvent->gesture( Qt::PinchGesture );
576 QPinchGesture* __pqPinchGesture =
static_cast<QPinchGesture *
>(__pqGesture);
577 switch( __pqPinchGesture->state() )
580 case Qt::GestureStarted:
581 __pqPinchGesture->setGestureCancelPolicy( QGesture::CancelAllInContext );
582 _pqGestureEvent->accept( __pqPinchGesture );
586 case Qt::GestureUpdated:
587 case Qt::GestureFinished:
588 if( __pqPinchGesture->changeFlags() & QPinchGesture::ScaleFactorChanged )
611 int __iWidgetCurrentIndex = QTabWidget::currentIndex();
612 bool __bLocked = ((
CChart*)QTabWidget::currentWidget())->isPositionLocked();
614 for(
int __iWidgetIndex = count() - 1; __iWidgetIndex >= 0; __iWidgetIndex-- )
617 if( __iWidgetIndex != __iWidgetCurrentIndex && __bLocked && __poChart->
isPositionLocked() )
621 if( __iWidgetIndex == __iWidgetCurrentIndex && !_bSkipCurrent )
630 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
631 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
638 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
639 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
640 int __iXOffset = _bHorizontal ? ( _bIncrease ? 1 : -1 ) * ( _bBigStep ? __poChart->
getDrawArea().width()/5 : __poChart->
getDrawArea().width()/50 ) : 0;
641 int __iYOffset = !_bHorizontal ? ( _bIncrease ? 1 : -1 ) * ( _bBigStep ? __poChart->
getDrawArea().height()/5 : __poChart->
getDrawArea().height()/50 ) : 0;
647 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 || _rqPointFScrPositionOffset.isNull() )
return;
648 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
655 __poChart->
move( _rqPointFScrPositionOffset );
662 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
663 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
669 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
670 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
679 int __iWidgetCurrentIndex = QTabWidget::currentIndex();
680 bool __bLocked = ((
CChart*)QTabWidget::currentWidget())->isZoomLocked();
682 for(
int __iWidgetIndex = count() - 1; __iWidgetIndex >= 0; __iWidgetIndex-- )
685 if( __iWidgetIndex != __iWidgetCurrentIndex && __bLocked && __poChart->
isZoomLocked() )
689 if( __iWidgetIndex == __iWidgetCurrentIndex && !_bSkipCurrent )
700 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
706 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
707 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
713 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
714 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
721 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
722 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
729 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
730 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
737 if( count() < 1 )
return;
739 double __fdScale =
toScale( _fdZoom );
740 int __iWidgetCurrentIndex = QTabWidget::currentIndex();
741 bool __bLocked = ((
CChart*)QTabWidget::currentWidget())->isZoomLocked();
743 for(
int __iWidgetIndex = count() - 1; __iWidgetIndex >= 0; __iWidgetIndex-- )
746 if( __iWidgetIndex != __iWidgetCurrentIndex && __bLocked && __poChart->
isZoomLocked() )
750 if( __iWidgetIndex == __iWidgetCurrentIndex && !_bSkipCurrent )
761 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
771 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return false;
775 __poPointerOverlay->
setPosition( _roGeoPosition,
true );
778 ((
CChart*)QTabWidget::currentWidget())->update();
786 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
805 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return;
819 if(
bIgnoreUpdate || QTabWidget::currentIndex() < 0 )
return false;
832 __poPointerOverlay->
setPath( _roGeoPosition );
835 ((
CChart*)QTabWidget::currentWidget())->update();
882 for(
int __i = count() - 1; __i >= 0; __i-- )
901 QFileInfo __qFileInfo( _rqsFilename );
906 QFileInfo __qFileInfo( _rqsFilename );
907 QFile __qFile( __qFileInfo.absoluteFilePath() );
908 if( !__qFile.open( QIODevice::ReadOnly ) )
910 __qsError = QString(
"Failed to open file (%1)" ).arg( __qFile.fileName() );
913 QDomDocument __qDocDocument;
914 if( !__qDocDocument.setContent( &__qFile ) )
916 __qsError = QString(
"Failed to parse XML (%1)" ).arg( __qFile.fileName() );
923 QDomElement __qDomElement = __qDocDocument.documentElement();
924 QString __qDocType = __qDomElement.nodeName();
925 if( __qDomElement.isNull() || ( __qDocType !=
"QVCT" ) )
927 __qsError = QString(
"Invalid XML document type (%1); expected: 'QVCT'" ).arg( __qFile.fileName() );
935 QTabWidget::setCurrentIndex( 0 );
937 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
956 if( !__qsError.isEmpty() )
958 qCritical(
"ERROR[%s]: %s", Q_FUNC_INFO, qPrintable( __qsError ) );
966 QFileInfo __qFileInfo( _rqsFilename );
967 QString __qsFormat = __qFileInfo.suffix();
968 if( __qsFormat !=
"qvct" )
970 qCritical(
"ERROR[%s]: Invalid file format/extention (%s); expected: 'qvct'", Q_FUNC_INFO, qPrintable( __qsFormat ) );
975 QFile __qFile( __qFileInfo.absoluteFilePath() );
976 if( !__qFile.open( QIODevice::WriteOnly ) )
978 qCritical(
"ERROR[%s]: Failed to open file (%s)", Q_FUNC_INFO, qPrintable( __qFile.fileName() ) );
983 QXmlStreamWriter __qXmlStreamWriter( &__qFile );
984 __qXmlStreamWriter.setAutoFormatting(
true );
985 __qXmlStreamWriter.writeStartDocument();
988 __qXmlStreamWriter.writeStartElement(
"QVCT" );
999 __qXmlStreamWriter.writeEndElement();
1002 __qXmlStreamWriter.writeEndDocument();
1011 QDomElement __qDomElementChartTable = _rqDomElement.firstChildElement(
"ChartTable" );
1012 if( __qDomElementChartTable.isNull() )
return 0;
1013 if( __qDomElementChartTable.hasAttribute(
"longitude" ) && __qDomElementChartTable.hasAttribute(
"longitude" ) )
1016 __qDomElementChartTable.attribute(
"latitude" ).toDouble() );
1018 if( __qDomElementChartTable.hasAttribute(
"scale" ) )
1019 fdScaleReference = __qDomElementChartTable.attribute(
"scale" ).toDouble();
1022 for( QDomElement __qDomElementChart = __qDomElementChartTable.firstChildElement(
"Chart" );
1023 !__qDomElementChart.isNull();
1024 __qDomElementChart = __qDomElementChart.nextSiblingElement(
"Chart" ) )
1026 QString __qsFilename = __qDomElementChart.hasAttribute(
"file" ) ? __qDomElementChart.attribute(
"file" ) : __qDomElementChart.attribute(
"raster" );
1033 __poChart->
parseQVCT( __qDomElementChart );
1042 _rqXmlStreamWriter.writeStartElement(
"ChartTable" );
1049 _rqXmlStreamWriter.writeAttribute(
"scale", QString::number(
fdScaleReference ) );
1051 int __iCount = QTabWidget::count();
1052 for(
int __i = 0; __i < __iCount; __i++ )
1053 ((
CChart*)QTabWidget::widget( __i ))->dumpQVCT( _rqXmlStreamWriter );
1055 _rqXmlStreamWriter.writeEndElement();
1077 __poChart->installEventFilter(
this );
1082 QFileInfo __qFileInfo( _rqsFilename );
1083 addTab( __poChart, __qFileInfo.baseName() );
1084 setCurrentWidget( __poChart );
1090 if( QTabWidget::currentIndex() < 0 )
return;
1091 ((
CChart*)QTabWidget::currentWidget())->update();
1096 if( QTabWidget::currentIndex() < 0 )
return false;
1097 CChart* __poChart = (
CChart*)QTabWidget::currentWidget();
1105 if( QTabWidget::currentIndex() < 0 )
return false;
1106 return ((
CChart*)QTabWidget::currentWidget())->hasElevation();
1111 if( QTabWidget::currentIndex() < 0 )
return;
1119 if( !_poChart && QTabWidget::currentIndex() < 0 )
return 1;
1120 const CChart* __poChart = _poChart ? _poChart : (
CChart*)QTabWidget::currentWidget();
1130 double __fdZoom = 39.37*
iDpi * __poChart->
getResolution() / pow( 10, 4.0+4.0*_fdScale );
1138 if( !_poChart && QTabWidget::currentIndex() < 0 )
return 0;
1139 const CChart* __poChart = _poChart ? _poChart : (
CChart*)QTabWidget::currentWidget();
1140 double __fdScale = ( log10( 39.37*
iDpi * __poChart->
getResolution() / _fdZoom ) - 4.0 ) / 4.0;
[UI] Chart control user-interface
void enableControls(bool _bEnable)
Enables/disables all chart controls.
void stepScale(bool _bIncrease, bool _bBigStep=true)
Increases/decreases the scale by discrete steps.
void enablePointer(bool _bEnable)
Enables/disables pointer actions.
void setScale(double _fdScale)
Sets the scale at the given value.
void enableMeasureSingle(bool _bEnable)
Enables/disables single measurement.
void setElevation(bool _bHasElevation, bool _bShowElevation)
Sets elevation status.
void lockScale(bool _bLock)
Sets the scale lock/unlock status.
void enableTarget(bool _bEnable)
Enables/disables target.
void enableMeasure(bool _bEnable)
Enables/disables ongoing measurements.
void lockPosition(bool _bLock)
Sets the position lock/unlock status.
double fdGestureZoomReference
Reference zoom for pinch gesture.
int parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
double fdGestureTimeLast
Keep track of when a gesture event last occured.
virtual bool eventFilter(QObject *_pqObject, QEvent *_pqEvent)
void slotLoad()
[UI:Slot] Slot to load a full project's content from file
int iDpi
Resolution, in Dots-per-Inch (DPI)
void slotSave()
[UI:Slot] Slot to save the full project's content to file
void setOverlayPointMove(COverlayPoint *_poOverlayPoint)
Sets the overlay point to be moved (and lock all other actions while it is ongoing)
double toZoom(double _fdScale, const CChart *_poChart=0)
Converts the given scale factor to zoom factor (for the current position and - by default - the curre...
bool extendPointerPath(const CDataPosition &_roGeoPosition)
Extends the pointer path; returns true if is was actually extended, false otherwise.
void enablePointerTarget(bool _bEnable)
Enables/disables pointer target.
double fdScaleReference
Reference scale factor (shared by all "locked" maps)
QPointF qPointFMouse
Mouse position (saved dragging purposes)
COverlayObject * poOverlayObjectSelected
Currently selected overlay object.
bool handlerKeyEvent(QKeyEvent *_pqKeyEvent)
Key events handler.
void showElevation(bool _bShow)
Display elevation data (instead of raster data) of the currently selected chart (if any)
void setPositionHome()
Sets the reference chart (geographical) position to the current chart's center position.
void slotVesselPointDestroyed(QObject *_pqObject)
[APP:Slot] Slot to handle vessel point destruction
void setVesselPointSynchronize(CVesselPoint *_poVesselPoint)
Sets the vessel point used to synchronize the chart reference (geographical) position.
bool bProjectModified
Flag to track project changes (and trigger user confirmation before discarding unsaved data)
double toScale(double _fdZoom, const CChart *_poChart=0)
Converts the given zoom factor to scale factor (for the current position and - by default - the curre...
bool handlerMouseEvent(QMouseEvent *_pqMouseEvent)
Mouse events handler.
void slotChangeTab(int _iTabIndex)
[UI:Slot] Slot to handle active tab change
void setZoom(double _fdZoom, bool _bSkipCurrent=false, bool _bUpdateControl=true)
Sets the reference zoom factor.
void lockScale(bool _bLock)
Sets the scale lock/unlock status.
void constructLayout()
Constructs the layout of the user-interface.
CChartTable(QWidget *_pqParent=0)
CVesselPoint * poVesselPointSynchronize
Vessel point to synchronize to.
void setScale(double _fdScale, bool _bSkipCurrent=false, bool _bUpdateControl=true)
Sets the reference scale factor.
void slotPointerTarget(bool _bEnable)
[UI:Slot] Slot to enable/disable pointer target
bool bIgnoreUpdate
Flag that disables position, scale and pointer updates.
bool bMousePressed
Mouse-pressed status.
void lockPosition(bool _bLock)
Sets the position lock/unlock status.
void setScaleFit()
Sets the reference scale factor to match the current chart's "fit" scale (entire chart visible)
void synchronizeVesselPoint()
Synchronize the reference chart (geographical) position with the designed vessel.
void setScaleArea(const CDataPosition &_roGeoPosition1, const CDataPosition &_roGeoPosition2, double _fdScaleCorrection=1.0)
Sets the reference scale factor to display the given (geographical) area (defined by its opposite cor...
virtual QSize sizeHint() const
void slotLoadChart()
[UI:Slot] Slot to load a new chart
void stepScale(bool _bIncrease, bool _bBigStep=true)
Discretely increases/decreases the reference scale factor.
CDataPosition oGeoPositionReference
Reference chart (geographical) position (shared by all "locked" maps)
bool bMouseDrag
Mouse-drag status.
COverlayPoint * poOverlayPointMove
Overlay point being moved (non-0 only when a move is being performed)
void stepScrPosition(bool _bHorizontal, bool _bIncrease, bool _bBigStep=true)
Discretely move the reference chart (geographical) position.
bool bPointerPathSingle
Pointer single-segment path status.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
bool bPointerPath
Pointer path status.
bool handlerGestureEvent(QGestureEvent *_pqGestureEvent)
Gesture events handler.
void updateChart()
Update the (current) chart content (on screen)
bool setPointerTarget(const CDataPosition &_roGeoPosition)
Sets the pointer target's position; returns true if is was actually set, false otherwise.
void slotCloseTab()
[UI:Slot] Slot to close the current tab
void slotScaleFit()
[UI:Slot] Slot to trigger scaling to "fit" scale
void showGeoPosition(const CDataPosition &_roGeoPosition)
Shows the given (geographical) position on chart.
void slotPointerPathSingle(bool _bEnable)
[UI:Slot] Slot to enable/disable single measurement (pointer path)
void slotPointerPath(bool _bEnable)
[UI:Slot] Slot to enable/disable ongoing measurements (pointer path)
void load(const QString &_rqsFilename)
Load a full project's content from the given file.
void slotAddElevation()
[UI:Slot] Slot to add elevation data to the currently displayed chart
void enablePointerPathSingle(bool _bEnable)
Enables/disables single measurement (pointer path)
void slotScaleActual()
[UI:Slot] Slot to trigger scaling to "actual" scale
void dragScrPosition(const QPointF &_rqPointFScrPositionOffset)
Moves the reference chart (geographical) position according to the given screen offset.
bool handlerWheelEvent(QWheelEvent *_pqWheelEvent)
Wheel events handler.
bool bPointerTarget
Pointer target status.
CChart * loadChart(const QString &_rqsFilename)
Load the given chart from file.
void setScaleActual()
Sets the reference scale factor to match the current chart's "actual" scale (1:1 zoom)
void setGeoPosition(const CDataPosition &_roGeoPosition, bool _bSkipCurrent=false)
Sets the reference chart (geographical) position.
void slotPrintChart()
[UI:Slot] Slot to print the currently displayed chart
bool hasElevation()
Returns whether the currently selected chart has been associated elevation data (if any)
void setOverlayObjectSelected(COverlayObject *_poOverlayObject)
Sets the currently selected overlay object.
bool addElevation(const QString &_rqsFilename)
Add elevation data to the currently displayed chart (if any)
void enablePointerPath(bool _bEnable)
Enables/disables ongoing measurements (pointer path)
void save(const QString &_rqsFilename) const
Save the full project's content to the given file.
void resetVesselPointSynchronize()
Resets (clears) the vessel point used to synchronize the chart reference (geographical) position.
bool hasElevation() const
Returns whether this chart has been associated elevation model data.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
void lockZoom(bool _bLock)
Sets the zoom lock status.
bool isPositionLocked() const
Returns the position lock status.
bool isZoomLocked() const
Returns the zoom lock status.
double getZoomFit() const
Returns the zoom factor allowing to view the entire chart.
double getZoom() const
Returns the current zoom factor.
double getZoomActual() const
Returns the zoom factor corresponding to a 1:1 dataset/screen pixels ratio.
void print(QPrinter *_pqPrinter)
Prints the chart.
double getResolution() const
Returns the resolution of the chart at its current position, in meters per pixel [m/px].
void move(const QPointF &_rqPointFDrawPositionOffset)
Move the current (center) chart position by specified offset (in the draw area)
bool isElevationShowed() const
Returns the elevation model show status.
QRectF getDrawArea() const
Returns the viewport draw area.
void setZoom(double _fdZoom)
Sets the current zoom factor.
void setGeoPosition(const CDataPosition &_roGeoPosition)
Sets the current (center) position (geographical coordinates) of the chart.
QVCT::EStatus getStatus() const
Returns the internal status of the object.
CDataPosition getGeoPosition() const
Returns the current (center) position (geographical coordinates) of the chart.
void lockPosition(bool _bLock)
Sets the position lock status.
void setDrawArea(QRectF _qRectFDrawArea)
Sets the viewport draw area.
void resetDrawArea()
Resets the viewport draw area (to the widget's area)
QPointF toDrawPosition(const CDataPosition &_roGeoPosition) const
Converts the given (geographical) position [long,lat,elev] to chart draw point [px].
CDataPosition toGeoPosition(const QPointF &_rqPointFDrawPosition) const
Converts the given chart draw position to geographical position.
double getZoomArea(const CDataPosition &_roGeoPosition1, const CDataPosition &_roGeoPosition2) const
Returns the zoom factor allowing to view the given geographical area (defined by its opposite corners...
void addElevation(const QString &_rqsFileName)
Add elevation model data to chart.
CDataPosition getGeoPositionCenter() const
Returns the center position (geographical coordinates) of the chart.
(Geographical) Position data [long,lat,elev]
double getLongitude() const
Returns this position's longitude, in degrees.
void resetPosition()
Resets all coordinates (to an undefined position)
double getElevation() const
Returns this position's elevation, 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.
[UI] Landmark overlay container
virtual COverlayPoint * matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns the overlay's point that (first) matches the given screen position (0 if none is found)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, CLandmarkContainer *_poLandmarkContainer=0, bool _bProjectDump=false) const
Stores this object's content to the given QVCT destination (file)
int parseQVCT(const QDomElement &_rqDomElement, CLandmarkContainer **_ppoLandmarkContainer=0)
Retrieves this object's content from the given QVCT source (file)
void clear()
Clear the entire content of this overlay.
[UI] Landmark overlay point (item)
void toggleMultiSelected()
Toggles this landmark's selection status.
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
void fileError(QVCT::EFileOperation _eFileOperation, const QString &_rqsFilename)
Displays a generic error message for an invalid file name and operation (open/save)
QString fileDialog(QVCT::EFileOperation _eFileOperation, const QString &_rqsTitle, const QString &_rqsFilter)
Displays a generic dialog to pick a file for the given operation (open/save)
virtual COverlay * useOverlay()=0
Returns this object's (base) overlay.
virtual void showDetail()=0
Displays this object's details (in the appropriate widget/view)
void forceRedraw()
Forces this overlay's rendering (not matter its cache content)
void setPath(const CChart *_poChart, const QPointF &_rqPointFScrPosition)
Adds the given screen position to the pointer path.
virtual void setPosition(const QTreeWidgetItem *_pqTreeWidgetItem) const
Centers the chart on the given overlay object's position.
int getPathSegments() const
Returns the quantity of segments along the pointer path (0 if no path is defined)
CPointerPoint * usePointerTarget()
Returns the pointer point corresponding to the target.
void clearPath()
Clears the pointer path.
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.
virtual void refreshContent()
Refreshes the content of the underlying widget.
[UI] Pointer overlay point (item)
[UI] Route overlay container
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, CRouteContainer *_poRouteContainer=0, bool _bProjectDump=false) const
Stores this object's content to the given QVCT destination (file)
virtual COverlayPoint * matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns the overlay's point that (first) matches the given screen position (0 if none is found)
void clear()
Clear the entire content of this overlay.
int parseQVCT(const QDomElement &_rqDomElement, CRouteContainer **_ppoRouteContainer=0)
Retrieves this object's content from the given QVCT source (file)
[UI] Route overlay point (item) / waypoint
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
void toggleMultiSelected()
Toggles this waypoint's selection status.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves parameters from the given QVCT source (file)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, bool _bProjectDump=false) const
Stores parameters to the given QVCT destination (file)
bool isPrintHighRes()
[Misc] Returns the high-resolution printing status
int getScreenDpi()
[Misc] Returns the screen Dots-per-Inch (DPI)
[UI] Track overlay container
void clear()
Clear the entire content of this overlay.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, CTrackContainer *_poTrackContainer=0, bool _bProjectDump=false) const
Stores this object's content to the given QVCT destination (file)
virtual COverlayPoint * matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns the overlay's point that (first) matches the given screen position (0 if none is found)
int parseQVCT(const QDomElement &_rqDomElement, CTrackContainer **_ppoTrackContainer=0)
Retrieves this object's content from the given QVCT source (file)
[UI] Track overlay point (item)
void toggleMultiSelected()
Toggles this track point's selection status.
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
[UI] Vessel overlay container
virtual COverlayPoint * matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns the overlay's point that (first) matches the given screen position (0 if none is found)
void clear()
Clear the entire content of this overlay.
int parseQVCT(const QDomElement &_rqDomElement, CVesselContainer **_ppoVesselContainer=0)
Retrieves this object's content from the given QVCT source (file)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, CVesselContainer *_poVesselContainer=0, bool _bProjectDump=false) const
Stores this object's content to the given QVCT destination (file)
[UI] Vessel overlay point (item) / vessel
void toggleMultiSelected()
Toggles this vessel's selection status.
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
static CPointerOverlay * usePointerOverlay()
static CPointerPointDetailView * usePointerPointDetailView()
static CVesselOverlay * useVesselOverlay()
static QMutex * useMutexDataChange()
static CRouteOverlay * useRouteOverlay()
static CChartControl * useChartControl()
static CMainWindow * useMainWindow()
static CSettings * useSettings()
static CLandmarkOverlay * useLandmarkOverlay()
static CTrackOverlay * useTrackOverlay()
double microtime()
Returns the system time with microseconds resolution, in seconds.