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 
63 
70  }
71 
72 
79  return m_autoGridCheckBox->isChecked();
80  }
81 
82 
89  return m_baseLat;
90  }
91 
92 
99  return m_baseLon;
100  }
101 
102 
110  return m_density;
111  }
112 
113 
120  return m_latInc;
121  }
122 
123 
130  return m_latExtents;
131  }
132 
133 
140  QString result;
141 
142  if (getWidget()->getProjection()) {
143  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
144  TProjection *tproj = (TProjection *) getWidget()->getProjection();
145  result = tproj->LatitudeTypeString();
146  }
147  }
148 
149  return result;
150  }
151 
152 
159  QString result;
160 
161  if (getWidget()->getProjection()) {
162  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
163  TProjection *tproj = (TProjection *) getWidget()->getProjection();
164  result = tproj->LongitudeDomainString();
165  }
166  }
167 
168  return result;
169  }
170 
171 
178  return m_lonExtents;
179  }
180 
181 
188  return m_lonInc;
189  }
190 
191 
198  return m_maxLat;
199  }
200 
201 
208  return m_maxLon;
209  }
210 
211 
218  return m_minLat;
219  }
220 
221 
228  return m_minLon;
229  }
230 
231 
238  return getWidget();
239  }
240 
241 
248  return m_drawGridCheckBox->isChecked();
249  }
250 
251 
258  m_autoGridCheckBox->setChecked(checked);
259  }
260 
261 
269  }
270 
271 
278  m_baseLon = baseLon;
279  }
280 
281 
287  void MosaicGridTool::setDensity(int density) {
288  m_density = density;
289  }
290 
291 
300  Latitude minLat = Latitude(),
301  Latitude maxLat = Latitude()) {
302  m_latExtents = source;
303 
304  Projection *proj = getWidget()->getProjection();
305  if (proj && proj->projectionType() == Projection::Triaxial) {
306  TProjection *tproj = (TProjection *) proj;
307  PvlGroup mappingGroup(tproj->Mapping());
308 
309  Distance equatorialRadius(tproj->EquatorialRadius(),
311  Distance polarRadius(tproj->PolarRadius(), Distance::Meters);
312 
313  QRectF boundingRect = getWidget()->cubesBoundingRect();
314 
315  double topLeft = 100;
316  double topRight = 100;
317  double bottomLeft = 100;
318  double bottomRight = 100;
319  bool cubeRectWorked = true;
320 
321  switch (source) {
322 
323  case Map:
324  m_minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
325  m_maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
326  break;
327 
328  case Cubes:
329  if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
330  topLeft = tproj->Latitude();
331  }
332  else {
333  cubeRectWorked = false;
334  }
335  if (tproj->SetCoordinate(boundingRect.topRight().x(), -boundingRect.topRight().y())) {
336  topRight = tproj->Latitude();
337  }
338  else {
339  cubeRectWorked = false;
340  }
341  if (tproj->SetCoordinate(boundingRect.bottomLeft().x(), -boundingRect.bottomLeft().y())) {
342  bottomLeft = tproj->Latitude();
343  }
344  else {
345  cubeRectWorked = false;
346  }
347  if (tproj->SetCoordinate(boundingRect.bottomRight().x(),
348  -boundingRect.bottomRight().y())) {
349  bottomRight = tproj->Latitude();
350  }
351  else {
352  cubeRectWorked = false;
353  }
354 
355  if (cubeRectWorked) {
356  m_minLat = Latitude(std::min(std::min(topLeft, topRight),
357  std::min(bottomLeft, bottomRight)), mappingGroup,
359  m_maxLat = Latitude(std::max(std::max(topLeft, topRight),
360  std::max(bottomLeft, bottomRight)), mappingGroup,
362 
363  if (tproj->SetUniversalGround(-90.0, 0) &&
364  boundingRect.contains(QPointF(tproj->XCoord(), -tproj->YCoord()))) {
365  m_minLat = Latitude(-90.0, mappingGroup, Angle::Degrees);
366  }
367 
368  if (tproj->SetUniversalGround(90.0, 0) &&
369  boundingRect.contains(QPointF(tproj->XCoord(), -tproj->YCoord()))) {
370  m_maxLat = Latitude(90.0, mappingGroup, Angle::Degrees);
371  }
372  }
373  else {
374  m_minLat = Latitude(-90, mappingGroup, Angle::Degrees);
375  m_maxLat = Latitude(90, mappingGroup, Angle::Degrees);
377 
378  static Projection *lastProjWithThisError = NULL;
379 
380  if (proj != lastProjWithThisError) {
381  lastProjWithThisError = proj;
382  QMessageBox::warning(NULL, tr("Latitude Extent Failure"),
383  tr("<p/>Could not extract latitude extents from the cubes.<br/>"
384  "<br/>The option <strong>\"Compute From Images\"</strong> "
385  "will default to using the <strong>Manual</strong> option "
386  "for latitude extents with a range of -90 to 90."));
387  }
388  }
389  break;
390 
391  case Manual:
394  break;
395 
396  default:
397  m_minLat = Latitude(tproj->MinimumLatitude(), mappingGroup, Angle::Degrees);
398  m_maxLat = Latitude(tproj->MaximumLatitude(), mappingGroup, Angle::Degrees);
399  }
400  }
401  }
402 
403 
410  if (latInc > Angle(0.0, Angle::Degrees)) {
411  m_latInc = latInc;
412  }
413  }
414 
415 
424  Longitude minLon = Longitude(),
425  Longitude maxLon = Longitude()) {
426  m_lonExtents = source;
427 
428  Projection *proj = getWidget()->getProjection();
429  if (proj && proj->projectionType() == Projection::Triaxial) {
430  TProjection * tproj = (TProjection *) proj;
431  QRectF boundingRect = getWidget()->cubesBoundingRect();
432 
433  double topLeft = 0;
434  double topRight = 0;
435  double bottomLeft = 0;
436  double bottomRight = 0;
437  bool cubeRectWorked = true;
438 
439  switch (source) {
440 
441  case Map:
444  break;
445 
446  case Cubes:
447  if (tproj->SetCoordinate(boundingRect.topLeft().x(), -boundingRect.topLeft().y())) {
448  topLeft = tproj->Longitude();
449  }
450  else {
451  cubeRectWorked = false;
452  }
453  if (tproj->SetCoordinate(boundingRect.topRight().x(), -boundingRect.topRight().y())) {
454  topRight = tproj->Longitude();
455  }
456  else {
457  cubeRectWorked = false;
458  }
459  if (tproj->SetCoordinate(boundingRect.bottomLeft().x(), -boundingRect.bottomLeft().y())) {
460  bottomLeft = tproj->Longitude();
461  }
462  else {
463  cubeRectWorked = false;
464  }
465  if (tproj->SetCoordinate(boundingRect.bottomRight().x(),
466  -boundingRect.bottomRight().y())) {
467  bottomRight = tproj->Longitude();
468  }
469  else {
470  cubeRectWorked = false;
471  }
472 
473  if (cubeRectWorked) {
474  m_minLon = Longitude(std::min(std::min(topLeft, topRight),
475  std::min(bottomLeft, bottomRight)),
477  m_maxLon = Longitude(std::max(std::max(topLeft, topRight),
478  std::max(bottomLeft, bottomRight)),
480  if (m_minLon < domainMinLon()) {
481  m_minLon = domainMinLon();
482  }
483  if (m_maxLon > domainMaxLon()) {
484  m_maxLon = domainMaxLon();
485  }
486  //Draw 0-360 if the pole is in the cubes' bounding rectangle.
487  if (m_minLat == Angle(-90.0, Angle::Degrees) ||
488  m_maxLat == Angle(90.0, Angle::Degrees)) {
489  m_minLon = domainMinLon();
490  m_maxLon = domainMaxLon();
491  }
492  }
493  else {
494  m_minLon = domainMinLon();
495  m_maxLon = domainMaxLon();
497 
498  static Projection *lastProjWithThisError = NULL;
499 
500  if (proj != lastProjWithThisError) {
501  lastProjWithThisError = proj;
502  QMessageBox::warning(NULL, tr("Longitude Extent Failure"),
503  tr("<p/>Could not extract longitude extents from the cubes.<br/>"
504  "<br/>The option <strong>\"Compute From Images\"</strong> "
505  "will default to using the <strong>Manual</strong> option "
506  "for longitude extents with a range of 0 to 360."));
507  }
508  }
509  break;
510 
511  case Manual:
512  m_minLon = minLon;
513  m_maxLon = maxLon;
514  break;
515 
516  default:
519  }
520  }
521  }
522 
523 
530  Angle lonRange = m_maxLon - m_minLon;
531 
532  if (lonInc > lonRange)
533  m_lonInc = lonRange;
534  else if (lonInc > Angle(0.0, Angle::Degrees))
535  m_lonInc = lonInc;
536  }
537 
538 
544  void MosaicGridTool::setShowGrid(bool show) {
545  m_drawGridCheckBox->setChecked(show);
546  }
547 
548 
555 
556  Projection *proj = getWidget()->getProjection();
557  if (proj && proj->projectionType() == Projection::Triaxial) {
558  TProjection *tproj = (TProjection *) proj;
559  Distance equatorialRadius(
560  tproj->EquatorialRadius(),
562  Distance polarRadius(
563  tproj->PolarRadius(), Distance::Meters);
564 
565  if (obj["BaseLatitude"][0] != "Null")
566  m_baseLat = Latitude(toDouble(obj["BaseLatitude"][0]), equatorialRadius, polarRadius,
568 
569  if (obj["BaseLongitude"][0] != "Null")
570  m_baseLon = Longitude(toDouble(obj["BaseLongitude"][0]), Angle::Degrees);
571 
572  if (obj["LatitudeIncrement"][0] != "Null")
573  m_latInc = Angle(toDouble(obj["LatitudeIncrement"][0]), Angle::Degrees);
574 
575  if (obj["LongitudeIncrement"][0] != "Null")
576  m_lonInc = Angle(toDouble(obj["LongitudeIncrement"][0]), Angle::Degrees);
577 
578  if (obj.hasKeyword("LatitudeExtentType")) {
579  if (obj["LatitudeExtentType"][0] != "Null")
580  m_latExtents = (GridExtentSource)toInt(obj["LatitudeExtentType"][0]);
581  }
582 
583  if (obj.hasKeyword("MinimumLatitude")) {
584  if (obj["MinimumLatitude"][0] != "Null")
585  m_minLat = Latitude(toDouble(obj["MinimumLatitude"][0]), equatorialRadius, polarRadius,
587  }
588 
589  if (obj.hasKeyword("MaximumLatitude")) {
590  if (obj["MaximumLatitude"][0] != "Null")
591  m_maxLat = Latitude(toDouble(obj["MaximumLatitude"][0]), equatorialRadius, polarRadius,
593  }
594 
595  if (obj.hasKeyword("LongitudeExtentType")) {
596  if (obj["LongitudeExtentType"][0] != "Null")
597  m_lonExtents = (GridExtentSource)toInt(obj["LongitudeExtentType"][0]);
598  }
599 
600  if (obj.hasKeyword("MinimumLongitude")) {
601  if (obj["MinimumLongitude"][0] != "Null")
602  m_minLon = Longitude(toDouble(obj["MinimumLongitude"][0]), Angle::Degrees);
603  }
604 
605  if (obj.hasKeyword("MaximumLongitude")) {
606  if (obj["MaximumLongitude"][0] != "Null")
607  m_maxLon = Longitude(toDouble(obj["MaximumLongitude"][0]), Angle::Degrees);
608  }
609 
610  if (obj["Density"][0] != "Null")
611  m_density = toDouble(obj["Density"][0]);
612 
613 
614  if (obj.hasKeyword("CheckTheBoxes")) {
615  if (obj["CheckTheBoxes"][0] != "Null") {
616  m_shouldCheckBoxes = (obj["CheckTheBoxes"][0] == "true");
617  }
618  }
619 
620  if(toBool(obj["Visible"][0])) {
621  drawGrid();
622  }
623  }
624  }
625 
626 
633  return "MosaicGridTool";
634  }
635 
636 
644 
645  obj += PvlKeyword("ShouldCheckBoxes", toString((int)m_shouldCheckBoxes));
646 
647  obj += PvlKeyword("BaseLatitude", toString(m_baseLat.degrees()));
648  obj += PvlKeyword("BaseLongitude", toString(m_baseLon.degrees()));
649 
650  obj += PvlKeyword("LatitudeIncrement", toString(m_latInc.degrees()));
651  obj += PvlKeyword("LongitudeIncrement", toString(m_lonInc.degrees()));
652 
653  obj += PvlKeyword("LatitudeExtentType", toString(m_latExtents));
654  obj += PvlKeyword("MaximumLatitude", toString(m_maxLat.degrees()));
655  obj += PvlKeyword("MinimumLongitude", toString(m_minLon.degrees()));
656 
657  obj += PvlKeyword("LongitudeExtentType", toString(m_lonExtents));
658  obj += PvlKeyword("MinimumLatitude", toString(m_minLat.degrees()));
659  obj += PvlKeyword("MaximumLongitude", toString(m_maxLon.degrees()));
660 
661  obj += PvlKeyword("Density", toString(m_density));
662  obj += PvlKeyword("Visible", toString((int)(m_gridItem != NULL)));
663 
664  return obj;
665  }
666 
667 
668  Longitude MosaicGridTool::domainMinLon() {
669  Longitude result;
670 
671  if (getWidget() && getWidget()->getProjection()) {
672  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
673  TProjection *tproj = (TProjection *) getWidget()->getProjection();
674  if (tproj->Has360Domain()) {
675  result = Longitude(0, Angle::Degrees);
676  }
677  else {
678  result = Longitude(-180, Angle::Degrees);
679  }
680  }
681  }
682  return result;
683  }
684 
685 
686  Longitude MosaicGridTool::domainMaxLon() {
687  Longitude result;
688 
689  if (getWidget() && getWidget()->getProjection()) {
690  if (getWidget()->getProjection()->projectionType() == Projection::Triaxial) {
691  TProjection *tproj = (TProjection *) getWidget()->getProjection();
692  if (tproj->Has360Domain()) {
693  result = Longitude(360, Angle::Degrees);
694  }
695  else {
696  result = Longitude(180, Angle::Degrees);
697  }
698  }
699  }
700 
701  return result;
702  }
703 
704 
710  void MosaicGridTool::autoGrid(bool draw) {
711 
712  QSettings settings(
713  FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
714  .arg(QApplication::applicationName())).expanded(),
715  QSettings::NativeFormat);
716  settings.setValue("autoGrid", draw);
717 
718  Projection *proj = getWidget()->getProjection();
719  if (draw && proj && proj->projectionType() == Projection::Triaxial) {
720  TProjection *tproj = (TProjection *) proj;
721  QRectF boundingRect = getWidget()->cubesBoundingRect();
722 
723  if (!boundingRect.isNull()) {
724 
727 
728  double latRange = m_maxLat.degrees() - m_minLat.degrees();
729 
730  if (tproj->Mapping()["LatitudeType"][0] == "Planetographic") {
731  latRange =
733  }
734 
735  double lonRange = m_maxLon.degrees() - m_minLon.degrees();
736 
737  /*
738  * To calculate the lat/lon increments we divide the range by 10 (so we end up
739  * with about 10 sections in the range, whatever the extents may be) and we
740  * divide that by 1, 10, 100,... depending on the log10 of the range. We then
741  * round this value and multiply but the same number that we divided by. This
742  * gives us a clear, sensible value for an increment.
743  *
744  * Example Increments:
745  * Range = 1 --> Inc = .1
746  * Range = 10 --> Inc = 1
747  * Range = 100 --> Inc = 10
748  * Range = 5000 --> Inc = 500
749  *
750  * inc = round[(range/10) / 10^floor(log(range) - 1)] * 10^floor(log(range) - 1)
751  */
752 
753  double latOffsetMultiplier = pow(10, qFloor(log10(latRange) - 1));
754  double lonOffsetMultiplier = pow(10, qFloor(log10(lonRange) - 1));
755 
756  double idealLatInc = latRange / 10.0;
757  double idealLonInc = lonRange / 10.0;
758 
759  double roundedLatInc = qRound(idealLatInc / latOffsetMultiplier) * latOffsetMultiplier ;
760  double roundedLonInc = qRound(idealLonInc / lonOffsetMultiplier) * lonOffsetMultiplier ;
761 
762  m_latInc = Angle(roundedLatInc, Angle::Degrees);
763  m_lonInc = Angle(roundedLonInc, Angle::Degrees);
764 
765  m_previousBoundingRect = boundingRect;
766 
767  drawGrid();
768  }
769  }
770  }
771 
772 
777  if(m_gridItem != NULL) {
778  disconnect(getWidget(), SIGNAL(projectionChanged(Projection *)),
779  this, SLOT(drawGrid()));
780 
781  getWidget()->getScene()->removeItem(m_gridItem);
782 
783  delete m_gridItem;
784  m_gridItem = NULL;
785  }
786  }
787 
788 
793  MosaicGridToolConfigDialog *configDialog =
795  qobject_cast<QWidget *>(parent()));
796  configDialog->setAttribute(Qt::WA_DeleteOnClose);
797  configDialog->show();
798  }
799 
800 
807  if(m_gridItem != NULL) {
808  m_drawGridCheckBox->setChecked(false);
809  m_autoGridCheckBox->setEnabled(true);
810  m_autoGridLabel->setEnabled(true);
811  }
812 
813  m_drawGridCheckBox->blockSignals(true);
814  m_drawGridCheckBox->setChecked(true);
815  m_drawGridCheckBox->blockSignals(false);
816 
817  if (!getWidget()->getProjection()) {
818  QString msg = "Please set the mosaic scene's projection before trying to "
819  "draw a grid. This means either open a cube (a projection "
820  "will be calculated) or set the projection explicitly";
821  QMessageBox::warning(NULL, tr("Grid Tool Requires Projection"), msg);
822  }
823 
825  m_gridItem = new GridGraphicsItem(m_baseLat, m_baseLon, m_latInc, m_lonInc, getWidget(),
827  }
828 
829  connect(getWidget(), SIGNAL(projectionChanged(Projection *)),
830  this, SLOT(drawGrid()), Qt::UniqueConnection);
831 
832  connect(getWidget(), SIGNAL(cubesChanged()),
833  this, SLOT(onCubesChanged()));
834 
835  if (m_gridItem != NULL)
836  getWidget()->getScene()->addItem(m_gridItem);
837  }
838 
839 
845  void MosaicGridTool::drawGrid(bool draw) {
846  if (draw) {
847  m_autoGridLabel->setEnabled(true);
848  m_autoGridCheckBox->setEnabled(true);
849  drawGrid();
850  }
851  else {
852  clearGrid();
853  m_autoGridLabel->setEnabled(false);
854  m_autoGridCheckBox->setEnabled(false);
855  }
856  }
857 
858 
867  if (m_previousBoundingRect != getWidget()->cubesBoundingRect()) {
868  emit boundingRectChanged();
869  autoGrid(m_autoGridCheckBox->isChecked());
870 
871  //Make sure that the grid is updated the first time new cubes are opened.
872  getWidget()->getView()->update();
873  QApplication::processEvents();
874  }
875  }
876 
877 
884  void MosaicGridTool::onToolOpen(bool check) {
885  if (check && m_shouldCheckBoxes) {
886  QSettings settings(
887  FileName(QString("$HOME/.Isis/%1/mosaicSceneGridTool.config")
888  .arg(QApplication::applicationName())).expanded(),
889  QSettings::NativeFormat);
890 
891  bool drawAuto = settings.value("autoGrid", true).toBool();
892  m_autoGridCheckBox->setChecked(drawAuto);
893 
894  // This is necessary to fully initialize properly... the auto increments should still be
895  // the default increments. This will also cause the lat/lon extents to be properly computed.
896  if (!drawAuto) {
897  autoGrid(true);
898  autoGrid(false);
899  }
900 
901  m_autoGridCheckBox->setEnabled(true);
902  m_autoGridLabel->setEnabled(true);
903  m_drawGridCheckBox->setChecked(true);
904  m_shouldCheckBoxes = false;
905  }
906  }
907 
908 
917  QWidget *widget = new QWidget();
918  return widget;
919  }
920 
921 
930  m_action = new QAction(this);
931  m_action->setIcon(getIcon("grid.png"));
932  m_action->setToolTip("Grid (g)");
933  m_action->setShortcut(Qt::Key_G);
934  QString text =
935  "<b>Function:</b> Superimpose a map grid over the area of displayed "
936  "footprints in the 'mosaic scene.'<br><br>"
937  "This tool allows you to overlay a ground grid onto the mosaic scene. "
938  "The inputs are standard ground grid parameters and a grid density."
939  "<p><b>Shortcut:</b> g</p> ";
940  m_action->setWhatsThis(text);
941  return m_action;
942  }
943 
944 
951 
952  m_previousBoundingRect = getWidget()->cubesBoundingRect();
953 
954  QHBoxLayout *actionLayout = new QHBoxLayout();
955 
956  QString autoGridWhatsThis =
957  "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
958  m_autoGridLabel = new QLabel("Auto Grid");
959  m_autoGridLabel->setWhatsThis(autoGridWhatsThis);
960  m_autoGridCheckBox = new QCheckBox;
961  m_autoGridCheckBox->setWhatsThis(autoGridWhatsThis);
962  connect(m_autoGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(autoGrid(bool)));
963  actionLayout->addWidget(m_autoGridLabel);
964  actionLayout->addWidget(m_autoGridCheckBox);
965 
966  // Create the action buttons
967  QPushButton *optionsButton = new QPushButton("Grid Options");
968  optionsButton->setWhatsThis("Opens a dialog box that has the options to change the base"
969  " latitude, base longitude, latitude increment, longitude"
970  " increment, and grid density.");
971  connect(optionsButton, SIGNAL(clicked()), this, SLOT(configure()));
972  actionLayout->addWidget(optionsButton);
973 
974  QString drawGridWhatsThis =
975  "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
976  QLabel *drawGridLabel = new QLabel("Show Grid");
977  drawGridLabel->setWhatsThis(drawGridWhatsThis);
978  m_drawGridCheckBox = new QCheckBox;
979  m_drawGridCheckBox->setWhatsThis(drawGridWhatsThis);
980  connect(m_drawGridCheckBox, SIGNAL(toggled(bool)), this, SLOT(drawGrid(bool)));
981  actionLayout->addWidget(drawGridLabel);
982  actionLayout->addWidget(m_drawGridCheckBox);
983 
984  connect(this, SIGNAL(activated(bool)), this, SLOT(onToolOpen(bool)));
985 
986  actionLayout->addStretch(1);
987  actionLayout->setMargin(0);
988 
989  QWidget *toolBarWidget = new QWidget;
990  toolBarWidget->setLayout(actionLayout);
991 
992  return toolBarWidget;
993  }
994 }
double EquatorialRadius() const
This returns the equatorial radius of the target.
Longitude m_maxLon
Maximum longitude of the grid.
Latitude maxLat()
The maximum latitude used to determine the grid&#39;s extents and increments.
void autoGrid(bool draw)
Calculates the lat/lon increments from the bounding rectangle of the open cubes.
double MaximumLongitude() const
This returns the maximum longitude of the area of interest.
Latitude baseLat()
The base latitude.
double planetographic(Angle::Units units=Angle::Radians) const
Get the latitude in the planetographic coordinate system.
Definition: Latitude.cpp:328
QString lonDomain()
The longitude domain of the projection of the scene.
void setLonExtents(GridExtentSource source, Longitude minLon, Longitude maxLon)
Set the maximum and minimum longitude of the grid.
bool SetUniversalGround(const double lat, const double lon)
This method is used to set the latitude/longitude which must be Planetocentric (latitude) and Positiv...
File name manipulation and expansion.
Definition: FileName.h:116
void setLatExtents(GridExtentSource source, Latitude minLat, Latitude maxLat)
Set the maximum and minimum latitude of the grid.
ProjectionType projectionType() const
Returns an enum value for the projection type.
Definition: Projection.cpp:213
Longitude minLon()
The minimum longitude used to determine the grid&#39;s extents and increments.
void setBaseLon(Longitude baseLon)
Modify the base longitude.
This widget encompasses the entire mosaic scene.
Angle m_lonInc
Longitude increment for drawing the grid.
void setLonInc(Angle lonInc)
Modify the longitude increment.
Base class for Map TProjections.
Definition: TProjection.h:182
QString LatitudeTypeString() const
This method returns the latitude type as a string.
The grid will be drawn using the extents that the user specifies.
Base class for the MosaicTools.
Definition: MosaicTool.h:37
Longitude m_baseLon
Base longitude for drawing the grid.
GridExtentSource m_lonExtents
Used for the state of the options dialog.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
MosaicSceneWidget * sceneWidget()
Longitude baseLon()
The base longitude.
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:63
GridExtentSource lonExtents()
The extent type (Map, Cubes, Manual) for the longitude.
Angle lonInc()
The angle of the longitude increment.
void clearGrid()
Clears the grid from the scene.
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Definition: Projection.cpp:402
void onToolOpen(bool check)
Checks both checkboxes when the tool is first opened.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
GridExtentSource m_latExtents
Used for the state of the options dialog.
Angle m_latInc
Latitude increment for drawing the grid.
Distance measurement, usually in meters.
Definition: Distance.h:47
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:249
double MinimumLongitude() const
This returns the minimum longitude of the area of interest.
QRectF m_previousBoundingRect
The bounding rectangle of the previous set of open cubes.
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:207
void configure()
Give a configuration dialog for the options available in this tool.
This is the universal (and default) latitude coordinate system.
Definition: Latitude.h:103
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
void fromPvl(const PvlObject &obj)
Read the tool information form a pvl object.
The grid will be drawn using the extents from the map projection.
Base class for Map Projections.
Definition: Projection.h:171
Longitude m_minLon
Minimum longitude of the grid.
QString latType()
The latitude type (planetocentric/planetographic) of the projection of the scene. ...
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:73
QWidget * createToolBarWidget()
Creates the widget to add to the tool bar.
bool autoGridCheckBox()
True if checked.
Longitude maxLon()
The maximum longitude used to determine the grid&#39;s extents and increments.
void setAutoGridCheckBox(bool checked)
Modify the check state of the checkbox.
Latitude m_maxLat
Maximum latitude of the grid.
Latitude minLat()
The minimum latitude used to determine the grid&#39;s extents and increments.
Latitude m_minLat
Minimum latitude of the grid.
The visual display of the find point.
double Longitude() const
This returns a longitude with correct longitude direction and domain as specified in the label object...
bool m_shouldCheckBoxes
True when the tool is first opened to check the checkboxes.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
Latitude m_baseLat
Base latitude for drawing the grid.
void setBaseLat(Latitude baseLat)
Modify the base latitude.
A single keyword-value pair.
Definition: PvlKeyword.h:98
void addToMenu(QMenu *menu)
Adds the pan action to the given menu.
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
Definition: Projection.cpp:415
QAction * getPrimaryAction()
Adds the action to the toolpad.
void setShowGrid(bool show)
Modify the check state of the checkbox.
QPointer< QLabel > m_autoGridLabel
Enabled and diabled with the autoGrid checkbox.
bool Has360Domain() const
This indicates if the longitude domain is 0 to 360 (as opposed to -180 to 180).
double MinimumLatitude() const
This returns the minimum latitude of the area of interest.
virtual PvlGroup Mapping()
This function returns the keywords that this projection uses.
MosaicGridTool(MosaicSceneWidget *)
MosaicGridTool constructor.
int density()
The density or resolution of the grid.
Defines an angle and provides unit conversions.
Definition: Angle.h:62
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QString projectPvlObjectName() const
An accessor for the name of the Pvl object that the tool&#39;s information is stored in.
QPixmap getIcon(QString iconName) const
returns the path to the icon directory.
Definition: MosaicTool.cpp:115
virtual bool SetCoordinate(const double x, const double y)
This method is used to set the projection x/y.
Configure user&#39;s settings for the grid tool.
double PolarRadius() const
This returns the polar radius of the target.
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:53
QPointer< QCheckBox > m_drawGridCheckBox
True if grid properties come from the open cubes.
double Latitude() const
This returns a latitude with correct latitude type as specified in the label object.
The grid will be drawn using the extents from the bounding rectangle of the open cubes.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void drawGrid()
Creates the GridGraphicsItem that will draw the grid.
QWidget * getToolBarWidget()
Creates the Grid Toolbar Widget.
The distance is being specified in meters.
Definition: Distance.h:56
GridExtentSource latExtents()
The extent type (Map, Cubes, Manual) for the latitude.
QString LongitudeDomainString() const
This method returns the longitude domain as a string.
int m_density
Grid density for drawing the grid.
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
bool showGrid()
True if grid is displayed.
void setLatInc(Angle latInc)
Modify the latitude increment.
void setDensity(int density)
Modify the density.
void onCubesChanged()
Determines whether or not the bounding rectangle was changed by the addition or removal of cubes...
PvlObject toPvl() const
Store the tool information in a pvl object.
QPointer< QCheckBox > m_autoGridCheckBox
True if grid properties come from the open cubes.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
These projections are used to map triaxial and irregular-shaped bodies.
Definition: Projection.h:182
double MaximumLatitude() const
This returns the maximum latitude of the area of interest.
Angle latInc()
The angle of the latitude increment.