All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Curve.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/Curve.cpp
22 
23  \brief Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of coordinates.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../common/Translator.h"
29 #include "Config.h"
30 #include "Curve.h"
31 #include "GEOSWriter.h"
32 
33 #ifdef TERRALIB_GEOS_ENABLED
34 // GEOS
35 #include <geos/geom/Geometry.h>
36 #include <geos/util/GEOSException.h>
37 #endif
38 
40  : Geometry(t, srid, mbr)
41 {
42 }
43 
45  : Geometry(rhs)
46 {
47 }
48 
50 {
51 #ifdef TERRALIB_GEOS_ENABLED
52  std::auto_ptr<geos::geom::Geometry> g(GEOSWriter::write(this));
53 
54  return g->getLength();
55 
56 #else
57  throw Exception(TE_TR("getLength routine is supported by GEOS! Please, enable the GEOS support."));
58 #endif
59 }
60 
62 {
64 
65  return *this;
66 }
67 
69 {
70  return (isClosed() && isSimple());
71 }
72 
74 {
75  return te::gm::L;
76 }
77 
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:77
bool isRing() const
It returns true if the curve is closed and simple.
Definition: Curve.cpp:68
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
Definition: Curve.h:58
virtual double getLength() const
The length of this curve in the unit associated to its spatial reference system.
Definition: Curve.cpp:49
virtual Curve & operator=(const Curve &rhs)
Assignment operator.
Definition: Curve.cpp:61
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:345
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
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
A class that converts a TerraLib geometry to a GEOS geometry.
Curve(GeomType t, int srid=0, Envelope *mbr=0)
It initializes the curve with the specified spatial reference system id and envelope.
Definition: Curve.cpp:39
Dimensionality getDimension() const
Curves are 1-dimensional objects.
Definition: Curve.cpp:73
Configuration flags for the Vector Geometry Model of TerraLib.