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 
10 class QCheckBox;
11 class QComboBox;
12 class QDialog;
13 class QLabel;
14 class QLineEdit;
15 class QMenu;
16 class QProgressBar;
17 class QPushButton;
18 class QString;
19 
20 template <typename A, typename B> class QMap;
21 template <typename A, typename B> struct QPair;
22 
23 namespace Isis {
24  class MdiCubeViewport;
25  class UniversalGroundMap;
26 
56  class FeatureNomenclatureTool : public Tool {
57  Q_OBJECT
58 
59  public:
60 
62  enum VectorType {
111  };
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 
157  void rebuildFeaturesCombo();
161  void toolStateChanged();
162  void viewportDone(MdiCubeViewport *vp);
163  ViewportFeatureDisplay *viewportFeatureDisplay(MdiCubeViewport *vp);
164  const ViewportFeatureDisplay *
166  bool viewportFeaturesFound(MdiCubeViewport *vp) const;
168 
169  void readSettings();
170  void writeSettings();
171 
172  private:
189  public:
190  FeaturePosition();
192  FeaturePosition(const FeaturePosition &other);
194 
195  bool isValid() const;
196 
200  const FeatureNomenclature::Feature &feature() const;
202 
203  void swap(FeaturePosition &other);
205 
206  private:
208  double m_centerLine;
211 
214 
222  };
223 
224 
237  public:
239  FeatureDisplayPosition(QRect textRect, QRect fullDisplayRect,
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:
254  QRect *m_textRect;
259  };
260 
261 
276  public:
284 
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:
303 
304  private:
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 
358 
365 
368 
372  QColor *m_fontColor;
381  };
382 }
383 
384 #endif
void swap(FeaturePosition &other)
Trade member data with other.
Cube display widget for certain Isis MDI applications.
QPointer< QProgressBar > m_queryingProgress
This is a busy indicator that is visible when queries are out to the nomenclature database...
void viewportDone(MdiCubeViewport *vp)
Finalize the search results for the given viewport.
QList< MdiCubeViewport * > viewportsWithFoundNomenclature()
Get a list of viewports with found nomenclature.
void removeFeatureDisplay(MdiCubeViewport *vp)
Remove knowledge of features on the given viewport.
void showFeatureDetails(FeatureNomenclature::Feature)
Show a dialog with full feature details of a given feature.
void updateTool()
Updates the state of the current tool.
void applyExtentType(VectorType vectorType)
Apply the extent type to all of the features for the source viewport.
void centerOnSelectedFeature()
Center the relevent viewport (and any viewports linked to it) on the feature selected in the feature ...
void setFontColor(QColor color)
Set the color to use for drawing on the viewport.
void paint(QPainter *painter, bool showVectors, VectorType vectorType, bool approvedOnly) const
Paint features onto the viewport.
Universal Ground Map.
QPair< QPointF, QPointF > viewportCubeRange() const
Get the min/max cube line/sample positions of the viewport.
QString menuName() const
This is the name of the menu that should be passed into "addTo()".
void onToolActivated()
When this tool is activated (clicked on in the tool bar), turn ourselves on immediately.
Feature nomenclature database querier.
bool m_showApprovedOnly
Only show IAU approved features.
void handleMouseClicked(FeatureNomenclatureTool *tool, QPoint p, Qt::MouseButton s)
Handle a mouse click event on the viewport.
QRect * m_textRect
The viewport screen pixel rect which the text will consume.
When using this vector (extent) type, 8 arrows will be drawn out from the text of the feature...
FeaturePosition()
Instiantiates a feature position with no data.
MdiCubeViewport * sourceViewport() const
Get the viewport associated with this feature display.
bool showApprovedOnly() const
Show approved features only?
~FeatureNomenclatureTool()
Cleans up memory allocated by this tool.
QPointer< QPushButton > m_disclaimerBtn
This is the &#39;Disclaimer&#39; button in this tool&#39;s tool bar.
~ViewportFeatureDisplay()
Cleans up memory allocated by this feature display.
void findNomenclatureStateChanged(int)
The &#39;Name Features&#39; check box has changed state.
QList< ViewportFeatureDisplay > * m_foundNomenclature
The nomenclature that has been identified, one for each viewport.
double m_centerSample
The cube sample position of the feature center, Null if !isValid()
When using this vector (extent) type, no extents will be drawn.
void setFontSize(int newFontSize)
Set the font point size to use for drawing text on the viewport.
FeatureNomenclatureTool(QWidget *parent)
This instantiates a FeatureNomenclatureTool.
bool defaultEnabled() const
Is this tool enabled by default? (i.e.
QPair< double, double > center() const
Get the center sample/line position of the feature.
void setDefaultEnabled(bool defaultEnabled)
Set whether this tool is enabled by default.
QColor * m_fontColor
The color to use when drawing on the viewport.
void addTo(QMenu *menu)
Add the &#39;Show Nomenclature&#39; option to the options menu.
double m_centerLine
The cube line position of the feature center, Null if !isValid()
void showFeatureWebsite(FeatureNomenclature::Feature)
Show a web view pointed to the feature&#39;s web page.
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature...
void swap(FeatureDisplayPosition &other)
Swap member data with another instance of this class.
void toolStateChanged()
This should be called any time this tool&#39;s enabled or searching state could have changed.
bool viewportFeaturesFound(MdiCubeViewport *vp) const
Test if features have already been found for a given viewport.
bool m_nomenclatureEnabled
Do we find and display nomenclature? This corresponds to the &#39;Name Features&#39; check box and the &#39;Show ...
A named feature&#39;s position in a cube.
void setShowApprovedOnly(bool approvedOnly)
Set whether to show approved features and exclude unapproved features.
VectorType m_extentType
How we need to draw extents (if at all)
QPointer< QPushButton > m_nomenclatureOptionsBtn
This is the &#39;Tool Options&#39; button in this tool&#39;s tool bar.
FeatureNomenclature::Feature & feature()
Get the feature associated with this feature position.
void featuresForViewportFound(MdiCubeViewport *vp)
Move the features from a searching state to a found state for the given viewport. ...
QList< FeatureDisplayPosition > * m_featureScreenAreas
The visible features on the image in m_sourceViewport.
FeatureNomenclature::Feature m_feature
The feature for which we&#39;re encapsulating a viewport position.
void writeSettings()
Write out this tool&#39;s preserved state between runs.
bool isValid() const
Test if sample/line coordinates could be found for this feature.
QMap< MdiCubeViewport *, FeatureNomenclature * > * m_nomenclatureSearchers
The nomenclature being queried currently, one for each viewport that has no found nomenclature...
QRect textArea() const
Get the screen pixel rect in viewport screen coordinates that ought to be filled with the textual nam...
void nomenclaturePositionsOutdated()
Update the screen coordinates of the named features because the viewport has changed it&#39;s mappings...
void readSettings()
Read this tool&#39;s preserved state.
VectorType vectorType() const
Draw vectors to the extents of features?
int fontSize() const
Retrieve the font size of the features in this tool.
ViewportFeatureDisplay * viewportFeatureDisplay(MdiCubeViewport *vp)
Map from viewport to feature display.
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget that goes on the tool bar when this tool is active.
QList< QPoint > * m_edgePoints
The viewport screen pixel points which the edges are at.
ViewportFeatureDisplay & operator=(const ViewportFeatureDisplay &rhs)
Copy the data of rhs into *this.
QPointer< QPushButton > m_nomenclatureCenterBtn
This is the &#39;Center&#39; button in this tool&#39;s tool bar.
void configure()
Give a configuration dialog for the options available in this tool.
void featuresIdentified(FeatureNomenclature *)
A feature nomenclature has finished querying...
bool m_defaultEnabled
Do we turn ourselves on immediately?
void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Paint features on the given viewport.
QPointer< QComboBox > m_foundFeaturesCombo
This combo box lists all of the found features and their viewports.
UniversalGroundMap * m_gmap
The map used to determine the sample, line pair from a lat, lon pair.
QList< FeaturePosition > featurePositions()
Get the list of feature positions for a given display.
Display nomenclature on MDI Cube Viewports.
void showDisclaimer()
Show the user our nomenclature disclaimer and make note that we have shown the disclaimer.
void handleViewChanged(FeatureNomenclatureTool *tool)
The display options or area on the viewport has changed.
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
This handles a mouse release on one of the cube viewports when this tool is active.
QPointer< QCheckBox > m_findNomenclatureCheckBox
This is the &#39;Name Features&#39; check box when this tool is active.
void rebuildFeaturesCombo()
Rebuild m_foundFeaturesCombo&#39;s data from scratch.
QRect * m_fullDisplayRect
The viewport screen pixel rect which the entire display will use.
QList< FeatureNomenclature::Feature > features()
Get a list of features available on this viewport.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString m_disclaimerText
The (HTML) contents of the disclaimer to show the user.
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature...
Base class for the Qisis tools.
Definition: Tool.h:81
FeatureDisplayPosition & operator=(const FeatureDisplayPosition &rhs)
Assign the state of rhs to this.This is exception-safe.
void centerOnFeature(MdiCubeViewport *vp, FeatureNomenclature::Feature)
Center the given and any linked viewports (which contain the same feature) on the given feature...
QPointer< QAction > m_action
This is the &#39;Show Nomenclature&#39; toggleable action in the options menu.
bool m_disclaimedAlready
Have we ever shown the user our disclaimer?
FeaturePosition & operator=(const FeaturePosition &rhs)
Assign rhs to this.
int m_fontSize
The font size to use when naming features.
MdiCubeViewport * m_sourceViewport
The viewport this display is working with; we paint onto this viewport and react to events on this vi...
QPair< QPointF, QPointF > * m_viewportCubeRange
A check to make sure the cube viewport is in the correct state for painting.
void featureSelected()
This handles a feature being selected in the feature list combo box.
void findMissingNomenclature()
Update this tool&#39;s nomenclature data based on this tool&#39;s enabled state and the current viewport list...
FeatureDisplayPosition()
Instantiate a blank feature display position.
QList< QPoint > edgePoints() const
Get the edge screen pixel points in viewport screen coordinates that circle the feature.
void applyExtentType(VectorType vectorType)
Applies the type of extents to the feature.
QList< QPair< double, double > > * m_featureEdgeLineSamples
The pair is cube sample, line (first and second) respectively.
QAction * toolPadAction(ToolPad *pad)
Add this tool&#39;s action to the toolpad.
void swap(ViewportFeatureDisplay &other)
Swap *this and other&#39;s member data in an exception-free way.
QColor fontColor() const
What is the font color to use?
QRect displayArea() const
Get the screen pixel rect in viewport screen coordinates that encapsulates the entire feature...
A named feature&#39;s position in a viewport.
QList< FeaturePosition > * m_features
The features on the image in m_sourceViewport.
A named feature on a target.
void centerFeature(FeatureNomenclature::Feature)
Center the viewport on this feature.
void setVectorType(VectorType show)
Set whether to draw vectors from the feature center to the feature extents on the viewport...
QList< QPair< double, double > > edges() const
Get the edge sample/line positions of the feature.
VectorType
Enumeration of extent vector typess.