Qt Virtual Chart Table (QVCT)
CLandmarkOverlay.hpp
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 
26 #ifndef QVCT_CLANDMARKOVERLAY_HPP
27 #define QVCT_CLANDMARKOVERLAY_HPP
28 
29 // QT
30 #include <QDomElement> // QtXml module
31 #include <QList>
32 #include <QMimeData>
33 #include <QPainter>
34 #include <QPointF>
35 #include <QStringList>
36 #include <QWidget>
37 #include <QXmlStreamWriter>
38 
39 // QVCT
41 class CChart;
42 class CLandmarkContainer;
43 class CLandmarkPoint;
44 
45 
47 
52 {
53 
54  //------------------------------------------------------------------------------
55  // CONSTANTS / STATIC
56  //------------------------------------------------------------------------------
57 
58 public:
60  enum EColumn {
61  NAME = 0,
62  VISIBLE = 1,
63  SELECT = 2
64  };
65 
66 
67  //------------------------------------------------------------------------------
68  // CONSTRUCTORS / DESTRUCTOR
69  //------------------------------------------------------------------------------
70 
71 public:
72  CLandmarkOverlay( QWidget* _pqParent = 0 );
73  virtual ~CLandmarkOverlay();
74 
75 
76  //------------------------------------------------------------------------------
77  // METHODS: QTreeWidget (implement/override)
78  //------------------------------------------------------------------------------
79 
80 private:
81  virtual QStringList mimeTypes() const;
82  virtual QMimeData* mimeData( const QList<QTreeWidgetItem*> _qListTreeWidgetItems ) const;
83  virtual bool dropMimeData ( QTreeWidgetItem* _pqTreeWidgetItem, int _iIndex, const QMimeData* _pqMimeData, Qt::DropAction eAction );
84 
85 
86  //------------------------------------------------------------------------------
87  // METHODS: COverlay (implement/override)
88  //------------------------------------------------------------------------------
89 
90 public:
91  virtual void drawContent( const CChart* _poChart, QPainter* _pqPainter ) const;
92  virtual void showDetail( const QTreeWidgetItem* _pqTreeWidgetItem ) const;
93  virtual void setPosition( const QTreeWidgetItem* _pqTreeWidgetItem ) const;
94  virtual COverlayPoint* matchScrPosition( const CChart* _poChart, const QPointF& _rqPointFScrPosition ) const;
95 
96 
97  //------------------------------------------------------------------------------
98  // METHODS: COverlayBaseTree (implement/override)
99  //------------------------------------------------------------------------------
100 
101 public:
102  virtual void onChange( QTreeWidgetItem* _pqTreeWidgetItem, int __iColumn );
103 
104 
105  //------------------------------------------------------------------------------
106  // METHODS
107  //------------------------------------------------------------------------------
108 
109  // OTHER
110 public:
112  void importSettings();
114  CLandmarkContainer* addContainer( const QString& _rqsName );
116 
122  int deleteSelection();
124  void clear();
125 
126 public:
128  CLandmarkContainer* load( const QString& _rqsFilename );
130  void save( const QString& _rqsFilename, CLandmarkContainer* _poLandmarkContainer = 0 ) const;
132  int parseQVCT( const QDomElement& _rqDomElement, CLandmarkContainer** _ppoLandmarkContainer = 0 );
134  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter, CLandmarkContainer* _poLandmarkContainer = 0, bool _bProjectDump = false ) const;
136  void dumpGPX( QXmlStreamWriter & _rqXmlStreamWriter, CLandmarkContainer* _poLandmarkContainer = 0 ) const;
137 
138 };
139 
140 #endif // QVCT_CLANDMARKOVERLAY_HPP
[UI] Chart (view)
Definition: CChart.hpp:44
[UI] Landmark overlay container
[UI] Landmark overlay container
virtual void showDetail(const QTreeWidgetItem *_pqTreeWidgetItem) const
Displays the given overlay object's details (in the appropriate widget/view)
void importSettings()
Imports settings from the application's global settings.
void save(const QString &_rqsFilename, CLandmarkContainer *_poLandmarkContainer=0) const
Save this object's content (container) to the given file (all selected items if no container is given...
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)
CLandmarkContainer * addContainer(const QString &_rqsName)
Add a new landmarks set (container) to this overlay.
EColumn
Implemented tree-widget columns.
@ SELECT
Landmark selection status.
@ NAME
Landmark name.
@ VISIBLE
Landmark visibility status.
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)
virtual void drawContent(const CChart *_poChart, QPainter *_pqPainter) const
Draws this overlay's content.
int deleteSelection()
Deletes selected items within this overlay's containers.
CLandmarkOverlay(QWidget *_pqParent=0)
CLandmarkContainer * load(const QString &_rqsFilename)
Load this object's content from the given file and returns the last loaded container (0 if none)
CLandmarkContainer * pickContainer()
Pick (select) a container among the available ones (0 if none is selected)
virtual QMimeData * mimeData(const QList< QTreeWidgetItem * > _qListTreeWidgetItems) const
void dumpGPX(QXmlStreamWriter &_rqXmlStreamWriter, CLandmarkContainer *_poLandmarkContainer=0) const
Stores this object's content to the given GPX destination (file)
virtual void setPosition(const QTreeWidgetItem *_pqTreeWidgetItem) const
Centers the chart on the given overlay object's position.
virtual void onChange(QTreeWidgetItem *_pqTreeWidgetItem, int __iColumn)
Handles item (content) changes in the underlying QTreeWidget.
virtual bool dropMimeData(QTreeWidgetItem *_pqTreeWidgetItem, int _iIndex, const QMimeData *_pqMimeData, Qt::DropAction eAction)
virtual ~CLandmarkOverlay()
virtual QStringList mimeTypes() const
void clear()
Clear the entire content of this overlay.
[UI] Landmark overlay point (item)
Generic overlay base (tree widget)
Generic overlay point.