geometry/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 "../core/translator/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 
44  = default;
45 
47 {
48 #ifdef TERRALIB_GEOS_ENABLED
49  std::unique_ptr<geos::geom::Geometry> g(GEOSWriter::write(this));
50 
51  return g->getLength();
52 
53 #else
54  throw Exception(TE_TR("getLength routine is supported by GEOS! Please, enable the GEOS support."));
55 #endif
56 }
57 
59 
61 {
62  return te::gm::A;
63 }
64 
Dimensionality getDimension() const
Surfaces are 2-dimensional objects.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Base exception class for plugin module.
virtual double getPerimeter() const =0
It returns the length of the boundary for the surface.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
An Envelope defines a 2D rectangular region.
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".
Surface is an abstract class that represents a 2-dimensional geometric objects.
virtual Surface & operator=(const Surface &rhs)
Assignment operator.
static geos::geom::Geometry * write(const Geometry *teGeom)
It reads a TerraLib geometry and make a GEOS geometry.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
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.
Surface is an abstract class that represents a 2-dimensional geometric objects.
Definition: Surface.h:54