Isis 3 Programmer Reference
FeatureNomenclatureTool.h
1#ifndef FeatureNomenclatureTool_h
2#define FeatureNomenclatureTool_h
3
4#include "Tool.h"
5
6#include <QPointer>
7#include <QProgressDialog>
8#include "FeatureNomenclature.h"
9
10class QCheckBox;
11class QComboBox;
12class QDialog;
13class QLabel;
14class QLineEdit;
15class QMenu;
16class QProgressBar;
17class QPushButton;
18class QString;
19
20template <typename A, typename B> class QMap;
21template <typename A, typename B> struct QPair;
22
23namespace Isis {
24 class MdiCubeViewport;
25 class UniversalGroundMap;
26
57 Q_OBJECT
58
59 public:
60
112
115
116 void addTo(QMenu *menu);
117 void paintViewport(MdiCubeViewport *vp, QPainter *painter);
118
119 bool defaultEnabled() const;
120 QColor fontColor() const;
121 int fontSize() const;
122 bool showApprovedOnly() const;
123 VectorType vectorType() const;
124
126 void setFontColor(QColor color);
127 void setFontSize(int newFontSize);
128 void setShowApprovedOnly(bool approvedOnly);
129 void setVectorType(VectorType show);
130
131 QString menuName() const;
132
133 protected:
134 QWidget *createToolBarWidget(QStackedWidget *parent);
136 void mouseButtonRelease(QPoint p, Qt::MouseButton s);
137 void updateTool();
138
139 private slots:
141 void configure();
142 void featureSelected();
146 void onToolActivated();
147 void showDisclaimer();
148
149 private:
150 // This is an inner class defined below.
151 class ViewportFeatureDisplay;
152
161 void toolStateChanged();
163 ViewportFeatureDisplay *viewportFeatureDisplay(MdiCubeViewport *vp);
164 const ViewportFeatureDisplay *
167 QList<MdiCubeViewport *> viewportsWithFoundNomenclature();
168
169 void readSettings();
170 void writeSettings();
171
172 private:
189 public:
192 FeaturePosition(const FeaturePosition &other);
194
195 bool isValid() const;
196
197 QPair<double, double> center() const;
198 QList< QPair<double, double> > edges() const;
202
203 void swap(FeaturePosition &other);
205
206 private:
211
214
219 QList< QPair<double, double> > *m_featureEdgeLineSamples;
222 };
223
224
237 public:
239 FeatureDisplayPosition(QRect textRect, QRect fullDisplayRect,
240 QList<QPoint> edgePoints);
243
244 QRect textArea() const;
245 QRect displayArea() const;
246 QList<QPoint> edgePoints() const;
247
248 void swap(FeatureDisplayPosition &other);
250 private:
251
252 private:
258 QList<QPoint> *m_edgePoints;
259 };
260
261
276 public:
280 QList<FeatureNomenclature::Feature> features,
284
287 QList<FeatureNomenclature::Feature> features();
288 QList<FeaturePosition> featurePositions();
290 void paint(QPainter *painter, bool showVectors,
291 VectorType vectorType, bool approvedOnly)const;
292
293 void handleMouseClicked(FeatureNomenclatureTool *tool, QPoint p,
294 Qt::MouseButton s);
296
297 void swap(ViewportFeatureDisplay &other);
299 const ViewportFeatureDisplay &rhs);
300
301 private:
302 QPair<QPointF, QPointF> viewportCubeRange() const;
303
304 private:
311 QList<FeaturePosition> *m_features;
313 QList<FeatureDisplayPosition> *m_featureScreenAreas;
319 QPair<QPointF, QPointF> *m_viewportCubeRange;
320 };
321
322 private:
324 QPointer<QAction> m_action;
325
327 QPointer<QCheckBox> m_findNomenclatureCheckBox;
337 QPointer<QComboBox> m_foundFeaturesCombo;
339 QPointer<QPushButton> m_nomenclatureCenterBtn;
341 QPointer<QPushButton> m_nomenclatureOptionsBtn;
343 QPointer<QPushButton> m_disclaimerBtn;
348 QPointer<QProgressBar> m_queryingProgress;
349
351 QList<ViewportFeatureDisplay> * m_foundNomenclature;
358
365
368
372 QColor *m_fontColor;
381 };
382}
383
384#endif
Feature nomenclature database querier.
QList< QPoint > * m_edgePoints
The viewport screen pixel points which the edges are at.
QList< QPoint > edgePoints() const
Get the edge screen pixel points in viewport screen coordinates that circle the feature.
QRect * m_textRect
The viewport screen pixel rect which the text will consume.
FeatureDisplayPosition & operator=(const FeatureDisplayPosition &rhs)
Assign the state of rhs to this.This is exception-safe.
QRect * m_fullDisplayRect
The viewport screen pixel rect which the entire display will use.
FeatureDisplayPosition()
Instantiate a blank feature display position.
QRect displayArea() const
Get the screen pixel rect in viewport screen coordinates that encapsulates the entire feature.
void swap(FeatureDisplayPosition &other)
Swap member data with another instance of this class.
QRect textArea() const
Get the screen pixel rect in viewport screen coordinates that ought to be filled with the textual nam...
FeatureNomenclature::Feature & feature()
Get the feature associated with this feature position.
double m_centerSample
The cube sample position of the feature center, Null if !isValid()
UniversalGroundMap * m_gmap
The map used to determine the sample, line pair from a lat, lon pair.
QList< QPair< double, double > > * m_featureEdgeLineSamples
The pair is cube sample, line (first and second) respectively.
QPair< double, double > center() const
Get the center sample/line position of the feature.
FeaturePosition()
Instiantiates a feature position with no data.
bool isValid() const
Test if sample/line coordinates could be found for this feature.
void applyExtentType(VectorType vectorType)
Applies the type of extents to the feature.
FeaturePosition & operator=(const FeaturePosition &rhs)
Assign rhs to this.
void swap(FeaturePosition &other)
Trade member data with other.
QList< QPair< double, double > > edges() const
Get the edge sample/line positions of the feature.
FeatureNomenclature::Feature m_feature
The feature for which we're encapsulating a viewport position.
double m_centerLine
The cube line position of the feature center, Null if !isValid()
void paint(QPainter *painter, bool showVectors, VectorType vectorType, bool approvedOnly) const
Paint features onto the viewport.
QPair< QPointF, QPointF > viewportCubeRange() const
Get the min/max cube line/sample positions of the viewport.
QList< FeatureNomenclature::Feature > features()
Get a list of features available on this viewport.
QPair< QPointF, QPointF > * m_viewportCubeRange
A check to make sure the cube viewport is in the correct state for painting.
void swap(ViewportFeatureDisplay &other)
Swap *this and other's member data in an exception-free way.
~ViewportFeatureDisplay()
Cleans up memory allocated by this feature display.
QList< FeaturePosition > * m_features
The features on the image in m_sourceViewport.
void centerFeature(FeatureNomenclature::Feature)
Center the viewport on this feature.
MdiCubeViewport * m_sourceViewport
The viewport this display is working with; we paint onto this viewport and react to events on this vi...
QList< FeatureDisplayPosition > * m_featureScreenAreas
The visible features on the image in m_sourceViewport.
void handleViewChanged(FeatureNomenclatureTool *tool)
The display options or area on the viewport has changed.
QList< FeaturePosition > featurePositions()
Get the list of feature positions for a given display.
ViewportFeatureDisplay & operator=(const ViewportFeatureDisplay &rhs)
Copy the data of rhs into *this.
void applyExtentType(VectorType vectorType)
Apply the extent type to all of the features for the source viewport.
void handleMouseClicked(FeatureNomenclatureTool *tool, QPoint p, Qt::MouseButton s)
Handle a mouse click event on the viewport.
MdiCubeViewport * sourceViewport() const
Get the viewport associated with this feature display.
Display nomenclature on MDI Cube Viewports.
void setVectorType(VectorType show)
Set whether to draw vectors from the feature center to the feature extents on the viewport.
void onToolActivated()
When this tool is activated (clicked on in the tool bar), turn ourselves on immediately.
QPointer< QProgressBar > m_queryingProgress
This is a busy indicator that is visible when queries are out to the nomenclature database.
~FeatureNomenclatureTool()
Cleans up memory allocated by this tool.
void featureSelected()
This handles a feature being selected in the feature list combo box.
void addTo(QMenu *menu)
Add the 'Show Nomenclature' option to the options menu.
bool viewportFeaturesFound(MdiCubeViewport *vp) const
Test if features have already been found for a given viewport.
void setShowApprovedOnly(bool approvedOnly)
Set whether to show approved features and exclude unapproved features.
QList< MdiCubeViewport * > viewportsWithFoundNomenclature()
Get a list of viewports with found nomenclature.
VectorType m_extentType
How we need to draw extents (if at all)
void featuresIdentified(FeatureNomenclature *)
A feature nomenclature has finished querying... we need to translate the features into visible names.
void nomenclaturePositionsOutdated()
Update the screen coordinates of the named features because the viewport has changed it's mappings.
QPointer< QCheckBox > m_findNomenclatureCheckBox
This is the 'Name Features' check box when this tool is active.
void writeSettings()
Write out this tool's preserved state between runs.
void setFontSize(int newFontSize)
Set the font point size to use for drawing text on the viewport.
void showFeatureWebsite(FeatureNomenclature::Feature)
Show a web view pointed to the feature's web page.
QList< ViewportFeatureDisplay > * m_foundNomenclature
The nomenclature that has been identified, one for each viewport.
void viewportDone(MdiCubeViewport *vp)
Finalize the search results for the given viewport.
VectorType vectorType() const
Draw vectors to the extents of features?
QString m_disclaimerText
The (HTML) contents of the disclaimer to show the user.
void updateTool()
Updates the state of the current tool.
void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Paint features on the given viewport.
void setDefaultEnabled(bool defaultEnabled)
Set whether this tool is enabled by default.
bool m_defaultEnabled
Do we turn ourselves on immediately?
bool m_disclaimedAlready
Have we ever shown the user our disclaimer?
FeatureNomenclatureTool(QWidget *parent)
This instantiates a FeatureNomenclatureTool.
QMap< MdiCubeViewport *, FeatureNomenclature * > * m_nomenclatureSearchers
The nomenclature being queried currently, one for each viewport that has no found nomenclature.
QPointer< QComboBox > m_foundFeaturesCombo
This combo box lists all of the found features and their viewports.
void configure()
Give a configuration dialog for the options available in this tool.
QPointer< QAction > m_action
This is the 'Show Nomenclature' toggleable action in the options menu.
void findMissingNomenclature()
Update this tool's nomenclature data based on this tool's enabled state and the current viewport list...
ViewportFeatureDisplay * viewportFeatureDisplay(MdiCubeViewport *vp)
Map from viewport to feature display.
bool m_nomenclatureEnabled
Do we find and display nomenclature? This corresponds to the 'Name Features' check box and the 'Show ...
void centerOnSelectedFeature()
Center the relevent viewport (and any viewports linked to it) on the feature selected in the feature ...
void readSettings()
Read this tool's preserved state.
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget that goes on the tool bar when this tool is active.
void featuresForViewportFound(MdiCubeViewport *vp)
Move the features from a searching state to a found state for the given viewport.
void findNomenclatureStateChanged(int)
The 'Name Features' check box has changed state.
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
This handles a mouse release on one of the cube viewports when this tool is active.
QPointer< QPushButton > m_nomenclatureOptionsBtn
This is the 'Tool Options' button in this tool's tool bar.
void toolStateChanged()
This should be called any time this tool's enabled or searching state could have changed.
QColor * m_fontColor
The color to use when drawing on the viewport.
void showDisclaimer()
Show the user our nomenclature disclaimer and make note that we have shown the disclaimer.
int fontSize() const
Retrieve the font size of the features in this tool.
VectorType
Enumeration of extent vector typess.
@ Arrows8
When using this vector (extent) type, 8 arrows will be drawn out from the text of the feature.
@ Box
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature.
@ None
When using this vector (extent) type, no extents will be drawn.
@ Arrows4
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature.
void rebuildFeaturesCombo()
Rebuild m_foundFeaturesCombo's data from scratch.
void setFontColor(QColor color)
Set the color to use for drawing on the viewport.
bool m_showApprovedOnly
Only show IAU approved features.
bool showApprovedOnly() const
Show approved features only?
void showFeatureDetails(FeatureNomenclature::Feature)
Show a dialog with full feature details of a given feature.
QPointer< QPushButton > m_disclaimerBtn
This is the 'Disclaimer' button in this tool's tool bar.
QString menuName() const
This is the name of the menu that should be passed into "addTo()".
QColor fontColor() const
What is the font color to use?
void removeFeatureDisplay(MdiCubeViewport *vp)
Remove knowledge of features on the given viewport.
QPointer< QPushButton > m_nomenclatureCenterBtn
This is the 'Center' button in this tool's tool bar.
void centerOnFeature(MdiCubeViewport *vp, FeatureNomenclature::Feature)
Center the given and any linked viewports (which contain the same feature) on the given feature.
bool defaultEnabled() const
Is this tool enabled by default? (i.e.
int m_fontSize
The font size to use when naming features.
QAction * toolPadAction(ToolPad *pad)
Add this tool's action to the toolpad.
Cube display widget for certain Isis MDI applications.
Base class for the Qisis tools.
Definition Tool.h:67
Universal Ground Map.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
This is free and unencumbered software released into the public domain.