Loading isis/src/qisis/objs/ControlMeasureEditWidget/ControlMeasureEditWidget.cpp +99 −43 Original line number Original line Diff line number Diff line Loading @@ -47,8 +47,6 @@ namespace Isis { * @param allowLeftMouse[in] Allow/Disallow mouse events on Left ChipViewport * @param allowLeftMouse[in] Allow/Disallow mouse events on Left ChipViewport * @param useGeometry[in] Allow/Disallow geometry and rotation on right ChipViewport * @param useGeometry[in] Allow/Disallow geometry and rotation on right ChipViewport * * * @throws IException::Io "Cannot create AutoRegFactory. As a result, sub-pixel registration * will not work." * @author Tracie Sucharski * @author Tracie Sucharski * @internal * @internal * @history 2008-15-?? Jeannie Walldren - Added error * @history 2008-15-?? Jeannie Walldren - Added error Loading @@ -72,20 +70,7 @@ namespace Isis { m_leftGroundMap = 0; m_leftGroundMap = 0; m_rightGroundMap = 0; m_rightGroundMap = 0; try { m_templateFileName = "$base/templates/autoreg/qnetReg.def"; m_templateFileName = "$base/templates/autoreg/qnetReg.def"; Pvl pvl(m_templateFileName); m_autoRegFact = AutoRegFactory::Create(pvl); } catch (IException &e) { m_autoRegFact = NULL; IException fullError(e, IException::Io, "Cannot create AutoRegFactory. As a result, " "sub-pixel registration will not work.", _FILEINFO_); QString message = fullError.toString(); QMessageBox::information((QWidget *)parent, "Error", message); } createMeasureEditor(parent); createMeasureEditor(parent); } } Loading Loading @@ -627,9 +612,11 @@ namespace Isis { m_saveMeasure->setShortcut(Qt::Key_M); m_saveMeasure->setShortcut(Qt::Key_M); m_saveDefaultPalette = m_saveMeasure->palette(); m_saveDefaultPalette = m_saveMeasure->palette(); // Blink extension allows all measures in the current control point to be blinked and gives // user ability to select which measures and the order for blinking m_blinkExtension = new QWidget; m_blinkExtension = new QWidget; QPushButton *blinkButton = new QPushButton("Blink"); QPushButton *blinkButton = new QPushButton("Advanced Blink"); blinkButton->setCheckable(true); blinkButton->setCheckable(true); connect(blinkButton, &QAbstractButton::toggled, m_blinkExtension, &QWidget::setVisible); connect(blinkButton, &QAbstractButton::toggled, m_blinkExtension, &QWidget::setVisible); connect(blinkButton, SIGNAL(clicked()), this, SLOT(showBlinkExtension())); connect(blinkButton, SIGNAL(clicked()), this, SLOT(showBlinkExtension())); Loading Loading @@ -769,6 +756,34 @@ namespace Isis { } } /** * Set the tack position of the measure in the left ChipViewport * * @param sample[in] Sample of the tack position for the right ChipViewport * @param line[in] Line of the tack position for the left ChipViewport * */ void ControlMeasureEditWidget::setLeftPosition(double sample, double line) { m_leftChip->TackCube(sample, line); emit updateLeftView(sample, line); } /** * Set the tack position of the measure in the right ChipViewport * * @param sample[in] Sample of the tack position for the right ChipViewport * @param line[in] Line of the tack position for the left ChipViewport * */ void ControlMeasureEditWidget::setRightPosition(double sample, double line) { m_rightChip->TackCube(sample, line); emit updateRightView(sample, line); } /** /** * Set the measure displayed in the right ChipViewport * Set the measure displayed in the right ChipViewport * * Loading Loading @@ -1012,10 +1027,29 @@ namespace Isis { * successful, change save button to red. * successful, change save button to red. * @history 2011-10-21 Tracie Sucharski - Add try/catch around registration * @history 2011-10-21 Tracie Sucharski - Add try/catch around registration * to catch errors thrown from autoreg class. * to catch errors thrown from autoreg class. * @history 2017-04-21 Marjorie Hahn - Added auto registration factory creation. * * */ */ void ControlMeasureEditWidget::registerPoint() { void ControlMeasureEditWidget::registerPoint() { // if the auto registration factory has not been initialized, do it here if (m_autoRegFact == NULL) { try { Pvl pvl(m_templateFileName); m_autoRegFact = AutoRegFactory::Create(pvl); } catch (IException &e) { m_autoRegFact = NULL; IException fullError(e, IException::Io, "Cannot create AutoRegFactory. As a result, " "sub-pixel registration will not work.", _FILEINFO_); QString message = fullError.toString(); QMessageBox::information((QWidget *)parent(), "Error", message); return; } } if ( m_autoRegShown ) { if ( m_autoRegShown ) { // Undo Registration // Undo Registration m_autoRegShown = false; m_autoRegShown = false; Loading Loading @@ -1174,6 +1208,11 @@ namespace Isis { * QnetTool::measureSaved to ::saveMeasure. The error checking now * QnetTool::measureSaved to ::saveMeasure. The error checking now * forces the edit lock check box to be unchecked before the measure * forces the edit lock check box to be unchecked before the measure * can be saved. * can be saved. * @history 2015-01-09 Ian Humphrey - Modified to prevent segmentation fault that arises when * registering, opening a template file, and saving the measure. This * was caused by not handling the exception thrown by * ControlMeasure::SetLogData(), which produces undefined behavior * within the Qt signal-slot connection mechanism. * * */ */ void ControlMeasureEditWidget::saveMeasure() { void ControlMeasureEditWidget::saveMeasure() { Loading @@ -1188,13 +1227,7 @@ namespace Isis { } } if ( m_autoRegShown ) { if ( m_autoRegShown ) { // Reset AprioriSample/Line to the current coordinate, before the try { // coordinate is updated with the registered coordinate. m_rightMeasure->SetAprioriSample(m_rightMeasure->GetSample()); m_rightMeasure->SetAprioriLine(m_rightMeasure->GetLine()); m_rightMeasure->SetChooserName("Application qnet"); m_rightMeasure->SetType(ControlMeasure::RegisteredSubPixel); // Save autoreg parameters to the right measure log entry // Save autoreg parameters to the right measure log entry // Eccentricity may be invalid, check before writing. // Eccentricity may be invalid, check before writing. m_rightMeasure->SetLogData(ControlMeasureLogData( m_rightMeasure->SetLogData(ControlMeasureLogData( Loading @@ -1208,10 +1241,29 @@ namespace Isis { m_rightMeasure->SetLogData(ControlMeasureLogData( m_rightMeasure->SetLogData(ControlMeasureLogData( ControlMeasureLogData::MaximumPixelZScore, ControlMeasureLogData::MaximumPixelZScore, maxZScore)); maxZScore)); } // need to handle exception that SetLogData throws if our data is invalid - // unhandled exceptions thrown in Qt signal and slot connections produce undefined behavior catch (IException &e) { QString message = e.toString(); QMessageBox::critical((QWidget *)parent(), "Error", message); return; } // Reset AprioriSample/Line to the current coordinate, before the // coordinate is updated with the registered coordinate. m_rightMeasure->SetAprioriSample(m_rightMeasure->GetSample()); m_rightMeasure->SetAprioriLine(m_rightMeasure->GetLine()); m_rightMeasure->SetChooserName("Application qnet"); m_rightMeasure->SetType(ControlMeasure::RegisteredSubPixel); m_autoRegShown = false; m_autoRegShown = false; m_autoRegExtension->hide(); m_autoRegExtension->hide(); m_autoReg->setText("Register"); m_autoReg->setText("Register"); m_autoReg->setToolTip("Sub-pixel register the right measure to the left. " "<strong>Shortcut: R</strong>"); m_autoReg->setShortcut(Qt::Key_R); } } else { else { m_rightMeasure->SetChooserName(Application::UserName()); m_rightMeasure->SetChooserName(Application::UserName()); Loading Loading @@ -1670,16 +1722,13 @@ namespace Isis { } } /** * Set the Control Point for this widget * * @param editPoint[in] ControlPoint for this widget * @param snList[in] SerialNumberList associated with the control net containing the ControlPoint // TODO IPCE 2016-06-13 ALL CODE BELOW HERE IS TEMPORARY PROTOTYPE CODE NEEDS MUCH CLEANUP, LEAKY MEMORY, ETC * */ void ControlMeasureEditWidget::setPoint(ControlPoint *editPoint, SerialNumberList *snList) { void ControlMeasureEditWidget::setPoint(ControlPoint *editPoint, SerialNumberList *snList) { m_editPoint = editPoint; m_editPoint = editPoint; Loading Loading @@ -1711,12 +1760,13 @@ namespace Isis { } } //! Slot to start blink function //! Slot to start blink function for advanced blink functionality void ControlMeasureEditWidget::blinkStartRight() { void ControlMeasureEditWidget::blinkStartRight() { if ( m_timerOnRight ) return; if ( m_timerOnRight ) return; // Set up blink list. Create ChipViewport for each cube active in the ListWidget // Set up blink list. Create ChipViewport for each cube active in the ListWidget, using the // correct zoom and geom selections QList<QListWidgetItem *> selected = m_blinkListWidget->selectedItems(); QList<QListWidgetItem *> selected = m_blinkListWidget->selectedItems(); if (selected.size() < 1) { if (selected.size() < 1) { QMessageBox::information((QWidget *)parent(), "Error", "No files selected for blinking."); QMessageBox::information((QWidget *)parent(), "Error", "No files selected for blinking."); Loading @@ -1734,6 +1784,12 @@ namespace Isis { blinkChip->Load(*blinkCube); blinkChip->Load(*blinkCube); ChipViewport *blinkViewport = new ChipViewport(VIEWSIZE, VIEWSIZE, this); ChipViewport *blinkViewport = new ChipViewport(VIEWSIZE, VIEWSIZE, this); blinkViewport->setChip(blinkChip, blinkCube); blinkViewport->setChip(blinkChip, blinkCube); if (m_geomIt) { blinkViewport->geomChip(m_leftChip, m_leftCube); } else { blinkViewport->zoom(m_leftView->zoomFactor()); } m_blinkChipViewportListRight.append(blinkViewport); m_blinkChipViewportListRight.append(blinkViewport); } } Loading isis/src/qisis/objs/ControlMeasureEditWidget/ControlMeasureEditWidget.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -148,6 +148,17 @@ namespace Isis { * shortcut errors. Set the shortcut and tooltip of m_autoReg inside of * shortcut errors. Set the shortcut and tooltip of m_autoReg inside of * registerPoint() to allow the user to use the shortcut after an * registerPoint() to allow the user to use the shortcut after an * undo-registration ocurs. * undo-registration ocurs. * @history 2018-09-06 Tracie Sucharski - Added bug fixes from qnet's ControlPointEdit class * including moving the creation of AutoRegFactory from constructor * to the registerPoint method and fixing seg fault happening in * saveMeasure when calling ControlMeasure::SetLogData. * @history 2018-09-24 Tracie Sucharski - Fixed right measure chooser name to the * Application::User. * @history 2018-09-26 Tracie Sucharski - Added public method to allow change measure tack * points. * @history 2018-10-10 Tracie Sucharski - Fixed blink extension to use geom if selected and * correct zoom factor. * * @todo Re-think design of the change made on 2012-07-26. The linking was put into * @todo Re-think design of the change made on 2012-07-26. The linking was put into * ::updateLeftPositionLabel because it was the fastest solution, but * ::updateLeftPositionLabel because it was the fastest solution, but * should this be put somewhere else. * should this be put somewhere else. Loading @@ -169,6 +180,9 @@ namespace Isis { }; }; void allowLeftMouse(bool allowMouse); void allowLeftMouse(bool allowMouse); void setLeftPosition(double sample, double line); void setRightPosition(double sample, double line); signals: signals: void updateLeftView(double sample, double line); void updateLeftView(double sample, double line); void updateRightView(double sample, double line); void updateRightView(double sample, double line); Loading isis/src/qisis/objs/ControlNetTool/ControlNetTool.cpp +103 −16 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,8 @@ #include "MdiCubeViewport.h" #include "MdiCubeViewport.h" #include "Project.h" #include "Project.h" #include "SerialNumber.h" #include "SerialNumber.h" #include "Shape.h" #include "ShapeList.h" #include "ToolPad.h" #include "ToolPad.h" #include "UniversalGroundMap.h" #include "UniversalGroundMap.h" #include "ViewportMainWindow.h" #include "ViewportMainWindow.h" Loading Loading @@ -140,12 +142,13 @@ namespace Isis { if (s == Qt::LeftButton) { if (s == Qt::LeftButton) { // if (sn == m_groundSN) { if (isGroundSource) { // QString message = "Cannot select point for editing on ground source. Select "; QString message = "Cannot select point for editing on ground source. Select "; // message += "point using un-projected images or the Navigator Window."; message += "point using un-projected images or the Cnet Editor View (choose \"View Network\" "; // QMessageBox::critical(m_ControlNetTool, "Error", message); message += "from the context menu for control nets on the project tree)."; // return; QMessageBox::critical(m_ControlNetTool, "Error", message); // } return; } // Find closest control point in network // Find closest control point in network // since we are in a connected slot, we need to handle exceptions thrown by FindClosest // since we are in a connected slot, we need to handle exceptions thrown by FindClosest Loading @@ -170,12 +173,13 @@ namespace Isis { return; return; } } // if (m_groundOpen && file == m_groundCube->fileName()) { if (isGroundSource) { // QString message = "Cannot select point for deleting on ground source. Select "; QString message = "Cannot select point for deleting on ground source. Select "; // message += "point using un-projected images or the Navigator Window."; message += "point using un-projected images or the Cnet Editor View (choose \"View Network\" "; // QMessageBox::critical(m_ControlNetTool, "Error", message); message += "from the context menu for control nets on the project tree)."; // return; QMessageBox::critical(m_ControlNetTool, "Error", message); // } return; } // Find closest control point in network // Find closest control point in network ControlPoint *point = NULL; ControlPoint *point = NULL; Loading Loading @@ -284,10 +288,23 @@ namespace Isis { // TODO: Should we add the SN to the viewPort // TODO: Should we add the SN to the viewPort QString serialNumber = SerialNumber::Compose(*vp->cube(), true); QString serialNumber = SerialNumber::Compose(*vp->cube(), true); // if (serialNumber == m_groundSN) { // Get list of shapes in the ipce project and see if the serial number for viewport passed in // drawGroundMeasures(vp, painter); // matches any of the project shapes. If there's a match, draw any ground points. // return; QList<ShapeList *> projectShapes = m_directory->project()->shapes(); // } foreach (ShapeList *shapeList, projectShapes) { foreach (Shape *shape, *shapeList) { QString shapeSn = shape->serialNumber(); if (serialNumber == shapeSn) { // Get cube, then ground map so that location can be calculated UniversalGroundMap *gmap = new UniversalGroundMap(*(shape->cube())); drawGroundMeasures(vp, painter, gmap); delete gmap; gmap = NULL; return; } } } if (!m_controlNet->GetCubeSerials().contains( if (!m_controlNet->GetCubeSerials().contains( serialNumber)) return; serialNumber)) return; Loading Loading @@ -352,4 +369,74 @@ namespace Isis { } } } } } } /** * Draw all Fixed or Constrained points on the ground source viewport * * @param vp Viewport whose measurements will be drawn * @param painter The QPainter used to draw crosshair * @param groundMap The UniversalGroundMap for the Cube associated with this viewport * */ void ControlNetTool::drawGroundMeasures(MdiCubeViewport *vp, QPainter *painter, UniversalGroundMap *groundMap) { // if ControlPointEditView is open, the editPointId will contain the ControlPoint Id of the // current edit point. Save so that when drawing point, it can be drawn to indicate current // edit point. ControlPoint *currentEditPoint = NULL; if (m_directory->controlPointEditView()) { currentEditPoint = m_directory->controlPointEditView()->controlPointEditWidget()->editPoint(); } // loop through control network looking for fixed and constrained points for (int i = 0; i < m_controlNet->GetNumPoints(); i++) { ControlPoint &p = *((*m_controlNet)[i]); if (p.GetType() == ControlPoint::Free) continue; if (!p.HasAprioriCoordinates()) continue; // Find the sample, line location on the ground image if (groundMap->SetGround(p.GetAprioriSurfacePoint().GetLatitude(), p.GetAprioriSurfacePoint().GetLongitude())) { double samp = groundMap->Sample(); double line = groundMap->Line(); int x, y; vp->cubeToViewport(samp, line, x, y); // if the point is ignored, if (p.IsIgnored()) { painter->setPen(QColor(255, 255, 0)); // set point marker yellow // draw points painter->drawLine(x - 5, y, x + 5, y); painter->drawLine(x, y - 5, x, y + 5); } // If this point is the current edit point in ControlPointEditView else if (currentEditPoint != NULL && p.GetId() == currentEditPoint->GetId()) { // Draw circle, then crosshair inside circle QPainterPath path; path.addEllipse(QPointF(x,y), 5., 5.); path.moveTo(x, y-5); path.lineTo(x, y+5); path.moveTo(x-5, y); path.lineTo(x+5, y); // set point marker red QBrush brush(Qt::red); // set point marker bold - line width 2 QPen pen(brush, 2); painter->setPen(pen); painter->drawPath(path); } // Only Constrained or Fixed pts. If Free, we've already skipped. else { painter->setPen(Qt::magenta);// set point marker magenta // draw points painter->drawLine(x - 5, y, x + 5, y); painter->drawLine(x, y - 5, x, y + 5); } } } } } } isis/src/qisis/objs/ControlNetTool/ControlNetTool.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,8 @@ namespace Isis { * loaded. * loaded. * @history 2018-04-13 Tracie Sucharski - In mouseButtonRelease method return if a control net * @history 2018-04-13 Tracie Sucharski - In mouseButtonRelease method return if a control net * has not been set. * has not been set. * @history 2018-09-21 Tracie Sucharski - Draw Fixed and Constrained points on ground cubes. * References #5504. */ */ class ControlNetTool : public Tool { class ControlNetTool : public Tool { Q_OBJECT Q_OBJECT Loading Loading @@ -91,6 +93,7 @@ namespace Isis { void createActions(); void createActions(); void createMenus(); void createMenus(); void drawAllMeasurements(MdiCubeViewport *vp, QPainter *painter); void drawAllMeasurements(MdiCubeViewport *vp, QPainter *painter); void drawGroundMeasures (MdiCubeViewport *vp, QPainter *painter, UniversalGroundMap *groundMap); QPointer<MainWindow> m_ControlNetTool; QPointer<MainWindow> m_ControlNetTool; Directory *m_directory; Directory *m_directory; Loading isis/src/qisis/objs/ControlPointEditWidget/ControlPointEditWidget.cpp +820 −300 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
isis/src/qisis/objs/ControlMeasureEditWidget/ControlMeasureEditWidget.cpp +99 −43 Original line number Original line Diff line number Diff line Loading @@ -47,8 +47,6 @@ namespace Isis { * @param allowLeftMouse[in] Allow/Disallow mouse events on Left ChipViewport * @param allowLeftMouse[in] Allow/Disallow mouse events on Left ChipViewport * @param useGeometry[in] Allow/Disallow geometry and rotation on right ChipViewport * @param useGeometry[in] Allow/Disallow geometry and rotation on right ChipViewport * * * @throws IException::Io "Cannot create AutoRegFactory. As a result, sub-pixel registration * will not work." * @author Tracie Sucharski * @author Tracie Sucharski * @internal * @internal * @history 2008-15-?? Jeannie Walldren - Added error * @history 2008-15-?? Jeannie Walldren - Added error Loading @@ -72,20 +70,7 @@ namespace Isis { m_leftGroundMap = 0; m_leftGroundMap = 0; m_rightGroundMap = 0; m_rightGroundMap = 0; try { m_templateFileName = "$base/templates/autoreg/qnetReg.def"; m_templateFileName = "$base/templates/autoreg/qnetReg.def"; Pvl pvl(m_templateFileName); m_autoRegFact = AutoRegFactory::Create(pvl); } catch (IException &e) { m_autoRegFact = NULL; IException fullError(e, IException::Io, "Cannot create AutoRegFactory. As a result, " "sub-pixel registration will not work.", _FILEINFO_); QString message = fullError.toString(); QMessageBox::information((QWidget *)parent, "Error", message); } createMeasureEditor(parent); createMeasureEditor(parent); } } Loading Loading @@ -627,9 +612,11 @@ namespace Isis { m_saveMeasure->setShortcut(Qt::Key_M); m_saveMeasure->setShortcut(Qt::Key_M); m_saveDefaultPalette = m_saveMeasure->palette(); m_saveDefaultPalette = m_saveMeasure->palette(); // Blink extension allows all measures in the current control point to be blinked and gives // user ability to select which measures and the order for blinking m_blinkExtension = new QWidget; m_blinkExtension = new QWidget; QPushButton *blinkButton = new QPushButton("Blink"); QPushButton *blinkButton = new QPushButton("Advanced Blink"); blinkButton->setCheckable(true); blinkButton->setCheckable(true); connect(blinkButton, &QAbstractButton::toggled, m_blinkExtension, &QWidget::setVisible); connect(blinkButton, &QAbstractButton::toggled, m_blinkExtension, &QWidget::setVisible); connect(blinkButton, SIGNAL(clicked()), this, SLOT(showBlinkExtension())); connect(blinkButton, SIGNAL(clicked()), this, SLOT(showBlinkExtension())); Loading Loading @@ -769,6 +756,34 @@ namespace Isis { } } /** * Set the tack position of the measure in the left ChipViewport * * @param sample[in] Sample of the tack position for the right ChipViewport * @param line[in] Line of the tack position for the left ChipViewport * */ void ControlMeasureEditWidget::setLeftPosition(double sample, double line) { m_leftChip->TackCube(sample, line); emit updateLeftView(sample, line); } /** * Set the tack position of the measure in the right ChipViewport * * @param sample[in] Sample of the tack position for the right ChipViewport * @param line[in] Line of the tack position for the left ChipViewport * */ void ControlMeasureEditWidget::setRightPosition(double sample, double line) { m_rightChip->TackCube(sample, line); emit updateRightView(sample, line); } /** /** * Set the measure displayed in the right ChipViewport * Set the measure displayed in the right ChipViewport * * Loading Loading @@ -1012,10 +1027,29 @@ namespace Isis { * successful, change save button to red. * successful, change save button to red. * @history 2011-10-21 Tracie Sucharski - Add try/catch around registration * @history 2011-10-21 Tracie Sucharski - Add try/catch around registration * to catch errors thrown from autoreg class. * to catch errors thrown from autoreg class. * @history 2017-04-21 Marjorie Hahn - Added auto registration factory creation. * * */ */ void ControlMeasureEditWidget::registerPoint() { void ControlMeasureEditWidget::registerPoint() { // if the auto registration factory has not been initialized, do it here if (m_autoRegFact == NULL) { try { Pvl pvl(m_templateFileName); m_autoRegFact = AutoRegFactory::Create(pvl); } catch (IException &e) { m_autoRegFact = NULL; IException fullError(e, IException::Io, "Cannot create AutoRegFactory. As a result, " "sub-pixel registration will not work.", _FILEINFO_); QString message = fullError.toString(); QMessageBox::information((QWidget *)parent(), "Error", message); return; } } if ( m_autoRegShown ) { if ( m_autoRegShown ) { // Undo Registration // Undo Registration m_autoRegShown = false; m_autoRegShown = false; Loading Loading @@ -1174,6 +1208,11 @@ namespace Isis { * QnetTool::measureSaved to ::saveMeasure. The error checking now * QnetTool::measureSaved to ::saveMeasure. The error checking now * forces the edit lock check box to be unchecked before the measure * forces the edit lock check box to be unchecked before the measure * can be saved. * can be saved. * @history 2015-01-09 Ian Humphrey - Modified to prevent segmentation fault that arises when * registering, opening a template file, and saving the measure. This * was caused by not handling the exception thrown by * ControlMeasure::SetLogData(), which produces undefined behavior * within the Qt signal-slot connection mechanism. * * */ */ void ControlMeasureEditWidget::saveMeasure() { void ControlMeasureEditWidget::saveMeasure() { Loading @@ -1188,13 +1227,7 @@ namespace Isis { } } if ( m_autoRegShown ) { if ( m_autoRegShown ) { // Reset AprioriSample/Line to the current coordinate, before the try { // coordinate is updated with the registered coordinate. m_rightMeasure->SetAprioriSample(m_rightMeasure->GetSample()); m_rightMeasure->SetAprioriLine(m_rightMeasure->GetLine()); m_rightMeasure->SetChooserName("Application qnet"); m_rightMeasure->SetType(ControlMeasure::RegisteredSubPixel); // Save autoreg parameters to the right measure log entry // Save autoreg parameters to the right measure log entry // Eccentricity may be invalid, check before writing. // Eccentricity may be invalid, check before writing. m_rightMeasure->SetLogData(ControlMeasureLogData( m_rightMeasure->SetLogData(ControlMeasureLogData( Loading @@ -1208,10 +1241,29 @@ namespace Isis { m_rightMeasure->SetLogData(ControlMeasureLogData( m_rightMeasure->SetLogData(ControlMeasureLogData( ControlMeasureLogData::MaximumPixelZScore, ControlMeasureLogData::MaximumPixelZScore, maxZScore)); maxZScore)); } // need to handle exception that SetLogData throws if our data is invalid - // unhandled exceptions thrown in Qt signal and slot connections produce undefined behavior catch (IException &e) { QString message = e.toString(); QMessageBox::critical((QWidget *)parent(), "Error", message); return; } // Reset AprioriSample/Line to the current coordinate, before the // coordinate is updated with the registered coordinate. m_rightMeasure->SetAprioriSample(m_rightMeasure->GetSample()); m_rightMeasure->SetAprioriLine(m_rightMeasure->GetLine()); m_rightMeasure->SetChooserName("Application qnet"); m_rightMeasure->SetType(ControlMeasure::RegisteredSubPixel); m_autoRegShown = false; m_autoRegShown = false; m_autoRegExtension->hide(); m_autoRegExtension->hide(); m_autoReg->setText("Register"); m_autoReg->setText("Register"); m_autoReg->setToolTip("Sub-pixel register the right measure to the left. " "<strong>Shortcut: R</strong>"); m_autoReg->setShortcut(Qt::Key_R); } } else { else { m_rightMeasure->SetChooserName(Application::UserName()); m_rightMeasure->SetChooserName(Application::UserName()); Loading Loading @@ -1670,16 +1722,13 @@ namespace Isis { } } /** * Set the Control Point for this widget * * @param editPoint[in] ControlPoint for this widget * @param snList[in] SerialNumberList associated with the control net containing the ControlPoint // TODO IPCE 2016-06-13 ALL CODE BELOW HERE IS TEMPORARY PROTOTYPE CODE NEEDS MUCH CLEANUP, LEAKY MEMORY, ETC * */ void ControlMeasureEditWidget::setPoint(ControlPoint *editPoint, SerialNumberList *snList) { void ControlMeasureEditWidget::setPoint(ControlPoint *editPoint, SerialNumberList *snList) { m_editPoint = editPoint; m_editPoint = editPoint; Loading Loading @@ -1711,12 +1760,13 @@ namespace Isis { } } //! Slot to start blink function //! Slot to start blink function for advanced blink functionality void ControlMeasureEditWidget::blinkStartRight() { void ControlMeasureEditWidget::blinkStartRight() { if ( m_timerOnRight ) return; if ( m_timerOnRight ) return; // Set up blink list. Create ChipViewport for each cube active in the ListWidget // Set up blink list. Create ChipViewport for each cube active in the ListWidget, using the // correct zoom and geom selections QList<QListWidgetItem *> selected = m_blinkListWidget->selectedItems(); QList<QListWidgetItem *> selected = m_blinkListWidget->selectedItems(); if (selected.size() < 1) { if (selected.size() < 1) { QMessageBox::information((QWidget *)parent(), "Error", "No files selected for blinking."); QMessageBox::information((QWidget *)parent(), "Error", "No files selected for blinking."); Loading @@ -1734,6 +1784,12 @@ namespace Isis { blinkChip->Load(*blinkCube); blinkChip->Load(*blinkCube); ChipViewport *blinkViewport = new ChipViewport(VIEWSIZE, VIEWSIZE, this); ChipViewport *blinkViewport = new ChipViewport(VIEWSIZE, VIEWSIZE, this); blinkViewport->setChip(blinkChip, blinkCube); blinkViewport->setChip(blinkChip, blinkCube); if (m_geomIt) { blinkViewport->geomChip(m_leftChip, m_leftCube); } else { blinkViewport->zoom(m_leftView->zoomFactor()); } m_blinkChipViewportListRight.append(blinkViewport); m_blinkChipViewportListRight.append(blinkViewport); } } Loading
isis/src/qisis/objs/ControlMeasureEditWidget/ControlMeasureEditWidget.h +14 −0 Original line number Original line Diff line number Diff line Loading @@ -148,6 +148,17 @@ namespace Isis { * shortcut errors. Set the shortcut and tooltip of m_autoReg inside of * shortcut errors. Set the shortcut and tooltip of m_autoReg inside of * registerPoint() to allow the user to use the shortcut after an * registerPoint() to allow the user to use the shortcut after an * undo-registration ocurs. * undo-registration ocurs. * @history 2018-09-06 Tracie Sucharski - Added bug fixes from qnet's ControlPointEdit class * including moving the creation of AutoRegFactory from constructor * to the registerPoint method and fixing seg fault happening in * saveMeasure when calling ControlMeasure::SetLogData. * @history 2018-09-24 Tracie Sucharski - Fixed right measure chooser name to the * Application::User. * @history 2018-09-26 Tracie Sucharski - Added public method to allow change measure tack * points. * @history 2018-10-10 Tracie Sucharski - Fixed blink extension to use geom if selected and * correct zoom factor. * * @todo Re-think design of the change made on 2012-07-26. The linking was put into * @todo Re-think design of the change made on 2012-07-26. The linking was put into * ::updateLeftPositionLabel because it was the fastest solution, but * ::updateLeftPositionLabel because it was the fastest solution, but * should this be put somewhere else. * should this be put somewhere else. Loading @@ -169,6 +180,9 @@ namespace Isis { }; }; void allowLeftMouse(bool allowMouse); void allowLeftMouse(bool allowMouse); void setLeftPosition(double sample, double line); void setRightPosition(double sample, double line); signals: signals: void updateLeftView(double sample, double line); void updateLeftView(double sample, double line); void updateRightView(double sample, double line); void updateRightView(double sample, double line); Loading
isis/src/qisis/objs/ControlNetTool/ControlNetTool.cpp +103 −16 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,8 @@ #include "MdiCubeViewport.h" #include "MdiCubeViewport.h" #include "Project.h" #include "Project.h" #include "SerialNumber.h" #include "SerialNumber.h" #include "Shape.h" #include "ShapeList.h" #include "ToolPad.h" #include "ToolPad.h" #include "UniversalGroundMap.h" #include "UniversalGroundMap.h" #include "ViewportMainWindow.h" #include "ViewportMainWindow.h" Loading Loading @@ -140,12 +142,13 @@ namespace Isis { if (s == Qt::LeftButton) { if (s == Qt::LeftButton) { // if (sn == m_groundSN) { if (isGroundSource) { // QString message = "Cannot select point for editing on ground source. Select "; QString message = "Cannot select point for editing on ground source. Select "; // message += "point using un-projected images or the Navigator Window."; message += "point using un-projected images or the Cnet Editor View (choose \"View Network\" "; // QMessageBox::critical(m_ControlNetTool, "Error", message); message += "from the context menu for control nets on the project tree)."; // return; QMessageBox::critical(m_ControlNetTool, "Error", message); // } return; } // Find closest control point in network // Find closest control point in network // since we are in a connected slot, we need to handle exceptions thrown by FindClosest // since we are in a connected slot, we need to handle exceptions thrown by FindClosest Loading @@ -170,12 +173,13 @@ namespace Isis { return; return; } } // if (m_groundOpen && file == m_groundCube->fileName()) { if (isGroundSource) { // QString message = "Cannot select point for deleting on ground source. Select "; QString message = "Cannot select point for deleting on ground source. Select "; // message += "point using un-projected images or the Navigator Window."; message += "point using un-projected images or the Cnet Editor View (choose \"View Network\" "; // QMessageBox::critical(m_ControlNetTool, "Error", message); message += "from the context menu for control nets on the project tree)."; // return; QMessageBox::critical(m_ControlNetTool, "Error", message); // } return; } // Find closest control point in network // Find closest control point in network ControlPoint *point = NULL; ControlPoint *point = NULL; Loading Loading @@ -284,10 +288,23 @@ namespace Isis { // TODO: Should we add the SN to the viewPort // TODO: Should we add the SN to the viewPort QString serialNumber = SerialNumber::Compose(*vp->cube(), true); QString serialNumber = SerialNumber::Compose(*vp->cube(), true); // if (serialNumber == m_groundSN) { // Get list of shapes in the ipce project and see if the serial number for viewport passed in // drawGroundMeasures(vp, painter); // matches any of the project shapes. If there's a match, draw any ground points. // return; QList<ShapeList *> projectShapes = m_directory->project()->shapes(); // } foreach (ShapeList *shapeList, projectShapes) { foreach (Shape *shape, *shapeList) { QString shapeSn = shape->serialNumber(); if (serialNumber == shapeSn) { // Get cube, then ground map so that location can be calculated UniversalGroundMap *gmap = new UniversalGroundMap(*(shape->cube())); drawGroundMeasures(vp, painter, gmap); delete gmap; gmap = NULL; return; } } } if (!m_controlNet->GetCubeSerials().contains( if (!m_controlNet->GetCubeSerials().contains( serialNumber)) return; serialNumber)) return; Loading Loading @@ -352,4 +369,74 @@ namespace Isis { } } } } } } /** * Draw all Fixed or Constrained points on the ground source viewport * * @param vp Viewport whose measurements will be drawn * @param painter The QPainter used to draw crosshair * @param groundMap The UniversalGroundMap for the Cube associated with this viewport * */ void ControlNetTool::drawGroundMeasures(MdiCubeViewport *vp, QPainter *painter, UniversalGroundMap *groundMap) { // if ControlPointEditView is open, the editPointId will contain the ControlPoint Id of the // current edit point. Save so that when drawing point, it can be drawn to indicate current // edit point. ControlPoint *currentEditPoint = NULL; if (m_directory->controlPointEditView()) { currentEditPoint = m_directory->controlPointEditView()->controlPointEditWidget()->editPoint(); } // loop through control network looking for fixed and constrained points for (int i = 0; i < m_controlNet->GetNumPoints(); i++) { ControlPoint &p = *((*m_controlNet)[i]); if (p.GetType() == ControlPoint::Free) continue; if (!p.HasAprioriCoordinates()) continue; // Find the sample, line location on the ground image if (groundMap->SetGround(p.GetAprioriSurfacePoint().GetLatitude(), p.GetAprioriSurfacePoint().GetLongitude())) { double samp = groundMap->Sample(); double line = groundMap->Line(); int x, y; vp->cubeToViewport(samp, line, x, y); // if the point is ignored, if (p.IsIgnored()) { painter->setPen(QColor(255, 255, 0)); // set point marker yellow // draw points painter->drawLine(x - 5, y, x + 5, y); painter->drawLine(x, y - 5, x, y + 5); } // If this point is the current edit point in ControlPointEditView else if (currentEditPoint != NULL && p.GetId() == currentEditPoint->GetId()) { // Draw circle, then crosshair inside circle QPainterPath path; path.addEllipse(QPointF(x,y), 5., 5.); path.moveTo(x, y-5); path.lineTo(x, y+5); path.moveTo(x-5, y); path.lineTo(x+5, y); // set point marker red QBrush brush(Qt::red); // set point marker bold - line width 2 QPen pen(brush, 2); painter->setPen(pen); painter->drawPath(path); } // Only Constrained or Fixed pts. If Free, we've already skipped. else { painter->setPen(Qt::magenta);// set point marker magenta // draw points painter->drawLine(x - 5, y, x + 5, y); painter->drawLine(x, y - 5, x, y + 5); } } } } } }
isis/src/qisis/objs/ControlNetTool/ControlNetTool.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,8 @@ namespace Isis { * loaded. * loaded. * @history 2018-04-13 Tracie Sucharski - In mouseButtonRelease method return if a control net * @history 2018-04-13 Tracie Sucharski - In mouseButtonRelease method return if a control net * has not been set. * has not been set. * @history 2018-09-21 Tracie Sucharski - Draw Fixed and Constrained points on ground cubes. * References #5504. */ */ class ControlNetTool : public Tool { class ControlNetTool : public Tool { Q_OBJECT Q_OBJECT Loading Loading @@ -91,6 +93,7 @@ namespace Isis { void createActions(); void createActions(); void createMenus(); void createMenus(); void drawAllMeasurements(MdiCubeViewport *vp, QPainter *painter); void drawAllMeasurements(MdiCubeViewport *vp, QPainter *painter); void drawGroundMeasures (MdiCubeViewport *vp, QPainter *painter, UniversalGroundMap *groundMap); QPointer<MainWindow> m_ControlNetTool; QPointer<MainWindow> m_ControlNetTool; Directory *m_directory; Directory *m_directory; Loading
isis/src/qisis/objs/ControlPointEditWidget/ControlPointEditWidget.cpp +820 −300 File changed.Preview size limit exceeded, changes collapsed. Show changes