27 #include "terralib_config.h"
28 #include "../common/Translator.h"
29 #include "../srs/Converter.h"
51 :
Curve(t, srid, mbr),
56 else if((
m_gType & 0xF00) == 0x700)
58 else if((
m_gType & 0xF00) == 0xB00)
60 assert(
m_zA.size() == 0);
61 assert(
m_mA.size() == 0);
70 m_coords(rhs.m_coords),
111 #ifdef TERRALIB_MOD_SRS_ENABLED
117 converter->setSourceSRID(getSRID());
119 converter->setTargetSRID(srid);
121 double* pt = (
double*)(&m_coords);
123 converter->convert(pt, &(pt[1]), static_cast<long>(size()), 2);
130 throw Exception(
TE_TR(
"transform method is not supported!"));
131 #endif // TERRALIB_MOD_SRS_ENABLED
141 const std::size_t nPts = size();
146 double minx = m_coords[0].x;
147 double miny = m_coords[0].y;
148 double maxx = m_coords[0].x;
149 double maxy = m_coords[0].y;
151 for(std::size_t i = 1; i < nPts; ++i)
153 if(minx > m_coords[i].x) minx = m_coords[i].x;
154 if(miny > m_coords[i].y) miny = m_coords[i].y;
155 if(maxx < m_coords[i].x) maxx = m_coords[i].x;
156 if(maxy < m_coords[i].y) maxy = m_coords[i].y;
184 return getPointN(size() - 1);
190 return m_coords[0] == m_coords[size() - 1];
195 m_coords.resize(size);
197 if((m_gType & 0xF00) == 0x300)
199 else if((m_gType & 0xF00) == 0x700)
201 else if((m_gType & 0xF00) == 0xB00)
219 if((m_gType & 0xF00) == 0x000)
220 return new Point(m_coords[i].x, m_coords[i].y, m_srid, 0);
222 if((m_gType & 0xF00) == 0x300)
223 return new PointZ(m_coords[i].x, m_coords[i].y, m_zA[i], m_srid, 0);
225 if((m_gType & 0xF00) == 0x700)
226 return new PointM(m_coords[i].x, m_coords[i].y, m_mA[i], m_srid, 0);
228 return new PointZM(m_coords[i].x, m_coords[i].y, m_zA[i], m_mA[i], m_srid, 0);
235 m_coords[i].x = p.
getX();
236 m_coords[i].y = p.
getY();
238 if((m_gType & 0xF00) == 0x300)
240 else if((m_gType & 0xF00) == 0x300)
242 else if((m_gType & 0xF00) == 0x700)
258 assert((i < size()) && (m_zA.empty() ==
false));
266 assert((i < size()) && (m_mA.empty() ==
false));
274 assert((i < size()) && (m_zA.empty() ==
false) && (m_mA.empty() ==
false));
284 return m_coords[i].x;
290 return m_coords[i].y;
295 assert((i < size()) && (m_zA.empty() ==
false));
301 assert((i < size()) && (m_mA.empty() ==
false));
320 assert((i < size()) && (m_zA.empty() ==
false));
326 assert((i < size()) && (m_mA.empty() ==
false));
virtual const double & getM() const
It returns the Point m-coordinate value, if it has one or DoubleNotANumber otherwise.
void makeInvalid()
It will invalidated the envelope.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
void transform(int srid)
It converts the coordinate values of the circularstring to the new spatial reference system...
void setPointN(std::size_t i, const Point &p)
It sets the value of the specified point to this new one.
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
CircularString is a curve with circular interpolation between points.
const std::vector< double > & getM() const
It returns a pointer to the internal array of m-values.
A point with x and y coordinate values.
void setY(std::size_t i, const double &y)
It sets the n-th y coordinate value.
const std::string & getGeometryType() const
The name of instantiable subtype is: CircularString.
Geometry * locateBetween(const double &mStart, const double &mEnd) const
It returns a derived geometry collection value according to the range of coordinate values inclusivel...
CircularString & operator=(const CircularString &rhs)
Assignment operator.
std::vector< double > m_zA
A pointer to z values.
virtual const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
virtual Curve & operator=(const Curve &rhs)
Assignment operator.
void setM(std::size_t i, const double &m)
It sets the n-th m measure value.
void computeMBR(bool cascade) const
It computes the minimum bounding rectangle for the circularstring.
#define TE_TR(message)
It marks a string in order to get translated.
A point with a z-coordinate value and an associated measurement.
A point with an associated measure.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
An Envelope defines a 2D rectangular region.
A point with z-coordinate value.
const double & getY() const
It returns the Point y-coordinate value.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
void setNumCoordinates(std::size_t size)
It reserves room for the number of coordinates in this CircularString.
void setPointZM(std::size_t i, const double &x, const double &y, const double &z, const double &m)
It sets the value of the specified point.
Point * getEndPoint() const
It returns the curve end point.
A base class for values that can be retrieved from the data access module.
std::vector< double > m_mA
A pointer to m values.
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
std::vector< Coord2D > m_coords
A pointer to x, y values.
An exception class for the Geometry module.
bool isClosed() const
It returns true if the curve is closed (startPoint = endPoint).
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
Point * getStartPoint() const
It returns the curve start point.
Point * getPointN(std::size_t i) const
It returns the specified point in this CircularString.
double getLength() const
The length of this Curve in its associated spatial reference.
const std::vector< double > & getZ() const
It returns a pointer to the internal array of z-values.
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
void setZ(std::size_t i, const double &z)
It sets the n-th z coordinate value.
void setPointM(std::size_t i, const double &x, const double &y, const double &m)
It sets the value of the specified point.
GeomType m_gType
Internal geometry type.
void setSRID(int srid)
It sets the Spatial Reference System ID of the circularstring.
void makeEmpty()
It clears all the coordinates.
static const std::string sm_typeName
A point with z-coordinate value.
A point with a z-coordinate value and an associated measurement.
void setPointZ(std::size_t i, const double &x, const double &y, const double &z)
It sets the value of the specified point.
te::dt::AbstractData * clone() const
It clones the circularstring.
An utility struct for representing 2D coordinates.
A point with an associated measure.
const double & getX() const
It returns the Point x-coordinate value.
~CircularString()
Virtual destructor.
CircularString is a curve with circular interpolation between points.
CircularString(GeomType t, int srid=0, Envelope *mbr=0)
It initializes the circularstring with the specified spatial reference system id and envelope...