9 #include "ControlPointEdit.h"
14 #include <QApplication>
15 #include <QButtonGroup>
19 #include <QDoubleSpinBox>
20 #include <QFileDialog>
21 #include <QGridLayout>
22 #include <QHBoxLayout>
24 #include <QMessageBox>
26 #include <QPushButton>
27 #include <QRadioButton>
32 #include <QToolButton>
34 #include "Application.h"
36 #include "AutoRegFactory.h"
37 #include "ChipViewport.h"
38 #include "ControlMeasure.h"
39 #include "ControlMeasureLogData.h"
42 #include "ProgramLauncher.h"
44 #include "UniversalGroundMap.h"
65 bool allowLeftMouse,
bool useGeometry) :
QWidget(parent) {
71 p_useGeometry = useGeometry;
79 p_templateFileName =
"$ISISROOT/appdata/templates/autoreg/qnetReg.def";
82 if (cnet != NULL) emit newControlNetwork(cnet);
86 ControlPointEdit::~ControlPointEdit() {
120 QGridLayout *gridLayout =
new QGridLayout();
121 gridLayout->setSizeConstraint(QLayout::SetFixedSize);
125 QString tempFileName =
FileName(
"$ISISROOT/appdata/images/icons").
expanded();
126 QString toolIconDir = tempFileName;
130 QToolButton *leftZoomIn =
new QToolButton();
131 leftZoomIn->setIcon(QPixmap(toolIconDir +
"/viewmag+.png"));
132 leftZoomIn->setIconSize(isize);
133 leftZoomIn->setToolTip(
"Zoom In 2x");
134 leftZoomIn->setWhatsThis(
"Zoom In 2x on left measure.");
136 QToolButton *leftZoomOut =
new QToolButton();
137 leftZoomOut->setIcon(QPixmap(toolIconDir +
"/viewmag-.png"));
138 leftZoomOut->setIconSize(isize);
139 leftZoomOut->setToolTip(
"Zoom Out 2x");
140 leftZoomOut->setWhatsThis(
"Zoom Out 2x on left measure.");
142 QToolButton *leftZoom1 =
new QToolButton();
143 leftZoom1->setIcon(QPixmap(toolIconDir +
"/viewmag1.png"));
144 leftZoom1->setIconSize(isize);
145 leftZoom1->setToolTip(
"Zoom 1:1");
146 leftZoom1->setWhatsThis(
"Show left measure at full resolution.");
148 QHBoxLayout *leftZoomPan =
new QHBoxLayout;
149 leftZoomPan->addWidget(leftZoomIn);
150 leftZoomPan->addWidget(leftZoomOut);
151 leftZoomPan->addWidget(leftZoom1);
154 QToolButton *leftPanUp = 0;
155 QToolButton *leftPanDown = 0;
156 QToolButton *leftPanLeft = 0;
157 QToolButton *leftPanRight = 0;
158 if (p_allowLeftMouse) {
160 leftPanUp =
new QToolButton(parent);
161 leftPanUp->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/up.png").
163 leftPanUp->setIconSize(isize);
164 leftPanUp->setToolTip(
"Move up 1 screen pixel");
165 leftPanUp->setStatusTip(
"Move up 1 screen pixel");
166 leftPanUp->setWhatsThis(
"Move the left measure up 1 screen pixel.");
168 leftPanDown =
new QToolButton(parent);
169 leftPanDown->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/down.png").
171 leftPanDown->setIconSize(isize);
172 leftPanDown->setToolTip(
"Move down 1 screen pixel");
173 leftPanDown->setStatusTip(
"Move down 1 screen pixel");
174 leftPanDown->setWhatsThis(
"Move the left measure down 1 screen pixel.");
176 leftPanLeft =
new QToolButton(parent);
177 leftPanLeft->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/back.png").
179 leftPanLeft->setIconSize(isize);
180 leftPanLeft->setToolTip(
"Move left 1 screen pixel");
181 leftPanLeft->setWhatsThis(
"Move the left measure to the left by 1 screen"
184 leftPanRight =
new QToolButton(parent);
185 leftPanRight->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/forward.png").
187 leftPanRight->setIconSize(isize);
188 leftPanRight->setToolTip(
"Move right 1 screen pixel");
189 leftPanRight->setWhatsThis(
"Move the left measure to the right by 1"
192 leftZoomPan->addWidget(leftPanUp);
193 leftZoomPan->addWidget(leftPanDown);
194 leftZoomPan->addWidget(leftPanLeft);
195 leftZoomPan->addWidget(leftPanRight);
198 leftZoomPan->addStretch();
199 gridLayout->addLayout(leftZoomPan, row, 0);
201 p_rightZoomIn =
new QToolButton();
202 p_rightZoomIn->setIcon(QPixmap(toolIconDir +
"/viewmag+.png"));
203 p_rightZoomIn->setIconSize(isize);
204 p_rightZoomIn->setToolTip(
"Zoom In 2x");
205 p_rightZoomIn->setWhatsThis(
"Zoom In 2x on right measure.");
207 p_rightZoomOut =
new QToolButton();
208 p_rightZoomOut->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/viewmag-.png").
210 p_rightZoomOut->setIconSize(isize);
211 p_rightZoomOut->setToolTip(
"Zoom Out 2x");
212 p_rightZoomOut->setWhatsThis(
"Zoom Out 2x on right measure.");
214 p_rightZoom1 =
new QToolButton();
215 p_rightZoom1->setIcon(QPixmap(toolIconDir +
"/viewmag1.png"));
216 p_rightZoom1->setIconSize(isize);
217 p_rightZoom1->setToolTip(
"Zoom 1:1");
218 p_rightZoom1->setWhatsThis(
"Show right measure at full resolution.");
220 QHBoxLayout *rightZoomPan =
new QHBoxLayout;
221 rightZoomPan->addWidget(p_rightZoomIn);
222 rightZoomPan->addWidget(p_rightZoomOut);
223 rightZoomPan->addWidget(p_rightZoom1);
226 QToolButton *rightPanUp =
new QToolButton(parent);
227 rightPanUp->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/up.png").
229 rightPanUp->setIconSize(isize);
230 rightPanUp->setToolTip(
"Move up 1 screen pixel");
231 rightPanUp->setWhatsThis(
"Move the right measure up 1 screen pixel.");
233 QToolButton *rightPanDown =
new QToolButton(parent);
234 rightPanDown->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/down.png").
236 rightPanDown->setIconSize(isize);
237 rightPanDown->setToolTip(
"Move down 1 screen pixel");
238 rightPanUp->setWhatsThis(
"Move the right measure down 1 screen pixel.");
240 QToolButton *rightPanLeft =
new QToolButton(parent);
241 rightPanLeft->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/back.png").
243 rightPanLeft->setIconSize(isize);
244 rightPanLeft->setToolTip(
"Move left 1 screen pixel");
245 rightPanLeft->setWhatsThis(
"Move the right measure to the left by 1 screen"
248 QToolButton *rightPanRight =
new QToolButton(parent);
249 rightPanRight->setIcon(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/forward.png").
251 rightPanRight->setIconSize(isize);
252 rightPanRight->setToolTip(
"Move right 1 screen pixel");
253 rightPanRight->setWhatsThis(
"Move the right measure to the right by 1"
256 rightZoomPan->addWidget(rightPanUp);
257 rightZoomPan->addWidget(rightPanDown);
258 rightZoomPan->addWidget(rightPanLeft);
259 rightZoomPan->addWidget(rightPanRight);
260 rightZoomPan->addStretch();
262 gridLayout->addLayout(rightZoomPan, row++, 1);
265 p_leftZoomFactor =
new QLabel();
266 QCheckBox *leftLockStretch =
new QCheckBox(
"lock stretch");
269 QString whatsThisTextForStretchLocking =
"If checked then a new stretch "
270 "will NOT be calculated for each pan or zoom change. Note that stretch"
271 " changes made using the stretch tool will ALWAYS take effect, "
272 "regardless of the state of this checkbox.";
273 leftLockStretch->setWhatsThis(whatsThisTextForStretchLocking);
274 QHBoxLayout *leftzflsLayout =
new QHBoxLayout;
275 leftzflsLayout->addWidget(p_leftZoomFactor);
276 leftzflsLayout->addWidget(leftLockStretch);
277 gridLayout->addLayout(leftzflsLayout, row, 0);
279 p_rightZoomFactor =
new QLabel();
280 QCheckBox *rightLockStretch =
new QCheckBox(
"lock stretch");
281 rightLockStretch->setWhatsThis(whatsThisTextForStretchLocking);
282 QHBoxLayout *rightzflsLayout =
new QHBoxLayout;
283 rightzflsLayout->addWidget(p_rightZoomFactor);
284 rightzflsLayout->addWidget(rightLockStretch);
285 gridLayout->addLayout(rightzflsLayout, row++, 1);
290 if (!p_allowLeftMouse) p_leftView->setDisabled(
true);
292 gridLayout->addWidget(p_leftView, row, 0);
294 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
295 p_leftView, SLOT(setControlNet(
ControlNet *)));
302 connect(leftLockStretch, SIGNAL(stateChanged(
int)),
304 SLOT(changeStretchLock(
int)));
305 leftLockStretch->setChecked(
false);
309 connect(leftZoomIn, SIGNAL(clicked()), p_leftView, SLOT(zoomIn()));
310 connect(leftZoomOut, SIGNAL(clicked()), p_leftView, SLOT(zoomOut()));
311 connect(leftZoom1, SIGNAL(clicked()), p_leftView, SLOT(zoom1()));
315 connect(leftZoomOut, SIGNAL(clicked()),
this, SLOT(
updateRightGeom()));
320 connect(p_leftView, SIGNAL(tackPointChanged(
double)),
325 connect(
this, SIGNAL(updateLeftView(
double,
double)),
326 p_leftView, SLOT(refreshView(
double,
double)));
328 connect (p_leftView, SIGNAL(userMovedTackPoint()),
331 if (p_allowLeftMouse) {
333 connect(leftPanUp, SIGNAL(clicked()), p_leftView, SLOT(panUp()));
334 connect(leftPanDown, SIGNAL(clicked()), p_leftView, SLOT(panDown()));
335 connect(leftPanLeft, SIGNAL(clicked()), p_leftView, SLOT(panLeft()));
336 connect(leftPanRight, SIGNAL(clicked()), p_leftView, SLOT(panRight()));
345 gridLayout->addWidget(p_rightView, row, 1);
347 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
348 p_rightView, SLOT(setControlNet(
ControlNet *)));
353 connect(rightLockStretch, SIGNAL(stateChanged(
int)),
355 SLOT(changeStretchLock(
int)));
356 rightLockStretch->setChecked(
false);
360 connect(p_rightView, SIGNAL(tackPointChanged(
double)),
362 connect(
this, SIGNAL(updateRightView(
double,
double)),
363 p_rightView, SLOT(refreshView(
double,
double)));
365 connect (p_rightView, SIGNAL(userMovedTackPoint()),
368 connect(p_rightZoomIn, SIGNAL(clicked()), p_rightView, SLOT(zoomIn()));
369 connect(p_rightZoomOut, SIGNAL(clicked()), p_rightView, SLOT(zoomOut()));
370 connect(p_rightZoom1, SIGNAL(clicked()), p_rightView, SLOT(zoom1()));
373 connect(rightPanUp, SIGNAL(clicked()), p_rightView, SLOT(panUp()));
374 connect(rightPanDown, SIGNAL(clicked()), p_rightView, SLOT(panDown()));
375 connect(rightPanLeft, SIGNAL(clicked()), p_rightView, SLOT(panLeft()));
376 connect(rightPanRight, SIGNAL(clicked()), p_rightView, SLOT(panRight()));
387 QButtonGroup *bgroup =
new QButtonGroup();
388 p_nogeom =
new QRadioButton();
389 p_nogeom->setChecked(
true);
390 connect(p_nogeom, SIGNAL(clicked()),
this, SLOT(
setNoGeom()));
392 QCheckBox *linkZoom = NULL;
394 p_nogeom->setText(
"No geom/rotate");
395 p_nogeom->setToolTip(
"Reset right measure to it's native geometry.");
396 p_nogeom->setWhatsThis(
"Reset right measure to it's native geometry. "
397 "If measure was rotated, set rotation back to 0. "
398 "If measure was geomed to match the left measure, "
399 "reset the geometry back to it's native state.");
400 p_geom =
new QRadioButton(
"Geom");
401 p_geom->setToolTip(
"Geom right measure to match geometry of left measure.");
402 p_geom->setWhatsThis(
"Using an affine transform, geom the right measure to match the "
403 "geometry of the left measure.");
404 bgroup->addButton(p_geom);
405 connect(p_geom, SIGNAL(clicked()),
this, SLOT(
setGeom()));
408 linkZoom =
new QCheckBox(
"Link Zoom");
409 linkZoom->setToolTip(
"Link zooming between the left and right views.");
410 linkZoom->setWhatsThis(
"When zooming in the left view, the right view will "
411 "be set to the same zoom factor as the left view.");
412 connect(linkZoom, SIGNAL(toggled(
bool)),
this, SLOT(
setZoomLink(
bool)));
414 p_nogeom->setText(
"No rotate");
415 p_nogeom->setToolTip(
"Reset right measure to it's native geometry.");
416 p_nogeom->setWhatsThis(
"Reset right measure to it's native geometry. "
417 "If measure was rotated, set rotation back to 0.");
419 bgroup->addButton(p_nogeom);
421 QRadioButton *rotate =
new QRadioButton(
"Rotate");
422 bgroup->addButton(rotate);
424 connect(rotate, SIGNAL(clicked()),
this, SLOT(
setRotate()));
431 p_dial =
new QDial();
432 p_dial->setRange(0, 360);
433 p_dial->setWrapping(
false);
434 p_dial->setNotchesVisible(
true);
435 p_dial->setNotchTarget(5.);
436 p_dial->setEnabled(
false);
437 p_dial->setToolTip(
"Rotate right measure");
438 p_dial->setWhatsThis(
"Rotate the right measure by degrees.");
440 p_dialNumber =
new QLCDNumber();
441 p_dialNumber->setEnabled(
false);
442 p_dialNumber->setToolTip(
"Rotate right measure");
443 p_dialNumber->setWhatsThis(
"Rotate the right measure by given number"
445 connect(p_dial, SIGNAL(valueChanged(
int)), p_dialNumber, SLOT(display(
int)));
446 connect(p_dial, SIGNAL(valueChanged(
int)), p_rightView, SLOT(rotateChip(
int)));
448 QCheckBox *showPoints =
new QCheckBox(
"Show control points");
449 showPoints->setToolTip(
"Draw control point crosshairs");
450 showPoints->setWhatsThis(
"This will toggle whether crosshairs are drawn"
451 " for the control points located within the measure''s"
452 " view. For areas of dense measurements, turning this"
453 " off will allow easier viewing of features.");
454 connect(showPoints, SIGNAL(toggled(
bool)), p_leftView, SLOT(setPoints(
bool)));
455 connect(showPoints, SIGNAL(toggled(
bool)), p_rightView, SLOT(setPoints(
bool)));
456 showPoints->setChecked(
true);
458 QCheckBox *cross =
new QCheckBox(
"Show crosshair");
459 connect(cross, SIGNAL(toggled(
bool)), p_leftView, SLOT(setCross(
bool)));
460 connect(cross, SIGNAL(toggled(
bool)), p_rightView, SLOT(setCross(
bool)));
461 cross->setChecked(
true);
462 cross->setToolTip(
"Show the red crosshair across measure view");
463 cross->setWhatsThis(
"This will toggle whether the crosshair across the"
464 " measure view will be shown");
466 QCheckBox *circle =
new QCheckBox(
"Circle");
467 circle->setChecked(
false);
468 circle->setToolTip(
"Draw circle");
469 circle->setWhatsThis(
"Draw circle on measure view. This can aid in"
470 " centering a crater under the crosshair.");
471 connect(circle, SIGNAL(toggled(
bool)),
this, SLOT(
setCircle(
bool)));
473 p_slider =
new QScrollBar(Qt::Horizontal);
474 p_slider->setRange(1, 100);
475 p_slider->setSingleStep(1);
476 connect(p_slider, SIGNAL(valueChanged(
int)), p_leftView, SLOT(setCircleSize(
int)));
477 connect(p_slider, SIGNAL(valueChanged(
int)), p_rightView, SLOT(setCircleSize(
int)));
478 p_slider->setValue(20);
479 p_slider->setDisabled(
true);
481 p_slider->setToolTip(
"Adjust circle size");
482 p_slider->setWhatsThis(
"This allows the cirle size to be adjusted.");
484 QVBoxLayout *vlayout =
new QVBoxLayout();
485 if (!p_useGeometry) {
486 vlayout->addWidget(linkZoom);
488 vlayout->addWidget(p_nogeom);
490 vlayout->addWidget(p_geom);
492 vlayout->addWidget(rotate);
493 vlayout->addWidget(p_dial);
494 vlayout->addWidget(p_dialNumber);
495 vlayout->addWidget(showPoints);
496 vlayout->addWidget(cross);
497 vlayout->addWidget(circle);
498 vlayout->addWidget(p_slider);
499 gridLayout->addLayout(vlayout, row++, 2);
502 p_leftSampLinePosition =
new QLabel();
503 p_leftSampLinePosition->setToolTip(
"Sample/Line under the crosshair");
504 gridLayout->addWidget(p_leftSampLinePosition, row, 0);
505 p_rightSampLinePosition =
new QLabel();
506 p_rightSampLinePosition->setToolTip(
"Sample/Line under the crosshair");
507 gridLayout->addWidget(p_rightSampLinePosition, row++, 1);
511 p_leftLatLonPosition =
new QLabel();
512 p_leftLatLonPosition->setToolTip(
"Latitude/Longitude under the crosshair");
513 gridLayout->addWidget(p_leftLatLonPosition, row, 0);
514 p_rightLatLonPosition =
new QLabel();
515 p_rightLatLonPosition->setToolTip(
"Latitude/Longitude under the crosshair");
516 gridLayout->addWidget(p_rightLatLonPosition, row++, 1);
521 p_autoRegExtension =
new QWidget;
522 p_oldPosition =
new QLabel;
523 p_oldPosition->setToolTip(
"Measure Sample/Line before sub-pixel "
525 p_oldPosition->setWhatsThis(
"Original Sample/Line of the right measure "
526 "before the sub-pixel registration. If you select the \"Undo\" "
527 "button, the measure will revert back to this Sample/Line.");
528 p_goodFit =
new QLabel;
529 p_goodFit->setToolTip(
"Goodness of Fit result from sub-pixel registration.");
530 p_goodFit->setWhatsThis(
"Resulting Goodness of Fit from sub-pixel "
532 QVBoxLayout *autoRegLayout =
new QVBoxLayout;
533 autoRegLayout->setMargin(0);
534 autoRegLayout->addWidget(p_oldPosition);
535 autoRegLayout->addWidget(p_goodFit);
536 p_autoRegExtension->setLayout(autoRegLayout);
537 p_autoRegShown =
false;
538 p_autoRegAttempted =
false;
539 gridLayout->addWidget(p_autoRegExtension, row++, 1);
542 QHBoxLayout *leftLayout =
new QHBoxLayout();
543 QToolButton *stop =
new QToolButton();
544 stop->setIcon(QPixmap(toolIconDir +
"/blinkStop.png"));
545 stop->setIconSize(QSize(22, 22));
546 stop->setToolTip(
"Blink Stop");
547 QString text =
"<b>Function:</b> Stop automatic timed blinking";
548 stop->setWhatsThis(text);
549 connect(stop, SIGNAL(released()),
this, SLOT(
blinkStop()));
551 QToolButton *start =
new QToolButton();
552 start->setIcon(QPixmap(toolIconDir +
"/blinkStart.png"));
553 start->setIconSize(QSize(22, 22));
554 start->setToolTip(
"Blink Start");
555 text =
"<b>Function:</b> Start automatic timed blinking. Cycles \
556 through linked viewports at variable rate";
557 start->setWhatsThis(text);
558 connect(start, SIGNAL(released()),
this, SLOT(
blinkStart()));
560 p_blinkTimeBox =
new QDoubleSpinBox();
561 p_blinkTimeBox->setMinimum(0.1);
562 p_blinkTimeBox->setMaximum(5.0);
563 p_blinkTimeBox->setDecimals(1);
564 p_blinkTimeBox->setSingleStep(0.1);
565 p_blinkTimeBox->setValue(0.5);
566 p_blinkTimeBox->setToolTip(
"Blink Time Delay");
567 text =
"<b>Function:</b> Change automatic blink rate between " +
568 QString::number(p_blinkTimeBox->minimum()) +
" and " +
569 QString::number(p_blinkTimeBox->maximum()) +
" seconds";
570 p_blinkTimeBox->setWhatsThis(text);
571 connect(p_blinkTimeBox, SIGNAL(valueChanged(
double)),
574 leftLayout->addWidget(stop);
575 leftLayout->addWidget(start);
576 leftLayout->addWidget(p_blinkTimeBox);
579 QPushButton *find =
new QPushButton(
"Find");
580 find->setShortcut(Qt::Key_F);
581 find->setToolTip(
"Move right measure to same Latitude/Longitude as left. "
582 "<strong>Shortcut: F</strong>");
583 find->setWhatsThis(
"Find the Latitude/Longitude under the crosshair in the "
584 "left measure and move the right measure to the same "
585 "latitude/longitude.");
586 leftLayout->addWidget(find);
587 connect(find, SIGNAL(clicked()),
this, SLOT(
findPoint()));
590 leftLayout->addStretch();
591 gridLayout->addLayout(leftLayout, row, 0);
593 QHBoxLayout *rightLayout =
new QHBoxLayout();
594 p_autoReg =
new QPushButton(
"Register");
595 p_autoReg->setShortcut(Qt::Key_R);
596 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. "
597 "<strong>Shortcut: R</strong>");
598 p_autoReg->setWhatsThis(
"Sub-pixel register the right measure to the left "
599 "and move the result under the crosshair. After "
600 "viewing the results, the option exists to move the "
601 "measure back to the original position by selecting "
602 "<strong>\"Undo Registration\"</strong>.");
603 if (p_allowLeftMouse) {
604 p_saveMeasure =
new QPushButton(
"Save Measures");
605 p_saveMeasure->setToolTip(
"Save the both the left and right measure to the edit control "
606 "point (control point currently being edited). "
607 "<strong>Shortcut: M</strong>. "
608 " <strong>Note: The edit control point "
609 "will not be saved to the network until you select "
610 "<strong>\"Save Point\"</strong>");
613 p_saveMeasure =
new QPushButton(
"Save Measure");
614 p_saveMeasure->setToolTip(
"Save the right measure to the edit control "
615 "point (control point currently being edited). "
616 "<strong>Shortcut: M</strong>. "
617 " <strong>Note: The edit control point "
618 "will not be saved to the network until you select "
619 "<strong>\"Save Point\"</strong>");
621 p_saveMeasure->setShortcut(Qt::Key_M);
622 p_saveDefaultPalette = p_saveMeasure->palette();
624 rightLayout->addWidget(p_autoReg);
625 rightLayout->addWidget(p_saveMeasure);
626 rightLayout->addStretch();
627 gridLayout->addLayout(rightLayout, row, 1);
629 connect(p_autoReg, SIGNAL(clicked()),
this, SLOT(
registerPoint()));
630 connect(p_saveMeasure, SIGNAL(clicked()),
this, SLOT(
saveMeasure()));
632 setLayout(gridLayout);
635 p_autoRegExtension->hide();
664 Cube *leftCube, QString pointId) {
667 if (p_autoRegShown) {
669 p_autoRegShown =
false;
670 p_autoRegExtension->hide();
671 p_autoReg->setText(
"Register");
672 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left."
673 "<strong>Shortcut: R</strong>");
674 p_autoReg->setShortcut(Qt::Key_R);
677 p_leftMeasure = leftMeasure;
681 if ( p_leftGroundMap != 0 )
delete p_leftGroundMap;
684 p_leftCube = leftCube;
686 p_leftChip->
TackCube(p_leftMeasure->GetSample(), p_leftMeasure->GetLine());
687 p_leftChip->
Load(*p_leftCube);
690 p_leftView->
setChip(p_leftChip, p_leftCube);
725 Cube *rightCube, QString pointId) {
728 if (p_autoRegShown) {
730 p_autoRegShown =
false;
731 p_autoRegExtension->hide();
732 p_autoReg->setText(
"Register");
733 p_autoReg->setShortcut(Qt::Key_R);
735 p_autoRegAttempted =
false;
737 p_rightMeasure = rightMeasure;
742 if ( p_rightGroundMap != 0 )
delete p_rightGroundMap;
745 p_rightCube = rightCube;
747 p_rightChip->
TackCube(p_rightMeasure->GetSample(),
748 p_rightMeasure->GetLine());
749 if (p_geomIt ==
false) {
750 p_rightChip->
Load(*p_rightCube);
754 p_rightChip->
Load(*p_rightCube, *p_leftChip, *p_leftCube);
759 QString message = fullError.
toString();
760 QMessageBox::information((
QWidget *)parent(),
"Error", message);
761 p_rightChip->
Load(*p_rightCube);
763 p_nogeom->setChecked(
true);
764 p_geom->setChecked(
false);
769 p_rightView->
setChip(p_rightChip, p_rightCube);
775 p_saveMeasure->setPalette(p_saveDefaultPalette);
793 QString pos =
"Sample: " + QString::number(p_leftView->
tackSample()) +
794 " Line: " + QString::number(p_leftView->
tackLine());
795 p_leftSampLinePosition->setText(pos);
803 pos =
"Latitude: " + QString::number(lat) +
804 " Longitude: " + QString::number(lon);
805 p_leftLatLonPosition->setText(pos);
809 pos =
"Zoom Factor: " + QString::number(zoomFactor);
810 p_leftZoomFactor->setText(pos);
830 if (p_autoRegShown) {
832 p_autoRegShown =
false;
833 p_autoRegExtension->hide();
834 p_autoReg->setText(
"Register");
835 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. "
836 "<strong>Shortcut: R</strong>");
837 p_autoReg->setShortcut(Qt::Key_R);
840 QString pos =
"Sample: " + QString::number(p_rightView->
tackSample()) +
841 " Line: " + QString::number(p_rightView->
tackLine());
842 p_rightSampLinePosition->setText(pos);
850 pos =
"Latitude: " + QString::number(lat) +
851 " Longitude: " + QString::number(lon);
852 p_rightLatLonPosition->setText(pos);
856 pos =
"Zoom Factor: " + QString::number(zoomFactor);
857 p_rightZoomFactor->setText(pos);
870 QPalette p = p_saveMeasure->palette();
871 p.setColor(QPalette::ButtonText,qc);
872 p_saveMeasure->setPalette(p);
895 emit updateRightView(p_rightGroundMap->
Sample(), p_rightGroundMap->
Line());
898 if (p_rightGroundMap->
Sample() != p_rightMeasure->GetSample() ||
899 p_rightGroundMap->
Line() != p_rightMeasure->GetLine())
903 QString message =
"Latitude: " + QString::number(lat) +
" Longitude: " +
904 QString::number(lon) +
" is not on the right image. Right measure " +
906 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
944 if (p_autoRegFact == NULL) {
946 Pvl pvl(p_templateFileName);
950 p_autoRegFact = NULL;
952 "Cannot create AutoRegFactory. As a result, "
953 "sub-pixel registration will not work.",
955 QString message = fullError.
toString();
956 QMessageBox::information((
QWidget *)parent(),
"Error", message);
961 if (p_autoRegShown) {
963 p_autoRegShown =
false;
964 p_autoRegExtension->hide();
965 p_autoReg->setText(
"Register");
966 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. "
967 "<strong>Shortcut: R</strong>");
968 p_autoReg->setShortcut(Qt::Key_R);
971 emit updateRightView(p_rightMeasure->GetSample(),
972 p_rightMeasure->GetLine());
974 p_saveMeasure->setPalette(p_saveDefaultPalette);
977 p_autoRegAttempted =
true;
981 p_leftMeasure->GetLine());
984 p_rightMeasure->GetLine());
994 QString msg =
"Cannot register this point, unable to Load chips.\n";
996 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1002 if (!p_autoRegFact->
Success()) {
1003 QString msg =
"Cannot sub-pixel register this point.\n";
1005 msg +=
"\n\nNot enough valid data in Pattern Chip.\n";
1006 msg +=
" PatternValidPercent = ";
1010 msg +=
"\n\nNo valid data in Fit Chip.";
1013 msg +=
"\n\nGoodness of Fit Tolerance not met.\n";
1014 msg +=
"\nGoodnessOfFit = " + QString::number(p_autoRegFact->
GoodnessOfFit());
1015 msg +=
"\nGoodnessOfFitTolerance = ";
1016 msg += QString::number(p_autoRegFact->
Tolerance());
1019 msg +=
"\n\nNot enough valid points in the fit chip window for sub-pixel ";
1020 msg +=
"accuracy. Probably too close to edge.\n";
1023 msg +=
"\n\nCould not model surface for sub-pixel accuracy.\n";
1026 double sampDist, lineDist;
1027 p_autoRegFact->
Distance(sampDist, lineDist);
1028 msg +=
"\n\nSub pixel algorithm moves registration more than tolerance.\n";
1029 msg +=
"\nSampleMovement = " + QString::number(sampDist) +
1030 " LineMovement = " + QString::number(lineDist);
1031 msg +=
"\nDistanceTolerance = " +
1035 double score1, score2;
1036 p_autoRegFact->
ZScores(score1, score2);
1037 msg +=
"\n\nPattern data max or min does not pass z-score test.\n";
1038 msg +=
"\nMinimumZScore = " + QString::number(p_autoRegFact->
MinimumZScore());
1039 msg +=
"\nCalculatedZscores = " + QString::number(score1) +
", " + QString::number(score2);
1042 msg +=
"\n\nError occured in Adaptive algorithm.";
1045 msg +=
"\n\nUnknown registration error.";
1048 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1053 QString msg =
"Cannot register this point.\n";
1055 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1062 if (p_autoRegFact->
CubeSample() != p_rightMeasure->GetSample() ||
1063 p_autoRegFact->
CubeLine() != p_rightMeasure->GetLine()) {
1067 QString oldPos =
"Original Sample: " +
1068 QString::number(p_rightMeasure->GetSample()) +
" Original Line: " +
1069 QString::number(p_rightMeasure->GetLine());
1070 p_oldPosition->setText(oldPos);
1072 QString goodFit =
"Goodness of Fit: " +
1074 p_goodFit->setText(goodFit);
1076 p_autoRegExtension->show();
1077 p_autoRegShown =
true;
1078 p_autoReg->setText(
"Undo Registration");
1079 p_autoReg->setToolTip(
"Undo sub-pixel registration. "
1080 "<strong>Shortcut: U</strong>");
1081 p_autoReg->setShortcut(Qt::Key_U);
1121 if (p_rightMeasure != NULL) {
1124 QString message =
"The right measure is locked. You must first unlock the measure by ";
1125 message +=
"clicking the check box above labeled \"Edit Lock Measure\".";
1126 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
1130 if (p_autoRegShown) {
1137 double minZScore, maxZScore;
1138 p_autoRegFact->
ZScores(minZScore,maxZScore);
1150 QMessageBox::critical((
QWidget *)parent(),
"Error", message);
1156 p_rightMeasure->SetAprioriSample(p_rightMeasure->GetSample());
1157 p_rightMeasure->SetAprioriLine(p_rightMeasure->GetLine());
1162 p_autoRegShown =
false;
1163 p_autoRegExtension->hide();
1164 p_autoReg->setText(
"Register");
1165 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left. "
1166 "<strong>Shortcut: R</strong>");
1167 p_autoReg->setShortcut(Qt::Key_R);
1187 if (p_allowLeftMouse) {
1188 if (p_leftMeasure != NULL) {
1190 QString message =
"The left measure is locked. You must first unlock the measure by ";
1191 message +=
"clicking the check box above labeled \"Edit Lock Measure\".";
1192 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
1208 *p_leftMeasure = *p_rightMeasure;
1213 p_saveMeasure->setPalette(p_saveDefaultPalette);
1216 emit measureSaved();
1231 p_rightView->
geomChip(p_leftChip, p_leftCube);
1236 QString message = fullError.
toString();
1237 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1239 p_nogeom->setChecked(
true);
1240 p_geom->setChecked(
false);
1279 QApplication::setOverrideCursor(Qt::WaitCursor);
1283 QString text =
"Zoom in 2X";
1284 p_rightZoomIn->setEnabled(
true);
1285 p_rightZoomIn->setWhatsThis(text);
1286 p_rightZoomIn->setToolTip(
"Zoom In");
1287 text =
"Zoom out 2X";
1288 p_rightZoomOut->setEnabled(
true);
1289 p_rightZoomOut->setWhatsThis(text);
1290 p_rightZoomOut->setToolTip(
"Zoom Out");
1292 p_rightZoom1->setEnabled(
true);
1293 p_rightZoom1->setWhatsThis(text);
1294 p_rightZoom1->setToolTip(
"Zoom 1:1");
1299 QApplication::restoreOverrideCursor();
1301 p_dial->setEnabled(
true);
1302 p_dialNumber->setEnabled(
true);
1303 p_dial->setNotchesVisible(
true);
1318 if (p_geomIt ==
true)
return;
1320 QApplication::setOverrideCursor(Qt::WaitCursor);
1323 QString text =
"Zoom functions disabled when Geom is set";
1324 p_rightZoomIn->setEnabled(
false);
1325 p_rightZoomIn->setWhatsThis(text);
1326 p_rightZoomIn->setToolTip(text);
1327 p_rightZoomOut->setEnabled(
false);
1328 p_rightZoomOut->setWhatsThis(text);
1329 p_rightZoomOut->setToolTip(text);
1330 p_rightZoom1->setEnabled(
false);
1331 p_rightZoom1->setWhatsThis(text);
1332 p_rightZoom1->setToolTip(text);
1336 p_dial->setValue(0);
1337 p_dial->setEnabled(
false);
1338 p_dialNumber->setEnabled(
false);
1343 p_rightView->
geomChip(p_leftChip, p_leftCube);
1347 QString message = fullError.
toString();
1348 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1350 p_nogeom->setChecked(
true);
1351 p_geom->setChecked(
false);
1354 QApplication::restoreOverrideCursor();
1365 QApplication::setOverrideCursor(Qt::WaitCursor);
1367 QString text =
"Zoom in 2X";
1368 p_rightZoomIn->setEnabled(
true);
1369 p_rightZoomIn->setWhatsThis(text);
1370 p_rightZoomIn->setToolTip(
"Zoom In");
1371 text =
"Zoom out 2X";
1372 p_rightZoomOut->setEnabled(
true);
1373 p_rightZoomOut->setWhatsThis(text);
1374 p_rightZoomOut->setToolTip(
"Zoom Out");
1376 p_rightZoom1->setEnabled(
true);
1377 p_rightZoom1->setWhatsThis(text);
1378 p_rightZoom1->setToolTip(
"Zoom 1:1");
1381 p_dial->setValue(0);
1382 p_dial->setEnabled(
false);
1383 p_dialNumber->setEnabled(
false);
1388 QApplication::restoreOverrideCursor();
1401 if (checked == p_circle)
return;
1406 p_slider->setDisabled(
false);
1408 p_slider->setValue(20);
1413 p_slider->setDisabled(
true);
1431 if (checked == p_linkZoom)
return;
1433 p_linkZoom = checked;
1442 if (p_timerOn)
return;
1445 p_blinkList.push_back(p_leftView);
1446 p_blinkList.push_back(p_rightView);
1450 int msec = (int)(p_blinkTimeBox->value() * 1000.0);
1451 p_timer =
new QTimer(
this);
1452 connect(p_timer, SIGNAL(timeout()),
this, SLOT(
updateBlink()));
1453 p_timer->start(msec);
1461 p_blinkList.clear();
1464 p_leftView->repaint();
1476 if (p_timerOn) p_timer->setInterval((
int)(interval * 1000.));
1483 p_blinkIndex = !p_blinkIndex;
1484 p_leftView->
loadView(*(p_blinkList)[p_blinkIndex]);
1510 QString temp = p_templateFileName;
1513 p_templateFileName = fn;
1520 if (p_autoRegFact != NULL)
1521 delete p_autoRegFact;
1522 p_autoRegFact = reg;
1524 p_templateFileName = fn;
1535 p_templateFileName = temp;
1537 "Cannot create AutoRegFactory for " +
1539 ". As a result, current template file will remain set to " +
1540 p_templateFileName, _FILEINFO_);
1541 QString message = fullError.
toString();
1542 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1555 p_allowLeftMouse = allowMouse;
1557 if (p_allowLeftMouse) {
1558 p_saveMeasure =
new QPushButton(
"Save Measures");
1559 p_saveMeasure->setToolTip(
"Save the both the left and 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>");
1566 p_saveMeasure =
new QPushButton(
"Save Measure");
1567 p_saveMeasure->setToolTip(
"Save the right measure to the edit control "
1568 "point (control point currently being edited). "
1569 " <strong>Note: The edit control point "
1570 "will not be saved to the network until you select "
1571 "<strong>\"Save Point\"</strong>");
1576 void ControlPointEdit::refreshChips() {
1577 p_leftView->update();
1578 p_rightView->update();
1593 if (!p_autoRegAttempted) {
1594 QString message =
"Point must be Registered before chips can be saved.";
1595 QMessageBox::warning((
QWidget *)parent(),
"Warning", message);
1600 QString baseFile = p_pointId.replace(
" ",
"_") +
"_" +
1601 toString((
int)(p_leftMeasure ->GetSample())) +
"_" +
1602 toString((
int)(p_leftMeasure ->GetLine())) +
"_" +
1603 toString((
int)(p_rightMeasure->GetSample())) +
"_" +
1604 toString((
int)(p_rightMeasure->GetLine())) +
"_";
1605 QString fname = baseFile +
"Search.cub";
1606 QString command =
"$ISISROOT/bin/qview \'" + fname +
"\'";
1608 fname = baseFile +
"Pattern.cub";
1609 command +=
" \'" + fname +
"\'";
1611 fname = baseFile +
"Fit.cub";
1612 command +=
" \'" + fname +
"\' &";