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