1 #include "ControlPointEdit.h" 6 #include <QApplication> 7 #include <QButtonGroup> 11 #include <QDoubleSpinBox> 12 #include <QFileDialog> 13 #include <QGridLayout> 14 #include <QHBoxLayout> 16 #include <QMessageBox> 18 #include <QPushButton> 19 #include <QRadioButton> 24 #include <QToolButton> 57 bool allowLeftMouse,
bool useGeometry) :
QWidget(parent) {
63 p_useGeometry = useGeometry;
71 p_templateFileName =
"$base/templates/autoreg/qnetReg.def";
74 if (cnet != NULL) emit newControlNetwork(cnet);
78 ControlPointEdit::~ControlPointEdit() {
112 QGridLayout *gridLayout =
new QGridLayout();
113 gridLayout->setSizeConstraint(QLayout::SetFixedSize);
118 QString toolIconDir = tempFileName;
122 QToolButton *leftZoomIn =
new QToolButton();
123 leftZoomIn->setIcon(QPixmap(toolIconDir +
"/viewmag+.png"));
124 leftZoomIn->setIconSize(isize);
125 leftZoomIn->setToolTip(
"Zoom In 2x");
126 leftZoomIn->setWhatsThis(
"Zoom In 2x on left measure.");
128 QToolButton *leftZoomOut =
new QToolButton();
129 leftZoomOut->setIcon(QPixmap(toolIconDir +
"/viewmag-.png"));
130 leftZoomOut->setIconSize(isize);
131 leftZoomOut->setToolTip(
"Zoom Out 2x");
132 leftZoomOut->setWhatsThis(
"Zoom Out 2x on left measure.");
134 QToolButton *leftZoom1 =
new QToolButton();
135 leftZoom1->setIcon(QPixmap(toolIconDir +
"/viewmag1.png"));
136 leftZoom1->setIconSize(isize);
137 leftZoom1->setToolTip(
"Zoom 1:1");
138 leftZoom1->setWhatsThis(
"Show left measure at full resolution.");
140 QHBoxLayout *leftZoomPan =
new QHBoxLayout;
141 leftZoomPan->addWidget(leftZoomIn);
142 leftZoomPan->addWidget(leftZoomOut);
143 leftZoomPan->addWidget(leftZoom1);
146 QToolButton *leftPanUp = 0;
147 QToolButton *leftPanDown = 0;
148 QToolButton *leftPanLeft = 0;
149 QToolButton *leftPanRight = 0;
150 if (p_allowLeftMouse) {
152 leftPanUp =
new QToolButton(parent);
153 leftPanUp->setIcon(QIcon(
FileName(
"$base/icons/up.png").
155 leftPanUp->setIconSize(isize);
156 leftPanUp->setToolTip(
"Move up 1 screen pixel");
157 leftPanUp->setStatusTip(
"Move up 1 screen pixel");
158 leftPanUp->setWhatsThis(
"Move the left measure up 1 screen pixel.");
160 leftPanDown =
new QToolButton(parent);
161 leftPanDown->setIcon(QIcon(
FileName(
"$base/icons/down.png").
163 leftPanDown->setIconSize(isize);
164 leftPanDown->setToolTip(
"Move down 1 screen pixel");
165 leftPanDown->setStatusTip(
"Move down 1 screen pixel");
166 leftPanDown->setWhatsThis(
"Move the left measure down 1 screen pixel.");
168 leftPanLeft =
new QToolButton(parent);
169 leftPanLeft->setIcon(QIcon(
FileName(
"$base/icons/back.png").
171 leftPanLeft->setIconSize(isize);
172 leftPanLeft->setToolTip(
"Move left 1 screen pixel");
173 leftPanLeft->setWhatsThis(
"Move the left measure to the left by 1 screen" 176 leftPanRight =
new QToolButton(parent);
177 leftPanRight->setIcon(QIcon(
FileName(
"$base/icons/forward.png").
179 leftPanRight->setIconSize(isize);
180 leftPanRight->setToolTip(
"Move right 1 screen pixel");
181 leftPanRight->setWhatsThis(
"Move the left measure to the right by 1" 184 leftZoomPan->addWidget(leftPanUp);
185 leftZoomPan->addWidget(leftPanDown);
186 leftZoomPan->addWidget(leftPanLeft);
187 leftZoomPan->addWidget(leftPanRight);
190 leftZoomPan->addStretch();
191 gridLayout->addLayout(leftZoomPan, row, 0);
193 p_rightZoomIn =
new QToolButton();
194 p_rightZoomIn->setIcon(QPixmap(toolIconDir +
"/viewmag+.png"));
195 p_rightZoomIn->setIconSize(isize);
196 p_rightZoomIn->setToolTip(
"Zoom In 2x");
197 p_rightZoomIn->setWhatsThis(
"Zoom In 2x on right measure.");
199 p_rightZoomOut =
new QToolButton();
200 p_rightZoomOut->setIcon(QIcon(
FileName(
"$base/icons/viewmag-.png").
202 p_rightZoomOut->setIconSize(isize);
203 p_rightZoomOut->setToolTip(
"Zoom Out 2x");
204 p_rightZoomOut->setWhatsThis(
"Zoom Out 2x on right measure.");
206 p_rightZoom1 =
new QToolButton();
207 p_rightZoom1->setIcon(QPixmap(toolIconDir +
"/viewmag1.png"));
208 p_rightZoom1->setIconSize(isize);
209 p_rightZoom1->setToolTip(
"Zoom 1:1");
210 p_rightZoom1->setWhatsThis(
"Show right measure at full resolution.");
212 QHBoxLayout *rightZoomPan =
new QHBoxLayout;
213 rightZoomPan->addWidget(p_rightZoomIn);
214 rightZoomPan->addWidget(p_rightZoomOut);
215 rightZoomPan->addWidget(p_rightZoom1);
218 QToolButton *rightPanUp =
new QToolButton(parent);
219 rightPanUp->setIcon(QIcon(
FileName(
"$base/icons/up.png").
221 rightPanUp->setIconSize(isize);
222 rightPanUp->setToolTip(
"Move up 1 screen pixel");
223 rightPanUp->setWhatsThis(
"Move the right measure up 1 screen pixel.");
225 QToolButton *rightPanDown =
new QToolButton(parent);
226 rightPanDown->setIcon(QIcon(
FileName(
"$base/icons/down.png").
228 rightPanDown->setIconSize(isize);
229 rightPanDown->setToolTip(
"Move down 1 screen pixel");
230 rightPanUp->setWhatsThis(
"Move the right measure down 1 screen pixel.");
232 QToolButton *rightPanLeft =
new QToolButton(parent);
233 rightPanLeft->setIcon(QIcon(
FileName(
"$base/icons/back.png").
235 rightPanLeft->setIconSize(isize);
236 rightPanLeft->setToolTip(
"Move left 1 screen pixel");
237 rightPanLeft->setWhatsThis(
"Move the right measure to the left by 1 screen" 240 QToolButton *rightPanRight =
new QToolButton(parent);
241 rightPanRight->setIcon(QIcon(
FileName(
"$base/icons/forward.png").
243 rightPanRight->setIconSize(isize);
244 rightPanRight->setToolTip(
"Move right 1 screen pixel");
245 rightPanRight->setWhatsThis(
"Move the right measure to the right by 1" 248 rightZoomPan->addWidget(rightPanUp);
249 rightZoomPan->addWidget(rightPanDown);
250 rightZoomPan->addWidget(rightPanLeft);
251 rightZoomPan->addWidget(rightPanRight);
252 rightZoomPan->addStretch();
254 gridLayout->addLayout(rightZoomPan, row++, 1);
257 p_leftZoomFactor =
new QLabel();
258 QCheckBox *leftLockStretch =
new QCheckBox(
"lock stretch");
261 QString whatsThisTextForStretchLocking =
"If checked then a new stretch " 262 "will NOT be calculated for each pan or zoom change. Note that stretch" 263 " changes made using the stretch tool will ALWAYS take effect, " 264 "regardless of the state of this checkbox.";
265 leftLockStretch->setWhatsThis(whatsThisTextForStretchLocking);
266 QHBoxLayout *leftzflsLayout =
new QHBoxLayout;
267 leftzflsLayout->addWidget(p_leftZoomFactor);
268 leftzflsLayout->addWidget(leftLockStretch);
269 gridLayout->addLayout(leftzflsLayout, row, 0);
271 p_rightZoomFactor =
new QLabel();
272 QCheckBox *rightLockStretch =
new QCheckBox(
"lock stretch");
273 rightLockStretch->setWhatsThis(whatsThisTextForStretchLocking);
274 QHBoxLayout *rightzflsLayout =
new QHBoxLayout;
275 rightzflsLayout->addWidget(p_rightZoomFactor);
276 rightzflsLayout->addWidget(rightLockStretch);
277 gridLayout->addLayout(rightzflsLayout, row++, 1);
282 if (!p_allowLeftMouse) p_leftView->setDisabled(
true);
284 gridLayout->addWidget(p_leftView, row, 0);
286 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
287 p_leftView, SLOT(setControlNet(
ControlNet *)));
294 connect(leftLockStretch, SIGNAL(stateChanged(
int)),
296 SLOT(changeStretchLock(
int)));
297 leftLockStretch->setChecked(
false);
301 connect(leftZoomIn, SIGNAL(clicked()), p_leftView, SLOT(zoomIn()));
302 connect(leftZoomOut, SIGNAL(clicked()), p_leftView, SLOT(zoomOut()));
303 connect(leftZoom1, SIGNAL(clicked()), p_leftView, SLOT(zoom1()));
307 connect(leftZoomOut, SIGNAL(clicked()),
this, SLOT(
updateRightGeom()));
312 connect(p_leftView, SIGNAL(tackPointChanged(
double)),
317 connect(
this, SIGNAL(updateLeftView(
double,
double)),
318 p_leftView, SLOT(refreshView(
double,
double)));
320 connect (p_leftView, SIGNAL(userMovedTackPoint()),
323 if (p_allowLeftMouse) {
325 connect(leftPanUp, SIGNAL(clicked()), p_leftView, SLOT(panUp()));
326 connect(leftPanDown, SIGNAL(clicked()), p_leftView, SLOT(panDown()));
327 connect(leftPanLeft, SIGNAL(clicked()), p_leftView, SLOT(panLeft()));
328 connect(leftPanRight, SIGNAL(clicked()), p_leftView, SLOT(panRight()));
337 gridLayout->addWidget(p_rightView, row, 1);
339 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
340 p_rightView, SLOT(setControlNet(
ControlNet *)));
345 connect(rightLockStretch, SIGNAL(stateChanged(
int)),
347 SLOT(changeStretchLock(
int)));
348 rightLockStretch->setChecked(
false);
352 connect(p_rightView, SIGNAL(tackPointChanged(
double)),
354 connect(
this, SIGNAL(updateRightView(
double,
double)),
355 p_rightView, SLOT(refreshView(
double,
double)));
357 connect (p_rightView, SIGNAL(userMovedTackPoint()),
360 connect(p_rightZoomIn, SIGNAL(clicked()), p_rightView, SLOT(zoomIn()));
361 connect(p_rightZoomOut, SIGNAL(clicked()), p_rightView, SLOT(zoomOut()));
362 connect(p_rightZoom1, SIGNAL(clicked()), p_rightView, SLOT(zoom1()));
365 connect(rightPanUp, SIGNAL(clicked()), p_rightView, SLOT(panUp()));
366 connect(rightPanDown, SIGNAL(clicked()), p_rightView, SLOT(panDown()));
367 connect(rightPanLeft, SIGNAL(clicked()), p_rightView, SLOT(panLeft()));
368 connect(rightPanRight, SIGNAL(clicked()), p_rightView, SLOT(panRight()));
379 QButtonGroup *bgroup =
new QButtonGroup();
380 p_nogeom =
new QRadioButton();
381 p_nogeom->setChecked(
true);
382 connect(p_nogeom, SIGNAL(clicked()),
this, SLOT(
setNoGeom()));
384 QCheckBox *linkZoom = NULL;
386 p_nogeom->setText(
"No geom/rotate");
387 p_nogeom->setToolTip(
"Reset right measure to it's native geometry.");
388 p_nogeom->setWhatsThis(
"Reset right measure to it's native geometry. " 389 "If measure was rotated, set rotation back to 0. " 390 "If measure was geomed to match the left measure, " 391 "reset the geometry back to it's native state.");
392 p_geom =
new QRadioButton(
"Geom");
393 p_geom->setToolTip(
"Geom right measure to match geometry of left measure.");
394 p_geom->setWhatsThis(
"Using an affine transform, geom the right measure to match the " 395 "geometry of the left measure.");
396 bgroup->addButton(p_geom);
397 connect(p_geom, SIGNAL(clicked()),
this, SLOT(
setGeom()));
400 linkZoom =
new QCheckBox(
"Link Zoom");
401 linkZoom->setToolTip(
"Link zooming between the left and right views.");
402 linkZoom->setWhatsThis(
"When zooming in the left view, the right view will " 403 "be set to the same zoom factor as the left view.");
404 connect(linkZoom, SIGNAL(toggled(
bool)),
this, SLOT(
setZoomLink(
bool)));
406 p_nogeom->setText(
"No rotate");
407 p_nogeom->setToolTip(
"Reset right measure to it's native geometry.");
408 p_nogeom->setWhatsThis(
"Reset right measure to it's native geometry. " 409 "If measure was rotated, set rotation back to 0.");
411 bgroup->addButton(p_nogeom);
413 QRadioButton *rotate =
new QRadioButton(
"Rotate");
414 bgroup->addButton(rotate);
416 connect(rotate, SIGNAL(clicked()),
this, SLOT(
setRotate()));
423 p_dial =
new QDial();
424 p_dial->setRange(0, 360);
425 p_dial->setWrapping(
false);
426 p_dial->setNotchesVisible(
true);
427 p_dial->setNotchTarget(5.);
428 p_dial->setEnabled(
false);
429 p_dial->setToolTip(
"Rotate right measure");
430 p_dial->setWhatsThis(
"Rotate the right measure by degrees.");
432 p_dialNumber =
new QLCDNumber();
433 p_dialNumber->setEnabled(
false);
434 p_dialNumber->setToolTip(
"Rotate right measure");
435 p_dialNumber->setWhatsThis(
"Rotate the right measure by given number" 437 connect(p_dial, SIGNAL(valueChanged(
int)), p_dialNumber, SLOT(display(
int)));
438 connect(p_dial, SIGNAL(valueChanged(
int)), p_rightView, SLOT(rotateChip(
int)));
440 QCheckBox *showPoints =
new QCheckBox(
"Show control points");
441 showPoints->setToolTip(
"Draw control point crosshairs");
442 showPoints->setWhatsThis(
"This will toggle whether crosshairs are drawn" 443 " for the control points located within the measure''s" 444 " view. For areas of dense measurements, turning this" 445 " off will allow easier viewing of features.");
446 connect(showPoints, SIGNAL(toggled(
bool)), p_leftView, SLOT(setPoints(
bool)));
447 connect(showPoints, SIGNAL(toggled(
bool)), p_rightView, SLOT(setPoints(
bool)));
448 showPoints->setChecked(
true);
450 QCheckBox *cross =
new QCheckBox(
"Show crosshair");
451 connect(cross, SIGNAL(toggled(
bool)), p_leftView, SLOT(setCross(
bool)));
452 connect(cross, SIGNAL(toggled(
bool)), p_rightView, SLOT(setCross(
bool)));
453 cross->setChecked(
true);
454 cross->setToolTip(
"Show the red crosshair across measure view");
455 cross->setWhatsThis(
"This will toggle whether the crosshair across the" 456 " measure view will be shown");
458 QCheckBox *circle =
new QCheckBox(
"Circle");
459 circle->setChecked(
false);
460 circle->setToolTip(
"Draw circle");
461 circle->setWhatsThis(
"Draw circle on measure view. This can aid in" 462 " centering a crater under the crosshair.");
463 connect(circle, SIGNAL(toggled(
bool)),
this, SLOT(
setCircle(
bool)));
465 p_slider =
new QScrollBar(Qt::Horizontal);
466 p_slider->setRange(1, 100);
467 p_slider->setSingleStep(1);
468 connect(p_slider, SIGNAL(valueChanged(
int)), p_leftView, SLOT(setCircleSize(
int)));
469 connect(p_slider, SIGNAL(valueChanged(
int)), p_rightView, SLOT(setCircleSize(
int)));
470 p_slider->setValue(20);
471 p_slider->setDisabled(
true);
473 p_slider->setToolTip(
"Adjust circle size");
474 p_slider->setWhatsThis(
"This allows the cirle size to be adjusted.");
476 QVBoxLayout *vlayout =
new QVBoxLayout();
477 if (!p_useGeometry) {
478 vlayout->addWidget(linkZoom);
480 vlayout->addWidget(p_nogeom);
482 vlayout->addWidget(p_geom);
484 vlayout->addWidget(rotate);
485 vlayout->addWidget(p_dial);
486 vlayout->addWidget(p_dialNumber);
487 vlayout->addWidget(showPoints);
488 vlayout->addWidget(cross);
489 vlayout->addWidget(circle);
490 vlayout->addWidget(p_slider);
491 gridLayout->addLayout(vlayout, row++, 2);
494 p_leftSampLinePosition =
new QLabel();
495 p_leftSampLinePosition->setToolTip(
"Sample/Line under the crosshair");
496 gridLayout->addWidget(p_leftSampLinePosition, row, 0);
497 p_rightSampLinePosition =
new QLabel();
498 p_rightSampLinePosition->setToolTip(
"Sample/Line under the crosshair");
499 gridLayout->addWidget(p_rightSampLinePosition, row++, 1);
503 p_leftLatLonPosition =
new QLabel();
504 p_leftLatLonPosition->setToolTip(
"Latitude/Longitude under the crosshair");
505 gridLayout->addWidget(p_leftLatLonPosition, row, 0);
506 p_rightLatLonPosition =
new QLabel();
507 p_rightLatLonPosition->setToolTip(
"Latitude/Longitude under the crosshair");
508 gridLayout->addWidget(p_rightLatLonPosition, row++, 1);
513 p_autoRegExtension =
new QWidget;
514 p_oldPosition =
new QLabel;
515 p_oldPosition->setToolTip(
"Measure Sample/Line before sub-pixel " 517 p_oldPosition->setWhatsThis(
"Original Sample/Line of the right measure " 518 "before the sub-pixel registration. If you select the \"Undo\" " 519 "button, the measure will revert back to this Sample/Line.");
520 p_goodFit =
new QLabel;
521 p_goodFit->setToolTip(
"Goodness of Fit result from sub-pixel registration.");
522 p_goodFit->setWhatsThis(
"Resulting Goodness of Fit from sub-pixel " 524 QVBoxLayout *autoRegLayout =
new QVBoxLayout;
525 autoRegLayout->setMargin(0);
526 autoRegLayout->addWidget(p_oldPosition);
527 autoRegLayout->addWidget(p_goodFit);
528 p_autoRegExtension->setLayout(autoRegLayout);
529 p_autoRegShown =
false;
530 p_autoRegAttempted =
false;
531 gridLayout->addWidget(p_autoRegExtension, row++, 1);
534 QHBoxLayout *leftLayout =
new QHBoxLayout();
535 QToolButton *stop =
new QToolButton();
536 stop->setIcon(QPixmap(toolIconDir +
"/blinkStop.png"));
537 stop->setIconSize(QSize(22, 22));
538 stop->setToolTip(
"Blink Stop");
539 QString text =
"<b>Function:</b> Stop automatic timed blinking";
540 stop->setWhatsThis(text);
541 connect(stop, SIGNAL(released()),
this, SLOT(
blinkStop()));
543 QToolButton *start =
new QToolButton();
544 start->setIcon(QPixmap(toolIconDir +
"/blinkStart.png"));
545 start->setIconSize(QSize(22, 22));
546 start->setToolTip(
"Blink Start");
547 text =
"<b>Function:</b> Start automatic timed blinking. Cycles \ 548 through linked viewports at variable rate";
549 start->setWhatsThis(text);
550 connect(start, SIGNAL(released()),
this, SLOT(
blinkStart()));
552 p_blinkTimeBox =
new QDoubleSpinBox();
553 p_blinkTimeBox->setMinimum(0.1);
554 p_blinkTimeBox->setMaximum(5.0);
555 p_blinkTimeBox->setDecimals(1);
556 p_blinkTimeBox->setSingleStep(0.1);
557 p_blinkTimeBox->setValue(0.5);
558 p_blinkTimeBox->setToolTip(
"Blink Time Delay");
559 text =
"<b>Function:</b> Change automatic blink rate between " +
560 QString::number(p_blinkTimeBox->minimum()) +
" and " +
561 QString::number(p_blinkTimeBox->maximum()) +
" seconds";
562 p_blinkTimeBox->setWhatsThis(text);
563 connect(p_blinkTimeBox, SIGNAL(valueChanged(
double)),
566 leftLayout->addWidget(stop);
567 leftLayout->addWidget(start);
568 leftLayout->addWidget(p_blinkTimeBox);
571 QPushButton *find =
new QPushButton(
"Find");
572 find->setShortcut(Qt::Key_F);
573 find->setToolTip(
"Move right measure to same Latitude/Longitude as left. " 574 "<strong>Shortcut: F</strong>");
575 find->setWhatsThis(
"Find the Latitude/Longitude under the crosshair in the " 576 "left measure and move the right measure to the same " 577 "latitude/longitude.");
578 leftLayout->addWidget(find);
579 connect(find, SIGNAL(clicked()),
this, SLOT(
findPoint()));
582 leftLayout->addStretch();
583 gridLayout->addLayout(leftLayout, row, 0);
585 QHBoxLayout *rightLayout =
new QHBoxLayout();
586 p_autoReg =
new QPushButton(
"Register");
587 p_autoReg->setShortcut(Qt::Key_R);
588 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. " 589 "<strong>Shortcut: R</strong>");
590 p_autoReg->setWhatsThis(
"Sub-pixel register the right measure to the left " 591 "and move the result under the crosshair. After " 592 "viewing the results, the option exists to move the " 593 "measure back to the original position by selecting " 594 "<strong>\"Undo Registration\"</strong>.");
595 if (p_allowLeftMouse) {
596 p_saveMeasure =
new QPushButton(
"Save Measures");
597 p_saveMeasure->setToolTip(
"Save the both the left and right measure to the edit control " 598 "point (control point currently being edited). " 599 "<strong>Shortcut: M</strong>. " 600 " <strong>Note: The edit control point " 601 "will not be saved to the network until you select " 602 "<strong>\"Save Point\"</strong>");
605 p_saveMeasure =
new QPushButton(
"Save Measure");
606 p_saveMeasure->setToolTip(
"Save the right measure to the edit control " 607 "point (control point currently being edited). " 608 "<strong>Shortcut: M</strong>. " 609 " <strong>Note: The edit control point " 610 "will not be saved to the network until you select " 611 "<strong>\"Save Point\"</strong>");
613 p_saveMeasure->setShortcut(Qt::Key_M);
614 p_saveDefaultPalette = p_saveMeasure->palette();
616 rightLayout->addWidget(p_autoReg);
617 rightLayout->addWidget(p_saveMeasure);
618 rightLayout->addStretch();
619 gridLayout->addLayout(rightLayout, row, 1);
621 connect(p_autoReg, SIGNAL(clicked()),
this, SLOT(
registerPoint()));
622 connect(p_saveMeasure, SIGNAL(clicked()),
this, SLOT(
saveMeasure()));
624 setLayout(gridLayout);
627 p_autoRegExtension->hide();
656 Cube *leftCube, QString pointId) {
659 if (p_autoRegShown) {
661 p_autoRegShown =
false;
662 p_autoRegExtension->hide();
663 p_autoReg->setText(
"Register");
664 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left." 665 "<strong>Shortcut: R</strong>");
666 p_autoReg->setShortcut(Qt::Key_R);
669 p_leftMeasure = leftMeasure;
673 if ( p_leftGroundMap != 0 )
delete p_leftGroundMap;
676 p_leftCube = leftCube;
678 p_leftChip->
TackCube(p_leftMeasure->GetSample(), p_leftMeasure->GetLine());
679 p_leftChip->
Load(*p_leftCube);
682 p_leftView->
setChip(p_leftChip, p_leftCube);
717 Cube *rightCube, QString pointId) {
720 if (p_autoRegShown) {
722 p_autoRegShown =
false;
723 p_autoRegExtension->hide();
724 p_autoReg->setText(
"Register");
725 p_autoReg->setShortcut(Qt::Key_R);
727 p_autoRegAttempted =
false;
729 p_rightMeasure = rightMeasure;
734 if ( p_rightGroundMap != 0 )
delete p_rightGroundMap;
737 p_rightCube = rightCube;
739 p_rightChip->
TackCube(p_rightMeasure->GetSample(),
740 p_rightMeasure->GetLine());
741 if (p_geomIt ==
false) {
742 p_rightChip->
Load(*p_rightCube);
746 p_rightChip->
Load(*p_rightCube, *p_leftChip, *p_leftCube);
751 QString message = fullError.
toString();
752 QMessageBox::information((
QWidget *)parent(),
"Error", message);
753 p_rightChip->
Load(*p_rightCube);
755 p_nogeom->setChecked(
true);
756 p_geom->setChecked(
false);
761 p_rightView->
setChip(p_rightChip, p_rightCube);
767 p_saveMeasure->setPalette(p_saveDefaultPalette);
785 QString pos =
"Sample: " + QString::number(p_leftView->
tackSample()) +
786 " Line: " + QString::number(p_leftView->
tackLine());
787 p_leftSampLinePosition->setText(pos);
795 pos =
"Latitude: " + QString::number(lat) +
796 " Longitude: " + QString::number(lon);
797 p_leftLatLonPosition->setText(pos);
801 pos =
"Zoom Factor: " + QString::number(zoomFactor);
802 p_leftZoomFactor->setText(pos);
822 if (p_autoRegShown) {
824 p_autoRegShown =
false;
825 p_autoRegExtension->hide();
826 p_autoReg->setText(
"Register");
827 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. " 828 "<strong>Shortcut: R</strong>");
829 p_autoReg->setShortcut(Qt::Key_R);
832 QString pos =
"Sample: " + QString::number(p_rightView->
tackSample()) +
833 " Line: " + QString::number(p_rightView->
tackLine());
834 p_rightSampLinePosition->setText(pos);
842 pos =
"Latitude: " + QString::number(lat) +
843 " Longitude: " + QString::number(lon);
844 p_rightLatLonPosition->setText(pos);
848 pos =
"Zoom Factor: " + QString::number(zoomFactor);
849 p_rightZoomFactor->setText(pos);
862 QPalette p = p_saveMeasure->palette();
863 p.setColor(QPalette::ButtonText,qc);
864 p_saveMeasure->setPalette(p);
887 emit updateRightView(p_rightGroundMap->
Sample(), p_rightGroundMap->
Line());
890 if (p_rightGroundMap->
Sample() != p_rightMeasure->GetSample() ||
891 p_rightGroundMap->
Line() != p_rightMeasure->GetLine())
895 QString message =
"Latitude: " + QString::number(lat) +
" Longitude: " +
896 QString::number(lon) +
" is not on the right image. Right measure " +
898 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
936 if (p_autoRegFact == NULL) {
938 Pvl pvl(p_templateFileName);
942 p_autoRegFact = NULL;
944 "Cannot create AutoRegFactory. As a result, " 945 "sub-pixel registration will not work.",
947 QString message = fullError.
toString();
948 QMessageBox::information((
QWidget *)parent(),
"Error", message);
953 if (p_autoRegShown) {
955 p_autoRegShown =
false;
956 p_autoRegExtension->hide();
957 p_autoReg->setText(
"Register");
958 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. " 959 "<strong>Shortcut: R</strong>");
960 p_autoReg->setShortcut(Qt::Key_R);
963 emit updateRightView(p_rightMeasure->GetSample(),
964 p_rightMeasure->GetLine());
966 p_saveMeasure->setPalette(p_saveDefaultPalette);
969 p_autoRegAttempted =
true;
973 p_leftMeasure->GetLine());
976 p_rightMeasure->GetLine());
986 QString msg =
"Cannot register this point, unable to Load chips.\n";
988 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
994 if (!p_autoRegFact->
Success()) {
995 QString msg =
"Cannot sub-pixel register this point.\n";
997 msg +=
"\n\nNot enough valid data in Pattern Chip.\n";
998 msg +=
" PatternValidPercent = ";
1002 msg +=
"\n\nNo valid data in Fit Chip.";
1005 msg +=
"\n\nGoodness of Fit Tolerance not met.\n";
1006 msg +=
"\nGoodnessOfFit = " + QString::number(p_autoRegFact->
GoodnessOfFit());
1007 msg +=
"\nGoodnessOfFitTolerance = ";
1008 msg += QString::number(p_autoRegFact->
Tolerance());
1011 msg +=
"\n\nNot enough valid points in the fit chip window for sub-pixel ";
1012 msg +=
"accuracy. Probably too close to edge.\n";
1015 msg +=
"\n\nCould not model surface for sub-pixel accuracy.\n";
1018 double sampDist, lineDist;
1019 p_autoRegFact->
Distance(sampDist, lineDist);
1020 msg +=
"\n\nSub pixel algorithm moves registration more than tolerance.\n";
1021 msg +=
"\nSampleMovement = " + QString::number(sampDist) +
1022 " LineMovement = " + QString::number(lineDist);
1023 msg +=
"\nDistanceTolerance = " +
1027 double score1, score2;
1028 p_autoRegFact->
ZScores(score1, score2);
1029 msg +=
"\n\nPattern data max or min does not pass z-score test.\n";
1030 msg +=
"\nMinimumZScore = " + QString::number(p_autoRegFact->
MinimumZScore());
1031 msg +=
"\nCalculatedZscores = " + QString::number(score1) +
", " + QString::number(score2);
1034 msg +=
"\n\nError occured in Adaptive algorithm.";
1037 msg +=
"\n\nUnknown registration error.";
1040 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1045 QString msg =
"Cannot register this point.\n";
1047 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1054 if (p_autoRegFact->
CubeSample() != p_rightMeasure->GetSample() ||
1055 p_autoRegFact->
CubeLine() != p_rightMeasure->GetLine()) {
1059 QString oldPos =
"Original Sample: " +
1060 QString::number(p_rightMeasure->GetSample()) +
" Original Line: " +
1061 QString::number(p_rightMeasure->GetLine());
1062 p_oldPosition->setText(oldPos);
1064 QString goodFit =
"Goodness of Fit: " +
1066 p_goodFit->setText(goodFit);
1068 p_autoRegExtension->show();
1069 p_autoRegShown =
true;
1070 p_autoReg->setText(
"Undo Registration");
1071 p_autoReg->setToolTip(
"Undo sub-pixel registration. " 1072 "<strong>Shortcut: U</strong>");
1073 p_autoReg->setShortcut(Qt::Key_U);
1113 if (p_rightMeasure != NULL) {
1116 QString message =
"The right measure is locked. You must first unlock the measure by ";
1117 message +=
"clicking the check box above labeled \"Edit Lock Measure\".";
1118 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
1122 if (p_autoRegShown) {
1129 double minZScore, maxZScore;
1130 p_autoRegFact->
ZScores(minZScore,maxZScore);
1142 QMessageBox::critical((
QWidget *)parent(),
"Error", message);
1148 p_rightMeasure->SetAprioriSample(p_rightMeasure->GetSample());
1149 p_rightMeasure->SetAprioriLine(p_rightMeasure->GetLine());
1154 p_autoRegShown =
false;
1155 p_autoRegExtension->hide();
1156 p_autoReg->setText(
"Register");
1157 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. " 1158 "<strong>Shortcut: R</strong>");
1159 p_autoReg->setShortcut(Qt::Key_R);
1179 if (p_allowLeftMouse) {
1180 if (p_leftMeasure != NULL) {
1182 QString message =
"The left measure is locked. You must first unlock the measure by ";
1183 message +=
"clicking the check box above labeled \"Edit Lock Measure\".";
1184 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
1200 *p_leftMeasure = *p_rightMeasure;
1205 p_saveMeasure->setPalette(p_saveDefaultPalette);
1208 emit measureSaved();
1223 p_rightView->
geomChip(p_leftChip, p_leftCube);
1228 QString message = fullError.
toString();
1229 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1231 p_nogeom->setChecked(
true);
1232 p_geom->setChecked(
false);
1271 QApplication::setOverrideCursor(Qt::WaitCursor);
1275 QString text =
"Zoom in 2X";
1276 p_rightZoomIn->setEnabled(
true);
1277 p_rightZoomIn->setWhatsThis(text);
1278 p_rightZoomIn->setToolTip(
"Zoom In");
1279 text =
"Zoom out 2X";
1280 p_rightZoomOut->setEnabled(
true);
1281 p_rightZoomOut->setWhatsThis(text);
1282 p_rightZoomOut->setToolTip(
"Zoom Out");
1284 p_rightZoom1->setEnabled(
true);
1285 p_rightZoom1->setWhatsThis(text);
1286 p_rightZoom1->setToolTip(
"Zoom 1:1");
1291 QApplication::restoreOverrideCursor();
1293 p_dial->setEnabled(
true);
1294 p_dialNumber->setEnabled(
true);
1295 p_dial->setNotchesVisible(
true);
1310 if (p_geomIt ==
true)
return;
1312 QApplication::setOverrideCursor(Qt::WaitCursor);
1315 QString text =
"Zoom functions disabled when Geom is set";
1316 p_rightZoomIn->setEnabled(
false);
1317 p_rightZoomIn->setWhatsThis(text);
1318 p_rightZoomIn->setToolTip(text);
1319 p_rightZoomOut->setEnabled(
false);
1320 p_rightZoomOut->setWhatsThis(text);
1321 p_rightZoomOut->setToolTip(text);
1322 p_rightZoom1->setEnabled(
false);
1323 p_rightZoom1->setWhatsThis(text);
1324 p_rightZoom1->setToolTip(text);
1328 p_dial->setValue(0);
1329 p_dial->setEnabled(
false);
1330 p_dialNumber->setEnabled(
false);
1335 p_rightView->
geomChip(p_leftChip, p_leftCube);
1339 QString message = fullError.
toString();
1340 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1342 p_nogeom->setChecked(
true);
1343 p_geom->setChecked(
false);
1346 QApplication::restoreOverrideCursor();
1357 QApplication::setOverrideCursor(Qt::WaitCursor);
1359 QString text =
"Zoom in 2X";
1360 p_rightZoomIn->setEnabled(
true);
1361 p_rightZoomIn->setWhatsThis(text);
1362 p_rightZoomIn->setToolTip(
"Zoom In");
1363 text =
"Zoom out 2X";
1364 p_rightZoomOut->setEnabled(
true);
1365 p_rightZoomOut->setWhatsThis(text);
1366 p_rightZoomOut->setToolTip(
"Zoom Out");
1368 p_rightZoom1->setEnabled(
true);
1369 p_rightZoom1->setWhatsThis(text);
1370 p_rightZoom1->setToolTip(
"Zoom 1:1");
1373 p_dial->setValue(0);
1374 p_dial->setEnabled(
false);
1375 p_dialNumber->setEnabled(
false);
1380 QApplication::restoreOverrideCursor();
1393 if (checked == p_circle)
return;
1398 p_slider->setDisabled(
false);
1400 p_slider->setValue(20);
1405 p_slider->setDisabled(
true);
1423 if (checked == p_linkZoom)
return;
1425 p_linkZoom = checked;
1434 if (p_timerOn)
return;
1437 p_blinkList.push_back(p_leftView);
1438 p_blinkList.push_back(p_rightView);
1442 int msec = (int)(p_blinkTimeBox->value() * 1000.0);
1443 p_timer =
new QTimer(
this);
1444 connect(p_timer, SIGNAL(timeout()),
this, SLOT(
updateBlink()));
1445 p_timer->start(msec);
1453 p_blinkList.clear();
1456 p_leftView->repaint();
1468 if (p_timerOn) p_timer->setInterval((
int)(interval * 1000.));
1475 p_blinkIndex = !p_blinkIndex;
1476 p_leftView->
loadView(*(p_blinkList)[p_blinkIndex]);
1502 QString temp = p_templateFileName;
1505 p_templateFileName = fn;
1512 if (p_autoRegFact != NULL)
1513 delete p_autoRegFact;
1514 p_autoRegFact = reg;
1516 p_templateFileName = fn;
1527 p_templateFileName = temp;
1529 "Cannot create AutoRegFactory for " +
1531 ". As a result, current template file will remain set to " +
1533 QString message = fullError.
toString();
1534 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1547 p_allowLeftMouse = allowMouse;
1549 if (p_allowLeftMouse) {
1550 p_saveMeasure =
new QPushButton(
"Save Measures");
1551 p_saveMeasure->setToolTip(
"Save the both the left and right measure to the edit control " 1552 "point (control point currently being edited). " 1553 " <strong>Note: The edit control point " 1554 "will not be saved to the network until you select " 1555 "<strong>\"Save Point\"</strong>");
1558 p_saveMeasure =
new QPushButton(
"Save Measure");
1559 p_saveMeasure->setToolTip(
"Save the right measure to the edit control " 1560 "point (control point currently being edited). " 1561 " <strong>Note: The edit control point " 1562 "will not be saved to the network until you select " 1563 "<strong>\"Save Point\"</strong>");
1568 void ControlPointEdit::refreshChips() {
1569 p_leftView->update();
1570 p_rightView->update();
1585 if (!p_autoRegAttempted) {
1586 QString message =
"Point must be Registered before chips can be saved.";
1587 QMessageBox::warning((
QWidget *)parent(),
"Warning", message);
1592 QString baseFile = p_pointId.replace(
" ",
"_") +
"_" +
1593 toString((
int)(p_leftMeasure ->GetSample())) +
"_" +
1594 toString((
int)(p_leftMeasure ->GetLine())) +
"_" +
1595 toString((
int)(p_rightMeasure->GetSample())) +
"_" +
1596 toString((
int)(p_rightMeasure->GetLine())) +
"_";
1597 QString fname = baseFile +
"Search.cub";
1598 QString command =
"$ISISROOT/bin/qview \'" + fname +
"\'";
1600 fname = baseFile +
"Pattern.cub";
1601 command +=
" \'" + fname +
"\'";
1603 fname = baseFile +
"Fit.cub";
1604 command +=
" \'" + fname +
"\' &";
Status SetType(MeasureType type)
Set how the coordinate was obtained.
void allowLeftMouse(bool allowMouse)
Set the option that allows mouse movements in the left ChipViewport.
Error occured in Adaptive algorithm.
double MinimumZScore() const
Return minimumPatternZScore.
void zoom(double zoomFactor)
Zoom by a specified factor.
double Line() const
Returns the current line value of the camera model or projection.
void findPoint()
Find point from left ChipViewport in the right ChipViewport.
File name manipulation and expansion.
A small chip of data used for pattern matching.
void setNoGeom()
Slot to turn off geom.
Chip * RegistrationSearchChip()
Return pointer to search chip used in registration.
Not enough valid data in pattern chip.
void updateRightPositionLabel(double zoomFactor)
Update sample/line, lat/lon and zoom factor of right measure.
Not enough points to fit a surface model for sub-pixel accuracy.
Chip * RegistrationPatternChip()
Return pointer to pattern chip used in registration.
Surface model moves registration more than one pixel.
Statistical and similar ControlMeasure associated information.
void registerPoint()
Sub-pixel register point in right chipViewport with point in left.
double DistanceTolerance() const
Return distance tolerance.
void TackCube(const double cubeSample, const double cubeLine)
This sets which cube position will be located at the chip tack position.
void updateLeftPositionLabel(double zoomFactor)
Update sample/line, lat/lon and zoom factor of left measure.
AutoReg::RegisterStatus Register()
Walk the pattern chip through the search chip to find the best registration.
Chip * SearchChip()
Return pointer to search chip.
void saveChips()
Slot to save registration chips to files and fire off qview.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Widget to display Isis cubes for qt apps.
Registered to sub-pixel (e.g., pointreg)
double GoodnessOfFit() const
Return the goodness of fit of the match algorithm.
A type of error that occurred when performing an actual I/O operation.
double tackLine()
Returns tack line.
void colorizeSaveButton()
Turn "Save Measure" button text to red.
double tackSample()
Return the position of cube under cross hair.
Control measures store z-scores in pairs.
double CubeSample() const
Return the search chip cube sample that best matched.
void ZScores(double &score1, double &score2) const
Return the ZScores of the pattern chip.
void setRightMeasure(ControlMeasure *rightMeasure, Cube *rightCube, QString pointId)
Set the measure displayed in the right ChipViewport.
static void RunSystemCommand(QString commandLine)
This runs arbitrary system commands.
ControlPointEdit(ControlNet *cnet, QWidget *parent=0, bool allowLeftMouse=false, bool useGeometry=true)
Constructs a ControlPointEdit widget.
bool setTemplateFile(QString)
Allows user to choose a new template file by opening a window from which to select a filename...
Hand Measured (e.g., qnet)
double Tolerance() const
Return match algorithm tolerance.
Chip * PatternChip()
Return pointer to pattern chip.
void Write(const QString &filename)
Writes the contents of the Chip to a cube.
void setGeom()
Turn geom on.
void changeBlinkTime(double interval)
Set blink rate.
#define _FILEINFO_
Macro for the filename and line number.
void blinkStart()
Slot to start blink function.
void SetLogData(ControlMeasureLogData)
This adds or updates the log data information associated with data's type.
A type of error that could only have occurred due to a mistake on the user's part (e...
void saveMeasure()
Save control measure under the crosshair in right ChipViewport.
void updateBlink()
Slot to cause the blink to happen coinciding with the timer.
double UniversalLatitude() const
Returns the universal latitude of the camera model or projection.
double CubeLine() const
Return the search chip cube line that best matched.
double PatternValidPercent() const
Return pattern chip valid percent. The default value is.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
void geomChip(Chip *matchChip, Cube *matchChipCube)
Slot to geom chip (apply geometry transformation)
double zoomFactor()
Return the zoom factor.
bool Success() const
Return whether the match algorithm succeeded or not.
Fit chip did not have any valid data.
Container for cube-like labels.
void Load(Cube &cube, const double rotation=0.0, const double scale=1.0, const int band=1)
Load cube data into the Chip.
void updateRightGeom()
Slot to update the geomed right ChipViewport for zoom operations.
void blinkStop()
Slot to stop blink function.
bool SetImage(double sample, double line)
Returns whether the sample/line postion was set successfully in the camera model or projection...
static AutoReg * Create(Pvl &pvl)
Create an AutoReg object using a PVL specification.
GoodnessOfFit is pointreg information for reference measures.
Goodness of fit tolerance not satisfied.
void createPointEditor(QWidget *parent)
Design the PointEdit widget.
QString toString() const
Returns a string representation of this exception.
void setRotate()
Slot to update the right ChipViewport for zoom operations.
RegisterStatus
Enumeration of the Register() method's return status.
void Distance(double &sampDistance, double &lineDistance)
Return the distance point moved.
void setChip(Chip *chip, Cube *chipCube)
Set chip.
static QString UserName()
Returns the user name.
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
Namespace for ISIS/Bullet specific routines.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
bool SetUniversalGround(double lat, double lon)
Returns whether the lat/lon position was set successfully in the camera model or projection.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
Chip * FitChip()
Return pointer to fit chip.
void DeleteLogData(long dataType)
This deletes log data of the specified type.
Status SetDateTime()
Date Time - Creation Time.
Could not model surface for sub-pixel accuracy.
Pattern data max or min does not pass the z-score test.
double Sample() const
Returns the current line value of the camera model or projection.
void setCircle(bool checked)
Slot to change state of circle.
const int VIEWSIZE
Constant representing the length and width of the chip viewports.
double UniversalLongitude() const
Returns the universal longitude of the camera model or projection.
void setZoomLink(bool)
Turn linking of zoom on or off.
void loadView(ChipViewport &newView)
Load with another ChipViewport, used for blinking.
void setCircle(bool)
Turn circle widgets on/off.
void nogeomChip()
Slot to un-geom chip (revert geometry transformation)
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
void setLeftMeasure(ControlMeasure *leftMeasure, Cube *leftCube, QString pointId)
Set the measure displayed in the left ChipViewport.
IO Handler for Isis Cubes.