37 #include <geos/algorithm/LineIntersector.h> 54 if((t & 0xF00) == 0x300)
59 else if((t & 0xF00) == 0x700)
64 else if((t & 0xF00) == 0xB00)
84 return new Line(*
this);
89 geos::algorithm::LineIntersector li;
94 li.computeIntersection(p0, p1, lp0, lp1);
95 if (li.hasIntersection())
97 ret.
setX(li.getIntersection(0).x);
98 ret.
setY(li.getIntersection(0).y);
109 return std::numeric_limits< double >::max();
118 if ((
m_gType & 0xF00) == 0x300)
122 else if ((
m_gType & 0xF00) == 0x700)
126 else if ((
m_gType & 0xF00) == 0xB00)
141 distance = std::fabs(A*(p.
getX()) + B*(p.
getY()) + C) / std::sqrt(A*A + B*B);
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
A Line is LineString with 2 points.
A Line is LineString with 2 points.
static te::dt::Date dx(2010, 12, 31)
A point with x and y coordinate values.
Line & operator=(const Line &rhs)
Assignment operator.
double distance(te::gm::Point p)
bool intersection(const Line &line, Point &coord) const
double * m_zA
A pointer to z values.
LineString is a curve with linear interpolation between points.
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.
~Line()
Virtual destructor.
void setCoord(int index, double x, double y, double z=0., double m=0.)
te::dt::AbstractData * clone() const
It clones the line.
A base class for values that can be retrieved from the data access module.
Coord2D * m_coords
A pointer to x, y values.
const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
void setX(const double &x)
It sets the Point x-coordinate value.
Line(GeomType t, int srid=0, Envelope *mbr=0)
It initializes the line with the specified spatial reference system id and envelope.
const double & getM() const
It returns the Point m-coordinate value, if it has one or DoubleNotANumber otherwise.
GeomType m_gType
Internal geometry type.
void setY(const double &y)
It sets the Point y-coordinate value.
const double & getX() const
It returns the Point x-coordinate value.
double * m_mA
A pointer to m values.