1 #include "ControlPointEdit.h"
3 #include <QApplication>
4 #include <QButtonGroup>
8 #include <QDoubleSpinBox>
10 #include <QGridLayout>
11 #include <QHBoxLayout>
13 #include <QMessageBox>
15 #include <QPushButton>
16 #include <QRadioButton>
21 #include <QToolButton>
37 const int VIEWSIZE = 301;
52 bool allowLeftMouse,
bool useGeometry) :
QWidget(parent) {
58 p_useGeometry = useGeometry;
67 p_templateFileName =
"$base/templates/autoreg/qnetReg.def";
68 Pvl pvl(p_templateFileName);
74 "Cannot create AutoRegFactory. As a result, "
75 "sub-pixel registration will not work.",
77 QString message = fullError.
toString();
78 QMessageBox::information((
QWidget *)parent,
"Error", message);
82 if (cnet != NULL) emit newControlNetwork(cnet);
87 ControlPointEdit::~ControlPointEdit() {
119 QGridLayout *gridLayout =
new QGridLayout();
120 gridLayout->setSizeConstraint(QLayout::SetFixedSize);
124 QString tempFileName =
FileName(
"$base/icons").expanded();
125 QString toolIconDir = tempFileName;
129 QToolButton *leftZoomIn =
new QToolButton();
130 leftZoomIn->setIcon(QPixmap(toolIconDir +
"/viewmag+.png"));
131 leftZoomIn->setIconSize(isize);
132 leftZoomIn->setToolTip(
"Zoom In 2x");
133 leftZoomIn->setWhatsThis(
"Zoom In 2x on left measure.");
135 QToolButton *leftZoomOut =
new QToolButton();
136 leftZoomOut->setIcon(QPixmap(toolIconDir +
"/viewmag-.png"));
137 leftZoomOut->setIconSize(isize);
138 leftZoomOut->setToolTip(
"Zoom Out 2x");
139 leftZoomOut->setWhatsThis(
"Zoom Out 2x on left measure.");
141 QToolButton *leftZoom1 =
new QToolButton();
142 leftZoom1->setIcon(QPixmap(toolIconDir +
"/viewmag1.png"));
143 leftZoom1->setIconSize(isize);
144 leftZoom1->setToolTip(
"Zoom 1:1");
145 leftZoom1->setWhatsThis(
"Show left measure at full resolution.");
147 QHBoxLayout *leftZoomPan =
new QHBoxLayout;
148 leftZoomPan->addWidget(leftZoomIn);
149 leftZoomPan->addWidget(leftZoomOut);
150 leftZoomPan->addWidget(leftZoom1);
153 QToolButton *leftPanUp = 0;
154 QToolButton *leftPanDown = 0;
155 QToolButton *leftPanLeft = 0;
156 QToolButton *leftPanRight = 0;
157 if ( p_allowLeftMouse ) {
159 leftPanUp =
new QToolButton(parent);
160 leftPanUp->setIcon(QIcon(
FileName(
"$base/icons/up.png").
162 leftPanUp->setIconSize(isize);
163 leftPanUp->setToolTip(
"Move up 1 screen pixel");
164 leftPanUp->setStatusTip(
"Move up 1 screen pixel");
165 leftPanUp->setWhatsThis(
"Move the left measure up 1 screen pixel.");
167 leftPanDown =
new QToolButton(parent);
168 leftPanDown->setIcon(QIcon(
FileName(
"$base/icons/down.png").
170 leftPanDown->setIconSize(isize);
171 leftPanDown->setToolTip(
"Move down 1 screen pixel");
172 leftPanDown->setStatusTip(
"Move down 1 screen pixel");
173 leftPanDown->setWhatsThis(
"Move the left measure down 1 screen pixel.");
175 leftPanLeft =
new QToolButton(parent);
176 leftPanLeft->setIcon(QIcon(
FileName(
"$base/icons/back.png").
178 leftPanLeft->setIconSize(isize);
179 leftPanLeft->setToolTip(
"Move left 1 screen pixel");
180 leftPanLeft->setWhatsThis(
"Move the left measure to the left by 1 screen"
183 leftPanRight =
new QToolButton(parent);
184 leftPanRight->setIcon(QIcon(
FileName(
"$base/icons/forward.png").
186 leftPanRight->setIconSize(isize);
187 leftPanRight->setToolTip(
"Move right 1 screen pixel");
188 leftPanRight->setWhatsThis(
"Move the left measure to the right by 1"
191 leftZoomPan->addWidget(leftPanUp);
192 leftZoomPan->addWidget(leftPanDown);
193 leftZoomPan->addWidget(leftPanLeft);
194 leftZoomPan->addWidget(leftPanRight);
197 leftZoomPan->addStretch();
198 gridLayout->addLayout(leftZoomPan, row, 0);
200 p_rightZoomIn =
new QToolButton();
201 p_rightZoomIn->setIcon(QPixmap(toolIconDir +
"/viewmag+.png"));
202 p_rightZoomIn->setIconSize(isize);
203 p_rightZoomIn->setToolTip(
"Zoom In 2x");
204 p_rightZoomIn->setWhatsThis(
"Zoom In 2x on right measure.");
206 p_rightZoomOut =
new QToolButton();
207 p_rightZoomOut->setIcon(QIcon(
FileName(
"$base/icons/viewmag-.png").
209 p_rightZoomOut->setIconSize(isize);
210 p_rightZoomOut->setToolTip(
"Zoom Out 2x");
211 p_rightZoomOut->setWhatsThis(
"Zoom Out 2x on right measure.");
213 p_rightZoom1 =
new QToolButton();
214 p_rightZoom1->setIcon(QPixmap(toolIconDir +
"/viewmag1.png"));
215 p_rightZoom1->setIconSize(isize);
216 p_rightZoom1->setToolTip(
"Zoom 1:1");
217 p_rightZoom1->setWhatsThis(
"Show right measure at full resolution.");
219 QHBoxLayout *rightZoomPan =
new QHBoxLayout;
220 rightZoomPan->addWidget(p_rightZoomIn);
221 rightZoomPan->addWidget(p_rightZoomOut);
222 rightZoomPan->addWidget(p_rightZoom1);
225 QToolButton *rightPanUp =
new QToolButton(parent);
226 rightPanUp->setIcon(QIcon(
FileName(
"$base/icons/up.png").
228 rightPanUp->setIconSize(isize);
229 rightPanUp->setToolTip(
"Move up 1 screen pixel");
230 rightPanUp->setWhatsThis(
"Move the right measure up 1 screen pixel.");
232 QToolButton *rightPanDown =
new QToolButton(parent);
233 rightPanDown->setIcon(QIcon(
FileName(
"$base/icons/down.png").
235 rightPanDown->setIconSize(isize);
236 rightPanDown->setToolTip(
"Move down 1 screen pixel");
237 rightPanUp->setWhatsThis(
"Move the right measure down 1 screen pixel.");
239 QToolButton *rightPanLeft =
new QToolButton(parent);
240 rightPanLeft->setIcon(QIcon(
FileName(
"$base/icons/back.png").
242 rightPanLeft->setIconSize(isize);
243 rightPanLeft->setToolTip(
"Move left 1 screen pixel");
244 rightPanLeft->setWhatsThis(
"Move the right measure to the left by 1 screen"
247 QToolButton *rightPanRight =
new QToolButton(parent);
248 rightPanRight->setIcon(QIcon(
FileName(
"$base/icons/forward.png").
250 rightPanRight->setIconSize(isize);
251 rightPanRight->setToolTip(
"Move right 1 screen pixel");
252 rightPanRight->setWhatsThis(
"Move the right measure to the right by 1"
255 rightZoomPan->addWidget(rightPanUp);
256 rightZoomPan->addWidget(rightPanDown);
257 rightZoomPan->addWidget(rightPanLeft);
258 rightZoomPan->addWidget(rightPanRight);
259 rightZoomPan->addStretch();
261 gridLayout->addLayout(rightZoomPan, row++, 1);
264 p_leftZoomFactor =
new QLabel();
265 QCheckBox *leftLockStretch =
new QCheckBox(
"lock stretch");
268 QString whatsThisTextForStretchLocking =
"If checked then a new stretch "
269 "will NOT be calculated for each pan or zoom change. Note that stretch"
270 " changes made using the stretch tool will ALWAYS take effect, "
271 "regardless of the state of this checkbox.";
272 leftLockStretch->setWhatsThis(whatsThisTextForStretchLocking);
273 QHBoxLayout *leftzflsLayout =
new QHBoxLayout;
274 leftzflsLayout->addWidget(p_leftZoomFactor);
275 leftzflsLayout->addWidget(leftLockStretch);
276 gridLayout->addLayout(leftzflsLayout, row, 0);
278 p_rightZoomFactor =
new QLabel();
279 QCheckBox *rightLockStretch =
new QCheckBox(
"lock stretch");
280 rightLockStretch->setWhatsThis(whatsThisTextForStretchLocking);
281 QHBoxLayout *rightzflsLayout =
new QHBoxLayout;
282 rightzflsLayout->addWidget(p_rightZoomFactor);
283 rightzflsLayout->addWidget(rightLockStretch);
284 gridLayout->addLayout(rightzflsLayout, row++, 1);
287 p_leftView =
new ChipViewport(VIEWSIZE, VIEWSIZE,
this);
289 if ( !p_allowLeftMouse ) p_leftView->setDisabled(
true);
291 gridLayout->addWidget(p_leftView, row, 0);
293 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
294 p_leftView, SLOT(setControlNet(
ControlNet *)));
301 connect(leftLockStretch, SIGNAL(stateChanged(
int)),
303 SLOT(changeStretchLock(
int)));
304 leftLockStretch->setChecked(
false);
308 connect(leftZoomIn, SIGNAL(clicked()), p_leftView, SLOT(zoomIn()));
309 connect(leftZoomOut, SIGNAL(clicked()), p_leftView, SLOT(zoomOut()));
310 connect(leftZoom1, SIGNAL(clicked()), p_leftView, SLOT(zoom1()));
314 connect(leftZoomOut, SIGNAL(clicked()),
this, SLOT(
updateRightGeom()));
319 connect(p_leftView, SIGNAL(tackPointChanged(
double)),
324 connect(
this, SIGNAL(updateLeftView(
double,
double)),
325 p_leftView, SLOT(refreshView(
double,
double)));
327 connect (p_leftView, SIGNAL(userMovedTackPoint()),
330 if ( p_allowLeftMouse ) {
332 connect(leftPanUp, SIGNAL(clicked()), p_leftView, SLOT(panUp()));
333 connect(leftPanDown, SIGNAL(clicked()), p_leftView, SLOT(panDown()));
334 connect(leftPanLeft, SIGNAL(clicked()), p_leftView, SLOT(panLeft()));
335 connect(leftPanRight, SIGNAL(clicked()), p_leftView, SLOT(panRight()));
343 p_rightView =
new ChipViewport(VIEWSIZE, VIEWSIZE,
this);
344 gridLayout->addWidget(p_rightView, row, 1);
346 connect(
this, SIGNAL(newControlNetwork(
ControlNet *)),
347 p_rightView, SLOT(setControlNet(
ControlNet *)));
352 connect(rightLockStretch, SIGNAL(stateChanged(
int)),
354 SLOT(changeStretchLock(
int)));
355 rightLockStretch->setChecked(
false);
359 connect(p_rightView, SIGNAL(tackPointChanged(
double)),
361 connect(
this, SIGNAL(updateRightView(
double,
double)),
362 p_rightView, SLOT(refreshView(
double,
double)));
364 connect (p_rightView, SIGNAL(userMovedTackPoint()),
367 connect(p_rightZoomIn, SIGNAL(clicked()), p_rightView, SLOT(zoomIn()));
368 connect(p_rightZoomOut, SIGNAL(clicked()), p_rightView, SLOT(zoomOut()));
369 connect(p_rightZoom1, SIGNAL(clicked()), p_rightView, SLOT(zoom1()));
372 connect(rightPanUp, SIGNAL(clicked()), p_rightView, SLOT(panUp()));
373 connect(rightPanDown, SIGNAL(clicked()), p_rightView, SLOT(panDown()));
374 connect(rightPanLeft, SIGNAL(clicked()), p_rightView, SLOT(panLeft()));
375 connect(rightPanRight, SIGNAL(clicked()), p_rightView, SLOT(panRight()));
383 p_leftChip =
new Chip(VIEWSIZE, VIEWSIZE);
384 p_rightChip =
new Chip(VIEWSIZE, VIEWSIZE);
386 QButtonGroup *bgroup =
new QButtonGroup();
387 p_nogeom =
new QRadioButton();
388 p_nogeom->setChecked(
true);
389 connect(p_nogeom, SIGNAL(clicked()),
this, SLOT(
setNoGeom()));
391 QCheckBox *linkZoom = NULL;
393 p_nogeom->setText(
"No geom/rotate");
394 p_nogeom->setToolTip(
"Reset right measure to it's native geometry.");
395 p_nogeom->setWhatsThis(
"Reset right measure to it's native geometry. "
396 "If measure was rotated, set rotation back to 0. "
397 "If measure was geomed to match the left measure, "
398 "reset the geometry back to it's native state.");
399 p_geom =
new QRadioButton(
"Geom");
400 p_geom->setToolTip(
"Geom right measure to match geometry of left measure.");
401 p_geom->setWhatsThis(
"Using an affine transform, geom the right measure to match the "
402 "geometry of the left measure.");
403 bgroup->addButton(p_geom);
404 connect(p_geom, SIGNAL(clicked()),
this, SLOT(
setGeom()));
407 linkZoom =
new QCheckBox(
"Link Zoom");
408 linkZoom->setToolTip(
"Link zooming between the left and right views.");
409 linkZoom->setWhatsThis(
"When zooming in the left view, the right view will "
410 "be set to the same zoom factor as the left view.");
411 connect(linkZoom, SIGNAL(toggled(
bool)),
this, SLOT(
setZoomLink(
bool)));
413 p_nogeom->setText(
"No rotate");
414 p_nogeom->setToolTip(
"Reset right measure to it's native geometry.");
415 p_nogeom->setWhatsThis(
"Reset right measure to it's native geometry. "
416 "If measure was rotated, set rotation back to 0.");
418 bgroup->addButton(p_nogeom);
420 QRadioButton *rotate =
new QRadioButton(
"Rotate");
421 bgroup->addButton(rotate);
423 connect(rotate, SIGNAL(clicked()),
this, SLOT(
setRotate()));
430 p_dial =
new QDial();
431 p_dial->setRange(0, 360);
432 p_dial->setWrapping(
false);
433 p_dial->setNotchesVisible(
true);
434 p_dial->setNotchTarget(5.);
435 p_dial->setEnabled(
false);
436 p_dial->setToolTip(
"Rotate right measure");
437 p_dial->setWhatsThis(
"Rotate the right measure by degrees.");
439 p_dialNumber =
new QLCDNumber();
440 p_dialNumber->setEnabled(
false);
441 p_dialNumber->setToolTip(
"Rotate right measure");
442 p_dialNumber->setWhatsThis(
"Rotate the right measure by given number"
444 connect(p_dial, SIGNAL(valueChanged(
int)), p_dialNumber, SLOT(display(
int)));
445 connect(p_dial, SIGNAL(valueChanged(
int)), p_rightView, SLOT(rotateChip(
int)));
447 QCheckBox *showPoints =
new QCheckBox(
"Show control points");
448 showPoints->setToolTip(
"Draw control point crosshairs");
449 showPoints->setWhatsThis(
"This will toggle whether crosshairs are drawn"
450 " for the control points located within the measure''s"
451 " view. For areas of dense measurements, turning this"
452 " off will allow easier viewing of features.");
453 connect(showPoints, SIGNAL(toggled(
bool)), p_leftView, SLOT(setPoints(
bool)));
454 connect(showPoints, SIGNAL(toggled(
bool)), p_rightView, SLOT(setPoints(
bool)));
455 showPoints->setChecked(
true);
457 QCheckBox *cross =
new QCheckBox(
"Show crosshair");
458 connect(cross, SIGNAL(toggled(
bool)), p_leftView, SLOT(setCross(
bool)));
459 connect(cross, SIGNAL(toggled(
bool)), p_rightView, SLOT(setCross(
bool)));
460 cross->setChecked(
true);
461 cross->setToolTip(
"Show the red crosshair across measure view");
462 cross->setWhatsThis(
"This will toggle whether the crosshair across the"
463 " measure view will be shown");
465 QCheckBox *circle =
new QCheckBox(
"Circle");
466 circle->setChecked(
false);
467 circle->setToolTip(
"Draw circle");
468 circle->setWhatsThis(
"Draw circle on measure view. This can aid in"
469 " centering a crater under the crosshair.");
470 connect(circle, SIGNAL(toggled(
bool)),
this, SLOT(
setCircle(
bool)));
472 p_slider =
new QScrollBar(Qt::Horizontal);
473 p_slider->setRange(1, 100);
474 p_slider->setSingleStep(1);
475 connect(p_slider, SIGNAL(valueChanged(
int)), p_leftView, SLOT(setCircleSize(
int)));
476 connect(p_slider, SIGNAL(valueChanged(
int)), p_rightView, SLOT(setCircleSize(
int)));
477 p_slider->setValue(20);
478 p_slider->setDisabled(
true);
480 p_slider->setToolTip(
"Adjust circle size");
481 p_slider->setWhatsThis(
"This allows the cirle size to be adjusted.");
483 QVBoxLayout *vlayout =
new QVBoxLayout();
484 if (!p_useGeometry) {
485 vlayout->addWidget(linkZoom);
487 vlayout->addWidget(p_nogeom);
489 vlayout->addWidget(p_geom);
491 vlayout->addWidget(rotate);
492 vlayout->addWidget(p_dial);
493 vlayout->addWidget(p_dialNumber);
494 vlayout->addWidget(showPoints);
495 vlayout->addWidget(cross);
496 vlayout->addWidget(circle);
497 vlayout->addWidget(p_slider);
498 gridLayout->addLayout(vlayout, row++, 2);
501 p_leftSampLinePosition =
new QLabel();
502 p_leftSampLinePosition->setToolTip(
"Sample/Line under the crosshair");
503 gridLayout->addWidget(p_leftSampLinePosition, row, 0);
504 p_rightSampLinePosition =
new QLabel();
505 p_rightSampLinePosition->setToolTip(
"Sample/Line under the crosshair");
506 gridLayout->addWidget(p_rightSampLinePosition, row++, 1);
510 p_leftLatLonPosition =
new QLabel();
511 p_leftLatLonPosition->setToolTip(
"Latitude/Longitude under the crosshair");
512 gridLayout->addWidget(p_leftLatLonPosition, row, 0);
513 p_rightLatLonPosition =
new QLabel();
514 p_rightLatLonPosition->setToolTip(
"Latitude/Longitude under the crosshair");
515 gridLayout->addWidget(p_rightLatLonPosition, row++, 1);
520 p_autoRegExtension =
new QWidget;
521 p_oldPosition =
new QLabel;
522 p_oldPosition->setToolTip(
"Measure Sample/Line before sub-pixel "
524 p_oldPosition->setWhatsThis(
"Original Sample/Line of the right measure "
525 "before the sub-pixel registration. If you select the \"Undo\" "
526 "button, the measure will revert back to this Sample/Line.");
527 p_goodFit =
new QLabel;
528 p_goodFit->setToolTip(
"Goodness of Fit result from sub-pixel registration.");
529 p_goodFit->setWhatsThis(
"Resulting Goodness of Fit from sub-pixel "
531 QVBoxLayout *autoRegLayout =
new QVBoxLayout;
532 autoRegLayout->setMargin(0);
533 autoRegLayout->addWidget(p_oldPosition);
534 autoRegLayout->addWidget(p_goodFit);
535 p_autoRegExtension->setLayout(autoRegLayout);
536 p_autoRegShown =
false;
537 p_autoRegAttempted =
false;
538 gridLayout->addWidget(p_autoRegExtension, row++, 1);
541 QHBoxLayout *leftLayout =
new QHBoxLayout();
542 QToolButton *stop =
new QToolButton();
543 stop->setIcon(QPixmap(toolIconDir +
"/blinkStop.png"));
544 stop->setIconSize(QSize(22, 22));
545 stop->setToolTip(
"Blink Stop");
546 QString text =
"<b>Function:</b> Stop automatic timed blinking";
547 stop->setWhatsThis(text);
548 connect(stop, SIGNAL(released()),
this, SLOT(
blinkStop()));
550 QToolButton *start =
new QToolButton();
551 start->setIcon(QPixmap(toolIconDir +
"/blinkStart.png"));
552 start->setIconSize(QSize(22, 22));
553 start->setToolTip(
"Blink Start");
554 text =
"<b>Function:</b> Start automatic timed blinking. Cycles \
555 through linked viewports at variable rate";
556 start->setWhatsThis(text);
557 connect(start, SIGNAL(released()),
this, SLOT(
blinkStart()));
559 p_blinkTimeBox =
new QDoubleSpinBox();
560 p_blinkTimeBox->setMinimum(0.1);
561 p_blinkTimeBox->setMaximum(5.0);
562 p_blinkTimeBox->setDecimals(1);
563 p_blinkTimeBox->setSingleStep(0.1);
564 p_blinkTimeBox->setValue(0.5);
565 p_blinkTimeBox->setToolTip(
"Blink Time Delay");
566 text =
"<b>Function:</b> Change automatic blink rate between " +
567 QString::number(p_blinkTimeBox->minimum()) +
" and " +
568 QString::number(p_blinkTimeBox->maximum()) +
" seconds";
569 p_blinkTimeBox->setWhatsThis(text);
570 connect(p_blinkTimeBox, SIGNAL(valueChanged(
double)),
573 leftLayout->addWidget(stop);
574 leftLayout->addWidget(start);
575 leftLayout->addWidget(p_blinkTimeBox);
578 QPushButton *find =
new QPushButton(
"Find");
579 find->setToolTip(
"Move right measure to same Latitude/Longitude as left.");
580 find->setWhatsThis(
"Find the Latitude/Longitude under the crosshair in the "
581 "left measure and move the right measure to the same "
582 "latitude/longitude.");
583 leftLayout->addWidget(find);
584 connect(find, SIGNAL(clicked()),
this, SLOT(
findPoint()));
587 leftLayout->addStretch();
588 gridLayout->addLayout(leftLayout, row, 0);
590 QHBoxLayout *rightLayout =
new QHBoxLayout();
591 p_autoReg =
new QPushButton(
"Register");
592 p_autoReg->setToolTip(
"Sub-pixel register the right measure to the left");
593 p_autoReg->setWhatsThis(
"Sub-pixel register the right measure to the left "
594 "and move the result under the crosshair. After "
595 "viewing the results, the option exists to move the "
596 "measure back to the original position by selecting "
597 "<strong>\"Undo Registration\"</strong>.");
598 if (p_allowLeftMouse) {
599 p_saveMeasure =
new QPushButton(
"Save Measures");
600 p_saveMeasure->setToolTip(
"Save the both the left and right measure to the edit control "
601 "point (control point currently being edited). "
602 " <strong>Note: The edit control point "
603 "will not be saved to the network until you select "
604 "<strong>\"Save Point\"</strong>");
607 p_saveMeasure =
new QPushButton(
"Save Measure");
608 p_saveMeasure->setToolTip(
"Save the right measure to the edit control "
609 "point (control point currently being edited). "
610 " <strong>Note: The edit control point "
611 "will not be saved to the network until you select "
612 "<strong>\"Save Point\"</strong>");
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();
658 Cube *leftCube, QString pointId) {
661 if ( p_autoRegShown ) {
663 p_autoRegShown =
false;
664 p_autoRegExtension->hide();
665 p_autoReg->setText(
"Register");
668 p_leftMeasure = leftMeasure;
672 if ( p_leftGroundMap != 0 )
delete p_leftGroundMap;
675 p_leftCube = leftCube;
677 p_leftChip->
TackCube(p_leftMeasure->GetSample(), p_leftMeasure->GetLine());
678 p_leftChip->
Load(*p_leftCube);
681 p_leftView->
setChip(p_leftChip, p_leftCube);
716 Cube *rightCube, QString pointId) {
719 if ( p_autoRegShown ) {
721 p_autoRegShown =
false;
722 p_autoRegExtension->hide();
723 p_autoReg->setText(
"Register");
725 p_autoRegAttempted =
false;
727 p_rightMeasure = rightMeasure;
732 if ( p_rightGroundMap != 0 )
delete p_rightGroundMap;
735 p_rightCube = rightCube;
737 p_rightChip->
TackCube(p_rightMeasure->GetSample(),
738 p_rightMeasure->GetLine());
739 if ( p_geomIt ==
false ) {
740 p_rightChip->
Load(*p_rightCube);
744 p_rightChip->
Load(*p_rightCube, *p_leftChip, *p_leftCube);
749 QString message = fullError.
toString();
750 QMessageBox::information((
QWidget *)parent(),
"Error", message);
751 p_rightChip->
Load(*p_rightCube);
753 p_nogeom->setChecked(
true);
754 p_geom->setChecked(
false);
759 p_rightView->
setChip(p_rightChip, p_rightCube);
765 p_saveMeasure->setPalette(p_saveDefaultPalette);
783 QString pos =
"Sample: " + QString::number(p_leftView->
tackSample()) +
784 " Line: " + QString::number(p_leftView->
tackLine());
785 p_leftSampLinePosition->setText(pos);
793 pos =
"Latitude: " + QString::number(lat) +
794 " Longitude: " + QString::number(lon);
795 p_leftLatLonPosition->setText(pos);
799 pos =
"Zoom Factor: " + QString::number(zoomFactor);
800 p_leftZoomFactor->setText(pos);
820 if ( p_autoRegShown ) {
822 p_autoRegShown =
false;
823 p_autoRegExtension->hide();
824 p_autoReg->setText(
"Register");
827 QString pos =
"Sample: " + QString::number(p_rightView->
tackSample()) +
828 " Line: " + QString::number(p_rightView->
tackLine());
829 p_rightSampLinePosition->setText(pos);
837 pos =
"Latitude: " + QString::number(lat) +
838 " Longitude: " + QString::number(lon);
839 p_rightLatLonPosition->setText(pos);
843 pos =
"Zoom Factor: " + QString::number(zoomFactor);
844 p_rightZoomFactor->setText(pos);
857 QPalette p = p_saveMeasure->palette();
858 p.setColor(QPalette::ButtonText,qc);
859 p_saveMeasure->setPalette(p);
882 emit updateRightView(p_rightGroundMap->
Sample(), p_rightGroundMap->
Line());
885 if (p_rightGroundMap->
Sample() != p_rightMeasure->GetSample() ||
886 p_rightGroundMap->
Line() != p_rightMeasure->GetLine())
890 QString message =
"Latitude: " + QString::number(lat) +
" Longitude: " +
891 QString::number(lon) +
" is not on the right image. Right measure " +
893 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
930 if ( p_autoRegShown ) {
932 p_autoRegShown =
false;
933 p_autoRegExtension->hide();
934 p_autoReg->setText(
"Register");
937 emit updateRightView(p_rightMeasure->GetSample(),
938 p_rightMeasure->GetLine());
940 p_saveMeasure->setPalette(p_saveDefaultPalette);
944 p_autoRegAttempted =
true;
948 p_leftMeasure->GetSample(), p_leftMeasure->GetLine());
951 p_rightMeasure->GetSample(),
952 p_rightMeasure->GetLine());
962 QString msg =
"Cannot register this point, unable to Load chips.\n";
964 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
970 if ( !p_autoRegFact->
Success() ) {
971 QString msg =
"Cannot sub-pixel register this point.\n";
973 msg +=
"\n\nNot enough valid data in Pattern Chip.\n";
974 msg +=
" PatternValidPercent = ";
978 msg +=
"\n\nNo valid data in Fit Chip.";
981 msg +=
"\n\nGoodness of Fit Tolerance not met.\n";
982 msg +=
"\nGoodnessOfFit = " + QString::number(p_autoRegFact->
GoodnessOfFit());
983 msg +=
"\nGoodnessOfFitTolerance = ";
984 msg += QString::number(p_autoRegFact->
Tolerance());
987 msg +=
"\n\nNot enough valid points in the fit chip window for sub-pixel ";
988 msg +=
"accuracy. Probably too close to edge.\n";
991 msg +=
"\n\nCould not model surface for sub-pixel accuracy.\n";
994 double sampDist, lineDist;
995 p_autoRegFact->
Distance(sampDist, lineDist);
996 msg +=
"\n\nSub pixel algorithm moves registration more than tolerance.\n";
997 msg +=
"\nSampleMovement = " + QString::number(sampDist) +
998 " LineMovement = " + QString::number(lineDist);
999 msg +=
"\nDistanceTolerance = " +
1003 double score1, score2;
1004 p_autoRegFact->
ZScores(score1, score2);
1005 msg +=
"\n\nPattern data max or min does not pass z-score test.\n";
1006 msg +=
"\nMinimumZScore = " + QString::number(p_autoRegFact->
MinimumZScore());
1007 msg +=
"\nCalculatedZscores = " + QString::number(score1) +
", " + QString::number(score2);
1010 msg +=
"\n\nError occured in Adaptive algorithm.";
1013 msg +=
"\n\nUnknown registration error.";
1016 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1021 QString msg =
"Cannot register this point.\n";
1023 QMessageBox::information((
QWidget *)parent(),
"Error", msg);
1032 if (p_autoRegFact->
CubeSample() != p_rightMeasure->GetSample() ||
1033 p_autoRegFact->
CubeLine() != p_rightMeasure->GetLine()) {
1037 QString oldPos =
"Original Sample: " +
1038 QString::number(p_rightMeasure->GetSample()) +
" Original Line: " +
1039 QString::number(p_rightMeasure->GetLine());
1040 p_oldPosition->setText(oldPos);
1042 QString goodFit =
"Goodness of Fit: " +
1044 p_goodFit->setText(goodFit);
1046 p_autoRegExtension->show();
1047 p_autoRegShown =
true;
1048 p_autoReg->setText(
"Undo Registration");
1088 if (p_rightMeasure != NULL) {
1091 QString message =
"The right measure is locked. You must first unlock the measure by ";
1092 message +=
"clicking the check box above labeled \"Edit Lock Measure\".";
1093 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
1097 if (p_autoRegShown) {
1104 double minZScore, maxZScore;
1105 p_autoRegFact->
ZScores(minZScore,maxZScore);
1117 QMessageBox::critical((
QWidget *)parent(),
"Error", message);
1123 p_rightMeasure->SetAprioriSample(p_rightMeasure->GetSample());
1124 p_rightMeasure->SetAprioriLine(p_rightMeasure->GetLine());
1129 p_autoRegShown =
false;
1130 p_autoRegExtension->hide();
1131 p_autoReg->setText(
"Register");
1151 if (p_allowLeftMouse) {
1152 if (p_leftMeasure != NULL) {
1154 QString message =
"The left measure is locked. You must first unlock the measure by ";
1155 message +=
"clicking the check box above labeled \"Edit Lock Measure\".";
1156 QMessageBox::warning((
QWidget *)parent(),
"Warning",message);
1172 *p_leftMeasure = *p_rightMeasure;
1177 p_saveMeasure->setPalette(p_saveDefaultPalette);
1180 emit measureSaved();
1195 p_rightView->
geomChip(p_leftChip, p_leftCube);
1200 QString message = fullError.
toString();
1201 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1203 p_nogeom->setChecked(
true);
1204 p_geom->setChecked(
false);
1245 QApplication::setOverrideCursor(Qt::WaitCursor);
1249 QString text =
"Zoom in 2X";
1250 p_rightZoomIn->setEnabled(
true);
1251 p_rightZoomIn->setWhatsThis(text);
1252 p_rightZoomIn->setToolTip(
"Zoom In");
1253 text =
"Zoom out 2X";
1254 p_rightZoomOut->setEnabled(
true);
1255 p_rightZoomOut->setWhatsThis(text);
1256 p_rightZoomOut->setToolTip(
"Zoom Out");
1258 p_rightZoom1->setEnabled(
true);
1259 p_rightZoom1->setWhatsThis(text);
1260 p_rightZoom1->setToolTip(
"Zoom 1:1");
1265 QApplication::restoreOverrideCursor();
1267 p_dial->setEnabled(
true);
1268 p_dialNumber->setEnabled(
true);
1269 p_dial->setNotchesVisible(
true);
1285 if (p_geomIt ==
true)
return;
1287 QApplication::setOverrideCursor(Qt::WaitCursor);
1290 QString text =
"Zoom functions disabled when Geom is set";
1291 p_rightZoomIn->setEnabled(
false);
1292 p_rightZoomIn->setWhatsThis(text);
1293 p_rightZoomIn->setToolTip(text);
1294 p_rightZoomOut->setEnabled(
false);
1295 p_rightZoomOut->setWhatsThis(text);
1296 p_rightZoomOut->setToolTip(text);
1297 p_rightZoom1->setEnabled(
false);
1298 p_rightZoom1->setWhatsThis(text);
1299 p_rightZoom1->setToolTip(text);
1303 p_dial->setValue(0);
1304 p_dial->setEnabled(
false);
1305 p_dialNumber->setEnabled(
false);
1310 p_rightView->
geomChip(p_leftChip, p_leftCube);
1315 QString message = fullError.
toString();
1316 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1318 p_nogeom->setChecked(
true);
1319 p_geom->setChecked(
false);
1322 QApplication::restoreOverrideCursor();
1333 QApplication::setOverrideCursor(Qt::WaitCursor);
1335 QString text =
"Zoom in 2X";
1336 p_rightZoomIn->setEnabled(
true);
1337 p_rightZoomIn->setWhatsThis(text);
1338 p_rightZoomIn->setToolTip(
"Zoom In");
1339 text =
"Zoom out 2X";
1340 p_rightZoomOut->setEnabled(
true);
1341 p_rightZoomOut->setWhatsThis(text);
1342 p_rightZoomOut->setToolTip(
"Zoom Out");
1344 p_rightZoom1->setEnabled(
true);
1345 p_rightZoom1->setWhatsThis(text);
1346 p_rightZoom1->setToolTip(
"Zoom 1:1");
1349 p_dial->setValue(0);
1350 p_dial->setEnabled(
false);
1351 p_dialNumber->setEnabled(
false);
1356 QApplication::restoreOverrideCursor();
1371 if ( checked == p_circle )
return;
1376 p_slider->setDisabled(
false);
1378 p_slider->setValue(20);
1379 p_leftView->setCircle(
true);
1380 p_rightView->setCircle(
true);
1383 p_slider->setDisabled(
true);
1385 p_leftView->setCircle(
false);
1386 p_rightView->setCircle(
false);
1403 if ( checked == p_linkZoom )
return;
1405 p_linkZoom = checked;
1415 if ( p_timerOn )
return;
1418 p_blinkList.push_back(p_leftView);
1419 p_blinkList.push_back(p_rightView);
1423 int msec = (int)(p_blinkTimeBox->value() * 1000.0);
1424 p_timer =
new QTimer(
this);
1425 connect(p_timer, SIGNAL(timeout()),
this, SLOT(
updateBlink()));
1426 p_timer->start(msec);
1434 p_blinkList.clear();
1437 p_leftView->repaint();
1450 if ( p_timerOn ) p_timer->setInterval((
int)(interval * 1000.));
1457 p_blinkIndex = !p_blinkIndex;
1458 p_leftView->
loadView(*(p_blinkList)[p_blinkIndex]);
1486 QString temp = p_templateFileName;
1489 p_templateFileName = fn;
1496 if ( p_autoRegFact != NULL )
1497 delete p_autoRegFact;
1498 p_autoRegFact = reg;
1500 p_templateFileName = fn;
1511 p_templateFileName = temp;
1513 "Cannot create AutoRegFactory for " +
1515 ". As a result, current template file will remain set to " +
1517 QString message = fullError.
toString();
1518 QMessageBox::information((
QWidget *)parent(),
"Error", message);
1531 p_allowLeftMouse = allowMouse;
1533 if (p_allowLeftMouse) {
1534 p_saveMeasure =
new QPushButton(
"Save Measures");
1535 p_saveMeasure->setToolTip(
"Save the both the left and right measure to the edit control "
1536 "point (control point currently being edited). "
1537 " <strong>Note: The edit control point "
1538 "will not be saved to the network until you select "
1539 "<strong>\"Save Point\"</strong>");
1542 p_saveMeasure =
new QPushButton(
"Save Measure");
1543 p_saveMeasure->setToolTip(
"Save the right measure to the edit control "
1544 "point (control point currently being edited). "
1545 " <strong>Note: The edit control point "
1546 "will not be saved to the network until you select "
1547 "<strong>\"Save Point\"</strong>");
1553 void ControlPointEdit::refreshChips() {
1554 p_leftView->update();
1555 p_rightView->update();
1571 if ( !p_autoRegAttempted ) {
1572 QString message =
"Point must be Registered before chips can be saved.";
1573 QMessageBox::warning((
QWidget *)parent(),
"Warning", message);
1578 QString baseFile = p_pointId.replace(
" ",
"_") +
"_" +
1579 toString((
int)(p_leftMeasure ->GetSample())) +
"_" +
1580 toString((
int)(p_leftMeasure ->GetLine())) +
"_" +
1581 toString((
int)(p_rightMeasure->GetSample())) +
"_" +
1582 toString((
int)(p_rightMeasure->GetLine())) +
"_";
1583 QString fname = baseFile +
"Search.cub";
1584 QString command =
"$ISISROOT/bin/qview \'" + fname +
"\'";
1586 fname = baseFile +
"Pattern.cub";
1587 command +=
" \'" + fname +
"\'";
1589 fname = baseFile +
"Fit.cub";
1590 command +=
" \'" + fname +
"\' &";