All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Surface.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/geometry/Surface.cpp
22 
23  \brief Surface is an abstract class that represents a 2-dimensional geometric objects.
24 */
25 
26 // TerraLib
27 #include "../common/Translator.h"
28 #include "Surface.h"
29 #include "GEOSWriter.h"
30 
31 #ifdef TERRALIB_GEOS_ENABLED
32 // GEOS
33 #include <geos/geom/Geometry.h>
34 #include <geos/util/GEOSException.h>
35 #endif
36 
38  : Geometry(t, srid, mbr)
39 {
40 }
41 
43  : Geometry(rhs)
44 {
45 }
46 
48 {
49 #ifdef TERRALIB_GEOS_ENABLED
50  std::auto_ptr<geos::geom::Geometry> g(GEOSWriter::write(this));
51 
52  return g->getLength();
53 
54 #else
55  throw Exception(TE_TR("getLength routine is supported by GEOS! Please, enable the GEOS support."));
56 #endif
57 }
58 
60 {
62 
63  return *this;
64 }
65 
67 {
68  return te::gm::A;
69 }
70 
Dimensionality getDimension() const
Surfaces are 2-dimensional objects.
Definition: Surface.cpp:66
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
virtual Geometry & operator=(const Geometry &rhs)
Assignment operator.
Definition: Geometry.cpp:78
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:347
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Dimensionality
From Wikipedia: "in mathematics, the dimension of an object is an intrinsic property, independent of the space in which the object may happen to be embedded".
Definition: Enums.h:142
Surface is an abstract class that represents a 2-dimensional geometric objects.
virtual Surface & operator=(const Surface &rhs)
Assignment operator.
Definition: Surface.cpp:59
virtual double getPerimeter() const =0
It returns the length of the boundary for the surface.
Definition: Surface.cpp:47
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
A class that converts a TerraLib geometry to a GEOS geometry.
Surface(GeomType t, int srid=0, Envelope *mbr=0)
It initializes the surface with the specified spatial reference system id and envelope.
Definition: Surface.cpp:37
Surface is an abstract class that represents a 2-dimensional geometric objects.
Definition: Surface.h:54