Isis 3 Programmer Reference
ControlPointEditWidget.h
1#ifndef ControlPointEditWidget_h
2#define ControlPointEditWidget_h
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12
13#include "ControlPoint.h"
14#include "FileName.h"
15#include "SpecialPixel.h"
16#include "TemplateList.h"
17
18#include <QCloseEvent>
19#include <QDir>
20#include <QHideEvent>
21#include <QPalette>
22#include <QPointer>
23#include <QStatusBar>
24#include <QString>
25#include <QStringList>
26#include <QWidget>
27
28class QAction;
29class QBoxLayout;
30class QCheckBox;
31class QComboBox;
32class QGroupBox;
33class QLabel;
34class QMainWindow;
35class QObject;
36class QPainter;
37class QPoint;
38class QPushButton;
39class QSplitter;
40class QStackedWidget;
42class QString;
43class QTableWidget;
44class QTextEdit;
45class QWidget;
46
47namespace Isis {
48 class Control;
49 class ControlMeasureEditWidget;
50 class ControlMeasure;
51 class ControlNet;
52 class Cube;
53 class CubeViewport;
54 class Directory;
55 class MdiCubeViewport;
56 class SerialNumberList;
57 class Stretch;
58 class ToolPad;
59 class UniversalGroundMap;
60
122 Q_OBJECT
123
124 public:
125 ControlPointEditWidget(Directory *directory, QWidget *parent, bool addMeasures = false);
126 virtual ~ControlPointEditWidget();
127
128 QString editPointId();
129 ControlPoint *editPoint();
130
131 signals:
132 void controlPointChanged(QString pointId);
133 void controlPointAdded(QString pointId);
134 void ignorePointChanged();
135 void ignoreLeftChanged();
136 void ignoreRightChanged();
137 void cnetModified();
138 void newControlNetwork(ControlNet *);
139 void stretchChipViewport(Stretch *, CubeViewport *);
140 void measureChanged();
141 // temporary signal for quick & dirty autosave in Ipce
142 void saveControlNet();
143
144 public slots:
146 void setControl(Control *control);
148 void setEditPoint(ControlPoint *controlPoint, QString serialNumber = "");
149 void deletePoint(ControlPoint *controlPoint);
150
151 void createControlPoint(double latitude, double longitude, Cube *cube = 0,
152 bool isGroundSource = false);
153
154 // Changed colorizeSaveNetButton to public slot so it could be called from
155 // Directory::saveActiveControl(). This should be temporary until the modify/save functionality
156 // of active control is re-factored. Also added reset parameter, defaulting to false so button
157 // is red. This default was used so that current calls did not need to be changed.
158 void colorizeSaveNetButton(bool reset = false);
159
160 void addTemplates(TemplateList *templateList);
161
162 protected:
163 bool eventFilter(QObject *o,QEvent *e);
164
165 private slots:
166// void enterWhatsThisMode();
167 void reloadPoint();
168 void saveNet();
169// void addMeasure();
170 void setPointType (int pointType);
171 void setLockPoint (bool ignore);
172 void setIgnorePoint (bool ignore);
173 void setLockLeftMeasure (bool ignore);
174 void setIgnoreLeftMeasure (bool ignore);
175 void setLockRightMeasure (bool ignore);
176 void setIgnoreRightMeasure (bool ignore);
177
178 void selectLeftMeasure (int index);
179 void selectRightMeasure (int index);
180 void nextRightMeasure();
182 void updateLeftMeasureInfo ();
184
185 void measureSaved();
186 void checkReference();
187
188 void updateGroundPosition();
190 void openReferenceRadius();
191 void groundSourceFileSelectionChanged(int index);
192
193 void savePoint();
194
195 void colorizeAllSaveButtons(QString color);
197
198 void openTemplateFile();
199 void viewTemplateFile();
200 void saveChips();
202 void saveTemplateFile();
203 void saveTemplateFileAs();
204 void setTemplateFile(QString);
205 void setTemplateModified();
206 void writeTemplateFile(QString);
207 void resetTemplateComboBox(QString fileName);
208 void clearEditPoint();
209
210 private:
211 void createActions();
212
213 void loadPoint(QString serialNumber = "");
214 void loadGroundMeasure();
215 void createPointEditor(QWidget *parent, bool addMeasures);
216 QSplitter * createTopSplitter();
217 QGroupBox * createControlPointGroupBox();
218 QGroupBox * createLeftMeasureGroupBox();
219 QGroupBox * createRightMeasureGroupBox();
221 void loadTemplateFile(QString);
222 bool okToContinue();
223 bool IsMeasureLocked(QString serialNumber);
225
226 void setShapesForPoint(double latitude=Null, double longitude=Null);
228 bool setGroundSourceInfo();
231 void clearGroundSource();
232
233 void initDem(QString demFile);
234 double demRadius(double latitude, double longitude);
235
236 private:
237
238 QPointer<QWidget> m_parent;
239 Directory *m_directory;
241
243 QPointer<QLabel> m_cnetFileNameLabel;
245
246 QPointer<QAction> m_closePointEditor;
247
248 QPointer<QAction> m_saveChips;
250 QPointer<QAction> m_showHideTemplateEditor;
251 QPointer<QAction> m_openTemplateFile;
252 QPointer<QAction> m_saveTemplateFile;
253 QPointer<QAction> m_saveTemplateFileAs;
254
255
257 QPointer<ControlMeasureEditWidget> m_measureEditor;
258
259 QPointer<QPushButton> m_reloadPoint;
260 QPointer<QPushButton> m_savePoint;
262
263 QPointer<QPushButton> m_saveNet;
264
265 QPointer<QTextEdit> m_templateEditor;
266 QPointer<QWidget> m_templateEditorWidget;
268
269 QPointer<QComboBox> m_templateComboBox;
270 QPointer<QComboBox> m_groundSourceCombo;
271 QPointer<QComboBox> m_radiusSourceCombo;
272 QPointer<QLabel> m_ptIdValue;
273 QPointer<QComboBox> m_pointTypeCombo;
274 QPointer<QLabel> m_numMeasures;
275 QPointer<QLabel> m_aprioriLatitude;
276 QPointer<QLabel> m_aprioriLongitude;
277 QPointer<QLabel> m_aprioriRadius;
278
279 QPointer<QCheckBox> m_lockPoint;
280 QPointer<QCheckBox> m_ignorePoint;
281 QPointer<QLabel> m_leftReference;
282 QPointer<QLabel> m_leftMeasureType;
283 QPointer<QLabel> m_rightReference;
284 QPointer<QLabel> m_rightMeasureType;
285 QPointer<QCheckBox> m_lockLeftMeasure;
286 QPointer<QCheckBox> m_ignoreLeftMeasure;
287 QPointer<QCheckBox> m_lockRightMeasure;
288 QPointer<QCheckBox> m_ignoreRightMeasure;
289
290 QPointer<QComboBox> m_leftCombo;
291 QPointer<QComboBox> m_rightCombo;
292 QPointer<QStandardItemModel> m_model;
293
294 QPointer<QMainWindow> m_measureWindow;
295 QPointer<QTableWidget> m_measureTable;
296
297 QPointer<ControlPoint> m_editPoint;
299 QPointer<ControlNet> m_controlNet;
300 QPointer<Control> m_control;
301
302 QPointer<ControlPoint> m_newPoint;
304
306
307 QString m_leftFile;
308 QPointer<ControlMeasure> m_leftMeasure;
309 QPointer<ControlMeasure> m_rightMeasure;
310 QScopedPointer<Cube> m_leftCube;
311 QScopedPointer<Cube> m_rightCube;
312
315 QMap<QString, Shape *> m_nameToShapeMap;
316
318 QString m_groundSN;
319 ControlPoint::SurfacePointSource::Source m_groundSourceType;
320 QScopedPointer<UniversalGroundMap> m_groundGmap;
321
326
327 // TODO: Combine the following m_groundSourceFile, m_radiusSourceFile
328 // with m_groundFile and m_demFile. Is it just a matter of
329 // full path vs filename only?
330 QString m_radiusFilename;
331 ControlPoint::RadiusSource::Source m_radiusSourceType;
333 QString m_demFile;
334 QScopedPointer<Cube> m_demCube;
335 };
336};
337#endif
This represents an ISIS control net in a project-based GUI interface.
Definition Control.h:66
a control measurement
a control network
Definition ControlNet.h:258
Gui for editing ControlPoints in ipce application.
QPointer< QComboBox > m_templateComboBox
ComboBox of imported registration templates.
void setLockLeftMeasure(bool ignore)
Set the "EditLock" keyword of the measure shown in the left viewport to the value of the input parame...
void saveTemplateFileAs()
Save the contents of template editor to a file chosen by the user.
bool m_addMeasuresButton
Indicates whether or not to add "Add Measures(s) to Point".
void deletePoint(ControlPoint *controlPoint)
Gives user options for deleting a control point from the control network.
void setLockRightMeasure(bool ignore)
Set the "EditLock" keyword of the measure shown in the right viewport to the value of the input param...
QPointer< Control > m_control
Current Control.
QPointer< QLabel > m_rightMeasureType
Label for the right measure's adjustment type.
QPointer< QCheckBox > m_ignorePoint
Checkbox to ignore the current point.
void setIgnoreRightMeasure(bool ignore)
Set the "Ignore" keyword of the measure shown in the right viewport to the value of the input paramet...
QPointer< QTableWidget > m_measureTable
Table widget for the measures.
void previousRightMeasure()
Selects the previous right measure when activated by key shortcut.
QPointer< ControlPoint > m_editPoint
The control point being edited.
void checkReference()
Change which measure is the reference.
void updateRightMeasureInfo()
Update the right measure information.
void colorizeSaveNetButton(bool reset=false)
Turn "Save Net" button text to red.
QPointer< QPushButton > m_reloadPoint
Button to reload current point to saved measures.
QPointer< QComboBox > m_rightCombo
Combobox to load right measure into right chip viewport.
bool m_changeAllGroundLocation
Change the ground source location of all fixed, constrained points in the network.
bool IsMeasureLocked(QString serialNumber)
Check for implicitly locked measure in m_editPoint.
void setEditPoint(ControlPoint *controlPoint, QString serialNumber="")
Slot called by Directory to set the control point for editing.
QPointer< QWidget > m_parent
Parent widget.
QPointer< QCheckBox > m_lockLeftMeasure
Checkbox to edit lock/unlock the left measure.
QPointer< QPushButton > m_saveNet
Button to save the current control network.
bool okToContinue()
Checks the state of the template registration file and determines if it is safe to continue opening a...
void resetTemplateComboBox(QString fileName)
Reset the selected template in the template combobox if the template selected by the user does not sa...
bool validateMeasureChange(ControlMeasure *m)
Validates a change to a control measure.
void setShapesForPoint(double latitude=Null, double longitude=Null)
Fill m_projectShapeNames with ALL shapes currently in project.
QPointer< ControlMeasureEditWidget > m_measureEditor
Pointer to control measure editor widget.
bool m_templateModified
Indicates if the registration template was edited.
QPointer< QAction > m_saveTemplateFile
Action to save a registration template file to disk.
QPointer< QComboBox > m_pointTypeCombo
Combobox to change the type of the current point.
QPointer< ControlMeasure > m_leftMeasure
Left control measure.
QString m_cnetFileName
Filename of the control network that is being modified.
bool setGroundSourceInfo()
Find the ground source location: First look at current edit point for parameter, AprioriXYZSourceFile...
void changeGroundLocationsInNet()
Change the location of all ground source locations in the ControlNet.
QPointer< QLabel > m_cnetFileNameLabel
Label with name of the control network file.
void setControl(Control *control)
New control network being edited.
QPointer< QComboBox > m_leftCombo
Combobox to load left measure into left chip viewport.
void initDem(QString demFile)
Initialize the given Dem and appropriate member variables for later use editing Fixed or Constrained ...
void saveChips()
Slot which calls ControlPointEditWidget slot to save chips.
QPointer< QCheckBox > m_ignoreLeftMeasure
Checkbox to ignore the left measure.
QString m_groundSN
Serial number of ground source file.
ControlMeasure * createTemporaryGroundMeasure()
Create a temporary measure to hold the ground point info for ground source.
void setSerialNumberList(SerialNumberList *snList)
Set the serial number list.
SerialNumberList * m_serialNumberList
Serial number list for the loaded cubes.
QPointer< QComboBox > m_radiusSourceCombo
ComboBox for selecting ground source.
void loadGroundMeasure()
Load ground measure into right side and add to file combo boxes.
void createControlPoint(double latitude, double longitude, Cube *cube=0, bool isGroundSource=false)
Create a new control point at the given latitude, longitude.
QPointer< QTextEdit > m_templateEditor
Text editor for editing the registration template.
void saveTemplateFile()
Save the file opened in the template editor.
QPointer< QCheckBox > m_lockRightMeasure
Checkbox to edit lock/unlock the right measure.
void createActions()
Creates the actions for the widget.
void addTemplates(TemplateList *templateList)
Add registration TemplateList to combobox when imported to project.
void viewTemplateFile()
Allows the user to view the template file that is currently set.
QStringList m_pointFiles
Associated files for current control point.
void measureSaved()
This method is connected with the measureSaved() signal from ControlMeasureEditWidget.
void openReferenceRadius()
Open a radius source using the shape model of the reference measure of m_editPoint.
FileName checkGroundFileLocation(FileName groundFile)
Ground source file from control net cannot be found, give user option to give new location.
bool m_cnetModified
Indicates if the control network has been modified.
void savePoint()
Save edit point to the Control Network.
void clearGroundSource()
Clear out the ground source used for Constrained or Fixed control points.
QPointer< QMainWindow > m_measureWindow
Main window for the the measure table widget.
void setControlFromActive()
New active control was set from ipce.
void setPointType(int pointType)
Set the point type.
int m_numberProjectShapesWithPoint
Number of shapes containing control point.
void setTemplateFile(QString)
Appends the filename to the registrations path (unless this is the default template) and calls setTem...
QPointer< QAction > m_saveTemplateFileAs
Action to save a new registration template.
bool m_changeGroundLocationInNet
Change the ground source location.
QPointer< QAction > m_openTemplateFile
Action to open a registration template file to disk.
void setIgnorePoint(bool ignore)
Set point's "Ignore" keyword to the value of the input parameter.
void clearEditPoint()
Cleans up the edit point memory.
void reloadPoint()
Set both chip viewports to their original measures for the control point.
void loadPoint(QString serialNumber="")
Load point into ControlPointEditWidget.
void colorizeSavePointButton()
Refresh all necessary widgets in ControlPointEditWidget including the PointEditor and CubeViewports.
void updateSurfacePointInfo()
Update the Surface Point Information in the ControlPointEditWidget.
void openTemplateFile()
Prompt user for a registration template file to open.
QMap< QString, Shape * > m_nameToShapeMap
Map between Shape display name and object.
void nextRightMeasure()
Selects the next right measure when activated by key shortcut.
void createTemplateEditorWidget()
Creates the Widget which contains the template editor and its toolbar.
void setLockPoint(bool ignore)
Set point's "EditLock" keyword to the value of the input parameter.
QPalette m_saveDefaultPalette
Default color pallet of the "Save Point" button.
void selectLeftMeasure(int index)
Select left measure.
QStringList m_projectShapeNames
List of Shapes imported into project, at time of loaded CP.
QString m_lastUsedPointId
Point id of the last used control point.
QPointer< ControlNet > m_controlNet
Current control net.
void groundSourceFileSelectionChanged(int index)
Slot called when user changes selection in m_groundSourceCombo.
void writeTemplateFile(QString)
Write the contents of the template editor to the file provided.
void selectRightMeasure(int index)
Select right measure.
QPointer< QComboBox > m_groundSourceCombo
ComboBox for selecting ground source.
QGroupBox * createLeftMeasureGroupBox()
Creates the "Left Measure" groupbox.
void setTemplateModified()
Called when the template file is modified by the template editor.
QPointer< QWidget > m_templateEditorWidget
Template editor widget.
void showHideTemplateEditor()
Toggles the visibility of the template editor widget.
void setIgnoreLeftMeasure(bool ignore)
Set the "Ignore" keyword of the measure shown in the left viewport to the value of the input paramete...
QScopedPointer< Cube > m_rightCube
Right cube.
void saveNet()
This slot is needed because we cannot directly emit a signal with a ControlNet argument after the "Sa...
QPointer< QCheckBox > m_ignoreRightMeasure
Checkbox to ignore the right measure.
QPointer< QLabel > m_rightReference
Label indicating if right measure is the reference.
bool eventFilter(QObject *o, QEvent *e)
Event filter for ControlPointEditWidget.
QString m_groundFilename
File name of ground source.
QScopedPointer< Cube > m_leftCube
Left cube.
QPointer< QAction > m_closePointEditor
Action to close the point editor.
ControlPoint::SurfacePointSource::Source m_groundSourceType
SurfacePoint type of ground source.
QString m_leftFile
Filename of left measure.
void updateLeftMeasureInfo()
Update the left measure information.
QPointer< ControlMeasure > m_rightMeasure
Right control measure.
QGroupBox * createControlPointGroupBox()
Creates the "Control Point" groupbox.
void loadTemplateFile(QString)
Updates the current template file being used.
QSplitter * createTopSplitter()
Creates everything above the ControlPointEdit.
QPointer< QAction > m_saveChips
Action to save the registration chips Action to toggle visibility of the registration template editor...
QGroupBox * createRightMeasureGroupBox()
Create the "Right Measure" groupbox.
QString m_newGroundDir
Contains the ground source location.
QPointer< QLabel > m_ptIdValue
Label for the point id of the current point.
QPointer< QPushButton > m_savePoint
Button to save current point being edited.
QPointer< QLabel > m_leftReference
Label indicating if left measure is the reference.
bool m_demOpen
Has a radius source been opened?
ControlPointEditWidget(Directory *directory, QWidget *parent, bool addMeasures=false)
Consructs the ControlPointEditWidget widget.
double demRadius(double latitude, double longitude)
Return a radius values from the dem using bilinear interpolation.
void createPointEditor(QWidget *parent, bool addMeasures)
Create the widget for editing control points.
QPointer< QLabel > m_leftMeasureType
Label for the left measure's adjustment type.
QPointer< ControlPoint > m_newPoint
New control point.
QPointer< QCheckBox > m_lockPoint
Checkbox that locks/unlocks the current point.
A single control point.
IO Handler for Isis Cubes.
Definition Cube.h:168
Widget to display Isis cubes for qt apps.
File name manipulation and expansion.
Definition FileName.h:100
Serial Number list generator.
Pixel value mapper.
Definition Stretch.h:58
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
const double Null
Value for an Isis Null pixel.