Qt Virtual Chart Table (QVCT)
CRouteOverlay.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_CROUTEOVERLAY_HPP
27 #define QVCT_CROUTEOVERLAY_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 CRouteContainer;
43 class CRoutePoint;
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  CRouteOverlay( QWidget* _pqParent = 0 );
73  virtual ~CRouteOverlay();
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  virtual void dropEvent( QDropEvent* _pqDropEvent );
85 
86 
87  //------------------------------------------------------------------------------
88  // METHODS: COverlay (implement/override)
89  //------------------------------------------------------------------------------
90 
91 public:
92  virtual void drawContent( const CChart* _poChart, QPainter* _pqPainter ) const;
93  virtual void showDetail( const QTreeWidgetItem* _pqTreeWidgetItem ) const;
94  virtual void setPosition( const QTreeWidgetItem* _pqTreeWidgetItem ) const;
95  virtual COverlayPoint* matchScrPosition( const CChart* _poChart, const QPointF& _rqPointFScrPosition ) const;
96 
97 
98  //------------------------------------------------------------------------------
99  // METHODS: COverlayBaseTree (implement/override)
100  //------------------------------------------------------------------------------
101 
102 public:
103  virtual void onChange( QTreeWidgetItem* _pqTreeWidgetItem, int __iColumn );
104 
105 
106  //------------------------------------------------------------------------------
107  // METHODS
108  //------------------------------------------------------------------------------
109 
110  // OTHER
111 public:
113  void importSettings();
115  CRouteContainer* addContainer( const QString& _rqsName );
117 
123  int deleteSelection();
125  void clear();
126 
127 public:
129  CRouteContainer* load( const QString& _rqsFilename );
131  void save( const QString& _rqsFilename, CRouteContainer* _poRouteContainer = 0 ) const;
133  int parseQVCT( const QDomElement& _rqDomElement, CRouteContainer** _ppoRouteContainer = 0 );
135  int parseGPX( const QDomElement& _rqDomElement, CRouteContainer** _ppoRouteContainer = 0 );
137  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter, CRouteContainer* _poRouteContainer = 0, bool _bProjectDump = false ) const;
139  void dumpGPX( QXmlStreamWriter & _rqXmlStreamWriter, CRouteContainer* _poRouteContainer = 0 ) const;
140 
141 };
142 
143 #endif // QVCT_CROUTEOVERLAY_HPP
[UI] Chart (view)
Definition: CChart.hpp:44
Generic overlay base (tree widget)
Generic overlay point.
[UI] Route overlay container
[UI] Route overlay container
CRouteContainer * load(const QString &_rqsFilename)
Load this object's content from the given file and returns the last loaded container (0 if none)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter, CRouteContainer *_poRouteContainer=0, bool _bProjectDump=false) const
Stores this object's content to the given QVCT destination (file)
virtual void showDetail(const QTreeWidgetItem *_pqTreeWidgetItem) const
Displays the given overlay object's details (in the appropriate widget/view)
virtual void onChange(QTreeWidgetItem *_pqTreeWidgetItem, int __iColumn)
Handles item (content) changes in the underlying QTreeWidget.
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)
CRouteContainer * pickContainer()
Pick (select) a route (container) among the available ones (0 if none is selected)
CRouteOverlay(QWidget *_pqParent=0)
void clear()
Clear the entire content of this overlay.
CRouteContainer * addContainer(const QString &_rqsName)
Add a new route (container) to this overlay.
int parseGPX(const QDomElement &_rqDomElement, CRouteContainer **_ppoRouteContainer=0)
Retrieves this object's content from the given GPX source (file)
int deleteSelection()
Deletes selected items within this overlay's containers.
virtual void setPosition(const QTreeWidgetItem *_pqTreeWidgetItem) const
Centers the chart on the given overlay object's position.
EColumn
Implemented tree-widget columns.
@ VISIBLE
Route visibility status.
@ SELECT
Route selection status.
@ NAME
Route name.
void importSettings()
Imports settings from the application's global settings.
void save(const QString &_rqsFilename, CRouteContainer *_poRouteContainer=0) const
Save this object's content (container) to the given file (all selected items if no container is given...
virtual bool dropMimeData(QTreeWidgetItem *_pqTreeWidgetItem, int _iIndex, const QMimeData *_pqMimeData, Qt::DropAction eAction)
int parseQVCT(const QDomElement &_rqDomElement, CRouteContainer **_ppoRouteContainer=0)
Retrieves this object's content from the given QVCT source (file)
void dumpGPX(QXmlStreamWriter &_rqXmlStreamWriter, CRouteContainer *_poRouteContainer=0) const
Stores this object's content to the given GPX destination (file)
virtual void drawContent(const CChart *_poChart, QPainter *_pqPainter) const
Draws this overlay's content.
virtual QStringList mimeTypes() const
virtual void dropEvent(QDropEvent *_pqDropEvent)
virtual ~CRouteOverlay()
virtual QMimeData * mimeData(const QList< QTreeWidgetItem * > _qListTreeWidgetItems) const
[UI] Route overlay point (item) / waypoint
Definition: CRoutePoint.hpp:40