All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiSurface.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/MultiSurface.cpp
22 
23  \brief MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surfaces.
24 */
25 
26 // TerraLib
27 #include "MultiSurface.h"
28 #include "Surface.h"
29 
30 // STL
31 #include <cassert>
32 
33 te::gm::MultiSurface::MultiSurface(std::size_t nGeom, GeomType t, int srid, Envelope* mbr)
34  : GeometryCollection(nGeom, t, srid, mbr)
35 {
36 }
37 
39  : GeometryCollection(rhs)
40 {
41 }
42 
44 {
46 
47  return *this;
48 }
49 
51 {
52  return new MultiSurface(*this);
53 }
54 
56 {
57  double sum = 0.0;
58 
59  std::size_t n = m_geometries.size();
60 
61  for(std::size_t i = 0; i < n; ++i)
62  {
63  Surface* surface = static_cast<Surface*>(m_geometries[i]);
64  assert(surface);
65 
66  sum += surface->getArea();
67  }
68 
69  return sum;
70 }
71 
73 {
74  return 0;
75 }
76 
78 {
79  return 0;
80 }
81 
83 {
84  return 0;
85 }
86 
88 {
89  return 0;
90 }
91 
93 {
94  return 0.0;
95 }
96 
98 {
99  return te::gm::A;
100 }
101 
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
Definition: MultiSurface.h:54
virtual MultiSurface & operator=(const MultiSurface &rhs)
Assignment operator.
double getPerimeter() const
It returns the length of the boundary for the surface.
Coord2D * getCentroidCoord() const
It returns the mathematical centroid for this MultiSurface as a coordinate.
double getArea() const
It returns the area of this MultiSurface, as measured in the spatial reference system of this multisu...
Point * getPointOnSurface() const
It returns a point guaranteed to be on this MultiSurface.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
GeometryCollection & operator=(const GeometryCollection &rhs)
Assignment operator.
TE_DEFINE_VISITABLE MultiSurface(std::size_t nGeom, GeomType t, int srid=0, Envelope *mbr=0)
It initializes the Geometry with the specified spatial reference system id and envelope.
Dimensionality
From Wikipedia: &quot;in mathematics, the dimension of an object is an intrinsic property, independent of the space in which the object may happen to be embedded&quot;.
Definition: Enums.h:142
virtual double getArea() const =0
It returns the area of the surface measured in the spatial reference system of the surface...
Dimensionality getDimension() const
MultiSurface is 2-dimenional.
A point with x and y coordinate values.
Definition: Point.h:50
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
It is a collection of other geometric objects.
Point * getCentroid() const
It returns the mathematical centroid for this MultiSurface as a point.
Coord2D * getCoordOnSurface() const
It returns a coordinate guaranteed to be on this MultiSurface.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
virtual te::dt::AbstractData * clone() const
It clones the multi surface.
Surface is an abstract class that represents a 2-dimensional geometric objects.
Definition: Surface.h:54
Surface is an abstract class that represents a 2-dimensional geometric objects.