Isis 3 Programmer Reference
MosaicGridTool.cpp
1#include "MosaicGridTool.h"
2
3#include <QApplication>
4#include <QCheckBox>
5#include <QDialog>
6#include <QDoubleValidator>
7#include <QGraphicsScene>
8#include <QGridLayout>
9#include <QLabel>
10#include <QLineEdit>
11#include <QMenu>
12#include <QMessageBox>
13#include <QPointF>
14#include <QPushButton>
15#include <QtCore>
16
17#include "Angle.h"
18#include "Distance.h"
19#include "FileName.h"
20#include "GridGraphicsItem.h"
21#include "IException.h"
22#include "Latitude.h"
23#include "Longitude.h"
24#include "MosaicGraphicsView.h"
25#include "MosaicGridToolConfigDialog.h"
26#include "Projection.h"
27#include "TProjection.h"
28#include "MosaicSceneWidget.h"
29#include "PvlObject.h"
30
31namespace Isis {
39 MosaicTool(scene) {
40 m_gridItem = NULL;
41
42 if (getWidget())
43 m_previousBoundingRect = getWidget()->cubesBoundingRect();
44
45 m_shouldCheckBoxes = true;
46
49
52
56
58 m_minLon = domainMinLon();
59 m_maxLon = domainMaxLon();
60 m_density = 10000;
61
62 connect(getWidget(), SIGNAL(projectionChanged(Projection *)),
63 this, SLOT(onProjectionChanged()), Qt::UniqueConnection);
64
65 }
66
67
74 }
75
76
83 return m_autoGridCheckBox->isChecked();
84 }
85
86
95
96
105
106
114 return m_density;
115 }
116
117
124 return m_latInc;
125 }
126
127
136
137
144 QString result;
145
146 if (getWidget()->getProjection()) {
147 if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
148 TProjection *tproj = (TProjection *) getWidget()->getProjection();
149 result = tproj->LatitudeTypeString();
150 }
151 }
152
153 return result;
154 }
155
156
163 QString result;
164
165 if (getWidget()->getProjection()) {
166 if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
167 TProjection *tproj = (TProjection *) getWidget()->getProjection();
168 result = tproj->LongitudeDomainString();
169 }
170 }
171
172 return result;
173 }
174
175
184
185
192 return m_lonInc;
193 }
194
195
204
205
214
215
224
225
234
235
242 return getWidget();
243 }
244
245
252 return m_drawGridCheckBox->isChecked();
253 }
254
255
262 m_autoGridCheckBox->setChecked(checked);
263 }
264
265
274
275
284
285
291 void MosaicGridTool::setDensity(int density) {
293 }
294
295
304 Latitude minLat = Latitude(),
305 Latitude maxLat = Latitude()) {
306 m_latExtents = source;
307
308 Projection *proj = getWidget()->getProjection();
309 if (proj && proj->projectionType() == Projection::Triaxial) {
310 TProjection *tproj = (TProjection *) proj;
311 PvlGroup mappingGroup(tproj->Mapping());
312
313 Distance equatorialRadius(tproj->EquatorialRadius(),
315 Distance polarRadius(tproj->PolarRadius(), Distance::Meters);
316
317 QRectF boundingRect = getWidget()->cubesBoundingRect();
318
319 double topLeft = 100;
320 double topRight = 100;
321 double bottomLeft = 100;
322 double bottomRight = 100;
323 bool cubeRectWorked = true;
324
325 switch (source) {
326
327 case Map:
328 m_minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
329 m_maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
330 break;
331
332 case Cubes:
333 if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
334 topLeft = tproj->Latitude();
335 }
336 else {
337 cubeRectWorked = false;
338 }
339 if (tproj->SetCoordinate(boundingRect.topRight().x(), -boundingRect.topRight().y())) {
340 topRight = tproj->Latitude();
341 }
342 else {
343 cubeRectWorked = false;
344 }
345 if (tproj->SetCoordinate(boundingRect.bottomLeft().x(), -boundingRect.bottomLeft().y())) {
346 bottomLeft = tproj->Latitude();
347 }
348 else {
349 cubeRectWorked = false;
350 }
351 if (tproj->SetCoordinate(boundingRect.bottomRight().x(),
352 -boundingRect.bottomRight().y())) {
353 bottomRight = tproj->Latitude();
354 }
355 else {
356 cubeRectWorked = false;
357 }
358
359 if (cubeRectWorked) {
360 m_minLat = Latitude(std::min(std::min(topLeft, topRight),
361 std::min(bottomLeft, bottomRight)), mappingGroup,
363 m_maxLat = Latitude(std::max(std::max(topLeft, topRight),
364 std::max(bottomLeft, bottomRight)), mappingGroup,
366
367 if (tproj->SetUniversalGround(-90.0, 0) &&
368 boundingRect.contains(QPointF(tproj->XCoord(), -tproj->YCoord()))) {
369 m_minLat = Latitude(-90.0, mappingGroup, Angle::Degrees);
370 }
371
372 if (tproj->SetUniversalGround(90.0, 0) &&
373 boundingRect.contains(QPointF(tproj->XCoord(), -tproj->YCoord()))) {
374 m_maxLat = Latitude(90.0, mappingGroup, Angle::Degrees);
375 }
376 }
377 else {
378 m_minLat = Latitude(-90, mappingGroup, Angle::Degrees);
379 m_maxLat = Latitude(90, mappingGroup, Angle::Degrees);
381
382 static Projection *lastProjWithThisError = NULL;
383
384 if (proj != lastProjWithThisError) {
385 lastProjWithThisError = proj;
386 QMessageBox::warning(NULL, tr("Latitude Extent Failure"),
387 tr("<p/>Could not extract latitude extents from the cubes.<br/>"
388 "<br/>The option <strong>\"Compute From Images\"</strong> "
389 "will default to using the <strong>Manual</strong> option "
390 "for latitude extents with a range of -90 to 90."));
391 }
392 }
393 break;
394
395 case Manual:
398 break;
399
400 default:
401 m_minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
402 m_maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
403 }
404 }
405 }
406
407
414 if (latInc > Angle(0.0, Angle::Degrees)) {
416 }
417 }
418
419
428 Longitude minLon = Longitude(),
429 Longitude maxLon = Longitude()) {
430 m_lonExtents = source;
431
432 Projection *proj = getWidget()->getProjection();
433 if (proj && proj->projectionType() == Projection::Triaxial) {
434 TProjection * tproj = (TProjection *) proj;
435 QRectF boundingRect = getWidget()->cubesBoundingRect();
436
437 double topLeft = 0;
438 double topRight = 0;
439 double bottomLeft = 0;
440 double bottomRight = 0;
441 bool cubeRectWorked = true;
442
443 switch (source) {
444
445 case Map:
446 m_minLon = Longitude(tproj->MinimumLongitude(), Angle::Degrees);
447 m_maxLon = Longitude(tproj->MaximumLongitude(), Angle::Degrees);
448 break;
449
450 case Cubes:
451 if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
452
453 topLeft = tproj->Longitude();
454 }
455 else {
456 cubeRectWorked = false;
457 }
458 if (tproj->SetCoordinate(boundingRect.topRight().x(), -boundingRect.topRight().y())) {
459 topRight = tproj->Longitude();
460 }
461 else {
462 cubeRectWorked = false;
463 }
464 if (tproj->SetCoordinate(boundingRect.bottomLeft().x(), -boundingRect.bottomLeft().y())) {
465 bottomLeft = tproj->Longitude();
466 }
467 else {
468 cubeRectWorked = false;
469 }
470 if (tproj->SetCoordinate(boundingRect.bottomRight().x(),
471 -boundingRect.bottomRight().y())) {
472 bottomRight = tproj->Longitude();
473 }
474 else {
475 cubeRectWorked = false;
476 }
477
478 if (cubeRectWorked) {
479 m_minLon = Longitude(std::min(std::min(topLeft, topRight),
480 std::min(bottomLeft, bottomRight)),
482 m_maxLon = Longitude(std::max(std::max(topLeft, topRight),
483 std::max(bottomLeft, bottomRight)),
485 if (m_minLon < domainMinLon()) {
486 m_minLon = domainMinLon();
487 }
488 if (m_maxLon > domainMaxLon()) {
489 m_maxLon = domainMaxLon();
490 }
491 //Draw 0-360 if the pole is in the cubes' bounding rectangle.
492 if (m_minLat == Angle(-90.0, Angle::Degrees) ||
493 m_maxLat == Angle(90.0, Angle::Degrees)) {
494 m_minLon = domainMinLon();
495 m_maxLon = domainMaxLon();
496 }
497 }
498 else {
499 m_minLon = domainMinLon();
500 m_maxLon = domainMaxLon();
502
503 static Projection *lastProjWithThisError = NULL;
504
505 if (proj != lastProjWithThisError) {
506 lastProjWithThisError = proj;
507 QMessageBox::warning(NULL, tr("Longitude Extent Failure"),
508 tr("<p/>Could not extract longitude extents from the cubes.<br/>"
509 "<br/>The option <strong>\"Compute From Images\"</strong> "
510 "will default to using the <strong>Manual</strong> option "
511 "for longitude extents with a range of 0 to 360."));
512 }
513 }
514 break;
515
516 case Manual:
519 break;
520
521 default:
522 m_minLon = Longitude(tproj->MinimumLongitude(), Angle::Degrees);
523 m_maxLon = Longitude(tproj->MaximumLongitude(), Angle::Degrees);
524 }
525 }
526 }
527
528
535 Angle lonRange = m_maxLon - m_minLon;
536
537 if (lonInc > lonRange)
538 m_lonInc = lonRange;
539 else if (lonInc > Angle(0.0, Angle::Degrees))
541 }
542
543
550 m_drawGridCheckBox->setChecked(show);
551 }
552
553
560
561 Projection *proj = getWidget()->getProjection();
562 if (proj && proj->projectionType() == Projection::Triaxial) {
563 TProjection *tproj = (TProjection *) proj;
564 Distance equatorialRadius(
565 tproj->EquatorialRadius(),
567 Distance polarRadius(
568 tproj->PolarRadius(), Distance::Meters);
569
570 if (obj["BaseLatitude"][0] != "Null")
571 m_baseLat = Latitude(toDouble(obj["BaseLatitude"][0]), equatorialRadius, polarRadius,
573
574 if (obj["BaseLongitude"][0] != "Null")
575 m_baseLon = Longitude(toDouble(obj["BaseLongitude"][0]), Angle::Degrees);
576
577 if (obj["LatitudeIncrement"][0] != "Null")
578 m_latInc = Angle(toDouble(obj["LatitudeIncrement"][0]), Angle::Degrees);
579
580 if (obj["LongitudeIncrement"][0] != "Null")
581 m_lonInc = Angle(toDouble(obj["LongitudeIncrement"][0]), Angle::Degrees);
582
583 if (obj.hasKeyword("LatitudeExtentType")) {
584 if (obj["LatitudeExtentType"][0] != "Null")
585 m_latExtents = (GridExtentSource)toInt(obj["LatitudeExtentType"][0]);
586 }
587
588 if (obj.hasKeyword("MinimumLatitude")) {
589 if (obj["MinimumLatitude"][0] != "Null")
590 m_minLat = Latitude(toDouble(obj["MinimumLatitude"][0]), equatorialRadius, polarRadius,
592 }
593
594 if (obj.hasKeyword("MaximumLatitude")) {
595 if (obj["MaximumLatitude"][0] != "Null")
596 m_maxLat = Latitude(toDouble(obj["MaximumLatitude"][0]), equatorialRadius, polarRadius,
598 }
599
600 if (obj.hasKeyword("LongitudeExtentType")) {
601 if (obj["LongitudeExtentType"][0] != "Null")
602 m_lonExtents = (GridExtentSource)toInt(obj["LongitudeExtentType"][0]);
603 }
604
605 if (obj.hasKeyword("MinimumLongitude")) {
606 if (obj["MinimumLongitude"][0] != "Null")
607 m_minLon = Longitude(toDouble(obj["MinimumLongitude"][0]), Angle::Degrees);
608 }
609
610 if (obj.hasKeyword("MaximumLongitude")) {
611 if (obj["MaximumLongitude"][0] != "Null")
612 m_maxLon = Longitude(toDouble(obj["MaximumLongitude"][0]), Angle::Degrees);
613 }
614
615 if (obj["Density"][0] != "Null")
616 m_density = toDouble(obj["Density"][0]);
617
618
619 if (obj.hasKeyword("CheckTheBoxes")) {
620 if (obj["CheckTheBoxes"][0] != "Null") {
621 m_shouldCheckBoxes = (obj["CheckTheBoxes"][0] == "true");
622 }
623 }
624
625 if(toBool(obj["Visible"][0])) {
626 drawGrid();
627 }
628 }
629 }
630
631
638 return "MosaicGridTool";
639 }
640
641
649
650 obj += PvlKeyword("ShouldCheckBoxes", toString((int)m_shouldCheckBoxes));
651
652 obj += PvlKeyword("BaseLatitude", toString(m_baseLat.degrees()));
653 obj += PvlKeyword("BaseLongitude", toString(m_baseLon.degrees()));
654
655 obj += PvlKeyword("LatitudeIncrement", toString(m_latInc.degrees()));
656 obj += PvlKeyword("LongitudeIncrement", toString(m_lonInc.degrees()));
657
658 obj += PvlKeyword("LatitudeExtentType", toString(m_latExtents));
659 obj += PvlKeyword("MaximumLatitude", toString(m_maxLat.degrees()));
660 obj += PvlKeyword("MinimumLongitude", toString(m_minLon.degrees()));
661
662 obj += PvlKeyword("LongitudeExtentType", toString(m_lonExtents));
663 obj += PvlKeyword("MinimumLatitude", toString(m_minLat.degrees()));
664 obj += PvlKeyword("MaximumLongitude", toString(m_maxLon.degrees()));
665
666 obj += PvlKeyword("Density", toString(m_density));
667 obj += PvlKeyword("Visible", toString((int)(m_gridItem != NULL)));
668
669 return obj;
670 }
671
672
673 Longitude MosaicGridTool::domainMinLon() {
674 Longitude result;
675
676 if (getWidget() && getWidget()->getProjection()) {
677 if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
678 TProjection *tproj = (TProjection *) getWidget()->getProjection();
679 if (tproj->Has360Domain()) {
680 result = Longitude(0, Angle::Degrees);
681 }
682 else {
683 result = Longitude(-180, Angle::Degrees);
684 }
685 }
686 }
687 return result;
688 }
689
690
691 Longitude MosaicGridTool::domainMaxLon() {
692 Longitude result;
693
694 if (getWidget() && getWidget()->getProjection()) {
695 if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
696 TProjection *tproj = (TProjection *) getWidget()->getProjection();
697 if (tproj->Has360Domain()) {
698 result = Longitude(360, Angle::Degrees);
699 }
700 else {
701 result = Longitude(180, Angle::Degrees);
702 }
703 }
704 }
705
706 return result;
707 }
708
709
715 void MosaicGridTool::autoGrid(bool draw) {
716
717 QSettings settings(
718 FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
719 .arg(QApplication::applicationName())).expanded(),
720 QSettings::NativeFormat);
721 settings.setValue("autoGrid", draw);
722
723 Projection *proj = getWidget()->getProjection();
724 if (draw && proj && proj->projectionType() == Projection::Triaxial) {
725 TProjection *tproj = (TProjection *) proj;
726 QRectF boundingRect = getWidget()->cubesBoundingRect();
727
728 if (!boundingRect.isNull()) {
729
732
733 double latRange = m_maxLat.degrees() - m_minLat.degrees();
734
735 if (tproj->Mapping()["LatitudeType"][0] == "Planetographic") {
736 latRange =
738 }
739
740 double lonRange = m_maxLon.degrees() - m_minLon.degrees();
741
742 /*
743 * To calculate the lat/lon increments we divide the range by 10 (so we end up
744 * with about 10 sections in the range, whatever the extents may be) and we
745 * divide that by 1, 10, 100,... depending on the log10 of the range. We then
746 * round this value and multiply but the same number that we divided by. This
747 * gives us a clear, sensible value for an increment.
748 *
749 * Example Increments:
750 * Range = 1 --> Inc = .1
751 * Range = 10 --> Inc = 1
752 * Range = 100 --> Inc = 10
753 * Range = 5000 --> Inc = 500
754 *
755 * inc = round[(range/10) / 10^floor(log(range) - 1)] * 10^floor(log(range) - 1)
756 */
757
758 double latOffsetMultiplier = pow(10, qFloor(log10(latRange) - 1));
759 double lonOffsetMultiplier = pow(10, qFloor(log10(lonRange) - 1));
760
761 double idealLatInc = latRange / 10.0;
762 double idealLonInc = lonRange / 10.0;
763
764 double roundedLatInc = qRound(idealLatInc / latOffsetMultiplier) * latOffsetMultiplier ;
765 double roundedLonInc = qRound(idealLonInc / lonOffsetMultiplier) * lonOffsetMultiplier ;
766
767 m_latInc = Angle(roundedLatInc, Angle::Degrees);
768 m_lonInc = Angle(roundedLonInc, Angle::Degrees);
769
770 m_previousBoundingRect = boundingRect;
771
772 drawGrid();
773 }
774 }
775 }
776
777
782 if(m_gridItem != NULL) {
783 disconnect(getWidget(), SIGNAL(projectionChanged(Projection *)),
784 this, SLOT(drawGrid()));
785
786 getWidget()->getScene()->removeItem(m_gridItem);
787
788 delete m_gridItem;
789 m_gridItem = NULL;
790 }
791 }
792
793
798 MosaicGridToolConfigDialog *configDialog =
800 qobject_cast<QWidget *>(parent()));
801 configDialog->setAttribute(Qt::WA_DeleteOnClose);
802 configDialog->show();
803 }
804
805 /*
806 * Updates lat/lon ranges when a new projection file is loaded. Also
807 * forces the lat/lon extent source to Map resetting user options in the grid tool dialog.
808 *
809 */
810 void MosaicGridTool::onProjectionChanged() {
811 TProjection * tproj = (TProjection *)getWidget()->getProjection();
812
813 PvlGroup mappingGroup(tproj->Mapping());
814
815 // If Projection changed from a file, force extents to come from
816 // the new map file
818 m_lonExtents = Map;
819
820 Latitude minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
821 Latitude maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
822
824
825 Longitude minLon = Longitude(tproj->MinimumLongitude(), mappingGroup, Angle::Degrees);
826 Longitude maxLon = Longitude(tproj->MaximumLongitude(), mappingGroup, Angle::Degrees);
827
829
830 setBaseLat(Latitude(baseLat().angle(Angle::Degrees), mappingGroup, Angle::Degrees));
831 setBaseLon(Longitude(baseLon().angle(Angle::Degrees), mappingGroup, Angle::Degrees));
832 }
833
834
841 if(m_gridItem != NULL) {
842 m_drawGridCheckBox->setChecked(false);
843 m_autoGridCheckBox->setEnabled(true);
844 m_autoGridLabel->setEnabled(true);
845 }
846
847 m_drawGridCheckBox->blockSignals(true);
848 m_drawGridCheckBox->setChecked(true);
849 m_drawGridCheckBox->blockSignals(false);
850
851 if (!getWidget()->getProjection()) {
852 QString msg = "Please set the mosaic scene's projection before trying to "
853 "draw a grid. This means either open a cube (a projection "
854 "will be calculated) or set the projection explicitly";
855 QMessageBox::warning(NULL, tr("Grid Tool Requires Projection"), msg);
856 }
857
858
860 m_gridItem = new GridGraphicsItem(m_baseLat, m_baseLon, m_latInc, m_lonInc, getWidget(),
862 }
863
864 connect(getWidget(), SIGNAL(projectionChanged(Projection *)),
865 this, SLOT(drawGrid()), Qt::UniqueConnection);
866
867 connect(getWidget(), SIGNAL(cubesChanged()),
868 this, SLOT(onCubesChanged()));
869
870 if (m_gridItem != NULL)
871 getWidget()->getScene()->addItem(m_gridItem);
872
873 }
874
875
881 void MosaicGridTool::drawGrid(bool draw) {
882 if (draw) {
883 m_autoGridLabel->setEnabled(true);
884 m_autoGridCheckBox->setEnabled(true);
885 drawGrid();
886 }
887 else {
888 clearGrid();
889 m_autoGridLabel->setEnabled(false);
890 m_autoGridCheckBox->setEnabled(false);
891 }
892 }
893
894
903 if (m_previousBoundingRect != getWidget()->cubesBoundingRect()) {
904 emit boundingRectChanged();
905 autoGrid(m_autoGridCheckBox->isChecked());
906
907 //Make sure that the grid is updated the first time new cubes are opened.
908 getWidget()->getView()->update();
909 QApplication::processEvents();
910 }
911 }
912
913
920 void MosaicGridTool::onToolOpen(bool check) {
921 if (check && m_shouldCheckBoxes) {
922 QSettings settings(
923 FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
924 .arg(QApplication::applicationName())).expanded(),
925 QSettings::NativeFormat);
926
927 bool drawAuto = settings.value("autoGrid", true).toBool();
928 m_autoGridCheckBox->setChecked(drawAuto);
929
930 // This is necessary to fully initialize properly... the auto increments should still be
931 // the default increments. This will also cause the lat/lon extents to be properly computed.
932 if (!drawAuto) {
933 autoGrid(true);
934 autoGrid(false);
935 }
936
937 m_autoGridCheckBox->setEnabled(true);
938 m_autoGridLabel->setEnabled(true);
939 m_drawGridCheckBox->setChecked(true);
940 m_shouldCheckBoxes = false;
941 }
942 }
943
944
953 QWidget *widget = new QWidget();
954 return widget;
955 }
956
957
966 m_action = new QAction(this);
967 m_action->setIcon(getIcon("grid.png"));
968 m_action->setToolTip("Grid (g)");
969 m_action->setShortcut(Qt::Key_G);
970 QString text =
971 "<b>Function:</b> Superimpose a map grid over the area of displayed "
972 "footprints in the 'mosaic scene.'<br><br>"
973 "This tool allows you to overlay a ground grid onto the mosaic scene. "
974 "The inputs are standard ground grid parameters and a grid density."
975 "<p><b>Shortcut:</b> g</p> ";
976 m_action->setWhatsThis(text);
977 return m_action;
978 }
979
980
987
988 m_previousBoundingRect = getWidget()->cubesBoundingRect();
989
990 QHBoxLayout *actionLayout = new QHBoxLayout();
991
992 QString autoGridWhatsThis =
993 "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
994 m_autoGridLabel = new QLabel("Auto Grid");
995 m_autoGridLabel->setWhatsThis(autoGridWhatsThis);
996 m_autoGridCheckBox = new QCheckBox;
997 m_autoGridCheckBox->setWhatsThis(autoGridWhatsThis);
998 connect(m_autoGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(autoGrid(bool)));
999 actionLayout->addWidget(m_autoGridLabel);
1000 actionLayout->addWidget(m_autoGridCheckBox);
1001
1002 // Create the action buttons
1003 QPushButton *optionsButton = new QPushButton("Grid Options");
1004 optionsButton->setWhatsThis("Opens a dialog box that has the options to change the base"
1005 " latitude, base longitude, latitude increment, longitude"
1006 " increment, and grid density.");
1007 connect(optionsButton, SIGNAL(clicked()), this, SLOT(configure()));
1008 actionLayout->addWidget(optionsButton);
1009
1010 QString drawGridWhatsThis =
1011 "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
1012 QLabel *drawGridLabel = new QLabel("Show Grid");
1013 drawGridLabel->setWhatsThis(drawGridWhatsThis);
1014 m_drawGridCheckBox = new QCheckBox;
1015 m_drawGridCheckBox->setWhatsThis(drawGridWhatsThis);
1016 connect(m_drawGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(drawGrid(bool)));
1017 actionLayout->addWidget(drawGridLabel);
1018 actionLayout->addWidget(m_drawGridCheckBox);
1019
1020 connect(this, SIGNAL(activated(bool)), this, SLOT(onToolOpen(bool)));
1021
1022 actionLayout->addStretch(1);
1023 actionLayout->setMargin(0);
1024
1025 QWidget *toolBarWidget = new QWidget;
1026 toolBarWidget->setLayout(actionLayout);
1027
1028 return toolBarWidget;
1029 }
1030}
Defines an angle and provides unit conversions.
Definition Angle.h:45
double degrees() const
Get the angle in units of Degrees.
Definition Angle.h:232
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition Angle.h:56
Distance measurement, usually in meters.
Definition Distance.h:34
@ Meters
The distance is being specified in meters.
Definition Distance.h:43
File name manipulation and expansion.
Definition FileName.h:100
The visual display of the find point.
This class is designed to encapsulate the concept of a Latitude.
Definition Latitude.h:51
@ Planetocentric
This is the universal (and default) latitude coordinate system.
Definition Latitude.h:91
double planetographic(Angle::Units units=Angle::Radians) const
Get the latitude in the planetographic coordinate system.
Definition Latitude.cpp:315
This class is designed to encapsulate the concept of a Longitude.
Definition Longitude.h:40
Configure user's settings for the grid tool.
void setShowGrid(bool show)
Modify the check state of the checkbox.
Angle latInc()
The angle of the latitude increment.
QWidget * createToolBarWidget()
Creates the widget to add to the tool bar.
Longitude m_baseLon
Base longitude for drawing the grid.
void setLonExtents(GridExtentSource source, Longitude minLon, Longitude maxLon)
Set the maximum and minimum longitude of the grid.
void onCubesChanged()
Determines whether or not the bounding rectangle was changed by the addition or removal of cubes.
MosaicSceneWidget * sceneWidget()
PvlObject toPvl() const
Store the tool information in a pvl object.
Latitude maxLat()
The maximum latitude used to determine the grid's extents and increments.
void onToolOpen(bool check)
Checks both checkboxes when the tool is first opened.
Longitude m_maxLon
Maximum longitude of the grid.
MosaicGridTool(MosaicSceneWidget *)
MosaicGridTool constructor.
GridExtentSource lonExtents()
The extent type (Map, Cubes, Manual) for the longitude.
bool autoGridCheckBox()
True if checked.
Latitude m_maxLat
Maximum latitude of the grid.
void setDensity(int density)
Modify the density.
QPointer< QLabel > m_autoGridLabel
Enabled and diabled with the autoGrid checkbox.
Longitude minLon()
The minimum longitude used to determine the grid's extents and increments.
Latitude m_baseLat
Base latitude for drawing the grid.
Longitude m_minLon
Minimum longitude of the grid.
void configure()
Give a configuration dialog for the options available in this tool.
Angle m_latInc
Latitude increment for drawing the grid.
Latitude minLat()
The minimum latitude used to determine the grid's extents and increments.
@ Cubes
The grid will be drawn using the extents from the bounding rectangle of the open cubes.
@ Manual
The grid will be drawn using the extents that the user specifies.
@ Map
The grid will be drawn using the extents from the map projection.
bool m_shouldCheckBoxes
True when the tool is first opened to check the checkboxes.
void fromPvl(const PvlObject &obj)
Read the tool information form a pvl object.
QPointer< QCheckBox > m_autoGridCheckBox
True if grid properties come from the open cubes.
bool showGrid()
True if grid is displayed.
Latitude baseLat()
The base latitude.
void clearGrid()
Clears the grid from the scene.
QRectF m_previousBoundingRect
The bounding rectangle of the previous set of open cubes.
Longitude baseLon()
The base longitude.
int density()
The density or resolution of the grid.
QAction * getPrimaryAction()
Adds the action to the toolpad.
Angle lonInc()
The angle of the longitude increment.
void drawGrid()
Creates the GridGraphicsItem that will draw the grid.
void setLatExtents(GridExtentSource source, Latitude minLat, Latitude maxLat)
Set the maximum and minimum latitude of the grid.
int m_density
Grid density for drawing the grid.
void setAutoGridCheckBox(bool checked)
Modify the check state of the checkbox.
GridExtentSource m_lonExtents
Used for the state of the options dialog.
QString projectPvlObjectName() const
An accessor for the name of the Pvl object that the tool's information is stored in.
void setBaseLon(Longitude baseLon)
Modify the base longitude.
void autoGrid(bool draw)
Calculates the lat/lon increments from the bounding rectangle of the open cubes.
QString latType()
The latitude type (planetocentric/planetographic) of the projection of the scene.
QPointer< QCheckBox > m_drawGridCheckBox
True if grid properties come from the open cubes.
Latitude m_minLat
Minimum latitude of the grid.
void setLonInc(Angle lonInc)
Modify the longitude increment.
void setLatInc(Angle latInc)
Modify the latitude increment.
Longitude maxLon()
The maximum longitude used to determine the grid's extents and increments.
void addToMenu(QMenu *menu)
Adds the pan action to the given menu.
void setBaseLat(Latitude baseLat)
Modify the base latitude.
Angle m_lonInc
Longitude increment for drawing the grid.
QString lonDomain()
The longitude domain of the projection of the scene.
QWidget * getToolBarWidget()
Creates the Grid Toolbar Widget.
GridExtentSource m_latExtents
Used for the state of the options dialog.
GridExtentSource latExtents()
The extent type (Map, Cubes, Manual) for the latitude.
This widget encompasses the entire mosaic scene.
Base class for the MosaicTools.
Definition MosaicTool.h:37
QPixmap getIcon(QString iconName) const
returns the path to the icon directory.
Base class for Map Projections.
Definition Projection.h:155
@ Triaxial
These projections are used to map triaxial and irregular-shaped bodies.
Definition Projection.h:166
Contains multiple PvlContainers.
Definition PvlGroup.h:41
A single keyword-value pair.
Definition PvlKeyword.h:87
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
Base class for Map TProjections.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition IString.cpp:93
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition IString.cpp:38
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition IString.cpp:149