27 #include "../common/Translator.h"
93 throw Exception(
TE_TR(
"Invalid spatial relation!"));
103 auxD = env.
m_llx/bWidth;
104 auxI = (int)(env.
m_llx/bWidth);
105 if (env.
m_llx < 0 && (auxD - auxI) != 0)
106 magicX = (
int) (env.
m_llx/bWidth - 1);
111 auxD = env.
m_lly/bHeight;
112 auxI = (int)(env.
m_lly/bHeight);
113 if (env.
m_lly < 0 && (auxD - auxI) != 0)
114 magicY = (
int)(env.
m_lly/bHeight - 1);
118 double xi = magicX*bWidth;
119 double yi = magicY*bHeight;
122 auxD = env.
m_urx/bWidth;
123 auxI = (int)(env.
m_urx/bWidth);
124 if ((env.
m_urx < 0) || (auxD - auxI) == 0)
125 magicX2 = (int) (env.
m_urx/bWidth);
127 magicX2 = (int) (env.
m_urx/bWidth + 1);
130 auxD = env.
m_ury/bHeight;
131 auxI = (int)(env.
m_ury/bHeight);
132 if ((env.
m_ury < 0) || (auxD - auxI) == 0)
133 magicY2 = (int) (env.
m_ury/bHeight);
135 magicY2 = (int) (env.
m_ury/bHeight + 1);
137 double xf = (magicX2)*bWidth;
138 double yf = (magicY2)*bHeight;
145 return o1->intersects(o2);
173 std::map<int, double> pointLenghtFromFirst;
175 double fullLineLenght = 0;
177 pointLenghtFromFirst[0] = 0;
178 for(std::size_t i = 1; i < line->
getNPoints(); i++)
181 pointLenghtFromFirst[i] = fullLineLenght;
184 double diference =
final-initial;
186 tTof = ((target-initial)*fullLineLenght)/diference;
190 int pointBeforeTarget;
191 for(std::size_t i = 0; i < pointLenghtFromFirst.size(); i++)
193 if(pointLenghtFromFirst[i] == tTof)
198 if(tTof >= pointLenghtFromFirst[i] && tTof < pointLenghtFromFirst[i+1])
200 pointBeforeTarget = i;
219 double pd = tTof - pointLenghtFromFirst[pointBeforeTarget];
222 double td = pointLenghtFromFirst[pointBeforeTarget+1] - pointLenghtFromFirst[pointBeforeTarget];
224 targetCoord->
x = ((pd*(p2->
getX()-p1->
getX()))/td)+p1->
getX();
226 targetCoord->
y = ((pd*(p2->
getY()-p1->
getY()))/td)+p1->
getY();
A LinearRing is a LineString that is both closed and simple.
virtual bool covers(const Geometry *const rhs) const
It returns true if this geometry object spatially covers the rhs geometry.
virtual bool intersects(const Geometry *const rhs) const
It returns true if the geometry object spatially intersects rhs geometry.
Point * getPointN(std::size_t i) const
It returns the specified point in this LineString.
A point with x and y coordinate values.
TEGEOMEXPORT bool SatisfySpatialRelation(const Geometry *g1, const Geometry *g2, SpatialRelation relation)
It returns if two geometries satisfy a given spatial relation.
double m_urx
Upper right corner x-coordinate.
SpatialRelation
Spatial relations between geometric objects.
An utility struct for representing 2D coordinates.
virtual bool contains(const Geometry *const rhs) const
It returns true if this geometry object spatially contains rhs geometry.
#define TE_TR(message)
It marks a string in order to get translated.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual bool crosses(const Geometry *const rhs) const
It returns true if the geometry object spatially crosses rhs geometry.
A LinearRing is a LineString that is both closed and simple.
double m_llx
Lower left corner x-coordinate.
An Envelope defines a 2D rectangular region.
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.
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.
virtual bool disjoint(const Geometry *const rhs) const
It returns true if the geometry object is spatially disjoint from rhs geometry.
TEGEOMEXPORT Coord2D * locateAlong(const LineString *line, double initial, double final, double target)
Make the line interpolation to find a target.
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
Utility functions for the Geometry Module.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual bool overlaps(const Geometry *const rhs) const
It returns true if this geometry object spatially overlaps rhs geometry.
bool Intersects(const T1 &o1, const T2 &o2)
double m_lly
Lower left corner y-coordinate.
An exception class for the Geometry module.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
virtual bool touches(const Geometry *const rhs) const
It returns true if the geometry object spatially touches rhs geometry.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
double m_ury
Upper right corner y-coordinate.
virtual bool equals(const Geometry *const rhs, const bool exact=false) const
It returns true if the geometry object is spatially equal to rhs geometry.
virtual bool coveredBy(const Geometry *const rhs) const
It returns true if this geometry object is spatially covered by rhs geometry.
TEGEOMEXPORT Envelope AdjustToCut(const Envelope &env, double bWidth, double bHeight)
Finds the correspondent smallest box that allows a box to be cut in blocks of a given size...
LineString is a curve with linear interpolation between points.
An utility struct for representing 2D coordinates.
virtual double distance(const Geometry *const rhs) const
It returns the shortest distance between any two points in the two geometry objects.
const double & getX() const
It returns the Point x-coordinate value.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.
virtual bool within(const Geometry *const rhs) const
It returns true if the geometry object is spatially within rhs geometry.