All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Point.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/Point.cpp
22 
23  \brief A point with x and y coordinate values.
24 */
25 
26 // TerraLib
27 #include "Point.h"
28 
29 // STL
30 #include <cassert>
31 
32 const std::string te::gm::Point::sm_typeName("Point");
33 
35 
36 te::gm::Point::Point(const double& x, const double& y, int srid, Envelope* mbr)
37  : AbstractPoint(PointType, srid, mbr),
38  m_x(x),
39  m_y(y)
40 {
41 }
42 
44  : AbstractPoint(PointType, srid, mbr),
45  m_x(sm_notNumber),
46  m_y(sm_notNumber)
47 {
48 }
49 
51  : AbstractPoint(rhs),
52  m_x(rhs.m_x),
53  m_y(rhs.m_y)
54 {
55 }
56 
58 {
59  if(this != &rhs)
60  {
62 
63  m_x = rhs.m_x;
64  m_y = rhs.m_y;
65  }
66 
67  return *this;
68 }
69 
71 {
72  return new Point(*this);
73 }
74 
75 void te::gm::Point::setZ(const double& /*z*/)
76 {
77 }
78 
79 void te::gm::Point::setM(const double& /*m*/)
80 {
81 }
82 
84  : AbstractPoint(t, srid, mbr),
85  m_x(sm_notNumber),
86  m_y(sm_notNumber)
87 {
88 }
89 
90 te::gm::Point::Point(GeomType t, int srid, Envelope* mbr, const double& x, const double& y)
91  : AbstractPoint(t, srid, mbr),
92  m_x(x),
93  m_y(y)
94 {
95 }
96 
97 
static const std::string sm_typeName
Geometry type name for Point.
Definition: Point.h:227
static const double sm_notNumber
Just a special value to return in the case of a invalid Geometry.
Definition: Point.h:228
virtual te::dt::AbstractData * clone() const
It clones the point.
Definition: Point.cpp:70
virtual AbstractPoint & operator=(const AbstractPoint &rhs)
Assignment operator.
double m_x
The Point x-coordinate value.
Definition: Point.h:224
A base abstract class for 0-dimensional geometric objects that represents a single location in coordi...
Definition: AbstractPoint.h:50
double m_y
The Point y-coordinate value.
Definition: Point.h:225
virtual void setM(const double &m)
It sets the Point m-coordinate value.
Definition: Point.cpp:79
A point with x and y coordinate values.
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
Point(const double &x, const double &y, int srid=0, Envelope *mbr=0)
It initializes the Geometry with the specified spatial reference system id and envelope.
Definition: Point.cpp:36
#define TE_DOUBLE_NOT_A_NUMBER
Macro for defining not a number for float values.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
virtual Point & operator=(const Point &rhs)
Assignment operator.
Definition: Point.cpp:57
virtual void setZ(const double &z)
It sets the Point z-coordinate value.
Definition: Point.cpp:75
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51