All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeometryPropertyWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/property/GeometryPropertyWidget.h
22 
23  \brief Defines the GeometryPropertyWidget class.
24 */
25 
26 // Terralib
27 #include "../../../geometry/Enums.h"
28 #include "../../../geometry/GeometryProperty.h"
29 #include "GeometryPropertyWidget.h"
30 #include "ui_GeometryPropertyWidgetForm.h"
31 
32 
34  : SimplePropertyWidget(parent),
35  m_ui(new Ui::GeometryPropertyWidgetForm)
36 {
37  m_ui->setupUi(this);
38 
39  //fill combo box
40  m_ui->m_typeComboBox->addItem(tr("Geometry"), te::gm::GeometryType);
41  m_ui->m_typeComboBox->addItem(tr("Geometry Z"), te::gm::GeometryZType);
42  m_ui->m_typeComboBox->addItem(tr("Geometry M"), te::gm::GeometryMType);
43  m_ui->m_typeComboBox->addItem(tr("Geometry ZM"), te::gm::GeometryZMType);
44 
45  m_ui->m_typeComboBox->addItem(tr("Point"), te::gm::PointType);
46  m_ui->m_typeComboBox->addItem(tr("Point Z"), te::gm::PointZType);
47  m_ui->m_typeComboBox->addItem(tr("Point M"), te::gm::PointMType);
48  m_ui->m_typeComboBox->addItem(tr("Point ZM"), te::gm::PointZMType);
49  m_ui->m_typeComboBox->addItem(tr("Point K dimensions"), te::gm::PointKdType);
50 
51  m_ui->m_typeComboBox->addItem(tr("Line String"), te::gm::LineStringType);
52  m_ui->m_typeComboBox->addItem(tr("Line String Z"), te::gm::LineStringZType);
53  m_ui->m_typeComboBox->addItem(tr("Line String M"), te::gm::LineStringMType);
54  m_ui->m_typeComboBox->addItem(tr("Line String ZM"), te::gm::LineStringZMType);
55 
56  m_ui->m_typeComboBox->addItem(tr("Circular String"), te::gm::CircularStringType);
57  m_ui->m_typeComboBox->addItem(tr("Circular String Z"), te::gm::CircularStringZType);
58  m_ui->m_typeComboBox->addItem(tr("Circular String M"), te::gm::CircularStringMType);
59  m_ui->m_typeComboBox->addItem(tr("Circular String ZM"), te::gm::CircularStringZMType);
60 
61  m_ui->m_typeComboBox->addItem(tr("Compound Curve"), te::gm::CompoundCurveType);
62  m_ui->m_typeComboBox->addItem(tr("Compound Curve Z"), te::gm::CompoundCurveZType);
63  m_ui->m_typeComboBox->addItem(tr("Compound Curve M"), te::gm::CompoundCurveMType);
64  m_ui->m_typeComboBox->addItem(tr("Compound Curve ZM"), te::gm::CompoundCurveZMType);
65 
66  m_ui->m_typeComboBox->addItem(tr("Polygon"), te::gm::PolygonType);
67  m_ui->m_typeComboBox->addItem(tr("Polygon Z"), te::gm::PolygonZType);
68  m_ui->m_typeComboBox->addItem(tr("Polygon M"), te::gm::PolygonMType);
69  m_ui->m_typeComboBox->addItem(tr("Polygon ZM"), te::gm::PolygonZMType);
70 
71  m_ui->m_typeComboBox->addItem(tr("Curve Polygon"), te::gm::CurvePolygonType);
72  m_ui->m_typeComboBox->addItem(tr("Curve Polygon Z"), te::gm::CurvePolygonZType);
73  m_ui->m_typeComboBox->addItem(tr("Curve Polygon M"), te::gm::CurvePolygonMType);
74  m_ui->m_typeComboBox->addItem(tr("Curve Polygon ZM"), te::gm::CurvePolygonZMType);
75 
76  m_ui->m_typeComboBox->addItem(tr("Geometry Collection"), te::gm::GeometryCollectionType);
77  m_ui->m_typeComboBox->addItem(tr("Geometry Collection Z"), te::gm::GeometryCollectionZType);
78  m_ui->m_typeComboBox->addItem(tr("Geometry Collection M"), te::gm::GeometryCollectionMType);
79  m_ui->m_typeComboBox->addItem(tr("Geometry Collection ZM"), te::gm::GeometryCollectionZMType);
80 
81  m_ui->m_typeComboBox->addItem(tr("Multi Point"), te::gm::MultiPointType);
82  m_ui->m_typeComboBox->addItem(tr("Multi Point Z"), te::gm::MultiPointZType);
83  m_ui->m_typeComboBox->addItem(tr("Multi Point M"), te::gm::MultiPointMType);
84  m_ui->m_typeComboBox->addItem(tr("Multi Point ZM"), te::gm::MultiPointZMType);
85 
86  m_ui->m_typeComboBox->addItem(tr("Multi Line String"), te::gm::MultiLineStringType);
87  m_ui->m_typeComboBox->addItem(tr("Multi Line String Z"), te::gm::MultiLineStringZType);
88  m_ui->m_typeComboBox->addItem(tr("Multi Line String M"), te::gm::MultiLineStringMType);
89  m_ui->m_typeComboBox->addItem(tr("Multi Line String ZM"), te::gm::MultiLineStringZMType);
90 
91  m_ui->m_typeComboBox->addItem(tr("Multi Polygon"), te::gm::MultiPolygonType);
92  m_ui->m_typeComboBox->addItem(tr("Multi Polygon Z"), te::gm::MultiPolygonZType);
93  m_ui->m_typeComboBox->addItem(tr("Multi Polygon M"), te::gm::MultiPolygonMType);
94  m_ui->m_typeComboBox->addItem(tr("Multi Polygon ZM"), te::gm::MultiPolygonZMType);
95 
96  m_ui->m_typeComboBox->addItem(tr("Polyhedral Surface"), te::gm::PolyhedralSurfaceType);
97  m_ui->m_typeComboBox->addItem(tr("Polyhedral Surface Z"), te::gm::PolyhedralSurfaceZType);
98  m_ui->m_typeComboBox->addItem(tr("Polyhedral Surface M"), te::gm::PolyhedralSurfaceMType);
99  m_ui->m_typeComboBox->addItem(tr("Polyhedral Surface ZM"), te::gm::PolyhedralSurfaceZMType);
100 
101  m_ui->m_typeComboBox->addItem(tr("TIN"), te::gm::TINType);
102  m_ui->m_typeComboBox->addItem(tr("TIN Z"), te::gm::TINZType);
103  m_ui->m_typeComboBox->addItem(tr("TIN M"), te::gm::TINMType);
104  m_ui->m_typeComboBox->addItem(tr("TIN ZM"), te::gm::TINZMType);
105 
106  m_ui->m_typeComboBox->addItem(tr("Triangle"), te::gm::TriangleType);
107  m_ui->m_typeComboBox->addItem(tr("Triangle Z"), te::gm::TriangleZType);
108  m_ui->m_typeComboBox->addItem(tr("Triangle M"), te::gm::TriangleMType);
109  m_ui->m_typeComboBox->addItem(tr("Triangle ZM"), te::gm::TriangleZMType);
110 
111  m_ui->m_typeComboBox->addItem(tr("Unknown"), te::gm::UnknownGeometryType);
112 
113 }
114 
116 {
117 
118 }
119 
121 {
122  int index = m_ui->m_typeComboBox->currentIndex();
123  int type = m_ui->m_typeComboBox->itemData(index).toInt();
124 
125  te::gm::GeometryProperty* gp = dynamic_cast<te::gm::GeometryProperty*>(sp);
126 
127  if(gp)
128  {
130 
131  if(m_ui->m_sridLineEdit->text().isEmpty() == false)
132  {
133  bool ok = false;
134  int srid = m_ui->m_sridLineEdit->text().toInt(&ok);
135 
136  if(ok)
137  gp->setSRID(srid);
138  }
139  }
140 }
virtual void fillProperty(te::dt::SimpleProperty *sp)
Geometric property.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.
void setGeometryType(GeomType t)
It sets the geometry subtype.
A base widget for simple properties.
An atomic property like an integer or double.
Defines the GeometryPropertyWidget class.
std::auto_ptr< Ui::GeometryPropertyWidgetForm > m_ui