1#include "MosaicGridToolConfigDialog.h"
7#include <QDoubleValidator>
8#include <QElapsedTimer>
18#include "IException.h"
21#include "MosaicGridTool.h"
22#include "MosaicGridToolConfigDialog.h"
23#include "MosaicSceneWidget.h"
24#include "Projection.h"
43 setWindowTitle(
"Grid Options");
45 QGridLayout *mainLayout =
new QGridLayout;
46 setLayout(mainLayout);
50 QString showGridWhatsThis =
51 "Check or uncheck to draw or clear the grid.";
52 QLabel *showGridLabel =
new QLabel(
"&Show Grid");
53 showGridLabel->setWhatsThis(showGridWhatsThis);
54 mainLayout->addWidget(showGridLabel, row, 0, 1, 2);
64 QString autoGridWhatsThis =
65 "Draws a grid based on the current lat/lon extents (from the cubes, map, or user).";
66 QLabel *autoGridLabel =
new QLabel(
"Auto &Grid");
67 autoGridLabel->setWhatsThis(autoGridWhatsThis);
68 mainLayout->addWidget(autoGridLabel, row, 0, 1, 2);
78 QString baseLatWhatsThis =
79 "The origin for the first latitude line. The first line of the grid "
80 "will be drawn at the base latitude. Successive latitude lines will "
81 "then be drawn relative to base latitude at an increment defined by "
82 "the latitude increment. Base latitude can be outside the range of "
106 QString baseLonWhatsThis =
107 "The origin for the first longitude line. The first line of the grid"
108 " will be drawn at the base longitude. Successive longitude lines will"
109 " then be drawn relative to base longitude at an increment defined by"
110 " the longitude increment. Base longitude can be outside the range of"
134 QString latIncWhatsThis =
135 "The latitude increment is how often a line is drawn as the latitude "
136 "values change. A latitude increment of 45 will result in a line at "
137 "latitude = -90, -45, 0, 45, 90 for the entire longitude range.";
160 QString lonIncWhatsThis =
161 "The longitude increment is how often a line is drawn as the longitude "
162 "values change. A longitude increment of 180 will result in a line at "
163 "longitude = 0, 180, 360 for the entire latitude range.";
185 mainLayout->setRowMinimumHeight(row, 10);
188 QString latExtentWhatsThis =
189 "The longitude range determines the extents of the grid. The \"Read Map File\" option will "
190 "derive the extents from the loaded map's projection. The \"Compute From Images\" option "
191 "will use the ranges covered by the open cubes. The \"Manual\" option allows you to enter "
192 "values of your choice.";
201 m_latExtentCombo->setCurrentIndex(m_latExtentCombo->findData(m_tool->
latExtents()));
202 m_latExtentCombo->setWhatsThis(latExtentWhatsThis);
203 connect(m_latExtentCombo, SIGNAL(currentIndexChanged(
int)),
205 mainLayout->addWidget(m_latExtentCombo, row, 2, 1, 2);
206 m_latExtentTypeLabel =
new QLabel(m_tool->
latType());
207 mainLayout->addWidget(m_latExtentTypeLabel, row, 4, 1, 1);
211 QString minLatWhatsThis =
212 "The minimum latitude will be the lower edge of the grid. This parameter currently "
213 "expects degree input.";
231 m_minLatExtentTypeLabel =
new QLabel(
"Degrees");
232 mainLayout->addWidget(m_minLatExtentTypeLabel, row, 4, 1, 1);
235 QString maxLatWhatsThis =
236 "The maximum latitude will be the upper edge of the grid. This parameter currently "
237 "expects degree input.";
255 m_maxLatExtentTypeLabel =
new QLabel(
"Degrees");
256 mainLayout->addWidget(m_maxLatExtentTypeLabel, row, 4, 1, 1);
258 mainLayout->setRowMinimumHeight(row, 10);
261 QString lonExtentWhatsThis =
262 "The longitude range determines the extents of the grid. The \"<b>Read Map File</b>\" "
263 "option will derive the extents from the loaded map's projection. The"
264 "\"Compute From Images\" option will use the ranges covered by the open cubes. The "
265 "\"Manual\" option allows you to enter "
266 "values of your choice. The domain is that of the map projection.";
276 m_lonExtentCombo->setCurrentIndex(m_lonExtentCombo->findData(m_tool->
lonExtents()));
277 m_lonExtentCombo->setWhatsThis(lonExtentWhatsThis);
278 connect(m_lonExtentCombo, SIGNAL(currentIndexChanged(
int)),
280 mainLayout->addWidget(m_lonExtentCombo, row, 2, 1, 2);
286 QString minLonWhatsThis =
287 "The maximum longitude will be the left edge of the grid. This parameter currently "
288 "expects degree input.";
306 m_minLonExtentTypeLabel =
new QLabel(
"Degrees");
307 mainLayout->addWidget(m_minLonExtentTypeLabel, row, 4, 1, 1);
310 QString maxLonWhatsThis =
311 "The maximum longitude will be the right edge of the grid. This parameter currently "
312 "expects degree input.";
330 m_maxLonExtentTypeLabel =
new QLabel(
"Degrees");
331 mainLayout->addWidget(m_maxLonExtentTypeLabel, row, 4, 1, 1);
333 mainLayout->setRowMinimumHeight(row, 10);
336 QString densityWhatsThis =
337 "The density is the estimated total number of straight lines used "
338 "to create the grid. Increasing this number will significantly slow "
339 "down the drawing of the grid while making curves more accurate. If "
340 "the grid does not look accurate then try increasing this number.";
346 m_densityEdit->setValidator(
new QIntValidator(1, INT_MAX,
this));
352 mainLayout->setRowMinimumHeight(row, 10);
355 QHBoxLayout *buttonsAreaLayout =
new QHBoxLayout;
356 mainLayout->addLayout(buttonsAreaLayout, row, 0, 1, 4);
358 QString autoApplyWhatsThis =
359 "Automatically updates the grid when parameters are changed.";
364 buttonsAreaLayout->addStretch();
366 QPushButton *okayButton =
new QPushButton(
"&Ok");
367 okayButton->setIcon(QIcon::fromTheme(
"dialog-ok"));
368 connect(okayButton, SIGNAL(clicked()),
370 connect(okayButton, SIGNAL(clicked()),
371 this, SLOT(accept()));
372 buttonsAreaLayout->addWidget(okayButton);
374 QPushButton *applyButton =
new QPushButton(
"&Apply");
375 applyButton->setIcon(QIcon::fromTheme(
"dialog-ok-apply"));
376 connect(applyButton, SIGNAL(clicked()),
378 buttonsAreaLayout->addWidget(applyButton);
380 QPushButton *cancelButton =
new QPushButton(
"&Cancel");
381 cancelButton->setIcon(QIcon::fromTheme(
"dialog-cancel"));
382 connect(cancelButton, SIGNAL(clicked()),
383 this, SLOT(reject()));
384 buttonsAreaLayout->addWidget(cancelButton);
386 connect(m_tool, SIGNAL(boundingRectChanged()),
this, SLOT(
readSettings()));
409 QValidator::State validBaseLat =
411 if (validBaseLat != QValidator::Acceptable) {
413 "Base Latitude value must be in the range -90 to 90",
420 QValidator::State validBaseLon =
422 if (validBaseLon != QValidator::Acceptable) {
424 "Base Longitude value must be a double",
430 QValidator::State validLatInc =
m_latIncLineEdit->validator()->validate(latitudeInc,
432 if (validLatInc != QValidator::Acceptable) {
434 "Latitude increment must be in the range 0 to 180",
440 QValidator::State validLonInc =
442 if (validLonInc != QValidator::Acceptable) {
444 "Longitude increment must be a double",
450 QValidator::State validMinLatExtent =
452 if (validMinLatExtent != QValidator::Acceptable) {
454 "Minimum latitude extent must be a double",
460 QValidator::State validMaxLatExtent =
462 if (validMaxLatExtent != QValidator::Acceptable) {
464 "Maximum latitude extent must be a double",
470 QValidator::State validMinLonExtent =
472 if (validMinLonExtent != QValidator::Acceptable) {
474 "Minimum longitude extent must be a double",
480 QValidator::State validMaxLonExtent =
482 if (validMaxLonExtent != QValidator::Acceptable) {
484 "Maximum longitude extent must be a double",
490 QValidator::State validDensity =
492 if (validDensity != QValidator::Acceptable) {
494 "Density must be a non-zero positive integer",
510 m_latExtentCombo->itemData(m_latExtentCombo->currentIndex()).toInt(),
514 m_lonExtentCombo->itemData(m_lonExtentCombo->currentIndex()).toInt(),
527 if (shouldReadSettings)
560 m_latExtentCombo->setCurrentIndex(m_latExtentCombo->findData(m_tool->
latExtents()));
561 if (m_tool->
sceneWidget()->getProjection()->Mapping()[
"LatitudeType"][0] ==
579 m_lonExtentCombo->setCurrentIndex(m_lonExtentCombo->findData(m_tool->
lonExtents()));
612 bool enabled = m_tool->
sceneWidget()->getProjection();
616 m_latExtentCombo->itemData(m_latExtentCombo->currentIndex()).
toInt() ==
619 m_lonExtentCombo->itemData(m_lonExtentCombo->currentIndex()).
toInt() ==
659 m_latExtentCombo->setEnabled(showGrid);
660 m_latExtentTypeLabel->setEnabled(showGrid);
669 m_minLatExtentTypeLabel->setEnabled(enableLatExtents);
678 m_maxLatExtentTypeLabel->setEnabled(enableLatExtents);
681 m_lonExtentCombo->setEnabled(showGrid);
686 m_tool->domainMaxLon().
degrees());
692 m_minLonExtentTypeLabel->setEnabled(enableLonExtents);
696 m_tool->domainMaxLon().
degrees());
702 m_maxLonExtentTypeLabel->setEnabled(enableLonExtents);
718 if (timer.elapsed() > 250) {
796 if (timer.elapsed() > 250)
Defines an angle and provides unit conversions.
double degrees() const
Get the angle in units of Degrees.
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
@ Unknown
A type of error that cannot be classified as any of the other error types.
This class is designed to encapsulate the concept of a Latitude.
double planetographic(Angle::Units units=Angle::Radians) const
Get the latitude in the planetographic coordinate system.
This class is designed to encapsulate the concept of a Longitude.
Contains multiple PvlContainers.
This is free and unencumbered software released into the public domain.
int toInt(const QString &string)
Global function to convert from a string to an integer.