Qt Virtual Chart Table (QVCT)
CVesselPointDetailView.cpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 // QT
20 #include <QHBoxLayout>
21 #include <QLabel>
22 #include <QPushButton>
23 #include <QScrollArea>
24 #include <QStackedWidget>
25 #include <QVBoxLayout>
26 #include <QWidget>
27 
28 // QVCT
29 #include "QVCTRuntime.hpp"
31 #include "overlays/COverlayUrl.hpp"
35 
36 
37 //------------------------------------------------------------------------------
38 // CONSTRUCTORS / DESTRUCTOR
39 //------------------------------------------------------------------------------
40 
42  : COverlayObjectDetailView( _pqParent )
43  , bIgnoreUpdate( true )
44 {
46 }
47 
49 {
50  // Create the buttons
51  // ... visible
52  pqPushButtonVisible = new QPushButton( QIcon( ":icons/32x32/visible.png" ), "" );
53  pqPushButtonVisible->setToolTip( tr("Toggle this vessel's visibility") );
54  pqPushButtonVisible->setMaximumSize( 36, 34 );
55  pqPushButtonVisible->setEnabled( false );
56  QWidget::connect( pqPushButtonVisible, SIGNAL( clicked() ), this, SLOT( slotToggleVisible() ) );
57  // ... center
58  pqPushButtonCenter = new QPushButton( QIcon( ":icons/32x32/center.png" ), "" );
59  pqPushButtonCenter->setToolTip( tr("Center chart on this vessel") );
60  pqPushButtonCenter->setMaximumSize( 36, 34 );
61  pqPushButtonCenter->setEnabled( false );
62  QWidget::connect( pqPushButtonCenter, SIGNAL( clicked() ), this, SLOT( slotPositionCenter() ) );
63  // ... center (lock)
64  pqPushButtonCenterLock = new QPushButton( QIcon( ":icons/32x32/center_unlock.png" ), "" );
65  pqPushButtonCenterLock->setToolTip( tr("Center and lock chart on this vessel") );
66  pqPushButtonCenterLock->setMaximumSize( 36, 34 );
67  pqPushButtonCenterLock->setEnabled( false );
68  pqPushButtonCenterLock->setCheckable( true );
69  QWidget::connect( pqPushButtonCenterLock, SIGNAL( toggled(bool) ), this, SLOT( slotPositionCenterLock(bool) ) );
70  // ... edit
71  pqPushButtonEdit = new QPushButton( QIcon( ":icons/32x32/edit.png" ), "" );
72  pqPushButtonEdit->setToolTip( tr("Edit this vessel") );
73  pqPushButtonEdit->setMaximumSize( 36, 34 );
74  pqPushButtonEdit->setEnabled( false );
75  QWidget::connect( pqPushButtonEdit, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
76  // ... delete
77  pqPushButtonDelete = new QPushButton( QIcon( ":icons/32x32/delete.png" ), "" );
78  pqPushButtonDelete->setToolTip( tr("Delete this vessel") );
79  pqPushButtonDelete->setMaximumSize( 36, 34 );
80  pqPushButtonDelete->setEnabled( false );
81  QWidget::connect( pqPushButtonDelete, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
82  // // ... Add landmark
83  // pqPushButtonAddLandmark = new QPushButton( QIcon( ":icons/32x32/landmark_add.png" ), "" );
84  // pqPushButtonAddLandmark->setToolTip( tr("Create a new landmark at the vessel position") );
85  // pqPushButtonAddLandmark->setMaximumSize( 36, 34 );
86  // pqPushButtonAddLandmark->setEnabled( false );
87  // QWidget::connect( pqPushButtonAddLandmark, SIGNAL( clicked() ), this, SLOT( slotAddLandmark() ) );
88  // // ... Add route
89  // pqPushButtonAddRoute = new QPushButton( QIcon( ":icons/32x32/route_add.png" ), "" );
90  // pqPushButtonAddRoute->setToolTip( tr("Create a new (route) waypoint at the vessel position") );
91  // pqPushButtonAddRoute->setMaximumSize( 36, 34 );
92  // pqPushButtonAddRoute->setEnabled( false );
93  // QWidget::connect( pqPushButtonAddRoute, SIGNAL( clicked() ), this, SLOT( slotAddRoute() ) );
94  // ... Track recording status
95  pqPushButtonTrackRecord = new QPushButton( QIcon( ":icons/32x32/track_stop.png" ), "" );
96  pqPushButtonTrackRecord->setToolTip( tr("Switch the track recording status for this vessel") );
97  pqPushButtonTrackRecord->setMaximumSize( 36, 34 );
98  pqPushButtonTrackRecord->setEnabled( false );
99  pqPushButtonTrackRecord->setCheckable( true );
100  QWidget::connect( pqPushButtonTrackRecord, SIGNAL( toggled(bool) ), this, SLOT( slotTrackRecord(bool) ) );
101  // ... Add device
102  pqPushButtonAddDevice = new QPushButton( QIcon( ":icons/32x32/device_add.png" ), "" );
103  pqPushButtonAddDevice->setToolTip( tr("Create a new device to slave this vessel's position and course") );
104  pqPushButtonAddDevice->setMaximumSize( 36, 34 );
105  pqPushButtonAddDevice->setEnabled( false );
106  QWidget::connect( pqPushButtonAddDevice, SIGNAL( clicked() ), this, SLOT( slotAddDevice() ) );
107 
108  // Create layout
109  QVBoxLayout* __pqVBoxLayout = new QVBoxLayout();
110 
111  // Add header
112  QFont __qFontHeader;
113  __qFontHeader.setPixelSize( 16 );
114  __qFontHeader.setBold( true );
115  QHBoxLayout* __pqHBoxLayoutHeader = new QHBoxLayout();
116  QLabel* __pqLabelIcon = new QLabel();
117  __pqLabelIcon->setPixmap( QPixmap( ":icons/32x32/vessel_point.png" ) );
118  __pqLabelIcon->setToolTip( tr("Vessel") );
119  __pqHBoxLayoutHeader->addWidget( __pqLabelIcon, 0, Qt::AlignTop );
120  poTextName = new COverlayText();
121  poTextName->setToolTip( tr("Name") );
122  poTextName->setFont( __qFontHeader );
123  poTextName->setWordWrap( true );
124  __pqHBoxLayoutHeader->addWidget( poTextName, 1 );
125  pqLabelSymbol = new QLabel();
126  pqLabelSymbol->setMaximumSize( 32, 32 );
127  pqLabelSymbol->setVisible( false );
128  __pqHBoxLayoutHeader->addWidget( pqLabelSymbol );
129  __pqVBoxLayout->addLayout( __pqHBoxLayoutHeader );
130 
131  // Add data
132  QFont __qFontData;
133  QTabWidget* __poTabWidget = new QTabWidget();
134  __poTabWidget->setTabPosition( QTabWidget::South );
135  __poTabWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
136 
137  // ... position
138  QWidget* __poWidgetPosition = new QWidget();
139  QVBoxLayout* __pqVBoxLayoutPosition = new QVBoxLayout();
140  __qFontData.setPixelSize( 20 );
142  poTextLongitude->setToolTip( tr("Longitude") );
143  poTextLongitude->setFont( __qFontData );
144  poTextLongitude->setIndent( 10 );
145  poTextLongitude->setAlignment( Qt::AlignHCenter );
147  __pqVBoxLayoutPosition->addWidget( poTextLongitude );
149  poTextLatitude->setToolTip( tr("Latitude") );
150  poTextLatitude->setFont( __qFontData );
151  poTextLatitude->setIndent( 10 );
152  poTextLatitude->setAlignment( Qt::AlignHCenter );
154  __pqVBoxLayoutPosition->addWidget( poTextLatitude );
156  poTextElevation->setToolTip( tr("Elevation") );
157  poTextElevation->setFont( __qFontData );
158  poTextElevation->setIndent( 10 );
159  poTextElevation->setAlignment( Qt::AlignHCenter );
161  __pqVBoxLayoutPosition->addWidget( poTextElevation, 1 );
162  __poWidgetPosition->setLayout( __pqVBoxLayoutPosition );
163  __poTabWidget->addTab( __poWidgetPosition, tr("Position") );
164 
165  // ... ground course
166  QWidget* __poWidgetGroundCourse = new QWidget();
167  QVBoxLayout* __pqVBoxLayoutGroundCourse = new QVBoxLayout();
168  __qFontData.setPixelSize( 20 );
170  poTextGroundBearing->setToolTip( tr("Ground Bearing") );
171  poTextGroundBearing->setFont( __qFontData );
172  poTextGroundBearing->setIndent( 10 );
173  poTextGroundBearing->setAlignment( Qt::AlignHCenter );
175  __pqVBoxLayoutGroundCourse->addWidget( poTextGroundBearing );
177  poTextGroundSpeed->setToolTip( tr("Ground Speed (horizontal)") );
178  poTextGroundSpeed->setFont( __qFontData );
179  poTextGroundSpeed->setIndent( 10 );
180  poTextGroundSpeed->setAlignment( Qt::AlignHCenter );
182  __pqVBoxLayoutGroundCourse->addWidget( poTextGroundSpeed );
184  poTextGroundSpeedVertical->setToolTip( tr("Ground Speed (vertical)") );
185  poTextGroundSpeedVertical->setFont( __qFontData );
186  poTextGroundSpeedVertical->setIndent( 10 );
187  poTextGroundSpeedVertical->setAlignment( Qt::AlignHCenter );
189  __pqVBoxLayoutGroundCourse->addWidget( poTextGroundSpeedVertical, 1 );
190  __poWidgetGroundCourse->setLayout( __pqVBoxLayoutGroundCourse );
191  __poTabWidget->addTab( __poWidgetGroundCourse, tr("Ground") );
192 
193  // ... apparent course
194  QWidget* __poWidgetApparentCourse = new QWidget();
195  QVBoxLayout* __pqVBoxLayoutApparentCourse = new QVBoxLayout();
196  __qFontData.setPixelSize( 20 );
198  poTextApparentBearing->setToolTip( tr("Apparent Bearing") );
199  poTextApparentBearing->setFont( __qFontData );
200  poTextApparentBearing->setIndent( 10 );
201  poTextApparentBearing->setAlignment( Qt::AlignHCenter );
203  __pqVBoxLayoutApparentCourse->addWidget( poTextApparentBearing );
205  poTextApparentSpeed->setToolTip( tr("Apparent Speed (horizontal)") );
206  poTextApparentSpeed->setFont( __qFontData );
207  poTextApparentSpeed->setIndent( 10 );
208  poTextApparentSpeed->setAlignment( Qt::AlignHCenter );
210  __pqVBoxLayoutApparentCourse->addWidget( poTextApparentSpeed );
212  poTextApparentSpeedVertical->setToolTip( tr("Apparent Speed (vertical)") );
213  poTextApparentSpeedVertical->setFont( __qFontData );
214  poTextApparentSpeedVertical->setIndent( 10 );
215  poTextApparentSpeedVertical->setAlignment( Qt::AlignHCenter );
217  __pqVBoxLayoutApparentCourse->addWidget( poTextApparentSpeedVertical, 1 );
218  __poWidgetApparentCourse->setLayout( __pqVBoxLayoutApparentCourse );
219  __poTabWidget->addTab( __poWidgetApparentCourse, tr("Apparent") );
220 
221  // ... date/time
222  QWidget* __poWidgetTime = new QWidget();
223  QVBoxLayout* __pqVBoxLayoutTime = new QVBoxLayout();
224  poTextDate = new COverlayText();
225  poTextDate->setToolTip( tr("Date") );
226  poTextDate->setFont( __qFontData );
227  poTextDate->setIndent( 10 );
228  poTextDate->setAlignment( Qt::AlignHCenter );
230  __pqVBoxLayoutTime->addWidget( poTextDate );
231  poTextTime = new COverlayText();
232  poTextTime->setToolTip( tr("Time") );
233  poTextTime->setFont( __qFontData );
234  poTextTime->setIndent( 10 );
235  poTextTime->setAlignment( Qt::AlignHCenter );
237  __pqVBoxLayoutTime->addWidget( poTextTime );
238  poTextTime2 = new COverlayText();
239  poTextTime2->setToolTip( tr("Time (alternate timezone)") );
240  poTextTime2->setFont( __qFontData );
241  poTextTime2->setIndent( 10 );
242  poTextTime2->setAlignment( Qt::AlignHCenter );
244  __pqVBoxLayoutTime->addWidget( poTextTime2, 1 );
245  __poWidgetTime->setLayout( __pqVBoxLayoutTime );
246  __poTabWidget->addTab( __poWidgetTime, tr("Time") );
247 
248  // ... info
249  QScrollArea* __poScrollAreaInfo = new QScrollArea();
250  __poScrollAreaInfo->setStyleSheet( ".QScrollArea, .QWidget { BACKGROUND-COLOR: rgba(0, 0, 0, 0); BORDER: none; }" );
251  __poScrollAreaInfo->setWidgetResizable( true );
252  QWidget* __poWidgetInfo = new QWidget();
253  QVBoxLayout* __pqVBoxLayoutInfo = new QVBoxLayout();
254  __qFontData.setPixelSize( 12 );
255  __qFontData.setBold( true );
256  poTextType = new COverlayText();
257  poTextType->setToolTip( tr("Type") );
258  poTextType->setFont( __qFontData );
259  poTextType->setIndent( 10 );
261  __pqVBoxLayoutInfo->addWidget( poTextType );
262  __qFontData.setBold( false );
264  poTextDescription->setToolTip( tr("Description") );
265  poTextDescription->setFont( __qFontData );
266  poTextDescription->setIndent( 10 );
267  poTextDescription->setWordWrap( true );
269  __pqVBoxLayoutInfo->addWidget( poTextDescription );
270  __qFontData.setPixelSize( 10 );
271  poTextComment = new COverlayText();
272  poTextComment->setToolTip( tr("Comment") );
273  poTextComment->setFont( __qFontData );
274  poTextComment->setIndent( 10 );
275  poTextComment->setWordWrap( true );
277  __pqVBoxLayoutInfo->addWidget( poTextComment );
278  poUrl = new COverlayUrl();
279  poUrl->setToolTip( tr("URL") );
280  poUrl->setFont( __qFontData );
281  poUrl->setIndent( 10 );
282  poUrl->setWordWrap( true );
283  poUrl->resetText();
284  __pqVBoxLayoutInfo->addWidget( poUrl, 1 );
285  __poWidgetInfo->setLayout( __pqVBoxLayoutInfo );
286  __poScrollAreaInfo->setWidget( __poWidgetInfo );
287  __poTabWidget->addTab( __poScrollAreaInfo, tr("Info") );
288 
289  // ... [end]
290  __pqVBoxLayout->addWidget( __poTabWidget, 1 );
291 
292  // Add separator
293  QFrame* __pqFrameSeparator = new QFrame();
294  __pqFrameSeparator->setFrameStyle( QFrame::HLine | QFrame::Sunken );
295  __pqVBoxLayout->addWidget( __pqFrameSeparator );
296 
297  // Add buttons
298  QHBoxLayout* __pqHBoxLayoutButtons = new QHBoxLayout();
299  __pqHBoxLayoutButtons->addWidget( pqPushButtonVisible, 0, Qt::AlignLeft );
300  __pqHBoxLayoutButtons->addWidget( pqPushButtonCenter, 0, Qt::AlignLeft );
301  __pqHBoxLayoutButtons->addWidget( pqPushButtonCenterLock, 1, Qt::AlignLeft );
302  __pqHBoxLayoutButtons->addWidget( pqPushButtonEdit, 0, Qt::AlignHCenter );
303  __pqHBoxLayoutButtons->addWidget( pqPushButtonDelete, 0, Qt::AlignHCenter );
304  // __pqHBoxLayoutButtons->addWidget( pqPushButtonAddLandmark, 1, Qt::AlignRight );
305  // __pqHBoxLayoutButtons->addWidget( pqPushButtonAddRoute, 0, Qt::AlignRight );
306  __pqHBoxLayoutButtons->addWidget( pqPushButtonTrackRecord, 1, Qt::AlignRight );
307  __pqHBoxLayoutButtons->addWidget( pqPushButtonAddDevice, 0, Qt::AlignRight );
308  __pqVBoxLayout->addLayout( __pqHBoxLayoutButtons );
309 
310  // Set the layout
311  COverlayObjectDetailView::setLayout( __pqVBoxLayout );
312 
313 }
314 
315 
316 //------------------------------------------------------------------------------
317 // METHODS: COverlayObjectDetailView (implement/override)
318 //------------------------------------------------------------------------------
319 
321 {
322  if( !poOverlayObject ) return;
323  CMainWindow* __poMainWindow = QVCTRuntime::useMainWindow();
324  CVesselPoint* __poVesselPoint = (CVesselPoint*)poOverlayObject;
325  poTextName->setText( __poVesselPoint->getName() );
326  QString __qsSymbol = __poVesselPoint->getSymbol();
327  if( __poMainWindow->symbolExists( __qsSymbol ) )
328  {
329  pqLabelSymbol->setPixmap( __poMainWindow->symbolPixmap( __qsSymbol ) );
330  pqLabelSymbol->setVisible( true );
331  }
332  else
333  {
334  pqLabelSymbol->setVisible( false );
335  }
336 
337  // ... position
338  if( __poVesselPoint->CDataPosition::operator!=( CDataPosition::UNDEFINED ) )
339  {
342  if( __poVesselPoint->getElevation() != CDataPosition::UNDEFINED_ELEVATION )
343  {
344  poTextElevation->setText( CUnitElevation::toString( __poVesselPoint->getElevation() ), !__poVesselPoint->isValidElevation() );
345  }
346  else
347  {
349  }
350  }
351  else
352  {
356  }
357 
358  // ... course
359  if( __poVesselPoint->GroundCourse.getBearing() != CDataCourse::UNDEFINED_BEARING )
362  if( __poVesselPoint->GroundCourse.getSpeed() != CDataCourse::UNDEFINED_SPEED )
368  if( __poVesselPoint->ApparentCourse.getBearing() != CDataCourse::UNDEFINED_BEARING )
371  if( __poVesselPoint->ApparentCourse.getSpeed() != CDataCourse::UNDEFINED_SPEED )
377 
378  // ... time
379  if( __poVesselPoint->getTime() != CDataTime::UNDEFINED_TIME )
380  {
381  double __fdTime = __poVesselPoint->getTime();
382  bool __bInvalid = !__poVesselPoint->isValidTime();
383  poTextDate->setText( CUnitDate::toString( __fdTime ), __bInvalid );
384  poTextTime->setText( CUnitTime::toString( __fdTime ), __bInvalid );
385  poTextTime2->setText( "("+CUnitTime::toString( __fdTime, true )+")", __bInvalid );
386  }
387  else
388  {
392  }
393 
394  // ... info
395  poTextType->setText( __poVesselPoint->getType() );
396  poTextDescription->setText( __poVesselPoint->getDescription() );
397  poTextComment->setText( __poVesselPoint->getComment() );
398  poUrl->setText( __poVesselPoint->getUrl() );
399 
400  // ... buttons
401  bIgnoreUpdate = true;
402  bool __bLocked = ( QVCTRuntime::useChartTable()->getVesselPointSynchronize() == __poVesselPoint );
403  pqPushButtonCenterLock->setChecked( __bLocked );
404  pqPushButtonCenterLock->setIcon( QIcon( __bLocked ? ":icons/32x32/center_lock.png" : ":icons/32x32/center_unlock.png" ) );
405  bool __bDynamic = __poVesselPoint->isDynamic();
406  pqPushButtonEdit->setEnabled( !__bDynamic );
407  pqPushButtonAddDevice->setEnabled( !__bDynamic );
408  bool __bTrackRecord = __poVesselPoint->isTrackRecording();
409  pqPushButtonTrackRecord->setChecked( __bTrackRecord );
410  pqPushButtonTrackRecord->setIcon( QIcon( __bTrackRecord ? ":icons/32x32/track_start.png" : ":icons/32x32/track_stop.png" ) );
411  bIgnoreUpdate = false;
412 }
413 
415 {
417  pqLabelSymbol->setVisible( false );
433  poUrl->resetText();
434 }
435 
437 {
438  if( poOverlayObject )
439  {
440  pqPushButtonVisible->setEnabled( true );
441  pqPushButtonCenter->setEnabled( true );
442  pqPushButtonCenterLock->setEnabled( true );
443  pqPushButtonDelete->setEnabled( true );
444  // pqPushButtonAddLandmark->setEnabled( true );
445  // pqPushButtonAddRoute->setEnabled( true );
446  pqPushButtonTrackRecord->setEnabled( true );
447  bIgnoreUpdate = false;
448  }
449 }
450 
452 {
453  pqPushButtonVisible->setEnabled( false );
454  pqPushButtonCenter->setEnabled( false );
455  pqPushButtonCenterLock->setEnabled( false );
456  pqPushButtonEdit->setEnabled( false );
457  pqPushButtonDelete->setEnabled( false );
458  // pqPushButtonAddLandmark->setEnabled( false );
459  // pqPushButtonAddRoute->setEnabled( false );
460  pqPushButtonTrackRecord->setEnabled( false );
461  pqPushButtonAddDevice->setEnabled( false );
462  bIgnoreUpdate = true;
463 }
464 
465 
466 //------------------------------------------------------------------------------
467 // METHODS
468 //------------------------------------------------------------------------------
469 
470 //
471 // SLOTS
472 //
473 
475 {
476  if( !poOverlayObject ) return;
477  CVesselPoint* __poVesselPoint = (CVesselPoint*)poOverlayObject;
478  bool __bVisible = __poVesselPoint->isVisible();
479  __poVesselPoint->toggleVisibility();
480  if( __bVisible != __poVesselPoint->isVisible() )
481  {
482  __poVesselPoint->setCheckState( CVesselOverlay::VISIBLE, __bVisible ? Qt::Unchecked : Qt::Checked );
483  }
484  __poVesselPoint->useOverlay()->forceRedraw();
487 }
488 
490 {
491  if( !poOverlayObject ) return;
492  CVesselPoint* __poVesselPoint = (CVesselPoint*)poOverlayObject;
493  QVCTRuntime::useChartTable()->setGeoPosition( *__poVesselPoint );
495 }
496 
498 {
499  if( !poOverlayObject || bIgnoreUpdate ) return;
500  CVesselPoint* __poVesselPoint = (CVesselPoint*)poOverlayObject;
501  if( _bLock )
502  {
503  pqPushButtonCenterLock->setIcon( QIcon( ":icons/32x32/center_lock.png" ) );
505  QVCTRuntime::useVesselPosition()->setVesselPoint( __poVesselPoint );
506  QVCTRuntime::useVesselCourse()->setVesselPoint( __poVesselPoint );
507  QVCTRuntime::useVesselTarget()->setVesselPoint( __poVesselPoint );
508  QVCTRuntime::useVesselCockpit()->setVesselPoint( __poVesselPoint );
511  }
512  else if( QVCTRuntime::useChartTable()->getVesselPointSynchronize() == __poVesselPoint )
513  {
514  pqPushButtonCenterLock->setIcon( QIcon( ":icons/32x32/center_unlock.png" ) );
522  }
523 }
524 
526 {
527  if( !poOverlayObject ) return;
528  ((CVesselPoint*)poOverlayObject)->showEdit();
530 }
531 
533 {
534  if( !poOverlayObject ) return;
535  if( !QVCTRuntime::useMainWindow()->deleteConfirm( poOverlayObject->getName() ) ) return;
536  QMutex* __pqMutexDataChange = QVCTRuntime::useMutexDataChange();
537  CVesselOverlay* __poVesselOverlay = QVCTRuntime::useVesselOverlay();
538  CVesselContainer* __poVesselContainer = (CVesselContainer*)((QTreeWidgetItem*)poOverlayObject)->parent();
539  CVesselPoint* __poVesselPoint = (CVesselPoint*)poOverlayObject;
540  __pqMutexDataChange->lock();
541  __poVesselContainer->removeChild( __poVesselPoint );
542  __pqMutexDataChange->unlock();
543  delete __poVesselPoint;
544  QTreeWidgetItem* __pqTreeWidgetItem = __poVesselOverlay->currentItem();
545  if( __pqTreeWidgetItem ) __poVesselOverlay->showDetail( __pqTreeWidgetItem );
546  __poVesselOverlay->forceRedraw();
549 }
550 
551 void CVesselPointDetailView::slotTrackRecord( bool _bTrackRecord )
552 {
553  if( !poOverlayObject || bIgnoreUpdate ) return;
554  bIgnoreUpdate = true;
555  CVesselPoint* __poVesselPoint = (CVesselPoint*)poOverlayObject;
556  _bTrackRecord = __poVesselPoint->setTrackRecord( _bTrackRecord );
557  pqPushButtonTrackRecord->setChecked( _bTrackRecord );
558  pqPushButtonTrackRecord->setIcon( QIcon( _bTrackRecord ? ":icons/32x32/track_start.png" : ":icons/32x32/track_stop.png" ) );
559  bIgnoreUpdate = false;
560 }
561 
563 {
564  if( !poOverlayObject ) return;
565  CVesselPointDevice* __poVesselPointDevice = 0;
566  CVesselPointDeviceCreateView* __poVesselPointDeviceCreateView = new CVesselPointDeviceCreateView( &__poVesselPointDevice );
567  __poVesselPointDeviceCreateView->exec();
568  if( __poVesselPointDevice )
569  {
570  ((CVesselPoint*)poOverlayObject)->addChild( __poVesselPointDevice );
571  QVCTRuntime::useVesselOverlay()->setCurrentItem( __poVesselPointDevice );
572  __poVesselPointDevice->showEdit();
573  __poVesselPointDevice->connectDevice();
574  __poVesselPointDevice->showDetail();
576  }
577  delete __poVesselPointDeviceCreateView;
578 }
void setProjectModified()
Sets the status of the project to modified (data have changed and need saving)
void setVesselPointSynchronize(CVesselPoint *_poVesselPoint)
Sets the vessel point used to synchronize the chart reference (geographical) position.
CVesselPoint * getVesselPointSynchronize() const
Returns the vessel defined to synchronize the chart reference (geographical) position.
void updateChart()
Update the (current) chart content (on screen)
void setGeoPosition(const CDataPosition &_roGeoPosition, bool _bSkipCurrent=false)
Sets the reference chart (geographical) position.
void resetVesselPointSynchronize()
Resets (clears) the vessel point used to synchronize the chart reference (geographical) position.
CDataCourse ApparentCourse
Apparent course.
CDataCourse GroundCourse
Ground course.
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.
double getSpeedVertical() const
Returns this course's vertical speed, in meters per second.
static constexpr double UNDEFINED_BEARING
Specific value for an undefined bearing.
Definition: CDataCourse.hpp:42
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
Definition: CDataCourse.hpp:44
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.
bool isValidElevation() const
Returns the elevation's (global) validity status.
double getLongitude() const
Returns this position's longitude, in degrees.
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.
static constexpr double UNDEFINED_ELEVATION
Specific value for an undefined elevation.
bool isValidTime() const
Returns the time's (global) validity status.
double getTime() const
Returns this time's time, in seconds from Unix epoch.
Definition: CDataTime.hpp:89
static constexpr double UNDEFINED_TIME
Specific value for an undefined time.
Definition: CDataTime.hpp:44
[UI] Application main window
Definition: CMainWindow.hpp:36
QPixmap symbolPixmap(const QString &_rqsSymbol)
Returns pixmap matching the given symbol (loaded from the application's symbol directory)
bool symbolExists(const QString &_rqsSymbol)
Returns whether the given symbol exists (in the application's symbol directory)
[UI] Generic overlay object's detail view
COverlayObject * poOverlayObject
Overlay object being displayed.
QString getName() const
Returns this object's name.
[UI] Overlay-specific text label
void setText(const QString &_rqsText)
[override] QLabel::setText( const QString& )
void resetText()
Resets (clears) the underlying QLabel's text.
[UI] Overlay-specific URL label
Definition: COverlayUrl.hpp:36
void setText(const QString &_rqsText)
Definition: COverlayUrl.cpp:51
bool isVisible() const
Returns the point's (marker) visibility status.
void forceRedraw()
Forces this overlay's rendering (not matter its cache content)
Definition: COverlay.hpp:115
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, CUnitTimeZone::EUnit _eUnitTimeZone, EUnit _eUnit)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
Definition: CUnitDate.cpp:71
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, EType _eType, 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...
Definition: CUnitSpeed.cpp:78
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...
Definition: CUnitTime.cpp:79
void setVesselPoint(CVesselPoint *_poVesselPoint)
Sets the vessel used to synchronize the instruments display.
void resetVesselPoint()
Resets (clears) the vessel used to synchronize the instruments display.
[UI] Vessel overlay container / flotilla
[UI] Vessel overlay container
@ VISIBLE
Vessel visibility status.
virtual void showDetail(const QTreeWidgetItem *_pqTreeWidgetItem) const
Displays the given overlay object's details (in the appropriate widget/view)
QPushButton * pqPushButtonAddDevice
[UI:Button] Add new device
COverlayText * poTextDescription
[UI:Label] Description
COverlayText * poTextApparentSpeed
[UI:Label] Apparent horizontal speed
QPushButton * pqPushButtonTrackRecord
[UI:Button] Track recording status
virtual void disableContent()
Disables the content (controls) of the underlying widget.
COverlayText * poTextDate
[UI:Label] Date
void slotPositionCenterLock(bool _bLock)
[UI:Slot] Slot to enable center lock (on this vessel)
void constructLayout()
Constructs the layout of the user-interface.
QPushButton * pqPushButtonEdit
[UI:Button] Edit
COverlayText * poTextApparentSpeedVertical
[UI:Label] Apparent vertical speed
COverlayUrl * poUrl
[UI:Label] URL
void slotTrackRecord(bool _bTrackRecord)
[UI:Slot] Slot to switch track recording status
COverlayText * poTextName
[UI:Label] Name
virtual void enableContent()
Enables the content (controls) of the underlying widget.
void slotEdit()
[UI:Slot] Slot to display edit view
QLabel * pqLabelSymbol
[UI:Label] Symbol
void slotToggleVisible()
[UI:Slot] Slot to modify the visibility status
COverlayText * poTextGroundBearing
[UI:Label] Ground bearing
virtual void resetContent()
Resets (clears) the content of the underlying widget.
COverlayText * poTextLongitude
[UI:Label] Longitude
QPushButton * pqPushButtonCenter
[UI:Button] Center (on chart)
COverlayText * poTextGroundSpeed
[UI:Label] Ground horizontal speed
COverlayText * poTextElevation
[UI:Label] Elevation
COverlayText * poTextTime2
[UI:Label] Time (alternate timezone)
CVesselPointDetailView(QWidget *_pqParent=0)
COverlayText * poTextGroundSpeedVertical
[UI:Label] Ground vertical speed
QPushButton * pqPushButtonCenterLock
[UI:Button] Center (on chart) lock
COverlayText * poTextType
[UI:Label] Type
void slotPositionCenter()
[UI:Slot] Slot to center chart (on item's position)
COverlayText * poTextComment
[UI:Label] Comment
QPushButton * pqPushButtonVisible
[UI:Button] Visibility status
COverlayText * poTextTime
[UI:Label] Time
COverlayText * poTextApparentBearing
[UI:Label] Apparent bearing
bool bIgnoreUpdate
Flag that disables checkable buttons update.
QPushButton * pqPushButtonDelete
[UI:Button] Delete
void slotAddDevice()
[UI:Slot] Slot to add new device
virtual void refreshContent()
Refreshes the content of the underlying widget.
COverlayText * poTextLatitude
[UI:Label] Latitude
void slotDelete()
[UI:Slot] Slot to delete (this item/point)
[UI] Generic overlay object's pick (select) view
[UI] Vessel device
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
bool connectDevice()
Connects to the actual device.
virtual void showEdit()
Displays this object's edit widget/view.
[UI] Vessel overlay point (item) / vessel
bool isDynamic()
Returns whether the vessel is dynamically generated.
QString getSymbol() const
Returns this vessel's symbol.
QString getComment() const
Returns this vessel's comment.
virtual void toggleVisibility()
QString getUrl() const
Returns this vessel's URL.
bool isTrackRecording()
Returns this vessel's track recording status.
virtual COverlay * useOverlay()
Returns this object's (base) overlay.
QString getDescription() const
Returns this vessel's description.
QString getType() const
Returns this vessel's type.
bool setTrackRecord(bool _bTrackRecord)
Sets this vessel's track recording status.
void resetVesselPoint()
Resets (clears) the vessel used to synchronize the instruments display.
void setVesselPoint(CVesselPoint *_poVesselPoint)
Sets the vessel used to synchronize the instruments display.
static CVesselPosition * useVesselPosition()
static CVesselCockpit * useVesselCockpit()
static CPointerOverlay * usePointerOverlay()
static CVesselCourse * useVesselCourse()
static CVesselOverlay * useVesselOverlay()
static CVesselTarget * useVesselTarget()
static QMutex * useMutexDataChange()
static CMainWindow * useMainWindow()
static CChartTable * useChartTable()