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() override;
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(
145  const makVrv::DtUnicode& category, const makVrv::DtUnicode& type, int to, int from) override;
146 
148 
149  virtual void mousePressEvent(QMouseEvent* event) override;
150  virtual void mouseReleaseEvent(QMouseEvent* event) override;
152 
153  protected slots:
154 
156  virtual void plotMouseReleased(const QPointF&) override;
157 
158  protected:
159 
165 
166  typedef std::pair<QwtSymbol::Style, qint64> SelectionMarkerId;
167  std::map<SelectionMarkerId, QwtPlotMarker*> mySelectionMarkers;
168  QwtPlotMarker* myVertexSelectionMarker;
169  QwtPlotMarker* myCurrentSelectionMarker;
170 
172  };
173 
177  {
178  public:
180  virtual ~DtRouteProfileWidgetCreator() override;
181 
182  static DtRouteProfileWidgetCreator& instance(makVrv::DtDe&);
183  static void registerInstance(makVrv::DtDe&, DtRouteProfileWidgetCreator*);
184 
185  virtual DtRouteProfileWidget* create(QWidget* parent);
186 
187  protected:
189  };
190 
191 }
DtRouteMarkerMap myRouteMarkers
Definition: routeProfileWidget.h:160
unsigned mySelectedVertexIndex
Definition: routeProfileWidget.h:164
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:163
QwtPlotMarker * plotMarker
Definition: routeProfileWidget.h:34
Definition: routeProfileWidget.h:30
std::pair< QwtSymbol::Style, qint64 > SelectionMarkerId
Definition: routeProfileWidget.h:166
unsigned afterVertex
Definition: routeProfileWidget.h:32
QwtPlotMarker * myCurrentSelectionMarker
Definition: routeProfileWidget.h:169
double fractionToNextVertex
Definition: routeProfileWidget.h:33
std::map< SelectionMarkerId, QwtPlotMarker * > mySelectionMarkers
Definition: routeProfileWidget.h:167
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:58
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:176
unsigned DtRouteMarkerId
Definition: routeProfileWidget.h:25
QwtPlotMarker * myVertexSelectionMarker
Definition: routeProfileWidget.h:168
#define DT_DLL_VRFGUICOMMONQT
Definition: vrfGuiCommonQt.h:20
std::set< DtRouteMarkerId > DtRouteMarkerIdSet
Definition: routeProfileWidget.h:38
DtRouteMarkerMap myHiddenRouteMarkers
Definition: routeProfileWidget.h:161
QPoint myLastCursorPosition
Definition: routeProfileWidget.h:171
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:76
makVrv::DtDe & myDe
Definition: routeProfileWidget.h:188
DtRouteMarkerId myNextMarkerId
Definition: routeProfileWidget.h:162
static const unsigned theInvalidVertexIndex
Definition: routeProfileWidget.h:28

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)