Isis 3 Developer Reference
FeatureNomenclatureTool.h
Go to the documentation of this file.
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:
140  void centerOnSelectedFeature();
141  void configure();
142  void featureSelected();
143  void featuresIdentified(FeatureNomenclature *);
144  void findNomenclatureStateChanged(int);
145  void nomenclaturePositionsOutdated();
146  void onToolActivated();
147  void showDisclaimer();
148 
149  private:
150  // This is an inner class defined below.
151  class ViewportFeatureDisplay;
152 
153  void centerOnFeature(MdiCubeViewport *vp, FeatureNomenclature::Feature);
154  void featuresForViewportFound(MdiCubeViewport *vp);
155  void findMissingNomenclature();
156  void findMissingNomenclature(MdiCubeViewport *vp);
157  void rebuildFeaturesCombo();
158  void removeFeatureDisplay(MdiCubeViewport *vp);
159  void showFeatureDetails(FeatureNomenclature::Feature);
160  void showFeatureWebsite(FeatureNomenclature::Feature);
161  void toolStateChanged();
162  void viewportDone(MdiCubeViewport *vp);
163  ViewportFeatureDisplay *viewportFeatureDisplay(MdiCubeViewport *vp);
164  const ViewportFeatureDisplay *
165  viewportFeatureDisplay(MdiCubeViewport *vp) const;
166  bool viewportFeaturesFound(MdiCubeViewport *vp) const;
167  QList<MdiCubeViewport *> viewportsWithFoundNomenclature();
168 
169  void readSettings();
170  void writeSettings();
171 
172  private:
188  class FeaturePosition {
189  public:
190  FeaturePosition();
192  FeaturePosition(const FeaturePosition &other);
193  ~FeaturePosition();
194 
195  bool isValid() const;
196 
197  QPair<double, double> center() const;
198  QList< QPair<double, double> > edges() const;
199  FeatureNomenclature::Feature &feature();
200  const FeatureNomenclature::Feature &feature() const;
201  void applyExtentType(VectorType vectorType);
202 
203  void swap(FeaturePosition &other);
204  FeaturePosition &operator=(const FeaturePosition &rhs);
205 
206  private:
208  double m_centerLine;
210  double m_centerSample;
211 
213  UniversalGroundMap *m_gmap;
214 
219  QList< QPair<double, double> > *m_featureEdgeLineSamples;
222  };
223 
224 
236  class FeatureDisplayPosition {
237  public:
238  FeatureDisplayPosition();
239  FeatureDisplayPosition(QRect textRect, QRect fullDisplayRect,
240  QList<QPoint> edgePoints);
241  FeatureDisplayPosition(const FeatureDisplayPosition &other);
242  ~FeatureDisplayPosition();
243 
244  QRect textArea() const;
245  QRect displayArea() const;
246  QList<QPoint> edgePoints() const;
247 
248  void swap(FeatureDisplayPosition &other);
249  FeatureDisplayPosition &operator=(const FeatureDisplayPosition &rhs);
250  private:
251 
252  private:
254  QRect *m_textRect;
256  QRect *m_fullDisplayRect;
258  QList<QPoint> *m_edgePoints;
259  };
260 
261 
275  class ViewportFeatureDisplay {
276  public:
277  ViewportFeatureDisplay();
278  ViewportFeatureDisplay(FeatureNomenclatureTool *tool,
279  MdiCubeViewport *sourceViewport,
282  ViewportFeatureDisplay(const ViewportFeatureDisplay &other);
283  ~ViewportFeatureDisplay();
284 
285  void applyExtentType(VectorType vectorType);
286  void centerFeature(FeatureNomenclature::Feature);
288  QList<FeaturePosition> featurePositions();
289  MdiCubeViewport *sourceViewport() const;
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);
295  void handleViewChanged(FeatureNomenclatureTool *tool);
296 
297  void swap(ViewportFeatureDisplay &other);
298  ViewportFeatureDisplay &operator=(
299  const ViewportFeatureDisplay &rhs);
300 
301  private:
302  QPair<QPointF, QPointF> viewportCubeRange() const;
303 
304  private:
309  MdiCubeViewport *m_sourceViewport;
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;
356  QMap< MdiCubeViewport *,
357  FeatureNomenclature *> * m_nomenclatureSearchers;
358 
364  bool m_nomenclatureEnabled;
365 
367  QString m_disclaimerText;
368 
370  int m_fontSize;
372  QColor *m_fontColor;
374  bool m_defaultEnabled;
376  bool m_disclaimedAlready;
378  VectorType m_extentType;
380  bool m_showApprovedOnly;
381  };
382 }
383 
384 #endif
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:53
void updateTool()
Updates the state of the current tool.
Definition: FeatureNomenclatureTool.cpp:404
void setFontColor(QColor color)
Set the color to use for drawing on the viewport.
Definition: FeatureNomenclatureTool.cpp:215
Universal Ground Map.
Definition: UniversalGroundMap.h:85
QString menuName() const
This is the name of the menu that should be passed into "addTo()".
Definition: FeatureNomenclatureTool.cpp:291
Feature nomenclature database querier.
Definition: FeatureNomenclature.h:51
When using this vector (extent) type, 8 arrows will be drawn out from the text of the feature...
Definition: FeatureNomenclatureTool.h:101
bool showApprovedOnly() const
Show approved features only?
Definition: FeatureNomenclatureTool.cpp:181
~FeatureNomenclatureTool()
Cleans up memory allocated by this tool.
Definition: FeatureNomenclatureTool.cpp:98
When using this vector (extent) type, no extents will be drawn.
Definition: FeatureNomenclatureTool.h:66
void setFontSize(int newFontSize)
Set the font point size to use for drawing text on the viewport.
Definition: FeatureNomenclatureTool.cpp:232
FeatureNomenclatureTool(QWidget *parent)
This instantiates a FeatureNomenclatureTool.
Definition: FeatureNomenclatureTool.cpp:46
bool defaultEnabled() const
Is this tool enabled by default? (i.e.
Definition: FeatureNomenclatureTool.cpp:151
void setDefaultEnabled(bool defaultEnabled)
Set whether this tool is enabled by default.
Definition: FeatureNomenclatureTool.cpp:201
void addTo(QMenu *menu)
Add the &#39;Show Nomenclature&#39; option to the options menu.
Definition: FeatureNomenclatureTool.cpp:116
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature...
Definition: FeatureNomenclatureTool.h:83
void setShowApprovedOnly(bool approvedOnly)
Set whether to show approved features and exclude unapproved features.
Definition: FeatureNomenclatureTool.cpp:250
VectorType vectorType() const
Draw vectors to the extents of features?
Definition: FeatureNomenclatureTool.cpp:191
int fontSize() const
Retrieve the font size of the features in this tool.
Definition: FeatureNomenclatureTool.cpp:171
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget that goes on the tool bar when this tool is active.
Definition: FeatureNomenclatureTool.cpp:303
void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Paint features on the given viewport.
Definition: FeatureNomenclatureTool.cpp:132
Display nomenclature on MDI Cube Viewports.
Definition: FeatureNomenclatureTool.h:56
void mouseButtonRelease(QPoint p, Qt::MouseButton s)
This handles a mouse release on one of the cube viewports when this tool is active.
Definition: FeatureNomenclatureTool.cpp:391
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature...
Definition: FeatureNomenclatureTool.h:110
Base class for the Qisis tools.
Definition: Tool.h:81
Definition: CubeIoHandler.h:39
QAction * toolPadAction(ToolPad *pad)
Add this tool&#39;s action to the toolpad.
Definition: FeatureNomenclatureTool.cpp:364
Definition: CubeIoHandler.h:38
QColor fontColor() const
What is the font color to use?
Definition: FeatureNomenclatureTool.cpp:161
A named feature on a target.
Definition: FeatureNomenclature.h:117
Definition: ToolPad.h:14
void setVectorType(VectorType show)
Set whether to draw vectors from the feature center to the feature extents on the viewport...
Definition: FeatureNomenclatureTool.cpp:269
VectorType
Enumeration of extent vector typess.
Definition: FeatureNomenclatureTool.h:62