GeometryFactory.h
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/geometry/GeometryFactory.h
22 
23  \brief This is the Geometry factory for TerraLib geometries.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYFACTORY_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYFACTORY_H
28 
29 // TerraLib
30 #include "../common/Static.h"
31 #include "Geometry.h"
32 #include "GeometryCollection.h"
33 #include "LineString.h"
34 #include "MultiLineString.h"
35 #include "MultiPoint.h"
36 #include "MultiPolygon.h"
37 #include "Point.h"
38 #include "Polygon.h"
39 #include "PolyhedralSurface.h"
40 #include "TIN.h"
41 #include "Triangle.h"
42 
43 namespace te
44 {
45  namespace gm
46  {
47  /*!
48  \class GeometryFactory
49 
50  \brief This is the Geometry factory for TerraLib geometries.
51 
52  \ingroup geometry
53 
54  \sa Geometry,
55  Point, PointM, PointZ, PointZM,
56  Curve, LineString, LinearRing,
57  Surface, Polygon, Triangle, PolyhedralSurface, TIN,
58  GeometryCollection, MultiCurve, MultiSurface,
59  MultiPoint, MultiLineString, MultiPolygon
60  */
62  {
63  public:
64 
65  /*!
66  \brief It returns an instance according to the informed geometry type.
67 
68  \param t The geometry type to be instantiable.
69  \param srid The geometry spatial reference system.
70 
71  \return A geometry object.
72  */
73  static Geometry* make(GeomType t, int srid);
74  };
75 
77  {
78  switch(t)
79  {
80  case PointType:
81  case PointZType:
82  case PointMType:
83  case PointZMType:
84  return new Point(t, srid, 0);
85 
86  case LineStringType:
87  case LineStringZType:
88  case LineStringMType:
89  case LineStringZMType:
90  return new LineString(t, srid, 0);
91 
92  case PolygonType:
93  case PolygonZType:
94  case PolygonMType:
95  case PolygonZMType:
96  return new Polygon(0, t, srid, 0);
97 
98  case MultiPointType:
99  case MultiPointZType:
100  case MultiPointMType:
101  case MultiPointZMType:
102  return new MultiPoint(0, t, srid, 0);
103 
104  case MultiLineStringType:
108  return new MultiLineString(0, t, srid, 0);
109 
110  case MultiPolygonType:
111  case MultiPolygonZType:
112  case MultiPolygonMType:
113  case MultiPolygonZMType:
114  return new MultiPolygon(0, t, srid, 0);
115 
116  case MultiSurfaceType:
117  case MultiSurfaceZType:
118  case MultiSurfaceMType:
119  case MultiSurfaceZMType:
120  return new MultiSurface(0, t, srid, 0);
121 
126  return new GeometryCollection(0, t, srid, 0);
127 
128  case TriangleType:
129  case TriangleZType:
130  case TriangleMType:
131  case TriangleZMType:
132  return new Triangle(t, srid, 0);
133 
134  case TINType:
135  case TINZType:
136  case TINMType:
137  case TINZMType:
138  return new TIN(0, t, srid, 0);
139 
144  return new PolyhedralSurface(0, t, srid, 0);
145 
146  default:
147  return 0;
148  }
149  }
150 
151  } // end namespace gm
152 } // end namespace te
153 
154 #endif // __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYFACTORY_H
155 
te::mnt::TIN
@ TIN
Definition: Enums.h:81
te::gm::TINZMType
@ TINZMType
Definition: Enums.h:112
te::gm::MultiPoint
MultiPoint is a GeometryCollection whose elements are restricted to points.
Definition: MultiPoint.h:54
te::gm::PointZMType
@ PointZMType
Definition: Enums.h:51
MultiPoint.h
MultiPoint is a GeometryCollection whose elements are restricted to points.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::gm::PolyhedralSurfaceMType
@ PolyhedralSurfaceMType
Definition: Enums.h:106
te::gm::TINMType
@ TINMType
Definition: Enums.h:111
Point.h
A point with x and y coordinate values.
te::gm::TINType
@ TINType
Definition: Enums.h:109
te::gm::GeometryCollectionZType
@ GeometryCollectionZType
Definition: Enums.h:80
te::gm::MultiPointZType
@ MultiPointZType
Definition: Enums.h:85
te::gm::MultiLineStringMType
@ MultiLineStringMType
Definition: Enums.h:91
te::gm::PolygonType
@ PolygonType
Definition: Enums.h:69
te::gm::MultiPointType
@ MultiPointType
Definition: Enums.h:84
te::gm::MultiPolygonZMType
@ MultiPolygonZMType
Definition: Enums.h:97
te::gm::GeometryFactory::make
static Geometry * make(GeomType t, int srid)
It returns an instance according to the informed geometry type.
Definition: GeometryFactory.h:76
Geometry.h
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
te::gm::TriangleZMType
@ TriangleZMType
Definition: Enums.h:117
PolyhedralSurface.h
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments.
te::gm::MultiPointZMType
@ MultiPointZMType
Definition: Enums.h:87
te::gm::PolyhedralSurface
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments.
Definition: PolyhedralSurface.h:58
te::gm::TriangleType
@ TriangleType
Definition: Enums.h:114
TEGEOMEXPORT
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
te::gm::PolyhedralSurfaceType
@ PolyhedralSurfaceType
Definition: Enums.h:104
te::gm::GeometryCollection
It is a collection of other geometric objects.
Definition: GeometryCollection.h:58
te::gm::GeometryCollectionMType
@ GeometryCollectionMType
Definition: Enums.h:81
Polygon.h
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
te::gm::Polygon
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
te::gm::LineStringType
@ LineStringType
Definition: Enums.h:54
te::gm::PointType
@ PointType
Definition: Enums.h:48
te::gm::GeometryCollectionZMType
@ GeometryCollectionZMType
Definition: Enums.h:82
te::gm::PointMType
@ PointMType
Definition: Enums.h:50
LineString.h
LineString is a curve with linear interpolation between points.
te::gm::MultiSurfaceMType
@ MultiSurfaceMType
Definition: Enums.h:101
Triangle.h
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
te::gm::TINZType
@ TINZType
Definition: Enums.h:110
te::gm::MultiPolygonType
@ MultiPolygonType
Definition: Enums.h:94
te::gm::MultiPolygonMType
@ MultiPolygonMType
Definition: Enums.h:96
te::gm::MultiPolygon
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:51
te::gm::MultiPointMType
@ MultiPointMType
Definition: Enums.h:86
te::gm::MultiSurfaceType
@ MultiSurfaceType
Definition: Enums.h:99
te::gm::MultiSurfaceZType
@ MultiSurfaceZType
Definition: Enums.h:100
te::gm::LineStringMType
@ LineStringMType
Definition: Enums.h:56
te::gm::LineString
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
te::gm::MultiSurfaceZMType
@ MultiSurfaceZMType
Definition: Enums.h:102
te::gm::PolyhedralSurfaceZType
@ PolyhedralSurfaceZType
Definition: Enums.h:105
MultiLineString.h
MultiLineString is a MultiCurve whose elements are LineStrings.
te::gm::PointZType
@ PointZType
Definition: Enums.h:49
te::common::Static
A base type for static classes.
Definition: Static.h:44
te::gm::LineStringZMType
@ LineStringZMType
Definition: Enums.h:57
te::gm::LineStringZType
@ LineStringZType
Definition: Enums.h:55
TIN.h
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches.
te::gm::PolygonZMType
@ PolygonZMType
Definition: Enums.h:72
te::gm::TriangleMType
@ TriangleMType
Definition: Enums.h:116
te::gm::Triangle
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
Definition: Triangle.h:51
te::gm::MultiLineStringType
@ MultiLineStringType
Definition: Enums.h:89
te::gm::MultiLineStringZType
@ MultiLineStringZType
Definition: Enums.h:90
te::gm::MultiLineString
MultiLineString is a MultiCurve whose elements are LineStrings.
Definition: MultiLineString.h:55
te::gm::MultiLineStringZMType
@ MultiLineStringZMType
Definition: Enums.h:92
GeometryCollection.h
It is a collection of other geometric objects.
te::gm::PolyhedralSurfaceZMType
@ PolyhedralSurfaceZMType
Definition: Enums.h:107
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::gm::PolygonZType
@ PolygonZType
Definition: Enums.h:70
te::gm::MultiPolygonZType
@ MultiPolygonZType
Definition: Enums.h:95
te::gm::GeomType
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
MultiPolygon.h
MultiPolygon is a MultiSurface whose elements are Polygons.
te::gm::TriangleZType
@ TriangleZType
Definition: Enums.h:115
te::gm::Point
A point with x and y coordinate values.
Definition: Point.h:51
te::gm::GeometryFactory
This is the Geometry factory for TerraLib geometries.
Definition: GeometryFactory.h:62
te::gm::GeometryCollectionType
@ GeometryCollectionType
Definition: Enums.h:79
te::gm::MultiSurface
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
Definition: MultiSurface.h:55
te::gm::PolygonMType
@ PolygonMType
Definition: Enums.h:71