Loading...
Searching...
No Matches
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
43namespace 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:
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
108 return new MultiLineString(0, t, srid, 0);
109
110 case MultiPolygonType:
114 return new MultiPolygon(0, t, srid, 0);
115
116 case MultiSurfaceType:
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
It is a collection of other geometric objects.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
LineString is a curve with linear interpolation between points.
MultiLineString is a MultiCurve whose elements are LineStrings.
MultiPoint is a GeometryCollection whose elements are restricted to points.
MultiPolygon is a MultiSurface whose elements are Polygons.
A point with x and y coordinate values.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments.
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches.
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
A base type for static classes.
Definition Static.h:44
It is a collection of other geometric objects.
This is the Geometry factory for TerraLib geometries.
static Geometry * make(GeomType t, int srid)
It returns an instance according to the informed geometry type.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition Geometry.h:78
LineString is a curve with linear interpolation between points.
Definition LineString.h:65
MultiLineString is a MultiCurve whose elements are LineStrings.
MultiPoint is a GeometryCollection whose elements are restricted to points.
Definition MultiPoint.h:54
MultiPolygon is a MultiSurface whose elements are Polygons.
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
A point with x and y coordinate values.
Definition Point.h:51
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition Polygon.h:51
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments.
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches.
Definition TIN.h:51
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
Definition Triangle.h:51
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition Enums.h:42
@ PolygonMType
Definition Enums.h:71
@ MultiPointMType
Definition Enums.h:86
@ PolygonZMType
Definition Enums.h:72
@ PolygonZType
Definition Enums.h:70
@ MultiLineStringType
Definition Enums.h:89
@ MultiSurfaceZType
Definition Enums.h:100
@ MultiSurfaceMType
Definition Enums.h:101
@ PointType
Definition Enums.h:48
@ PolygonType
Definition Enums.h:69
@ TINMType
Definition Enums.h:111
@ MultiPointZType
Definition Enums.h:85
@ MultiPolygonZType
Definition Enums.h:95
@ PointZType
Definition Enums.h:49
@ GeometryCollectionMType
Definition Enums.h:81
@ MultiLineStringZType
Definition Enums.h:90
@ TriangleMType
Definition Enums.h:116
@ MultiPolygonMType
Definition Enums.h:96
@ LineStringType
Definition Enums.h:54
@ TINZMType
Definition Enums.h:112
@ PointZMType
Definition Enums.h:51
@ TINZType
Definition Enums.h:110
@ LineStringZType
Definition Enums.h:55
@ PolyhedralSurfaceZMType
Definition Enums.h:107
@ GeometryCollectionZType
Definition Enums.h:80
@ PolyhedralSurfaceType
Definition Enums.h:104
@ GeometryCollectionZMType
Definition Enums.h:82
@ MultiPolygonType
Definition Enums.h:94
@ LineStringZMType
Definition Enums.h:57
@ MultiLineStringMType
Definition Enums.h:91
@ MultiPointZMType
Definition Enums.h:87
@ PolyhedralSurfaceMType
Definition Enums.h:106
@ MultiSurfaceZMType
Definition Enums.h:102
@ TINType
Definition Enums.h:109
@ MultiLineStringZMType
Definition Enums.h:92
@ TriangleZType
Definition Enums.h:115
@ MultiSurfaceType
Definition Enums.h:99
@ GeometryCollectionType
Definition Enums.h:79
@ TriangleZMType
Definition Enums.h:117
@ PolyhedralSurfaceZType
Definition Enums.h:105
@ PointMType
Definition Enums.h:50
@ MultiPolygonZMType
Definition Enums.h:97
@ MultiPointType
Definition Enums.h:84
@ LineStringMType
Definition Enums.h:56
@ TriangleType
Definition Enums.h:114
TerraLib.
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:76