VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
routeProfileWidget.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #if !defined(Q_MOC_RUN)
11 #endif
12 
13 #include <qwt_symbol.h>
14 
15 namespace makVrf
16 {
20  {
21  Q_OBJECT
22 
23  public:
24 
25  typedef unsigned DtRouteMarkerId;
26 
28  static const unsigned theInvalidVertexIndex;
29 
31  {
32  unsigned afterVertex;
34  QwtPlotMarker* plotMarker;
35  };
36  typedef std::map<DtRouteMarkerId, DtRouteMarker> DtRouteMarkerMap;
37 
38  typedef std::set<DtRouteMarkerId> DtRouteMarkerIdSet;
39 
41  DtRouteProfileWidget(makVrv::DtDe& de, QWidget* parent = NULL, const Qt::WindowFlags& flags = 0);
42 
44  virtual ~DtRouteProfileWidget();
45 
47  virtual DtVector geocentricPositionOfMarker(DtRouteMarkerId markerId) const;
48 
50  virtual DtVector geocentricPositionOfVertex(unsigned vertex) const;
51 
53  unsigned numberOfVertices() const;
54 
56  virtual DtRouteMarkerId addRouteMarker(unsigned afterVertex, double fractionToNextVertex,
57  const QString& label, QwtSymbol::Style symbol);
58  virtual DtRouteMarkerId addRouteMarker(unsigned afterVertex, double fractionToNextVertex,
59  const QString& label, const std::string& modelDefinition);
60 
62  virtual void removeRouteMarker(DtRouteMarkerId markerId);
63 
68  virtual bool moveRouteMarker(DtRouteMarkerId markerId, unsigned afterVertex, double fractionToNextVertex,
69  unsigned* newAfterVertex = 0, double* newFractionToNextVertex = 0);
70 
72  virtual void changeRouteMarkerLabel(DtRouteMarkerId markerId, const QString& label);
73 
75  virtual bool isMarkerHidden(DtRouteMarkerId markerId) const;
76 
78  virtual void hideRouteMarker(DtRouteMarkerId markerId);
79 
81  virtual void showRouteMarker(DtRouteMarkerId markerId);
82 
84  virtual void setCursor(Qt::CursorShape shape);
85 
87  virtual void selectRouteMarker(DtRouteMarkerId markerId);
88 
90  virtual void selectVertex(unsigned vertexIndex);
91 
93  virtual bool closestRouteLocationToLastCursorPosition(unsigned& afterVertex, double& fractionToNextVertex);
94 
96  virtual bool closestRouteLocationToLastDatabasePosition(const DtVector& dbLocation, unsigned& afterVertex, double& fractionToNextVertex);
97 
100  virtual void closestValidRouteLocation(unsigned afterVertex, double fractionToNextVertex,
101  unsigned& afterVertexValid, double& fractionToNextVertexValid);
102 
105  virtual bool invalidMarkerList(DtRouteMarkerIdSet& idSet) const;
106 
107  signals:
108 
110  void vertexClicked(unsigned vertexIndex, unsigned button);
111 
113  void routeMarkerClicked(unsigned markerId, unsigned button);
114 
117  void routeClicked(unsigned afterVertex, double fractionToNextVertex, unsigned button);
118 
119  protected:
121  virtual QwtPlotMarker* createPlotMarker(unsigned afterVertex, double fractionToNextVertex,
122  const QString& label, DtRouteMarkerId& id);
123 
127  virtual QPointF plotPointFromVertexAndFraction(unsigned afterVertex, double fractionToNextVertex) const;
128 
132  virtual void vertexAndFractionFromPlotX(double x, unsigned& afterVertex, double& fractionToNextVertex) const;
133 
135  virtual QwtPlotMarker* vertexSelectionMarker();
136 
138  virtual QwtPlotMarker* selectionMarker(const QwtSymbol& symbol);
139 
141  virtual void disableSelectionMarkers();
142 
144  virtual void slot_onUnitChanged(const makVrv::DtUnicode& category, const makVrv::DtUnicode& type, int to, int from);
145 
147 
148  virtual void mousePressEvent(QMouseEvent *event);
149  virtual void mouseReleaseEvent(QMouseEvent *event);
151 
152  protected slots:
153 
155  virtual void plotMouseReleased(const QPointF&);
156 
157  protected:
158 
164 
165  typedef std::pair<QwtSymbol::Style, qint64> SelectionMarkerId;
166  std::map<SelectionMarkerId, QwtPlotMarker*> mySelectionMarkers;
167  QwtPlotMarker* myVertexSelectionMarker;
168  QwtPlotMarker* myCurrentSelectionMarker;
169 
171  };
172 
176  {
177  public:
179  virtual ~DtRouteProfileWidgetCreator();
180 
181  static DtRouteProfileWidgetCreator& instance(makVrv::DtDe&);
182  static void registerInstance(makVrv::DtDe&, DtRouteProfileWidgetCreator*);
183 
184  virtual DtRouteProfileWidget* create(QWidget* parent);
185 
186  protected:
188  };
189 
190 }
DtRouteMarkerMap myRouteMarkers
Definition: routeProfileWidget.h:159
unsigned mySelectedVertexIndex
Definition: routeProfileWidget.h:163
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
DtRouteMarkerId mySelectedMarkerId
Definition: routeProfileWidget.h:162
QwtPlotMarker * plotMarker
Definition: routeProfileWidget.h:34
Definition: routeProfileWidget.h:30
std::pair< QwtSymbol::Style, qint64 > SelectionMarkerId
Definition: routeProfileWidget.h:165
unsigned afterVertex
Definition: routeProfileWidget.h:32
QwtPlotMarker * myCurrentSelectionMarker
Definition: routeProfileWidget.h:168
double fractionToNextVertex
Definition: routeProfileWidget.h:33
std::map< SelectionMarkerId, QwtPlotMarker * > mySelectionMarkers
Definition: routeProfileWidget.h:166
Definition: routeProfileWidget.h:19
static const DtRouteMarkerId theInvalidMarkerId
Definition: routeProfileWidget.h:27
This class will display a terrain profile graph, which is the graph of a distance over a line and the...
Definition: terrainProfileWidget.h:59
std::map< DtRouteMarkerId, DtRouteMarker > DtRouteMarkerMap
Definition: routeProfileWidget.h:36
Creator used to create a route profile widget. Use registerInstance to replace with your new creator ...
Definition: routeProfileWidget.h:175
unsigned DtRouteMarkerId
Definition: routeProfileWidget.h:25
QwtPlotMarker * myVertexSelectionMarker
Definition: routeProfileWidget.h:167
#define DT_DLL_VRFGUICOMMONQT
Definition: vrfGuiCommonQt.h:20
std::set< DtRouteMarkerId > DtRouteMarkerIdSet
Definition: routeProfileWidget.h:38
DtRouteMarkerMap myHiddenRouteMarkers
Definition: routeProfileWidget.h:160
QPoint myLastCursorPosition
Definition: routeProfileWidget.h:170
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
makVrv::DtDe & myDe
Definition: routeProfileWidget.h:187
DtRouteMarkerId myNextMarkerId
Definition: routeProfileWidget.h:161
static const unsigned theInvalidVertexIndex
Definition: routeProfileWidget.h:28

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)