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