Isis 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 {
110  Box
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
Isis::FeatureNomenclatureTool::fontColor
QColor fontColor() const
What is the font color to use?
Definition: FeatureNomenclatureTool.cpp:161
Isis::FeatureNomenclatureTool::VectorType
VectorType
Enumeration of extent vector typess.
Definition: FeatureNomenclatureTool.h:62
Isis::Angle::Degrees
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:56
FileName.h
Isis::MdiCubeViewport
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:39
QWidget
Isis::FeatureNomenclatureTool::updateTool
void updateTool()
Updates the state of the current tool.
Definition: FeatureNomenclatureTool.cpp:404
QProgressBar
Isis::UniversalGroundMap
Universal Ground Map.
Definition: UniversalGroundMap.h:69
MdiCubeViewport.h
QList< ViewportFeatureDisplay >
Isis::FeatureNomenclatureTool::Arrows4
@ Arrows4
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature.
Definition: FeatureNomenclatureTool.h:83
Isis::Tool::cubeViewportList
CubeViewportList * cubeViewportList() const
Return the list of cubeviewports.
Definition: Tool.cpp:390
Isis::FeatureNomenclature
Feature nomenclature database querier.
Definition: FeatureNomenclature.h:51
Isis::Tool::screenPixelsChanged
virtual void screenPixelsChanged()
This is called when actions change which pixels from the cube are displayed.
Definition: Tool.h:148
Isis::Tool
Base class for the Qisis tools.
Definition: Tool.h:67
Isis::FeatureNomenclatureTool::menuName
QString menuName() const
This is the name of the menu that should be passed into "addTo()".
Definition: FeatureNomenclatureTool.cpp:291
Isis::FeatureNomenclatureTool::~FeatureNomenclatureTool
~FeatureNomenclatureTool()
Cleans up memory allocated by this tool.
Definition: FeatureNomenclatureTool.cpp:98
QMenu
Target.h
Isis::FeatureNomenclatureTool::setFontColor
void setFontColor(QColor color)
Set the color to use for drawing on the viewport.
Definition: FeatureNomenclatureTool.cpp:215
Isis::FeatureNomenclatureTool::showApprovedOnly
bool showApprovedOnly() const
Show approved features only?
Definition: FeatureNomenclatureTool.cpp:181
Isis::Tool::toolIconDir
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:113
Longitude.h
Tool.h
Isis::FeatureNomenclatureTool::defaultEnabled
bool defaultEnabled() const
Is this tool enabled by default? (i.e.
Definition: FeatureNomenclatureTool.cpp:151
Isis::FeatureNomenclatureTool::FeatureNomenclatureTool
FeatureNomenclatureTool(QWidget *parent)
This instantiates a FeatureNomenclatureTool.
Definition: FeatureNomenclatureTool.cpp:46
ToolPad.h
Isis::FeatureNomenclatureTool::None
@ None
When using this vector (extent) type, no extents will be drawn.
Definition: FeatureNomenclatureTool.h:66
Isis::FeatureNomenclatureTool::addTo
void addTo(QMenu *menu)
Add the 'Show Nomenclature' option to the options menu.
Definition: FeatureNomenclatureTool.cpp:116
Isis::FeatureNomenclatureTool::setDefaultEnabled
void setDefaultEnabled(bool defaultEnabled)
Set whether this tool is enabled by default.
Definition: FeatureNomenclatureTool.cpp:201
Isis::FeatureNomenclature::Feature
A named feature on a target.
Definition: FeatureNomenclature.h:117
Isis::FeatureNomenclatureTool::Arrows8
@ Arrows8
When using this vector (extent) type, 8 arrows will be drawn out from the text of the feature.
Definition: FeatureNomenclatureTool.h:101
QComboBox
Isis::FeatureNomenclatureTool::setFontSize
void setFontSize(int newFontSize)
Set the font point size to use for drawing text on the viewport.
Definition: FeatureNomenclatureTool.cpp:232
NomenclatureToolConfigDialog.h
FeatureNomenclature.h
Isis::FeatureNomenclatureTool::setShowApprovedOnly
void setShowApprovedOnly(bool approvedOnly)
Set whether to show approved features and exclude unapproved features.
Definition: FeatureNomenclatureTool.cpp:250
Latitude.h
Isis::FeatureNomenclature::Approved
@ Approved
When this status is assigned to a feature, the displayed status will be "Adopted by the IAU" and the ...
Definition: FeatureNomenclature.h:67
Isis::Tool::toolActivated
void toolActivated()
Isis::FeatureNomenclature::featureDiameterGreaterThan
static bool featureDiameterGreaterThan(const FeatureNomenclature::Feature &lhs, const FeatureNomenclature::Feature &rhs)
Compare the diameter of two features.
Definition: FeatureNomenclature.cpp:193
Isis::FeatureNomenclatureTool::Box
@ Box
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature.
Definition: FeatureNomenclatureTool.h:110
FeatureNomenclatureTool.h
Isis::FeatureNomenclatureTool
Display nomenclature on MDI Cube Viewports.
Definition: FeatureNomenclatureTool.h:56
Isis::FeatureNomenclatureTool::fontSize
int fontSize() const
Retrieve the font size of the features in this tool.
Definition: FeatureNomenclatureTool.cpp:171
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::FeatureNomenclatureTool::vectorType
VectorType vectorType() const
Draw vectors to the extents of features?
Definition: FeatureNomenclatureTool.cpp:191
Isis::FeatureNomenclatureTool::createToolBarWidget
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget that goes on the tool bar when this tool is active.
Definition: FeatureNomenclatureTool.cpp:303
Isis::ToolPad
Definition: ToolPad.h:14
Isis::FeatureNomenclatureTool::paintViewport
void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Paint features on the given viewport.
Definition: FeatureNomenclatureTool.cpp:132
QPair< double, double >
Isis::FeatureNomenclatureTool::mouseButtonRelease
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
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
Isis::FeatureNomenclatureTool::toolPadAction
QAction * toolPadAction(ToolPad *pad)
Add this tool's action to the toolpad.
Definition: FeatureNomenclatureTool.cpp:364
QDialog
PolygonTools.h
Distance.h
IsisDebug.h
QAction
Isis::Tool::cubeViewport
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:197
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::FeatureNomenclatureTool::setVectorType
void setVectorType(VectorType show)
Set whether to draw vectors from the feature center to the feature extents on the viewport.
Definition: FeatureNomenclatureTool.cpp:269
ImagePolygon.h
Isis::None
@ None
Definition: PixelType.h:28