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 
31 namespace 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 
93  return m_baseLat;
94  }
95 
96 
103  return m_baseLon;
104  }
105 
106 
114  return m_density;
115  }
116 
117 
124  return m_latInc;
125  }
126 
127 
134  return m_latExtents;
135  }
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 
182  return m_lonExtents;
183  }
184 
185 
192  return m_lonInc;
193  }
194 
195 
202  return m_maxLat;
203  }
204 
205 
212  return m_maxLon;
213  }
214 
215 
222  return m_minLat;
223  }
224 
225 
232  return m_minLon;
233  }
234 
235 
242  return getWidget();
243  }
244 
245 
252  return m_drawGridCheckBox->isChecked();
253  }
254 
255 
262  m_autoGridCheckBox->setChecked(checked);
263  }
264 
265 
273  }
274 
275 
282  m_baseLon = baseLon;
283  }
284 
285 
291  void MosaicGridTool::setDensity(int density) {
292  m_density = 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)) {
415  m_latInc = latInc;
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:
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:
517  m_minLon = minLon;
518  m_maxLon = maxLon;
519  break;
520 
521  default:
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))
540  m_lonInc = lonInc;
541  }
542 
543 
549  void MosaicGridTool::setShowGrid(bool show) {
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  // If Projection changed from a file, force extents to come from
814  // the new map file
815  m_latExtents = Map;
816  m_lonExtents = Map;
817 
820 
822 
825 
827  }
828 
829 
836  if(m_gridItem != NULL) {
837  m_drawGridCheckBox->setChecked(false);
838  m_autoGridCheckBox->setEnabled(true);
839  m_autoGridLabel->setEnabled(true);
840  }
841 
842  m_drawGridCheckBox->blockSignals(true);
843  m_drawGridCheckBox->setChecked(true);
844  m_drawGridCheckBox->blockSignals(false);
845 
846  if (!getWidget()->getProjection()) {
847  QString msg = "Please set the mosaic scene's projection before trying to "
848  "draw a grid. This means either open a cube (a projection "
849  "will be calculated) or set the projection explicitly";
850  QMessageBox::warning(NULL, tr("Grid Tool Requires Projection"), msg);
851  }
852 
853 
855  m_gridItem = new GridGraphicsItem(m_baseLat, m_baseLon, m_latInc, m_lonInc, getWidget(),
857  }
858 
859  connect(getWidget(), SIGNAL(projectionChanged(Projection *)),
860  this, SLOT(drawGrid()), Qt::UniqueConnection);
861 
862  connect(getWidget(), SIGNAL(cubesChanged()),
863  this, SLOT(onCubesChanged()));
864 
865  if (m_gridItem != NULL)
866  getWidget()->getScene()->addItem(m_gridItem);
867 
868  }
869 
870 
876  void MosaicGridTool::drawGrid(bool draw) {
877  if (draw) {
878  m_autoGridLabel->setEnabled(true);
879  m_autoGridCheckBox->setEnabled(true);
880  drawGrid();
881  }
882  else {
883  clearGrid();
884  m_autoGridLabel->setEnabled(false);
885  m_autoGridCheckBox->setEnabled(false);
886  }
887  }
888 
889 
898  if (m_previousBoundingRect != getWidget()->cubesBoundingRect()) {
899  emit boundingRectChanged();
900  autoGrid(m_autoGridCheckBox->isChecked());
901 
902  //Make sure that the grid is updated the first time new cubes are opened.
903  getWidget()->getView()->update();
904  QApplication::processEvents();
905  }
906  }
907 
908 
915  void MosaicGridTool::onToolOpen(bool check) {
916  if (check && m_shouldCheckBoxes) {
917  QSettings settings(
918  FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
919  .arg(QApplication::applicationName())).expanded(),
920  QSettings::NativeFormat);
921 
922  bool drawAuto = settings.value("autoGrid", true).toBool();
923  m_autoGridCheckBox->setChecked(drawAuto);
924 
925  // This is necessary to fully initialize properly... the auto increments should still be
926  // the default increments. This will also cause the lat/lon extents to be properly computed.
927  if (!drawAuto) {
928  autoGrid(true);
929  autoGrid(false);
930  }
931 
932  m_autoGridCheckBox->setEnabled(true);
933  m_autoGridLabel->setEnabled(true);
934  m_drawGridCheckBox->setChecked(true);
935  m_shouldCheckBoxes = false;
936  }
937  }
938 
939 
948  QWidget *widget = new QWidget();
949  return widget;
950  }
951 
952 
961  m_action = new QAction(this);
962  m_action->setIcon(getIcon("grid.png"));
963  m_action->setToolTip("Grid (g)");
964  m_action->setShortcut(Qt::Key_G);
965  QString text =
966  "<b>Function:</b> Superimpose a map grid over the area of displayed "
967  "footprints in the 'mosaic scene.'<br><br>"
968  "This tool allows you to overlay a ground grid onto the mosaic scene. "
969  "The inputs are standard ground grid parameters and a grid density."
970  "<p><b>Shortcut:</b> g</p> ";
971  m_action->setWhatsThis(text);
972  return m_action;
973  }
974 
975 
982 
983  m_previousBoundingRect = getWidget()->cubesBoundingRect();
984 
985  QHBoxLayout *actionLayout = new QHBoxLayout();
986 
987  QString autoGridWhatsThis =
988  "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
989  m_autoGridLabel = new QLabel("Auto Grid");
990  m_autoGridLabel->setWhatsThis(autoGridWhatsThis);
991  m_autoGridCheckBox = new QCheckBox;
992  m_autoGridCheckBox->setWhatsThis(autoGridWhatsThis);
993  connect(m_autoGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(autoGrid(bool)));
994  actionLayout->addWidget(m_autoGridLabel);
995  actionLayout->addWidget(m_autoGridCheckBox);
996 
997  // Create the action buttons
998  QPushButton *optionsButton = new QPushButton("Grid Options");
999  optionsButton->setWhatsThis("Opens a dialog box that has the options to change the base"
1000  " latitude, base longitude, latitude increment, longitude"
1001  " increment, and grid density.");
1002  connect(optionsButton, SIGNAL(clicked()), this, SLOT(configure()));
1003  actionLayout->addWidget(optionsButton);
1004 
1005  QString drawGridWhatsThis =
1006  "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
1007  QLabel *drawGridLabel = new QLabel("Show Grid");
1008  drawGridLabel->setWhatsThis(drawGridWhatsThis);
1009  m_drawGridCheckBox = new QCheckBox;
1010  m_drawGridCheckBox->setWhatsThis(drawGridWhatsThis);
1011  connect(m_drawGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(drawGrid(bool)));
1012  actionLayout->addWidget(drawGridLabel);
1013  actionLayout->addWidget(m_drawGridCheckBox);
1014 
1015  connect(this, SIGNAL(activated(bool)), this, SLOT(onToolOpen(bool)));
1016 
1017  actionLayout->addStretch(1);
1018  actionLayout->setMargin(0);
1019 
1020  QWidget *toolBarWidget = new QWidget;
1021  toolBarWidget->setLayout(actionLayout);
1022 
1023  return toolBarWidget;
1024  }
1025 }
Isis::MosaicGridTool::setBaseLon
void setBaseLon(Longitude baseLon)
Modify the base longitude.
Definition: MosaicGridTool.cpp:281
Isis::Angle::Degrees
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:56
Isis::MosaicGridTool::density
int density()
The density or resolution of the grid.
Definition: MosaicGridTool.cpp:113
Isis::MosaicGridTool::m_drawGridCheckBox
QPointer< QCheckBox > m_drawGridCheckBox
True if grid properties come from the open cubes.
Definition: MosaicGridTool.h:135
QWidget
Isis::MosaicGridTool::maxLon
Longitude maxLon()
The maximum longitude used to determine the grid's extents and increments.
Definition: MosaicGridTool.cpp:211
Isis::MosaicGridTool::addToMenu
void addToMenu(QMenu *menu)
Adds the pan action to the given menu.
Definition: MosaicGridTool.cpp:73
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::MosaicGridTool::m_minLon
Longitude m_minLon
Minimum longitude of the grid.
Definition: MosaicGridTool.h:150
Isis::MosaicTool::getIcon
QPixmap getIcon(QString iconName) const
returns the path to the icon directory.
Definition: MosaicTool.cpp:115
Isis::MosaicGridTool::latExtents
GridExtentSource latExtents()
The extent type (Map, Cubes, Manual) for the latitude.
Definition: MosaicGridTool.cpp:133
Isis::GridGraphicsItem
The visual display of the find point.
Definition: GridGraphicsItem.h:40
Isis::MosaicGridTool::setBaseLat
void setBaseLat(Latitude baseLat)
Modify the base latitude.
Definition: MosaicGridTool.cpp:271
Isis::MosaicGridTool::m_autoGridLabel
QPointer< QLabel > m_autoGridLabel
Enabled and diabled with the autoGrid checkbox.
Definition: MosaicGridTool.h:133
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Latitude
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:51
Isis::MosaicGridTool::clearGrid
void clearGrid()
Clears the grid from the scene.
Definition: MosaicGridTool.cpp:781
Isis::Latitude::planetographic
double planetographic(Angle::Units units=Angle::Radians) const
Get the latitude in the planetographic coordinate system.
Definition: Latitude.cpp:315
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::MosaicGridTool::Manual
@ Manual
The grid will be drawn using the extents that the user specifies.
Definition: MosaicGridTool.h:70
Isis::MosaicGridToolConfigDialog
Configure user's settings for the grid tool.
Definition: MosaicGridToolConfigDialog.h:37
Isis::TProjection::SetCoordinate
virtual bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
Definition: TProjection.cpp:789
Isis::TProjection::MinimumLongitude
virtual double MinimumLongitude() const
This returns the minimum longitude of the area of interest.
Definition: TProjection.cpp:732
Isis::MosaicGridTool::drawGrid
void drawGrid()
Creates the GridGraphicsItem that will draw the grid.
Definition: MosaicGridTool.cpp:835
QMenu
Isis::MosaicGridTool::fromPvl
void fromPvl(const PvlObject &obj)
Read the tool information form a pvl object.
Definition: MosaicGridTool.cpp:559
Isis::MosaicGridTool::m_autoGridCheckBox
QPointer< QCheckBox > m_autoGridCheckBox
True if grid properties come from the open cubes.
Definition: MosaicGridTool.h:134
Isis::MosaicGridTool::GridExtentSource
GridExtentSource
Definition: MosaicGridTool.h:57
Isis::TProjection::Longitude
virtual double Longitude() const
This returns a longitude with correct longitude direction and domain as specified in the label object...
Definition: TProjection.cpp:823
Isis::Projection::projectionType
ProjectionType projectionType() const
Returns an enum value for the projection type.
Definition: Projection.cpp:198
Isis::MosaicSceneWidget
This widget encompasses the entire mosaic scene.
Definition: MosaicSceneWidget.h:153
Isis::MosaicGridTool::autoGrid
void autoGrid(bool draw)
Calculates the lat/lon increments from the bounding rectangle of the open cubes.
Definition: MosaicGridTool.cpp:715
Isis::MosaicGridTool::setDensity
void setDensity(int density)
Modify the density.
Definition: MosaicGridTool.cpp:291
Isis::MosaicGridTool::showGrid
bool showGrid()
True if grid is displayed.
Definition: MosaicGridTool.cpp:251
Isis::TProjection::MaximumLatitude
virtual double MaximumLatitude() const
This returns the maximum latitude of the area of interest.
Definition: TProjection.cpp:721
Isis::MosaicTool
Base class for the MosaicTools.
Definition: MosaicTool.h:37
Isis::TProjection::EquatorialRadius
double EquatorialRadius() const
This returns the equatorial radius of the target.
Definition: TProjection.cpp:277
Isis::TProjection::Has360Domain
bool Has360Domain() const
This indicates if the longitude domain is 0 to 360 (as opposed to -180 to 180).
Definition: TProjection.cpp:643
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::MosaicGridTool::setLatInc
void setLatInc(Angle latInc)
Modify the latitude increment.
Definition: MosaicGridTool.cpp:413
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::MosaicGridTool::toPvl
PvlObject toPvl() const
Store the tool information in a pvl object.
Definition: MosaicGridTool.cpp:647
Isis::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
Isis::TProjection::LongitudeDomainString
QString LongitudeDomainString() const
This method returns the longitude domain as a string.
Definition: TProjection.cpp:698
Isis::MosaicGridTool::onCubesChanged
void onCubesChanged()
Determines whether or not the bounding rectangle was changed by the addition or removal of cubes.
Definition: MosaicGridTool.cpp:897
Isis::TProjection::LatitudeTypeString
QString LatitudeTypeString() const
This method returns the latitude type as a string.
Definition: TProjection.cpp:508
Isis::TProjection::SetUniversalGround
virtual bool SetUniversalGround(const double lat, const double lon)
This method is used to set the latitude/longitude which must be Planetocentric (latitude) and Positiv...
Definition: TProjection.cpp:839
Isis::MosaicGridTool::getToolBarWidget
QWidget * getToolBarWidget()
Creates the Grid Toolbar Widget.
Definition: MosaicGridTool.cpp:981
Isis::MosaicGridTool::setLatExtents
void setLatExtents(GridExtentSource source, Latitude minLat, Latitude maxLat)
Set the maximum and minimum latitude of the grid.
Definition: MosaicGridTool.cpp:303
Isis::MosaicGridTool::m_density
int m_density
Grid density for drawing the grid.
Definition: MosaicGridTool.h:152
Isis::MosaicGridTool::setShowGrid
void setShowGrid(bool show)
Modify the check state of the checkbox.
Definition: MosaicGridTool.cpp:549
Isis::Distance::Meters
@ Meters
The distance is being specified in meters.
Definition: Distance.h:43
Isis::MosaicGridTool::setLonExtents
void setLonExtents(GridExtentSource source, Longitude minLon, Longitude maxLon)
Set the maximum and minimum longitude of the grid.
Definition: MosaicGridTool.cpp:427
Isis::MosaicGridTool::m_latInc
Angle m_latInc
Latitude increment for drawing the grid.
Definition: MosaicGridTool.h:141
Isis::MosaicGridTool::Map
@ Map
The grid will be drawn using the extents from the map projection.
Definition: MosaicGridTool.h:61
Isis::MosaicGridTool::latInc
Angle latInc()
The angle of the latitude increment.
Definition: MosaicGridTool.cpp:123
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::MosaicGridTool::m_lonInc
Angle m_lonInc
Longitude increment for drawing the grid.
Definition: MosaicGridTool.h:142
Isis::TProjection::PolarRadius
double PolarRadius() const
This returns the polar radius of the target.
Definition: TProjection.cpp:287
Isis::TProjection::Latitude
virtual double Latitude() const
This returns a latitude with correct latitude type as specified in the label object.
Definition: TProjection.cpp:811
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::MosaicGridTool::lonDomain
QString lonDomain()
The longitude domain of the projection of the scene.
Definition: MosaicGridTool.cpp:162
Isis::Latitude::Planetocentric
@ Planetocentric
This is the universal (and default) latitude coordinate system.
Definition: Latitude.h:91
Isis::TProjection
Base class for Map TProjections.
Definition: TProjection.h:166
Isis::PvlObject::hasKeyword
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
Definition: PvlObject.cpp:236
Isis::MosaicGridTool::projectPvlObjectName
QString projectPvlObjectName() const
An accessor for the name of the Pvl object that the tool's information is stored in.
Definition: MosaicGridTool.cpp:637
Isis::MosaicGridTool::baseLat
Latitude baseLat()
The base latitude.
Definition: MosaicGridTool.cpp:92
Isis::MosaicGridTool::createToolBarWidget
QWidget * createToolBarWidget()
Creates the widget to add to the tool bar.
Definition: MosaicGridTool.cpp:947
Isis::MosaicGridTool::maxLat
Latitude maxLat()
The maximum latitude used to determine the grid's extents and increments.
Definition: MosaicGridTool.cpp:201
Isis::Angle
Defines an angle and provides unit conversions.
Definition: Angle.h:45
Isis::MosaicGridTool::m_latExtents
GridExtentSource m_latExtents
Used for the state of the options dialog.
Definition: MosaicGridTool.h:144
Isis::TProjection::MaximumLongitude
virtual double MaximumLongitude() const
This returns the maximum longitude of the area of interest.
Definition: TProjection.cpp:743
Isis::MosaicGridTool::autoGridCheckBox
bool autoGridCheckBox()
True if checked.
Definition: MosaicGridTool.cpp:82
Isis::MosaicGridTool::minLat
Latitude minLat()
The minimum latitude used to determine the grid's extents and increments.
Definition: MosaicGridTool.cpp:221
Isis::MosaicGridTool::getPrimaryAction
QAction * getPrimaryAction()
Adds the action to the toolpad.
Definition: MosaicGridTool.cpp:960
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::MosaicGridTool::setAutoGridCheckBox
void setAutoGridCheckBox(bool checked)
Modify the check state of the checkbox.
Definition: MosaicGridTool.cpp:261
Isis::MosaicGridTool::m_lonExtents
GridExtentSource m_lonExtents
Used for the state of the options dialog.
Definition: MosaicGridTool.h:148
Isis::MosaicGridTool::configure
void configure()
Give a configuration dialog for the options available in this tool.
Definition: MosaicGridTool.cpp:797
Isis::MosaicGridTool::setLonInc
void setLonInc(Angle lonInc)
Modify the longitude increment.
Definition: MosaicGridTool.cpp:534
Isis::toBool
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:38
Isis::MosaicGridTool::m_maxLon
Longitude m_maxLon
Maximum longitude of the grid.
Definition: MosaicGridTool.h:149
Isis::MosaicGridTool::onToolOpen
void onToolOpen(bool check)
Checks both checkboxes when the tool is first opened.
Definition: MosaicGridTool.cpp:915
Isis::MosaicGridTool::m_baseLon
Longitude m_baseLon
Base longitude for drawing the grid.
Definition: MosaicGridTool.h:139
Isis::Angle::degrees
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:232
Isis::TProjection::MinimumLatitude
virtual double MinimumLatitude() const
This returns the minimum latitude of the area of interest.
Definition: TProjection.cpp:710
Isis::Projection::Triaxial
@ Triaxial
These projections are used to map triaxial and irregular-shaped bodies.
Definition: Projection.h:166
Isis::TProjection::Mapping
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
Definition: TProjection.cpp:1698
Isis::MosaicGridTool::Cubes
@ Cubes
The grid will be drawn using the extents from the bounding rectangle of the open cubes.
Definition: MosaicGridTool.h:66
Isis::MosaicGridTool::latType
QString latType()
The latitude type (planetocentric/planetographic) of the projection of the scene.
Definition: MosaicGridTool.cpp:143
Isis::MosaicGridTool::m_shouldCheckBoxes
bool m_shouldCheckBoxes
True when the tool is first opened to check the checkboxes.
Definition: MosaicGridTool.h:136
Isis::Projection::YCoord
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:400
Isis::MosaicGridTool::minLon
Longitude minLon()
The minimum longitude used to determine the grid's extents and increments.
Definition: MosaicGridTool.cpp:231
Isis::Projection
Base class for Map Projections.
Definition: Projection.h:155
Isis::MosaicGridTool::lonExtents
GridExtentSource lonExtents()
The extent type (Map, Cubes, Manual) for the longitude.
Definition: MosaicGridTool.cpp:181
QAction
Isis::MosaicGridTool::m_baseLat
Latitude m_baseLat
Base latitude for drawing the grid.
Definition: MosaicGridTool.h:138
Isis::MosaicGridTool::MosaicGridTool
MosaicGridTool(MosaicSceneWidget *)
MosaicGridTool constructor.
Definition: MosaicGridTool.cpp:38
Isis::MosaicGridTool::lonInc
Angle lonInc()
The angle of the longitude increment.
Definition: MosaicGridTool.cpp:191
Isis::Projection::XCoord
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround,...
Definition: Projection.cpp:387
Isis::MosaicGridTool::m_maxLat
Latitude m_maxLat
Maximum latitude of the grid.
Definition: MosaicGridTool.h:145
Isis::MosaicGridTool::sceneWidget
MosaicSceneWidget * sceneWidget()
Definition: MosaicGridTool.cpp:241
Isis::MosaicGridTool::m_minLat
Latitude m_minLat
Minimum latitude of the grid.
Definition: MosaicGridTool.h:146
Isis::MosaicGridTool::m_previousBoundingRect
QRectF m_previousBoundingRect
The bounding rectangle of the previous set of open cubes.
Definition: MosaicGridTool.h:156
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::MosaicGridTool::baseLon
Longitude baseLon()
The base longitude.
Definition: MosaicGridTool.cpp:102