![]() |
VR-Forces 4.0.4 Class Documentation
|
This class will display a terrain profile graph, which is the graph of a distance over a line and the altitudes of the terrain along sample points along that line. More...

Public Member Functions | |
| DtTerrainProfileWidget (makVrv::DtDe &de, QWidget *parent=NULL, const Qt::WindowFlags &flags=0) | |
| Constructor. | |
| virtual | ~DtTerrainProfileWidget () |
| Destructor. | |
| virtual void | init () |
| Initializes the widget by creating GUI (plot) elements and initializing member variables. | |
| virtual void | setDataProvider (DtTerrainProfileDataProvider *) |
| Sets the data provider for this graph. | |
| virtual void | replot () |
| Redraws the graph given the existing profile data and settings. | |
| virtual void | setSamplingRate (double) |
| Sets the frequency in distance to check along the line for terrain points. | |
| double | samplingRate () const |
| virtual void | setMaximumSamplingPoints (int) |
| Sets the maximum number of points to check. | |
| int | maximumSamplingPoints () const |
| virtual void | clearGraph () |
| Clears the graph of all data. | |
| virtual void | setReplotTime (int) |
| Sets the time (in milliseconds) to wait before doing a replot. | |
| int | replotTime () const |
| virtual void | setScaleFactor (double) |
| Value to scale difference between max and min height of terrain. | |
| double | scaleFactor () const |
| virtual void | suspend () |
| Suspends this graph. This means that there shall be no updates made to this graph. | |
| virtual void | resume () |
| Resumes graph updates. Will do a full replot. | |
| virtual bool | isSuspended () const |
| Returns true if this graph has been suspended. | |
| virtual void | setShowVertices (bool) |
| If true will put a vertex marker at each point on the line. | |
| bool | showVertices () const |
Public Attributes | |
| boost::signal< void()> | signal_ready |
| Signal only once when graph is ready to show (at least two points) | |
| QwtPlot * | myTerrainProfileGraph |
| QVBoxLayout * | myMainLayout |
| QwtPlotCurve * | myTerrainLine |
| QwtPlotCurve * | myTerrainProfile |
| QwtPlotPicker * | myPlotPicker |
| QLabel * | mySelectedPointLabel |
| QLabel * | mySelectedPoint |
| bool | myFirstPlot |
Protected Types | |
| typedef std::map < makVrv::DtElementID, QwtPlotMarker * > | TrackedEntities |
| Map of plot markers for entities being tracked. | |
Protected Slots | |
| virtual void | plotMouseReleased (const QPointF &) |
| Called when the mouse is released on the plot area, will show a mark on the terrain line and information about that point. | |
Protected Member Functions | |
| virtual void | createProfileGraph () |
| Create the graph object that will be used to show the terrain profile. | |
| virtual void | initConnections () |
| Initializes any connections (boost or Qt) needed to support this graph. | |
| virtual bool | updateProfileData () |
| Updates local data represented by the profile id to watch. If data has changed will return true, else false. | |
| virtual void | slot_dataUpdated () |
| Called when the state view is updated, if profile data is updated will redraw the graph. | |
| virtual void | slot_dataRemoved () |
| Called when an object is about to be removed, will clear the graph. | |
| virtual void | calculateReplotRanges (std::vector< QPoint > &) const |
| Figures out the range to recalculate points for in line plot. | |
| virtual double | calculateLineLength (const std::vector< DtVector > &) const |
| Returns the length of the line given the number of points. | |
| virtual double | calculateSegment (const QPoint &segment, double lineLength) |
| Calculates the points for the curve along the given segment of the line. Returns the length of the segment. | |
| virtual double | segmentLength (const QPoint &) const |
| Convenience routines to calculate the length of a segment of a line. | |
| virtual double | segmentLength (int start, int end) const |
| virtual double | terrainHeight (int point) const |
| Returns the height of the terrain (in meters) at the given point index. | |
| virtual double | terrainHeight (const DtVector &) const |
| Returns terrain height at geocentric position. | |
| virtual double | lineHeight (int pos) const |
| Returns the height of the line at the given position. | |
| virtual void | setupLabels () |
| Sets labels for the graph based on current display unit settings. | |
| void | slot_onUnitChanged (int attribute, int from) |
| Called when unit display settings change, see if any graph data needs to change. | |
| virtual double | altitudeValueFor (double) const |
| Given current display units settings, return altitude or distance for those settings based on meters. | |
| virtual double | distanceValueFor (double) const |
| virtual void | convertAltitudeAndDistance (int newAltitudeUnits, int newDistanceUnits, bool replot=true) |
| Given the current altitude and distance settings, convert to the new settings and redisplay graph. | |
| virtual void | convertAltitudeAndDistance (QVector< QPointF > &, int newAltitudeUnits, int newDistanceUnits) const |
| Converts x (distance) and y (altitude) in place in the vectors. | |
| virtual void | convertAltitudeAndDistance (QwtPlotMarker *, int newAltitudeUnits, int newDistanceUnits) const |
| virtual void | deferredReplot (bool full=true) |
| Connect to DE pre-tick to replot graph. If full does a full redraw of graph, else just a simple replot. | |
| virtual QwtPlotMarker * | addMarker (double x, double y) |
| Adds a point marker to the x, y coordinate. | |
| virtual void | setupPointMarkerLabel () |
| Sets the label on the point marker to the current point location. | |
| virtual void | onTerrainProfileSettingsChanged (const DtTerrainProfileSettingsRecord &) |
| Called when terrain profile settings change, modify graph to match. | |
| virtual void | createSymbolTracker () |
| Creates a symbol tracker to track symbols within a certain range near the line. | |
| virtual void | trackEntity (const DtVector &geocentricPosition, const makVrv::DtStateView< makVrv::DtVrlinkSimulatedEntityState > *) |
| Start tracking or continue tracking the given entity. | |
| virtual void | stopTrackingEntity (makVrv::DtElementID) |
| Stop tracking entity. | |
| virtual void | clearTrackingSymbols (bool suspended=false) |
| Clears out all symbols being tracked and deletes the symbol tracker. | |
| virtual QwtSymbol * | symbolFor (const makVrv::DtStateView< makVrv::DtVrlinkSimulatedEntityState > *) const |
| Returns a symbol for the given sim state view to be placed on the plot graph. | |
| virtual int | linePositionFromLocation (const DtVector &geocentricLocation, QPointF &result) const |
| Given a geocentric point, convert point to a position on the line of distance along the line and height. | |
| virtual int | closestPoint (const DtVector &v, double &range, double &totalRange) const |
| Given a geocentric coordinate, find the closest point to that on the line being plotted. | |
| virtual void | timedReplot () |
| Method called when a page tile is loaded. | |
| virtual void | replotIfTime () |
| virtual void | updateLineVertices (bool replot=true) |
| Udpates the vertices on the line. | |
| virtual void | resetAltitudeScale (bool replot=true) |
Protected Attributes | |
| makVrv::DtDe & | myDe |
| DtTerrainProfileDataProvider * | myDataProvider |
| makVrv::DtSignalConnectionManager | myConnections |
| std::vector< DtVector > | myLinePoints |
| Points are in geocentric. | |
| std::vector< DtVector > | myPlotPoints |
| The points that were last used to plot the graph. | |
| double | mySamplingRate |
| Test the length of the line every N meters along the line. | |
| int | myMaximumSamplingPoints |
| Maximum number of points to check. | |
| std::vector< int > | mySegmentPoints |
| For each segment, the number of plot points on the terrain represented by that segment. | |
| QVector< QPointF > | myTerrainProfilePoints |
| The points used to plot the terrain profile. | |
| QVector< QPointF > | myTerrainLinePoints |
| The points used for the line that is being used to sample the terrain segment. | |
| DtReferenceEllipsoid * | myReferenceForConversion |
| makVrv::DtDisplayUnitsConverter::DistanceUnits | myAltitudeUnits |
| Current units for distance and altitude. Used to check to see if units need to be changed. | |
| makVrv::DtDisplayUnitsConverter::DistanceUnits | myDistanceUnits |
| DtVector | myPointMarkerLocation |
| Geocentric location of point marker. Used for labels. | |
| bool | myReady |
| Set to true when the graph is ready to display. | |
| DtSymbolTracker * | mySymbolTracker |
| Class that will be used to track symbols within a particular distance to the given line. | |
| QwtPlotMarker * | myPointMarker |
| TrackedEntities | myTrackedEntities |
| QTime * | myReplotTimer |
| int | myReplotTime |
| double | myMinimumHeight |
| double | myMaximumHeight |
| double | myScaleFactor |
| double | myBuffer |
| bool | mySuspended |
| bool | myReplotting |
| bool | myShowVertices |
| QImage * | myVertexImage |
| std::vector< QwtPlotMarker * > | myVertices |
This class will display a terrain profile graph, which is the graph of a distance over a line and the altitudes of the terrain along sample points along that line.
The Qwt toolkit is used for the actual rendering of the graph. This widget will calculate the points on the graph to display as well as manage helper classes to show tracked symbols and the provider of point data for this gragh. It listens to signals sent by the DtTerrainProfileSettingsManager to indicate when graph settings have changed and apply them to this graph.
If you wish to use this object and supply your own (or existing) data, you must create a DtTerrainProfileDataProvider object to provide data that this class needs in order to render the graph
typedef std::map<makVrv::DtElementID, QwtPlotMarker*> makVrf::DtTerrainProfileWidget::TrackedEntities [protected] |
Map of plot markers for entities being tracked.
| makVrf::DtTerrainProfileWidget::DtTerrainProfileWidget | ( | makVrv::DtDe & | de, |
| QWidget * | parent = NULL, |
||
| const Qt::WindowFlags & | flags = 0 |
||
| ) |
Constructor.
| virtual makVrf::DtTerrainProfileWidget::~DtTerrainProfileWidget | ( | ) | [virtual] |
Destructor.
| virtual void makVrf::DtTerrainProfileWidget::init | ( | ) | [virtual] |
Initializes the widget by creating GUI (plot) elements and initializing member variables.
To use this to start a profile line for a particular item, call the setDataProvider() method with the provider of the object you wish to profile
| virtual void makVrf::DtTerrainProfileWidget::setDataProvider | ( | DtTerrainProfileDataProvider * | ) | [virtual] |
Sets the data provider for this graph.
Does not take ownership of the pointer, so, it is up to the developer to free the data provided
| virtual void makVrf::DtTerrainProfileWidget::replot | ( | ) | [virtual] |
Redraws the graph given the existing profile data and settings.
| virtual void makVrf::DtTerrainProfileWidget::setSamplingRate | ( | double | ) | [virtual] |
Sets the frequency in distance to check along the line for terrain points.
| double makVrf::DtTerrainProfileWidget::samplingRate | ( | ) | const |
| virtual void makVrf::DtTerrainProfileWidget::setMaximumSamplingPoints | ( | int | ) | [virtual] |
Sets the maximum number of points to check.
| int makVrf::DtTerrainProfileWidget::maximumSamplingPoints | ( | ) | const |
| virtual void makVrf::DtTerrainProfileWidget::clearGraph | ( | ) | [virtual] |
Clears the graph of all data.
| virtual void makVrf::DtTerrainProfileWidget::setReplotTime | ( | int | ) | [virtual] |
Sets the time (in milliseconds) to wait before doing a replot.
This will be used when replotting from paging in terrain as to not continually replot as many pages might page in at once. Default is 5 seconds
| int makVrf::DtTerrainProfileWidget::replotTime | ( | ) | const |
| virtual void makVrf::DtTerrainProfileWidget::setScaleFactor | ( | double | ) | [virtual] |
Value to scale difference between max and min height of terrain.
will provide a buffer above the maximum height Default is 1.0. Factor will not be allowed to go below 1.0
| double makVrf::DtTerrainProfileWidget::scaleFactor | ( | ) | const |
| virtual void makVrf::DtTerrainProfileWidget::suspend | ( | ) | [virtual] |
Suspends this graph. This means that there shall be no updates made to this graph.
| virtual void makVrf::DtTerrainProfileWidget::resume | ( | ) | [virtual] |
Resumes graph updates. Will do a full replot.
| virtual bool makVrf::DtTerrainProfileWidget::isSuspended | ( | ) | const [virtual] |
Returns true if this graph has been suspended.
| virtual void makVrf::DtTerrainProfileWidget::setShowVertices | ( | bool | ) | [virtual] |
If true will put a vertex marker at each point on the line.
| virtual void makVrf::DtTerrainProfileWidget::createProfileGraph | ( | ) | [protected, virtual] |
Create the graph object that will be used to show the terrain profile.
| virtual void makVrf::DtTerrainProfileWidget::initConnections | ( | ) | [protected, virtual] |
Initializes any connections (boost or Qt) needed to support this graph.
| virtual bool makVrf::DtTerrainProfileWidget::updateProfileData | ( | ) | [protected, virtual] |
Updates local data represented by the profile id to watch. If data has changed will return true, else false.
| virtual void makVrf::DtTerrainProfileWidget::slot_dataUpdated | ( | ) | [protected, virtual] |
Called when the state view is updated, if profile data is updated will redraw the graph.
| virtual void makVrf::DtTerrainProfileWidget::slot_dataRemoved | ( | ) | [protected, virtual] |
Called when an object is about to be removed, will clear the graph.
| virtual void makVrf::DtTerrainProfileWidget::calculateReplotRanges | ( | std::vector< QPoint > & | ) | const [protected, virtual] |
Figures out the range to recalculate points for in line plot.
The points are pairs, so, if more than one range needs to be recalculated, it will contain multiple entries
| virtual double makVrf::DtTerrainProfileWidget::calculateLineLength | ( | const std::vector< DtVector > & | ) | const [protected, virtual] |
Returns the length of the line given the number of points.
Only calculates on X/Y plane. Does not take Z coordinate into account. Points must be in geocentric
| virtual double makVrf::DtTerrainProfileWidget::calculateSegment | ( | const QPoint & | segment, |
| double | lineLength | ||
| ) | [protected, virtual] |
Calculates the points for the curve along the given segment of the line. Returns the length of the segment.
| virtual double makVrf::DtTerrainProfileWidget::segmentLength | ( | const QPoint & | ) | const [protected, virtual] |
Convenience routines to calculate the length of a segment of a line.
| virtual double makVrf::DtTerrainProfileWidget::segmentLength | ( | int | start, |
| int | end | ||
| ) | const [protected, virtual] |
| virtual double makVrf::DtTerrainProfileWidget::terrainHeight | ( | int | point | ) | const [protected, virtual] |
Returns the height of the terrain (in meters) at the given point index.
| virtual double makVrf::DtTerrainProfileWidget::terrainHeight | ( | const DtVector & | ) | const [protected, virtual] |
Returns terrain height at geocentric position.
| virtual double makVrf::DtTerrainProfileWidget::lineHeight | ( | int | pos | ) | const [protected, virtual] |
Returns the height of the line at the given position.
| virtual void makVrf::DtTerrainProfileWidget::setupLabels | ( | ) | [protected, virtual] |
Sets labels for the graph based on current display unit settings.
| void makVrf::DtTerrainProfileWidget::slot_onUnitChanged | ( | int | attribute, |
| int | from | ||
| ) | [protected] |
Called when unit display settings change, see if any graph data needs to change.
| virtual double makVrf::DtTerrainProfileWidget::altitudeValueFor | ( | double | ) | const [protected, virtual] |
Given current display units settings, return altitude or distance for those settings based on meters.
| virtual double makVrf::DtTerrainProfileWidget::distanceValueFor | ( | double | ) | const [protected, virtual] |
| virtual void makVrf::DtTerrainProfileWidget::convertAltitudeAndDistance | ( | int | newAltitudeUnits, |
| int | newDistanceUnits, | ||
| bool | replot = true |
||
| ) | [protected, virtual] |
Given the current altitude and distance settings, convert to the new settings and redisplay graph.
| virtual void makVrf::DtTerrainProfileWidget::convertAltitudeAndDistance | ( | QVector< QPointF > & | , |
| int | newAltitudeUnits, | ||
| int | newDistanceUnits | ||
| ) | const [protected, virtual] |
Converts x (distance) and y (altitude) in place in the vectors.
| virtual void makVrf::DtTerrainProfileWidget::convertAltitudeAndDistance | ( | QwtPlotMarker * | , |
| int | newAltitudeUnits, | ||
| int | newDistanceUnits | ||
| ) | const [protected, virtual] |
| virtual void makVrf::DtTerrainProfileWidget::deferredReplot | ( | bool | full = true | ) | [protected, virtual] |
Connect to DE pre-tick to replot graph. If full does a full redraw of graph, else just a simple replot.
| virtual QwtPlotMarker* makVrf::DtTerrainProfileWidget::addMarker | ( | double | x, |
| double | y | ||
| ) | [protected, virtual] |
Adds a point marker to the x, y coordinate.
| virtual void makVrf::DtTerrainProfileWidget::setupPointMarkerLabel | ( | ) | [protected, virtual] |
Sets the label on the point marker to the current point location.
| virtual void makVrf::DtTerrainProfileWidget::onTerrainProfileSettingsChanged | ( | const DtTerrainProfileSettingsRecord & | ) | [protected, virtual] |
Called when terrain profile settings change, modify graph to match.
| virtual void makVrf::DtTerrainProfileWidget::createSymbolTracker | ( | ) | [protected, virtual] |
Creates a symbol tracker to track symbols within a certain range near the line.
The symbol tracker will emit signals for symbols coming near the line, moving away from the line and moving if they are tracked. This class will show the plot symbols for those tracked symbols
| virtual void makVrf::DtTerrainProfileWidget::trackEntity | ( | const DtVector & | geocentricPosition, |
| const makVrv::DtStateView< makVrv::DtVrlinkSimulatedEntityState > * | |||
| ) | [protected, virtual] |
Start tracking or continue tracking the given entity.
| virtual void makVrf::DtTerrainProfileWidget::stopTrackingEntity | ( | makVrv::DtElementID | ) | [protected, virtual] |
Stop tracking entity.
| virtual void makVrf::DtTerrainProfileWidget::clearTrackingSymbols | ( | bool | suspended = false | ) | [protected, virtual] |
Clears out all symbols being tracked and deletes the symbol tracker.
| virtual QwtSymbol* makVrf::DtTerrainProfileWidget::symbolFor | ( | const makVrv::DtStateView< makVrv::DtVrlinkSimulatedEntityState > * | ) | const [protected, virtual] |
Returns a symbol for the given sim state view to be placed on the plot graph.
| virtual int makVrf::DtTerrainProfileWidget::linePositionFromLocation | ( | const DtVector & | geocentricLocation, |
| QPointF & | result | ||
| ) | const [protected, virtual] |
Given a geocentric point, convert point to a position on the line of distance along the line and height.
Returns the segment hit
| virtual int makVrf::DtTerrainProfileWidget::closestPoint | ( | const DtVector & | v, |
| double & | range, | ||
| double & | totalRange | ||
| ) | const [protected, virtual] |
Given a geocentric coordinate, find the closest point to that on the line being plotted.
The range variable will contain the current distance to get to the segment for the clostest point, the totalRange along the line left, and the method will return the segment hit. If the method returns -1, no segment is valid
| virtual void makVrf::DtTerrainProfileWidget::timedReplot | ( | ) | [protected, virtual] |
Method called when a page tile is loaded.
If timer is not started, restarts, else, checks elapsed time. If
than replotTime, replots and removes current timer
| virtual void makVrf::DtTerrainProfileWidget::replotIfTime | ( | ) | [protected, virtual] |
| virtual void makVrf::DtTerrainProfileWidget::updateLineVertices | ( | bool | replot = true | ) | [protected, virtual] |
Udpates the vertices on the line.
| virtual void makVrf::DtTerrainProfileWidget::resetAltitudeScale | ( | bool | replot = true | ) | [protected, virtual] |
| virtual void makVrf::DtTerrainProfileWidget::plotMouseReleased | ( | const QPointF & | ) | [protected, virtual, slot] |
Called when the mouse is released on the plot area, will show a mark on the terrain line and information about that point.
| boost::signal<void ()> makVrf::DtTerrainProfileWidget::signal_ready |
Signal only once when graph is ready to show (at least two points)
makVrv::DtDe& makVrf::DtTerrainProfileWidget::myDe [protected] |
std::vector<DtVector> makVrf::DtTerrainProfileWidget::myLinePoints [protected] |
Points are in geocentric.
std::vector<DtVector> makVrf::DtTerrainProfileWidget::myPlotPoints [protected] |
The points that were last used to plot the graph.
These will be used with the current line points to try and more efficiently replot only parts of the graph that need replotting
double makVrf::DtTerrainProfileWidget::mySamplingRate [protected] |
Test the length of the line every N meters along the line.
int makVrf::DtTerrainProfileWidget::myMaximumSamplingPoints [protected] |
Maximum number of points to check.
std::vector<int> makVrf::DtTerrainProfileWidget::mySegmentPoints [protected] |
For each segment, the number of plot points on the terrain represented by that segment.
QVector<QPointF> makVrf::DtTerrainProfileWidget::myTerrainProfilePoints [protected] |
The points used to plot the terrain profile.
QVector<QPointF> makVrf::DtTerrainProfileWidget::myTerrainLinePoints [protected] |
The points used for the line that is being used to sample the terrain segment.
DtReferenceEllipsoid* makVrf::DtTerrainProfileWidget::myReferenceForConversion [protected] |
makVrv::DtDisplayUnitsConverter::DistanceUnits makVrf::DtTerrainProfileWidget::myAltitudeUnits [protected] |
Current units for distance and altitude. Used to check to see if units need to be changed.
makVrv::DtDisplayUnitsConverter::DistanceUnits makVrf::DtTerrainProfileWidget::myDistanceUnits [protected] |
Geocentric location of point marker. Used for labels.
bool makVrf::DtTerrainProfileWidget::myReady [protected] |
Set to true when the graph is ready to display.
Class that will be used to track symbols within a particular distance to the given line.
The tracker will emit signals as symbols come to or move away from the line
QwtPlotMarker* makVrf::DtTerrainProfileWidget::myPointMarker [protected] |
QTime* makVrf::DtTerrainProfileWidget::myReplotTimer [protected] |
int makVrf::DtTerrainProfileWidget::myReplotTime [protected] |
double makVrf::DtTerrainProfileWidget::myMinimumHeight [protected] |
double makVrf::DtTerrainProfileWidget::myMaximumHeight [protected] |
double makVrf::DtTerrainProfileWidget::myScaleFactor [protected] |
double makVrf::DtTerrainProfileWidget::myBuffer [protected] |
bool makVrf::DtTerrainProfileWidget::mySuspended [protected] |
bool makVrf::DtTerrainProfileWidget::myReplotting [protected] |
bool makVrf::DtTerrainProfileWidget::myShowVertices [protected] |
QImage* makVrf::DtTerrainProfileWidget::myVertexImage [protected] |
std::vector<QwtPlotMarker*> makVrf::DtTerrainProfileWidget::myVertices [protected] |
| QVBoxLayout* makVrf::DtTerrainProfileWidget::myMainLayout |
| QwtPlotCurve* makVrf::DtTerrainProfileWidget::myTerrainLine |
| QwtPlotCurve* makVrf::DtTerrainProfileWidget::myTerrainProfile |
| QwtPlotPicker* makVrf::DtTerrainProfileWidget::myPlotPicker |