12 #include "../../common/progress/TaskProgress.h" 13 #include "../../dataaccess/utils/Utils.h" 14 #include "../../geometry/GeometryProperty.h" 15 #include "../../srs/SpatialReferenceSystemManager.h" 22 std::string inDsetName,
23 std::unique_ptr<te::da::DataSetType> inDsetType)
48 std::vector< std::unique_ptr< te::gm::LineString > > isolines_suavizado;
69 isolines_suavizado.push_back(std::move(iso_sim));
72 isolines_suavizado.push_back(std::move(iso));
76 std::vector<double> guidevalues;
85 double valuez = iso.
getZ(0);
101 std::vector<te::gm::Coord2D> vab;
102 std::vector<te::gm::Coord2D> vbc;
103 std::vector<te::gm::Coord2D> isout;
128 double a2 = (2 * xyA.
getX() - 5 * xyB.
getX() + 4 * xyC.
getX() - xyD.
getX()) / 2;
129 double a1 = (xyC.
getX() - xyA.
getX()) / 2;
130 double a0 = xyB.
getX();
133 double b2 = (2 * xyA.
getY() - 5 * xyB.
getY() + 4 * xyC.
getY() - xyD.
getY()) / 2;
134 double b1 = (xyC.
getY() - xyA.
getY()) / 2;
135 double b0 = xyB.
getY();
138 double dy = xyC.
getY() - xyB.
getY();
140 double stsize = sqrt(dx * dx + dy * dy);
143 for (
int j = 0; j < nsteps; j++)
145 double t = (double)j / (
double)nsteps;
147 double x = ((a3 * t + a2) * t + a1) * t + a0;
148 double y = ((b3 * t + b2) * t + b1) * t + b0;
152 double dx1 = pxy.
getX() - x;
153 double dy1 = pxy.
getY() - y;
155 double segSize = sqrt(dx1 * dx1 + dy1 * dy1);
156 double cost = (dx * dx1 + dy * dy1) / (stsize * segSize);
158 if (fabs(cost) < 0.7)
172 if ((segsizeAB >= segsizeBC) && (segsizeAB >= segsizeCD))
182 else if ((segsizeBC >= segsizeAB) && (segsizeBC >= segsizeCD))
214 if ((!nsteps) || (ipts == npts))
216 double x = a3 + a2 + a1 + a0;
217 double y = b3 + b2 + b1 + b0;
223 if ((!nsteps) && (getNext))
239 for (
size_t i = 0; i < vab.size(); i++)
240 isout.push_back(vab[i]);
248 for (
size_t i = 0; i < vbc.size(); i++)
249 isout.push_back(vbc[i]);
257 for (
size_t i = 0; i < vbc.size(); i++)
258 vab.push_back(vbc[i]);
266 for (
size_t i = 0; i < isout.size(); i++)
268 iso.
setPointZ(i, isout[i].getX(), isout[i].getY(), valuez);
282 double x = (a / 2) + pfr.
getX();
283 double y = (b / 2) + pfr.
getY();
307 double bx = pfr.
getX() - ptm.
getX();
308 double by = pfr.
getY() - ptm.
getY();
310 double c = -(bx / by);
312 double x0 = sqrt((d * d) / (1 + (c * c)));
318 pt0.
y = y0 + ptm.
getY();
319 pt1.
x = x1 + ptm.
getX();
320 pt1.
y = y1 + ptm.
getY();
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
boost::shared_ptr< DataSource > DataSourcePtr
Coord2D * getCoordinates() const
It returns a pointer to the internal array of coordinates.
static te::dt::Date dx(2010, 12, 31)
TEMNTEXPORT double Distance(const te::gm::Coord2D &pt1, const te::gm::Coord2D &pt2)
void makeEmpty()
It clears all the coordinates.
This class can be used to inform the progress of a task.
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
std::string m_outDsetName
An utility struct for representing 2D coordinates.
double getY() const
It returns the y-coordinate.
void setParams(double factor, double max_dist, bool simpl)
te::da::DataSourcePtr m_outDsrc
bool middlePointWithSnap(te::gm::Coord2D &pfr, te::gm::Coord2D &pto, te::gm::Coord2D &pt0, te::gm::Coord2D &pt1, double d)
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType)
MultiPoint is a GeometryCollection whose elements are restricted to points.
LineString is a curve with linear interpolation between points.
An Envelope defines a 2D rectangular region.
TEMNTEXPORT te::gm::LineString * pointListSimplify(te::gm::LineString *ls, double snap, double maxdist, double Zvalue)
int m_srid
Attribute with spatial reference information.
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
void setNumCoordinates(std::size_t size)
It reserves room for the number of coordinates in this LineString.
std::unique_ptr< te::da::DataSetType > m_inDsetType
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
void setPointZ(std::size_t i, const double &x, const double &y, const double &z)
It sets the value of the specified point.
Utility functions for the data access module.
TEMNTEXPORT size_t ReadSamples(std::string &inDsetName, te::da::DataSourcePtr &inDsrc, std::string &atrZ, double tol, double max, Simplify alg, te::gm::MultiPoint &mpt, te::gm::MultiLineString &isolines, std::string &geostype, te::gm::Envelope &env, int srid=0)
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
MultiLineString is a MultiCurve whose elements are LineStrings.
This file contains a class to isolines smooth. Adapted from SPRING.
double getX() const
It returns the x-coordinate.
TEMNTEXPORT int onSameSide(te::gm::Coord2D pt1, te::gm::Coord2D pt2, te::gm::Coord2D fseg, te::gm::Coord2D lseg)
bool AdjustCatmullRom(te::gm::LineString &iso)
const double & getZ(std::size_t i) const
It returns the n-th z coordinate value.
TEMNTEXPORT bool SaveIso(std::string &outDsetName, te::da::DataSourcePtr &outDsrc, std::vector< std::unique_ptr< te::gm::LineString > > &isolist, std::vector< double > &guidevalues, int srid)
te::da::DataSourcePtr m_inDsrc