27 #include "../srs/Converter.h"
49 :
Curve(t, srid, mbr),
54 else if((
m_gType & 0xF00) == 0x700)
56 else if((
m_gType & 0xF00) == 0xB00)
58 assert(
m_zA.size() == 0);
59 assert(
m_mA.size() == 0);
68 m_coords(rhs.m_coords),
114 converter->setSourceSRID(getSRID());
116 converter->setTargetSRID(srid);
118 double* pt = (
double*)(&m_coords);
120 converter->convert(pt, &(pt[1]), static_cast<long>(size()), 2);
135 const std::size_t nPts = size();
140 double minx = m_coords[0].x;
141 double miny = m_coords[0].y;
142 double maxx = m_coords[0].x;
143 double maxy = m_coords[0].y;
145 for(std::size_t i = 1; i < nPts; ++i)
147 if(minx > m_coords[i].x) minx = m_coords[i].x;
148 if(miny > m_coords[i].y) miny = m_coords[i].y;
149 if(maxx < m_coords[i].x) maxx = m_coords[i].x;
150 if(maxy < m_coords[i].y) maxy = m_coords[i].y;
178 return getPointN(size() - 1);
184 return m_coords[0] == m_coords[size() - 1];
189 m_coords.resize(size);
191 if((m_gType & 0xF00) == 0x300)
193 else if((m_gType & 0xF00) == 0x700)
195 else if((m_gType & 0xF00) == 0xB00)
213 if((m_gType & 0xF00) == 0x000)
214 return new Point(m_coords[i].x, m_coords[i].y, m_srid, 0);
216 if((m_gType & 0xF00) == 0x300)
217 return new PointZ(m_coords[i].x, m_coords[i].y, m_zA[i], m_srid, 0);
219 if((m_gType & 0xF00) == 0x700)
220 return new PointM(m_coords[i].x, m_coords[i].y, m_mA[i], m_srid, 0);
222 return new PointZM(m_coords[i].x, m_coords[i].y, m_zA[i], m_mA[i], m_srid, 0);
229 m_coords[i].x = p.
getX();
230 m_coords[i].y = p.
getY();
232 if((m_gType & 0xF00) == 0x300)
234 else if((m_gType & 0xF00) == 0x300)
236 else if((m_gType & 0xF00) == 0x700)
252 assert((i < size()) && (m_zA.empty() ==
false));
260 assert((i < size()) && (m_mA.empty() ==
false));
268 assert((i < size()) && (m_zA.empty() ==
false) && (m_mA.empty() ==
false));
278 return m_coords[i].x;
284 return m_coords[i].y;
289 assert((i < size()) && (m_zA.empty() ==
false));
295 assert((i < size()) && (m_mA.empty() ==
false));
314 assert((i < size()) && (m_zA.empty() ==
false));
320 assert((i < size()) && (m_mA.empty() ==
false));
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
void setZ(std::size_t i, const double &z)
It sets the n-th z coordinate value.
double getLength() const
The length of this Curve in its associated spatial reference.
void setSRID(int srid)
It sets the Spatial Reference System ID of the circularstring.
GeomType m_gType
Internal geometry type.
CircularString(GeomType t, int srid=0, Envelope *mbr=0)
It initializes the circularstring with the specified spatial reference system id and envelope...
void setPointZ(std::size_t i, const double &x, const double &y, const double &z)
It sets the value of the specified point.
void setPointN(std::size_t i, const Point &p)
It sets the value of the specified point to this new one.
A point with z-coordinate value.
An exception class for the Geometry module.
CircularString is a curve with circular interpolation between points.
void setY(std::size_t i, const double &y)
It sets the n-th y coordinate value.
An utility struct for representing 2D coordinates.
Point * getPointN(std::size_t i) const
It returns the specified point in this CircularString.
A point with z-coordinate value.
A point with a z-coordinate value and an associated measurement.
std::vector< double > m_zA
A pointer to z values.
void makeEmpty()
It clears all the coordinates.
CircularString is a curve with circular interpolation between points.
bool isClosed() const
It returns true if the curve is closed (startPoint = endPoint).
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
const std::vector< double > & getZ() const
It returns a pointer to the internal array of z-values.
const double & getX() const
It returns the Point x-coordinate value.
CircularString & operator=(const CircularString &rhs)
Assignment operator.
const std::string & getGeometryType() const
The name of instantiable subtype is: CircularString.
void computeMBR(bool cascade) const
It computes the minimum bounding rectangle for the circularstring.
virtual const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
A point with x and y coordinate values.
Point * getStartPoint() const
It returns the curve start point.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
te::dt::AbstractData * clone() const
It clones the circularstring.
std::vector< Coord2D > m_coords
A pointer to x, y values.
A point with x and y coordinate values.
static const std::string sm_typeName
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Point * getEndPoint() const
It returns the curve end point.
std::vector< double > m_mA
A pointer to m values.
A point with an associated measure.
A point with a z-coordinate value and an associated measurement.
void setPointM(std::size_t i, const double &x, const double &y, const double &m)
It sets the value of the specified point.
void transform(int srid)
It converts the coordinate values of the circularstring to the new spatial reference system...
A base class for values that can be retrieved from the data access module.
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.
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS...
~CircularString()
Virtual destructor.
const std::vector< double > & getM() const
It returns a pointer to the internal array of m-values.
void setNumCoordinates(std::size_t size)
It reserves room for the number of coordinates in this CircularString.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
An Envelope defines a 2D rectangular region.
void setM(std::size_t i, const double &m)
It sets the n-th m measure value.
const double & getY() const
It returns the Point y-coordinate value.
Geometry * locateBetween(const double &mStart, const double &mEnd) const
It returns a derived geometry collection value according to the range of coordinate values inclusivel...
An Envelope defines a 2D rectangular region.
A point with an associated measure.
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
void makeInvalid()
It will invalidated the envelope.
virtual const double & getM() const
It returns the Point m-coordinate value, if it has one or DoubleNotANumber otherwise.
virtual Curve & operator=(const Curve &rhs)
Assignment operator.
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.