00001
00002
00003
00004
00005
00006
00007 #include "DlgImportAdvanced.h"
00008 #include "Logger.h"
00009 #include "MainWindow.h"
00010 #include <QGridLayout>
00011 #include <QLabel>
00012 #include <QRadioButton>
00013 #include <QSpinBox>
00014
00015 const int MINIMUM_DIALOG_WIDTH_COORDS = 800;
00016
00017 DlgImportAdvanced::DlgImportAdvanced(MainWindow &mainWindow) :
00018 DlgSettingsAbstractBase (tr ("Import Advanced"),
00019 "DlgImportAdvanced",
00020 mainWindow)
00021 {
00022 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::DlgImportAdvanced";
00023
00024 QWidget *subPanel = createSubPanel ();
00025 finishPanel (subPanel,
00026 MINIMUM_DIALOG_WIDTH_COORDS);
00027
00028
00029 enableOk (true);
00030 setDisableOkAtStartup (false);
00031 }
00032
00033 void DlgImportAdvanced::createOptionalSaveDefault (QHBoxLayout * )
00034 {
00035 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::createOptionalSaveDefault";
00036 }
00037
00038 QWidget *DlgImportAdvanced::createSubPanel ()
00039 {
00040 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::createSubPanel";
00041
00042 QWidget *subPanel = new QWidget ();
00043 QGridLayout *layout = new QGridLayout (subPanel);
00044 subPanel->setLayout (layout);
00045
00046 int row = 0;
00047
00048
00049 QLabel *labelCoordCount = new QLabel (tr ("Coordinate System Count:"));
00050 layout->addWidget (labelCoordCount, row, 1);
00051
00052 m_spinCoordSystemCount = new QSpinBox;
00053 m_spinCoordSystemCount->setMinimum (1);
00054 m_spinCoordSystemCount->setValue (1);
00055 m_spinCoordSystemCount->setWhatsThis (tr ("Coordinate System Count\n\n"
00056 "Specifies the total number of coordinate systems that will be used in the imported image. "
00057 "There can be one or more graphs in the image, and each graph can have one or more "
00058 "coordinate systems. Each coordinate system is defined by a pair of coordinate axes."));
00059 connect (m_spinCoordSystemCount, SIGNAL (valueChanged (const QString &)), this, SLOT (slotCoordSystemCount (const QString &)));
00060 layout->addWidget (m_spinCoordSystemCount, row++, 2);
00061
00062
00063 QLabel *labelPointCount = new QLabel (tr ("Graph Coordinates Definition:"));
00064 layout->addWidget (labelPointCount, row, 1);
00065
00066 m_btnAxesPointCount2 = new QRadioButton (tr ("1 scale bar - Used for maps with a scale bar defining the map scale"));
00067 m_btnAxesPointCount2->setWhatsThis (tr ("The two endpoints of the scale bar will define the scale of a map. The scale bar can "
00068 "edited to set its length.\n\n"
00069 "This setting is used when importing a map that has only a scale bar "
00070 "to define distance, rather than a graph with axes that define two coordinates."));
00071 connect (m_btnAxesPointCount2, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
00072 layout->addWidget (m_btnAxesPointCount2, row++, 2);
00073
00074 m_btnAxesPointCount3 = new QRadioButton (tr ("3 axis points - Used for graphs with both coordinates defined on each axis"));
00075 m_btnAxesPointCount3->setChecked (true);
00076 m_btnAxesPointCount3->setWhatsThis (tr ("Three axes points will define the coordinate system. Each will have both "
00077 "x and y coordinates.\n\n"
00078 "This setting is always used when importing images in non-advanced mode.\n\n"
00079 "In total, there will be three points as (x1,y1), (x2,y2) "
00080 "and (x3,y3)."));
00081 connect (m_btnAxesPointCount3, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
00082 layout->addWidget (m_btnAxesPointCount3, row++, 2);
00083
00084 m_btnAxesPointCount4 = new QRadioButton (tr ("4 axis points - Used for graphs with only one coordinate defined on each axis"));
00085 m_btnAxesPointCount4->setWhatsThis (tr ("Four axes points will define the coordinate system. Each will have a single "
00086 "x or y coordinate.\n\n"
00087 "This setting is required when the x coordinate of the y axis is unknown, and/or "
00088 "the y coordinate of the x axis is unknown.\n\n"
00089 "In total, there will be two points on the x axis as (x1) and "
00090 "(x2), and two points on the y axis as (y1) and (y2)."));
00091 connect (m_btnAxesPointCount4, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
00092 layout->addWidget (m_btnAxesPointCount4, row++, 2);
00093
00094 return subPanel;
00095 }
00096
00097 DocumentAxesPointsRequired DlgImportAdvanced::documentAxesPointsRequired () const
00098 {
00099 if (m_btnAxesPointCount2->isChecked ()) {
00100 return DOCUMENT_AXES_POINTS_REQUIRED_2;
00101 } else if (m_btnAxesPointCount3->isChecked ()) {
00102 return DOCUMENT_AXES_POINTS_REQUIRED_3;
00103 } else {
00104 return DOCUMENT_AXES_POINTS_REQUIRED_4;
00105 }
00106 }
00107
00108 void DlgImportAdvanced::handleOk()
00109 {
00110 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::handleOk";
00111
00112 setResult (QDialog::Accepted);
00113
00114 hide ();
00115 }
00116
00117 void DlgImportAdvanced::load(CmdMediator & )
00118 {
00119 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::load";
00120 }
00121
00122 unsigned int DlgImportAdvanced::numberCoordSystem () const
00123 {
00124 return m_spinCoordSystemCount->value ();
00125 }
00126
00127 void DlgImportAdvanced::setSmallDialogs(bool )
00128 {
00129 }
00130
00131 void DlgImportAdvanced::slotAxesPointCount (bool)
00132 {
00133 LOG4CPP_INFO_S ((*mainCat)) << "DlgCoordSystem::slotAxesPointCount";
00134 }
00135
00136 void DlgImportAdvanced::slotCoordSystemCount (const QString &)
00137 {
00138 LOG4CPP_INFO_S ((*mainCat)) << "DlgCoordSystem::slotImportAdvanced";
00139 }
00140