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>
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:
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();
191 FeaturePosition(MdiCubeViewport *, FeatureNomenclature::Feature, VectorType vectorType);
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;
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,
280 QList<FeatureNomenclature::Feature> features,
281 VectorType vectorType);
282 ViewportFeatureDisplay(const ViewportFeatureDisplay &other);
283 ~ViewportFeatureDisplay();
284
285 void applyExtentType(VectorType vectorType);
286 void centerFeature(FeatureNomenclature::Feature);
287 QList<FeatureNomenclature::Feature> features();
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
A named feature on a target.
Definition FeatureNomenclature.h:117
Feature nomenclature database querier.
Definition FeatureNomenclature.h:51
Display nomenclature on MDI Cube Viewports.
Definition FeatureNomenclatureTool.h:56
void setVectorType(VectorType show)
Set whether to draw vectors from the feature center to the feature extents on the viewport.
Definition FeatureNomenclatureTool.cpp:268
~FeatureNomenclatureTool()
Cleans up memory allocated by this tool.
Definition FeatureNomenclatureTool.cpp:97
void addTo(QMenu *menu)
Add the 'Show Nomenclature' option to the options menu.
Definition FeatureNomenclatureTool.cpp:115
void setShowApprovedOnly(bool approvedOnly)
Set whether to show approved features and exclude unapproved features.
Definition FeatureNomenclatureTool.cpp:249
void setFontSize(int newFontSize)
Set the font point size to use for drawing text on the viewport.
Definition FeatureNomenclatureTool.cpp:231
VectorType vectorType() const
Draw vectors to the extents of features?
Definition FeatureNomenclatureTool.cpp:190
void updateTool()
Updates the state of the current tool.
Definition FeatureNomenclatureTool.cpp:403
void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Paint features on the given viewport.
Definition FeatureNomenclatureTool.cpp:131
void setDefaultEnabled(bool defaultEnabled)
Set whether this tool is enabled by default.
Definition FeatureNomenclatureTool.cpp:200
FeatureNomenclatureTool(QWidget *parent)
This instantiates a FeatureNomenclatureTool.
Definition FeatureNomenclatureTool.cpp:45
QWidget * createToolBarWidget(QStackedWidget *parent)
Creates the widget that goes on the tool bar when this tool is active.
Definition FeatureNomenclatureTool.cpp:302
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:390
int fontSize() const
Retrieve the font size of the features in this tool.
Definition FeatureNomenclatureTool.cpp:170
VectorType
Enumeration of extent vector typess.
Definition FeatureNomenclatureTool.h:62
@ Arrows8
When using this vector (extent) type, 8 arrows will be drawn out from the text of the feature.
Definition FeatureNomenclatureTool.h:101
@ Box
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature.
Definition FeatureNomenclatureTool.h:110
@ None
When using this vector (extent) type, no extents will be drawn.
Definition FeatureNomenclatureTool.h:66
@ Arrows4
When using this vector (extent) type, 4 arrows will be drawn out from the text of the feature.
Definition FeatureNomenclatureTool.h:83
void setFontColor(QColor color)
Set the color to use for drawing on the viewport.
Definition FeatureNomenclatureTool.cpp:214
bool showApprovedOnly() const
Show approved features only?
Definition FeatureNomenclatureTool.cpp:180
QString menuName() const
This is the name of the menu that should be passed into "addTo()".
Definition FeatureNomenclatureTool.cpp:290
QColor fontColor() const
What is the font color to use?
Definition FeatureNomenclatureTool.cpp:160
bool defaultEnabled() const
Is this tool enabled by default? (i.e.
Definition FeatureNomenclatureTool.cpp:150
QAction * toolPadAction(ToolPad *pad)
Add this tool's action to the toolpad.
Definition FeatureNomenclatureTool.cpp:363
Cube display widget for certain Isis MDI applications.
Definition MdiCubeViewport.h:39
Base class for the Qisis tools.
Definition Tool.h:67
Definition ToolPad.h:14
Universal Ground Map.
Definition UniversalGroundMap.h:69
This is free and unencumbered software released into the public domain.
Definition CubeIoHandler.h:22
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.
Definition CubeIoHandler.h:23