12 #include "../../common/progress/TaskProgress.h" 13 #include "../../dataaccess/datasource/DataSourceTransactor.h" 14 #include "../../dataaccess/utils/Utils.h" 15 #include "../../datatype/SimpleProperty.h" 16 #include "../../geometry/GeometryProperty.h" 17 #include "../../geometry/Point.h" 18 #include "../../memory/DataSet.h" 19 #include "../../memory/DataSetItem.h" 20 #include "../../raster.h" 21 #include "../../vp/Utils.h" 24 #include <geos/geom/Coordinate.h> 25 #include <geos/simplify/DouglasPeuckerLineSimplifier.h> 36 if (inDsetName.empty())
41 std::unique_ptr<te::da::DataSet> inDset(inDsrc->getDataSet(inDsetName));
47 inDset->moveBeforeFirst();
48 double value=std::numeric_limits<double>::max();
49 while (inDset->moveNext())
55 std::unique_ptr<te::gm::Geometry> gin(inDset->getGeometry(geo_pos));
56 geostype = gin.get()->getGeometryType();
58 if (geostype ==
"MultiPoint")
63 value = inDset->getDouble(atrZ);
64 for (std::size_t i = 0; i < np; ++i)
75 mpt.
add(dynamic_cast<te::gm::Geometry*>(pz.
clone()));
79 else if (geostype ==
"Point")
85 value = inDset->getDouble(atrZ);
92 mpt.
add(dynamic_cast<te::gm::Geometry*>(pz.
clone()));
99 std::unique_ptr<te::gm::Envelope> e(inDset->getExtent(geo_pos));
100 env.
init((e->getLowerLeftX() - tol), (e->getLowerLeftY() - tol), (e->getUpperRightX() + tol), (e->getUpperRightY() + tol));
109 if (inDsetName.empty())
112 std::unique_ptr<te::da::DataSet> inDset;
115 inDset = inDsrc->getDataSet(inDsetName);
117 const std::size_t npr = inDset->getNumProperties();
120 std::vector<std::string>pnames;
121 std::vector<int> ptypes;
122 for (std::size_t i = 0; i != npr; ++i)
124 pnames.push_back(inDset->getPropertyName(i));
125 ptypes.push_back(inDset->getPropertyDataType(i));
132 inDset->moveBeforeFirst();
133 double value = std::numeric_limits<double>::max();
135 while (inDset->moveNext())
137 if (!task.isActive())
141 std::unique_ptr<te::gm::Geometry> gin(inDset->getGeometry(geo_pos));
143 geostype = gin.get()->getGeometryType();
145 if (geostype ==
"LineString")
154 value = inDset->getDouble(atrZ);
161 else if (alg ==
None)
164 for (std::size_t il = 0; il < l->
size(); il++)
170 isolines.
add(dynamic_cast<te::gm::Geometry*>(ls));
171 for (std::size_t
p = 0;
p < ls->
size();
p++)
175 nsamples += ls->
size();
177 if (geostype ==
"MultiLineString")
182 value = inDset->getDouble(atrZ);
183 for (std::size_t i = 0; i < np; ++i)
187 if (atrZ.empty() && l->
is3D())
190 for (std::size_t il = 0; il < l->
size(); il++)
191 lz->setPointZ(il, l->
getX(il), l->
getY(il), value);
193 std::unique_ptr<te::gm::LineString> ls;
198 else if (alg ==
None)
199 ls.reset(lz.release());
204 isolines.
add(dynamic_cast<te::gm::Geometry*>(ls.get()));
205 nsamples += ls->size();
207 for (std::size_t
p = 0;
p < ls->size();
p++)
209 mpt.
add(ls->getPointN(
p).release());
217 std::unique_ptr<te::gm::Envelope> e = inDset->getExtent(geo_pos);
218 env.
init((e->getLowerLeftX() - tol), (e->getLowerLeftY() - tol), (e->getUpperRightX() + tol), (e->getUpperRightY() + tol));
228 double te::mnt::Distance(
const double pt1x,
const double pt1y,
const double pt2x,
const double pt2y)
238 dist = sqrt(dy + dx);
256 return (std::fabs(p1.
getX() - p2.
getX()) < tol && std::fabs(p1.
getY() - p2.
getY()) < tol && std::fabs(p1.
getZ() - p2.
getZ()) < tol);
261 double delta = (double)(scale);
264 if (fabs(fpt.
getX() - spt.
getX()) > delta)
return false;
265 if (fabs(fpt.
getY() - spt.
getY()) < delta)
return true;
271 double d12, xmin, ymin;
273 double xi = first.
getX();
274 double xf = last.
getX();
275 double yi = first.
getY();
276 double yf = last.
getY();
277 double x = pin.
getX();
278 double y = pin.
getY();
282 double a2 = (y - yi) * dx - (x - xi)*dy;
284 if (dx == 0. && dy == 0.)
286 d12 = sqrt(((x - xi) * (x - xi)) + ((y - yi) * (y - yi)));
290 d12 = a2 * a2 / (dx * dx + dy * dy);
304 double alfa = dy /
dx;
305 xmin = (x + alfa * (y - yi) + alfa * alfa * xi) / (1. + alfa * alfa);
306 ymin = (x - xmin) / alfa + y;
319 if (lineIn->
size() <= 3)
327 std::vector<te::gm::Point*> lringOut;
328 lringOut.push_back(lringIn.
getPointN(0).release());
330 unsigned int initial = 0;
331 unsigned int final = 2;
333 while (initial < (lringIn.
size() - 2))
335 bool distIsGreater =
false;
337 while (!distIsGreater)
339 for (
unsigned i = initial + 1; i <
final; i++)
345 lringOut.push_back(lringIn.
getPointN(
final - 1).release());
350 distIsGreater =
true;
360 if ((
final) >= lringIn.
size())
362 lringOut.push_back(lringIn.
getPointN(
final - 2).release());
365 distIsGreater =
true;
373 if (
final >= lringIn.
size())
376 distIsGreater =
true;
383 if (lringOut.size() <= 3)
390 for (std::size_t i = 0; i < lringOut.size(); i++)
393 lineOut->
setZ(i, Zvalue);
404 std::vector<geos::geom::Coordinate> coordpts;
405 for (std::size_t j = 0; j < ls->
size(); ++j)
407 std::unique_ptr<te::gm::Point> lpt = ls->
getPointN(j);
408 geos::geom::Coordinate coo(lpt->getX(), lpt->getY());
409 coordpts.push_back(coo);
411 geos::simplify::DouglasPeuckerLineSimplifier douglas(coordpts);
412 douglas.setDistanceTolerance(snap);
413 geos::simplify::DouglasPeuckerLineSimplifier::CoordsVectAutoPtr simplified(douglas.simplify());
417 for (std::size_t j = 0; j < simplified->size(); ++j)
419 geos::geom::Coordinate c1 = simplified.get()->at(j);
434 if (npts <= 3 || snap == 0.)
437 for (
size_t i = 0; i < npts; i++)
439 ptlist->setPointZ(i, vxy[i].getX(), vxy[i].getY(), Zvalue);
441 return ptlist.release();
445 double snap2 = maxdist*maxdist;
450 if (vxy[0] == vxy[npte - 1])
461 size_t numpf = npt - 1;
475 while (numa < (npt - 1))
485 aa1 = sqrt(a * a + 1.);
492 for (k = numa + 1; k < numpf; k++)
496 d = fabs(axy.
getX() - vxy[k].
getX());
498 d = fabs(vxy[k].getY() - a*vxy[k].getX() -
b) / aa1;
516 double axbx = pfxy.
getX() - axy.
getX();
517 double ayby = pfxy.
getY() - axy.
getY();
518 double dist2 = axbx*axbx + ayby*ayby;
521 for (k = numpf; k > numa + 1; k--)
525 dist2 = axbx*axbx + ayby*ayby;
552 if ((
Distance(vxy[i], vxy[i - 1]) < snap) || (
Distance(vxy[i], vxy[0]) < snap))
563 for (i = 0; i < npts; i++)
565 ptlist->setPointZ(i, vxy[i].getX(), vxy[i].getY(), Zvalue);
569 ptlist->setPointZ(npts, vxy[0].getX(), vxy[0].getY(), Zvalue);
571 return ptlist.release();
586 double vx = ptx - fx;
587 double vy = pty - fy;
588 double uv = (ux*vx + uy*vy);
596 return (sqrt(vx*vx + vy*vy));
604 uv = (ux*vx + uy*vy);
612 return (sqrt(vx*vx + vy*vy));
616 double a,
b, c, k, dist, aabb;
623 dist = fabs((a*ptx + b*pty + c) / (sqrt(aabb)));
627 *pix = (b*k - a*c) / aabb;
628 *piy = (-a*k - b*c) / aabb;
668 double m1 = 10., m2 = 10.;
673 bool perpvert1 =
false,
677 for (i = 0; i < 3; i++)
679 px[i] = vert[i].
getX();
680 py[i] = vert[i].
getY();
684 if ((
float)py[0] == (
float)py[1])
686 if ((
float)px[0] == (
float)px[1])
694 m1 = -(px[1] - px[0]) / (py[1] - py[0]);
697 if ((
float)py[1] == (float)py[2])
699 if ((
float)px[1] == (float)px[2])
707 m2 = -(px[2] - px[1]) / (py[2] - py[1]);
711 if ((
float)m1 == (float)m2)
718 xm1 = (px[0] + px[1]) / 2.;
719 ym1 = (py[0] + py[1]) / 2.;
722 xm2 = (px[1] + px[2]) / 2.;
723 ym2 = (py[1] + py[2]) / 2.;
727 if (perpvert1 ==
true)
730 yaux = (ym2 + m2 * (xaux - xm2));
732 else if (perpvert2 ==
true)
735 yaux = (ym1 + m1 * (xaux - xm1));
739 xaux = (m1*xm1 - m2*xm2 - ym1 + ym2) / (m1 - m2);
740 yaux = (ym1 + m1 * (xaux - xm1));
772 px, py, lx, ly, lpx, lpy, s;
781 a = py * lx - px * ly;
782 b = lpx * ly - lpy * lx;
783 c = lpx * py - lpy * px;
791 if ((b < 0) || (b > a) || (c < 0) || (c > a))
796 if ((b > 0) || (b < a) || (c > 0) || (c < a))
818 double delta = .9999;
821 for (i = 0; i < 3; i++)
822 if (p3da[i].getZ() == isolin)
823 p3da[i].
setZ(isolin*delta);
826 if ((p3da[0].getZ() == std::numeric_limits<double>::max()) ||
827 (p3da[1].getZ() == std::numeric_limits<double>::max()) ||
828 (p3da[2].getZ() == std::numeric_limits<double>::max()))
831 if ((p3da[0].getZ() < isolin) &&
832 (p3da[1].getZ() < isolin) &&
833 (p3da[2].getZ() < isolin))
836 if ((p3da[0].getZ() > isolin) &&
837 (p3da[1].getZ() > isolin) &&
838 (p3da[2].getZ() > isolin))
841 for (i = 0; i < 3; i++)
843 if ((p3da[i].getZ() == isolin) &&
844 (p3da[(i + 1) % 3].getZ() > isolin) &&
845 (p3da[(i + 2) % 3].getZ() > isolin))
847 if ((p3da[i].getZ() == isolin) &&
848 (p3da[(i + 1) % 3].getZ() < isolin) &&
849 (p3da[(i + 2) % 3].getZ() < isolin))
869 if ((isolin < p3da[0].getZ()) && (isolin < p3da[1].getZ()) &&
870 (isolin < p3da[2].getZ()))
873 if ((isolin > p3da[0].getZ()) && (isolin > p3da[1].getZ()) &&
874 (isolin > p3da[2].getZ()))
877 if (((isolin <= p3da[0].getZ()) && (isolin > p3da[1].getZ())) ||
878 ((isolin > p3da[0].getZ()) && (isolin <= p3da[1].getZ())))
885 if (((isolin <= p3da[1].getZ()) && (isolin > p3da[2].getZ())) ||
886 ((isolin > p3da[1].getZ()) && (isolin <= p3da[2].getZ())))
893 if (((isolin <= p3da[2].getZ()) && (isolin > p3da[0].getZ())) ||
894 ((isolin > p3da[2].getZ()) && (isolin <= p3da[0].getZ())))
927 paux = (isolin - fpt.
getZ()) / dvect.
getZ();
933 ptline.push_back(pt);
937 bool te::mnt::extractLines(std::vector<te::gm::Point> &pline, std::vector< std::unique_ptr< te::gm::LineString > > &clinlist,
double scale)
939 std::vector<te::gm::Point> velin;
942 std::vector<te::gm::Point>::iterator it, itf, itn;
950 it = itf = pline.begin();
954 while (it != pline.end())
958 pt = velin[velin.size()-1];
961 velin.push_back(ptn);
963 it = itf = pline.erase(it);
964 itn = pline.erase(it);
968 velin.push_back(ptf);
970 it = itf = pline.erase(it);
971 itn = pline.erase(it);
976 if (it != pline.end())
978 if (itf == pline.end() || itn == pline.end())
988 std::reverse(velin.begin(), velin.end());
991 it = itf = pline.begin();
992 if (it == pline.end())
1000 ptn = velin[velin.size()-1];
1001 if (
Equal(ptf, ptn, scale))
1006 it= itf = pline.begin();
1007 if (it == pline.end())
1029 std::vector<te::gm::Point>::iterator it;
1031 if (vect.size() != 0)
1034 if (pline.size() < 2)
1037 for (c = 0; c < 2; c++)
1039 vect.push_back(*pline.begin());
1040 pline.erase(pline.begin());
1043 if (vect.size() != 2)
1059 bool te::mnt::assembLine(std::vector< std::unique_ptr< te::gm::LineString > > &linlout, std::vector<te::gm::Point> &vect)
1061 if (vect.size() <= 1)
1066 for (
size_t i = 0; i < vect.size(); i++)
1067 linout->setPointN(i, vect[i]);
1069 linlout.push_back(std::move(linout));
1083 double ux, vx, uy, vy, uz, vz;
1085 if ((p3da == NULL) || (nvector == NULL)){
1093 ux = p3da[1].
getX() - p3da[0].
getX();
1094 vx = p3da[2].
getX() - p3da[0].
getX();
1095 uy = p3da[1].
getY() - p3da[0].
getY();
1096 vy = p3da[2].
getY() - p3da[0].
getY();
1097 uz = p3da[1].
getZ() - p3da[0].
getZ();
1098 vz = p3da[2].
getZ() - p3da[0].
getZ();
1100 if ((ux == 0) && (vx == 0))
1107 if ((uy == 0) && (vy == 0))
1114 if ((uz == 0) && (vz == 0))
1122 nvector[2] = ux * vy - vx * uy;
1123 if (nvector[2] < 0.)
1126 nvector[2] = -nvector[2];
1127 nvector[0] = vy * uz - uy * vz;
1128 nvector[1] = ux * vz - vx * uz;
1132 nvector[0] = uy * vz - vy * uz;
1133 nvector[1] = vx * uz - ux * vz;
1148 if (nvector == NULL){
1152 vectorSize = sqrt(nvector[0] * nvector[0] + nvector[1] * nvector[1] + nvector[2] * nvector[2]);
1154 if (vectorSize != 0.)
1156 nvector[0] = nvector[0] / vectorSize;
1157 nvector[1] = nvector[1] / vectorSize;
1158 nvector[2] = nvector[2] / vectorSize;
1171 double pax, pay, bax, bay;
1172 double area2, minxy, daux;
1184 if ((pax == 0.) && (bax == 0.))
1190 if ((pay == 0.) && (bay == 0.))
1194 area2 = fabs((pay * bax) - (pax * bay));
1200 daux = area2 / (bax + bay - (minxy / 2));
1212 double a,
b, c, ip, ipt;
1217 ip = a*pt1.
getX() + b*pt1.
getY() + c;
1220 ipt = a*pt2.
getX() + b*pt2.
getY() + c;
1221 if ((ip > 0.) && (ipt < 0.))
1223 if ((ip < 0.) && (ipt > 0.))
1240 int32_t npts, i, j, maxdiffindex = 0;
1241 double x0 = 0, y0 = 0, coef[5];
1243 double maxfixptdiff;
1250 double *vectd =
new double[200];
1251 double *vectz =
new double[200];
1252 double *vectx =
new double[200];
1253 double *vecty =
new double[200];
1254 double *fvectz =
new double[200];
1255 short *ptype =
new short[200];
1258 for(i = 0; i < 200; ++i)
1262 for (
size_t pp = 0; pp < p3dl.size(); pp++)
1265 if ((p3d.
getX() >= std::numeric_limits< float >::max()) || (npts > 199))
1268 maxdiff = std::numeric_limits< float >::max();
1269 maxfixptdiff = std::numeric_limits< float >::max();
1271 while ((maxdiff > tol) && (maxfixptdiff > tol) &&
1272 (j > 3) && (npts > 3))
1275 for (i = 0; i < npts; i++)
1279 vectx[j] = vectd[i];
1280 vecty[j++] = vectz[i];
1291 for (i = 0; i < npts; i++)
1293 fvectz[i] = coef[0];
1294 for (j = 1; j <= degree; j++)
1295 fvectz[i] += coef[j] * pow(vectd[i], (
double)j);
1298 for (i = 0; i < npts; i++)
1300 if ((ptype[i] == 0) || (ptype[i] == 1))
1302 if (fabs(fvectz[i] - vectz[i]) > maxfixptdiff)
1303 maxfixptdiff = (float)fabs(fvectz[i] - vectz[i]);
1306 for (i = 0; i < npts; i++)
1308 if ((ptype[i] == 0) || (ptype[i] == 2))
1310 if (fabs(fvectz[i] - vectz[i]) > maxdiff)
1312 maxdiff = (float)fabs(fvectz[i] - vectz[i]);
1318 ptype[maxdiffindex] = 0;
1321 for (i = 0; i < npts; i++)
1324 p3d.
setZ(fvectz[i]);
1338 vectd[npts] = sqrt((p3d.
getX() - x0)*(p3d.
getX() - x0) +
1339 (p3d.
getY() - y0)*(p3d.
getY() - y0));
1341 vectd[npts] += vectd[npts - 1];
1342 if (p3d.
getZ() < std::numeric_limits< float >::max())
1348 vectz[npts] = p3d.
getZ();
1349 fvectz[npts++] = p3d.
getZ();
1361 for(
size_t ii = 0; ii < 200; ++ii)
1365 catch (std::bad_alloc& ba)
1367 std::cerr <<
"bad_alloc caught: " << ba.what() <<
'\n';
1396 powx =
new double[(unsigned)np];
1397 sumpow =
new double[200];
1398 fx =
new double[(unsigned)np];
1400 catch (std::bad_alloc& ba)
1402 std::cerr <<
"bad_alloc caught: " << ba.what() <<
'\n';
1407 for (i = 0; i<np; i++)
1414 matx[0][deg + 1] = 0;
1415 for (i = 0; i<np; i++)
1416 matx[0][deg + 1] = matx[0][deg + 1] + vecty[i];
1421 for (i = 1; i <= deg; i++)
1424 matx[i][deg + 1] = 0;
1426 for (j = 0; j< np; j++)
1428 powx[j] = powx[j] * vectx[j];
1429 fx[j] = fx[j] * vectx[j];
1430 sumpow[i] = sumpow[i] + powx[j];
1431 matx[i][deg + 1] = matx[i][deg + 1] + fx[j];
1435 for (i = deg + 1; i< 2 * (deg + 1); i++)
1438 for (j = 0; j<np; j++)
1440 powx[j] = powx[j] * vectx[j];
1441 sumpow[i] = sumpow[i] + powx[j];
1445 for (i = 0; i <= deg; i++)
1446 for (j = 0; j <= deg; j++)
1447 matx[i][j] = sumpow[i + j];
1462 for (i = 0; i<deg + 1; i++)
1463 coef[i] = matx[i][m];
1483 short i, j, k, l, ii, jj, kk;
1484 double aux, piv, eps;
1491 for (i = 0; i<m - 1; i++)
1493 piv = fabs(mat[i][i]);
1498 for (j = ii; j< m; j++)
1500 if (fabs(mat[j][i]) > piv)
1502 piv = fabs(mat[j][i]);
1510 for (j = i; j< m + n; j++)
1513 mat[i][j] = mat[jj][j];
1525 for (j = ii; j< m; j++)
1527 for (k = ii; k< m + n; k++)
1528 mat[j][k] = mat[j][k] - mat[j][i] * mat[i][k] / mat[i][i];
1532 if (fabs(mat[m - 1][m - 1]) < eps)
1538 for (i = 0; i<n; i++)
1540 mat[m - 1][i + m] = mat[m - 1][i + m] / mat[m - 1][m - 1];
1542 for (j = 0; j<m - 1; j++)
1547 for (l = kk; l<m; l++)
1548 mat[k][i + m] = mat[k][i + m] - mat[l][i + m] * mat[k][l];
1550 mat[k][i + m] = mat[k][i + m] / mat[k][k];
1556 if (fabs(mat[0][0]) < eps)
1561 for (i = 0; i<n; i++)
1562 mat[0][m + i] = mat[0][m + i] / mat[0][0];
1575 prop0->setAutoNumber(
true);
1579 prop2->setSRID(srid);
1580 dt->add(prop0.release());
1581 dt->add(prop1.release());
1582 dt->add(prop11.release());
1583 dt->add(prop2.release());
1591 for (
unsigned int Idx = 0; Idx < isolist.size(); ++Idx)
1593 if (!task.isActive())
1598 isolist[Idx]->setSRID(srid);
1599 double *zvalue = isolist[Idx]->getZ();
1603 if (std::find(guidevalues.begin(), guidevalues.end(), zvalue[0]) != guidevalues.end())
1608 dataSetItem->
setGeometry(3, isolist[Idx].release());
1610 ds->add(dataSetItem);
1622 switch (planar->getId())
1640 switch (planar->getId())
1643 val *= 111000. * 111000.;
1649 val *= 364173.24 * 364173.24;
1661 switch (unit->getId())
1680 double min = std::numeric_limits<double>::max();
1681 double max = std::numeric_limits<double>::min();
1683 std::complex<double> pixel;
1688 for (
unsigned r = 0; r <= rf; r++)
1689 for (
unsigned c = 0; c <= cf; c++)
1693 if (pixel.real() == no_data)
1696 if (pixel.real() < min)
1699 if (pixel.real() > max)
1709 double d12, xmin, ymin;
1711 double xi = first.
getX();
1712 double xf = last.
getX();
1713 double yi = first.
getY();
1714 double yf = last.
getY();
1715 double x = pin.
getX();
1716 double y = pin.
getY();
1718 double dx = xf - xi;
1719 double dy = yf - yi;
1720 double a2 = (y - yi) * dx - (x - xi)*dy;
1722 if (dx == 0. && dy == 0.)
1724 d12 = sqrt(((x - xi) * (x - xi)) + ((y - yi) * (y - yi)));
1728 d12 = a2 * a2 / (dx * dx + dy * dy);
1742 double alfa = dy /
dx;
1743 xmin = (x + alfa * (y - yi) + alfa * alfa * xi) / (1. + alfa * alfa);
1744 ymin = (x - xmin) / alfa + y;
void setZ(std::size_t i, const double &z)
It sets the n-th z coordinate value.
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
TEMNTEXPORT bool Least_square_fitting(double *vectx, double *vecty, short np, short deg, double *coef)
Function that performs a leat square fitting in a set of points.
TEMNTEXPORT bool initLineVector(std::vector< te::gm::Point > &pline, std::vector< te::gm::Point > &vect)
void init(const double &llx, const double &lly, const double &urx, const double &ury)
It initializes (sets) the envelope bounds.
TEMNTEXPORT bool convertPlanarToAngle(double &val, te::common::UnitOfMeasurePtr unit)
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
An atomic property like an integer or double.
TEMNTEXPORT te::gm::LineString * DouglasPeuckerTA(te::gm::LineString *lineIn, double simpFactor, double Zvalue)
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)
bool hasGeom() const
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false...
A class that models the description of a dataset.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
TEMNTEXPORT bool normalizeVector(double *)
Function that normalize a vector by its size.
TEMNTEXPORT bool Equal(te::gm::Point &p1, te::gm::Point &p2, double &tol)
te::gm::LineString * GEOS_DouglasPeucker(te::gm::LineString *ls, double snap)
TEMNTEXPORT double Distance(const te::gm::Coord2D &pt1, const te::gm::Coord2D &pt2)
TEMNTEXPORT te::gm::Point Max(te::gm::Point &p1, te::gm::Point &p2)
TEMNTEXPORT bool Gauss_elimination(short m, short n, double mat[6][6])
This class can be used to inform the progress of a task.
std::unique_ptr< Point > getPointN(std::size_t i) const
It returns the specified point in this LineString.
#define MIN(a, b)
Macro that returns min between two values.
TEMNTEXPORT te::gm::LineString * GEOS_DouglasPeucker(te::gm::LineString *ls, double snap, double Zvalue)
An utility struct for representing 2D coordinates.
double getY() const
It returns the y-coordinate.
static te::dt::Date ds(2010, 01, 01)
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
TEMNTEXPORT double pointToSegmentDistance(te::gm::Point &fseg, te::gm::Point &lseg, te::gm::Point &pt, te::gm::Point *pti)
double TePerpendicularDistance(const te::gm::Coord2D &first, const te::gm::Coord2D &last, const te::gm::Coord2D &pin, te::gm::Coord2D &pinter)
#define MAX(a, b)
Macro that returns max between two values.
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
TEVPEXPORT void Save(te::da::DataSource *source, te::da::DataSet *result, te::da::DataSetType *outDsType, const bool &enableProgress=true)
TEMNTEXPORT bool assembLine(std::vector< std::unique_ptr< te::gm::LineString > > &linlout, std::vector< te::gm::Point > &vect)
TEMNTEXPORT double PerpendicularDistance(te::gm::Coord2D &first, te::gm::Coord2D &last, te::gm::Coord2D &pin, te::gm::Coord2D &pinter)
TEMNTEXPORT size_t ReadPoints(std::string &inDsetName, te::da::DataSourcePtr &inDsrc, std::string &atrZ, double tol, te::gm::MultiPoint &mpt, std::string &geostype, te::gm::Envelope &env)
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
MultiPoint is a GeometryCollection whose elements are restricted to points.
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.
An abstract class for raster data strucutures.
TEMNTEXPORT bool equalFptSpt(te::gm::Point &fpt, te::gm::Point &spt, double scale)
virtual te::dt::AbstractData * clone() const
It clones the point.
TEMNTEXPORT te::gm::LineString * pointListSimplify(te::gm::LineString *ls, double snap, double maxdist, double Zvalue)
unsigned int getNumberOfRows() const
Returns the raster number of rows.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
bool hasRaster() const
It returns true if the DataSetType has at least one raster property; otherwise, it returns false...
BandProperty * getProperty()
Returns the band property.
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
TEMNTEXPORT bool point3dListFilter(std::vector< te::gm::Point > &p3dl, std::vector< bool > &fixed, double tol)
Function that filters the points that are closer considering a given tolerance.
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
static te::dt::TimeDuration dt(20, 30, 50, 11)
TEMNTEXPORT bool defineInterEdge(std::vector< te::gm::Point > &, te::gm::Point &, te::gm::Point &, double)
Function that defines the intersection with an edge of a triangle.
TEMNTEXPORT bool testVertexValues(double, te::gm::Point *)
Function that test the vertex values.
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
void setPointZ(std::size_t i, const double &x, const double &y, const double &z)
It sets the value of the specified point.
bool is3D() const _NOEXCEPT_OP(true)
It returns true if this geometric object has z coordinate values.
double SegmentDistance(double fx, double fy, double lx, double ly, double ptx, double pty, double *pix, double *piy)
Function that evaluates the distance between a point and a segment.
Utility functions for the data access module.
TEMNTEXPORT bool extractLines(std::vector< te::gm::Point > &pline, std::vector< std::unique_ptr< te::gm::LineString > > &clinlist, double scale)
const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
double Distance(const double pt1x, const double pt1y, const double pt2x, const double pt2y)
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.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
This file contains a class to calculate retangular grid from Samples. Adapted from SPRING...
TEMNTEXPORT double SegmentDistance(double fx, double fy, double lx, double ly, double ptx, double pty, double *pix, double *piy)
Function that evaluates the distance between a point and a segment.
double getX() const
It returns the x-coordinate.
void setX(const double &x)
It sets the Point x-coordinate value.
TEMNTEXPORT int onSameSide(te::gm::Coord2D pt1, te::gm::Coord2D pt2, te::gm::Coord2D fseg, te::gm::Coord2D lseg)
void add(Geometry *g)
It adds the geometry into the collection.
void setSRID(int srid)
It sets the Spatial Reference System ID of the linestring.
TEMNTEXPORT short segIntersect(te::gm::Point &pfr, te::gm::Point &pto, te::gm::Point &lfr, te::gm::Point <o)
Function for check segment intersection.
This file contains a class to calculate retangular grid from Samples using Spline Grass Interpolation...
const double & getZ(std::size_t i) const
It returns the n-th z coordinate value.
TEMNTEXPORT te::gm::Point Min(te::gm::Point &p1, te::gm::Point &p2)
void setPointN(std::size_t i, const Point &p)
It sets the value of the specified point to this new one.
TEMNTEXPORT bool defineInterTriangle(std::vector< te::gm::Point > &, te::gm::Point *, double)
Function that defines the intersections between an isoline and a triangle.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
void setY(const double &y)
It sets the Point y-coordinate value.
TEMNTEXPORT te::mnt::mntType getMNTType(const te::da::DataSetType *dt)
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
TEMNTEXPORT double coordToSegmentDistance(te::gm::Coord2D &fseg, te::gm::Coord2D &lseg, te::gm::Coord2D &pt, te::gm::Coord2D *pti)
TEMNTEXPORT bool segInterPoint(te::gm::Point &pfr, te::gm::Point &pto, te::gm::Point &lfr, te::gm::Point <o, te::gm::Point *pt)
Function for determines the point of two segment intersections.
TEMNTEXPORT void getMinMax(te::rst::Raster *inputRst, double &vmin, double &vmax)
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
TEMNTEXPORT bool onSegment(te::gm::Point &pt, te::gm::Point &fseg, te::gm::Point &lseg, double tol)
Function that checks if a point pt is on a segment.
TEMNTEXPORT bool triangleNormalVector(te::gm::Point *, double *)
Function that defines the triangle normal vector.
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)
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
bool segInterPoint(te::gm::Coord2D &pfr, te::gm::Coord2D &pto, te::gm::Coord2D &lfr, te::gm::Coord2D <o, te::gm::Coord2D *pt)
const double & getX() const
It returns the Point x-coordinate value.
TEMNTEXPORT short findCenter(te::gm::Point *vert, double *pcx, double *pcy)
Function that finds the center of the vertices of a triangle.
void setZ(const double &z)
It sets the Point z-coordinate value.
std::size_t size() const
It returns the number of points (vertexes) in the geometry.
TEMNTEXPORT bool convertAngleToPlanar(double &val, te::common::UnitOfMeasurePtr planar, int type)
static te::gm::LineString * pointListSimplify(te::gm::LineString *ls, double snap, double Zvalue)