28 #include "../../../srs/SpatialReferenceSystemManager.h" 30 #include <ui_SRSDialogForm.h> 31 #include <QApplication> 32 #include <QMessageBox> 40 m_ui(new
Ui::SRSDialogForm),
49 m_ui->m_helpPushButton->setPageReference(
"widgets/srs/srs.html");
51 m_ui->m_authority->setPlainText(
"USER");
58 unsigned int srid,
const std::string& name,
const std::string& p4desc):
60 m_ui(new
Ui::SRSDialogForm),
69 m_ui->m_helpPushButton->setPageReference(
"widgets/srs/srs.html");
71 m_ui->m_authority->setPlainText(
"USER");
75 m_ui->m_srid->setPlainText(sridt);
76 m_ui->m_name->setPlainText(name.c_str());
77 m_ui->m_p4desc->setPlainText(p4desc.c_str());
88 if (
m_ui->m_name->toPlainText().isEmpty())
90 QMessageBox::warning(
this, tr(
"SRS Dialog"), tr(
"Inform a name for the new SRS."));
94 if (
m_ui->m_p4desc->toPlainText().isEmpty())
96 QMessageBox::warning(
this, tr(
"SRS Dialog"), tr(
"Inform the PROJ.4 description for the new SRS."));
101 std::string name =
m_ui->m_name->toPlainText().toUtf8().data();
113 QMessageBox::warning(
this, tr(
"SRS Dialog"), tr(
"There is already a SRS with the given name. Please inform a different name."));
117 name =
m_ui->m_p4desc->toPlainText().toUtf8().data();
130 QMessageBox::warning(
this, tr(
"SRS Dialog"), tr(
"There is already a SRS with the PROJ.4 description. Please inform a different description."));
134 QString proj4 =
m_ui->m_p4desc->toPlainText();
137 QStringList list = proj4.split(rx, QString::SkipEmptyParts);
139 if (list.size() < 2 ||
140 (!list[0].contains(
"+proj=",Qt::CaseInsensitive) &&
141 !list[0].contains(
"+proj =",Qt::CaseInsensitive)))
143 QMessageBox::warning(
this, tr(
"SRS Dialog"), tr(
"PROJ.4 description is not valid."));
156 std::string
id =
m_ui->m_srid->toPlainText().toUtf8().data();
157 return boost::lexical_cast<
unsigned int >(id);
162 return m_ui->m_name->toPlainText().toUtf8().data();
167 return m_ui->m_p4desc->toPlainText().toUtf8().data();
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.