12 #include "../../common/progress/TaskProgress.h" 13 #include "../../dataaccess/utils/Utils.h" 15 #include "../../geometry/Envelope.h" 16 #include "../../geometry/Geometry.h" 17 #include "../../geometry/LineString.h" 18 #include "../../geometry/Point.h" 19 #include "../../geometry/TIN.h" 20 #include "../../geometry/Triangle.h" 22 #include "../../sam.h" 42 std::string inDsetName,
43 std::unique_ptr<te::da::DataSetType> inDsetType,
InputType type)
74 const double &maxdist,
75 const double &minedgesize,
76 const std::string &atrz_iso,
77 const std::string &atrz_pt)
167 int32_t nodelist[4], linlist[5];
172 if (t1 > m_triangsize)
174 if (t2 > m_triangsize)
178 std::vector<te::gm::Point> pointaux;
182 pointaux.push_back(
pt1);
186 pointaux.push_back(
pt2);
190 pointaux.push_back(
pt3);
194 pointaux.push_back(pt4);
197 for (i = 0; i < 4; i++)
201 if (nodelist[i] >(int32_t)m_nodesize)
203 m_node[(
unsigned int)nodelist[i]].Init(pointaux[i]);
209 for (i = 0; i < 5; i++)
213 if (linlist[i] >(int32_t)m_linesize){
219 m_line[(
unsigned int)linlist[i]].Nodes(nodelist[i], nodelist[((i + 1) % 4)]);
220 m_node[(
unsigned int)nodelist[i]].setEdge(linlist[i]);
221 m_node[(
unsigned int)nodelist[((i + 1) % 4)]].setEdge(linlist[i]);
226 m_line[(
unsigned int)linlist[i]].Polygons(-1, (int32_t)t1);
230 m_line[(
unsigned int)linlist[i]].Polygons(-1, (int32_t)t2);
234 m_line[(
unsigned int)linlist[i]].Nodes(nodelist[2], nodelist[0]);
235 m_node[(
unsigned int)nodelist[2]].setEdge(linlist[i]);
236 m_node[(
unsigned int)nodelist[0]].setEdge(linlist[i]);
237 m_line[(
unsigned int)linlist[i]].Polygons((int32_t)t2, (int32_t)t1);
242 m_triang[t1].setEdges(linlist[0], linlist[1], linlist[4]);
244 m_triang[t2].setEdges(linlist[4], linlist[2], linlist[3]);
246 m_node[(
unsigned int)nodelist[0]].setEdge(linlist[0]);
247 m_node[(
unsigned int)nodelist[1]].setEdge(linlist[1]);
248 m_node[(
unsigned int)nodelist[2]].setEdge(linlist[2]);
249 m_node[(
unsigned int)nodelist[3]].setEdge(linlist[3]);
280 std::vector<KD_NODE*> reportsnode;
283 for (
unsigned int id = 0;
id < mlsize; ++id)
289 for (
size_t j = 0; j < gnp; ++j)
291 std::unique_ptr<te::gm::Point>
p = gout->
getPointN(j);
297 nodetree.
search(ept, reportsnode);
298 if (reportsnode.size())
312 nodetree.
insert(coord, node);
336 else if (
m_node[(
unsigned int)node].getType() ==
First)
338 else if ((
m_node[(
unsigned int)node].getType() !=
Sample) && (
m_node[(
unsigned int)node].getType() !=
Last))
358 double zvalue = pt.
getZ();
361 double px = pt.
getX();
362 double py = pt.
getY();
376 for (
unsigned short j = 0; j < 3; j++)
378 if ((fabs(px - vert[j].getX()) < tol) && (fabs(py - vert[j].getY()) < tol))
389 m_triang[(
unsigned int)triangid].LinesId(linesid);
395 double dmin = std::numeric_limits< float >::max();
398 for (
unsigned int j = 0; j < 3; j++)
401 (pt.
getX() > vert[(j + 1) % 3].getX()))
404 (pt.
getX() < vert[(j + 1) % 3].getX()))
407 (pt.
getY() > vert[(j + 1) % 3].getY()))
410 (pt.
getY() < vert[(j + 1) % 3].getY()))
414 if ((daux < tol) && (daux < dmin))
424 int32_t ntri1, ntri2;
427 int32_t testLines[6];
429 for (
int j = 0; j < 6; j++)
431 if (testLines[j] == -1)
467 m_node[(
unsigned int)nodeId].setNPoint(pmin);
469 for (
unsigned int j = 0; j < 3; j++)
471 if (neighids[j] == -1)
473 int32_t oppNode =
OppositeNode(neighids[j], linesid[j]);
476 if ((fabs(px -
m_node[(
unsigned int)oppNode].getX()) < tol) && (fabs(py -
m_node[(
unsigned int)oppNode].getY()) < tol))
486 int32_t testLines[5];
488 if (neighids[(
unsigned int)nedge] != -1)
490 int32_t ngtriang = neighids[(
unsigned int)nedge];
493 int32_t testLines2[2];
495 for (
int j = 0; j < 2; j++)
497 if (testLines2[(
unsigned int)j] == -1)
538 for (
int j = 0; j < 5; j++)
540 if (testLines[(
unsigned int)j] == -1)
573 switch (
m_node[(
unsigned int)node].getType())
586 else if (
m_node[(
unsigned int)nidaux].getType() ==
Last)
598 else if (
m_node[(
unsigned int)nidaux].getType() ==
First)
665 std::vector<int32_t> lids;
670 for (
size_t i = 0; i < lids.size(); i++)
673 m_line[(
unsigned int)linid].ExchangeNode(oldNode, newNode);
674 m_node[(
unsigned int)oldNode].removeEdge(linid);
675 m_node[(
unsigned int)newNode].setEdge(linid);
677 m_node[(
unsigned int)newNode].setX(
m_node[(
unsigned int)oldNode].getX());
678 m_node[(
unsigned int)newNode].setY(
m_node[(
unsigned int)oldNode].getY());
679 m_node[(
unsigned int)newNode].setZ(
m_node[(
unsigned int)oldNode].getZ());
695 if (t2 > (int32_t)m_triangsize)
703 m_node[(
unsigned int)
NodeId(t, 0)].setEdge(an0);
704 m_line[(
unsigned int)an0].Polygons(t, t1);
710 m_node[(
unsigned int)vn].setEdge(an1);
711 m_node[(
unsigned int)
NodeId(t, 1)].setEdge(an1);
712 m_line[(
unsigned int)an1].Polygons(t1, t2);
718 m_node[(
unsigned int)vn].setEdge(an2);
719 m_node[(
unsigned int)
NodeId(t, 2)].setEdge(an2);
720 m_line[(
unsigned int)an2].Polygons(t2, t);
735 int32_t a2 =
m_triang[(
unsigned int)t].LineAtEdge(2);
761 int32_t an = lineids[n];
762 int32_t aj = lineids[(n + 1) % 3];
763 int32_t ak = lineids[(n + 2) % 3];
764 int32_t vn =
NodeId(t, n);
772 if (
m_line[(
unsigned int)an].getLeftPolygon() == t)
773 tv =
m_line[(
unsigned int)an].getRightPolygon();
774 else if (
m_line[(
unsigned int)an].getRightPolygon() == t)
775 tv =
m_line[(
unsigned int)an].getLeftPolygon();
781 int32_t vop =
NodeId(t, (n + 2) % 3);
794 m_line[(
unsigned int)an0].Nodes(v, vn);
795 m_node[(
unsigned int)v].setEdge(an0);
796 m_node[(
unsigned int)vn].setEdge(an0);
797 m_line[(
unsigned int)an0].Polygons(t1, tv);
805 if (an1 > (int32_t)m_linesize)
808 m_line[(
unsigned int)an1].Nodes(v, vop);
809 m_node[(
unsigned int)v].setEdge(an1);
810 m_node[(
unsigned int)vop].setEdge(an1);
811 m_line[(
unsigned int)an1].Polygons(t, t1);
816 m_node[(
unsigned int)vn].removeEdge(an);
817 m_node[(
unsigned int)v].setEdge(an);
818 m_line[(
unsigned int)an].ExchangeNode(vn, v);
821 m_triang[(
unsigned int)t].setEdges(an, aj, an1);
827 m_triang[(
unsigned int)t1].setEdges(an0, an1, ak);
840 int32_t vn =
m_line[(
unsigned int)an0].getNodeTo();
844 for (i = 0; i < 3; i++)
848 if ((
m_line[(
unsigned int)lineids[i]].getNodeFrom() == vn) ||
849 (
m_line[(
unsigned int)lineids[i]].getNodeTo() == vn))
855 int32_t av = lineids[i];
860 int32_t av1 = lineids[(i + 1) % 3];
861 int32_t av2 = lineids[(i + 2) % 3];
867 if (
m_line[(
unsigned int)av].getNodeFrom() == vn)
868 vvo =
m_line[(
unsigned int)av].getNodeTo();
870 vvo =
m_line[(
unsigned int)av].getNodeFrom();
877 m_line[(
unsigned int)an2].Nodes(v, vvo);
878 m_line[(
unsigned int)an2].Polygons(tv, t2);
887 m_triang[(
unsigned int)tv].setEdges(an2, av1, av2);
890 m_triang[(
unsigned int)t2].setEdges(an0, av, an2);
905 for (j = 0; j < 3; j++)
906 if ((nids[j] != tri2Id) && (nids[j] != tri3Id))
915 for (j = 0; j < 3; j++)
916 if ((nids[j] != tri1Id) && (nids[j] != tri3Id))
925 for (j = 0; j < 3; j++)
926 if ((nids[j] != tri1Id) && (nids[j] != tri2Id))
947 for (j = 0; j < 3; j++)
948 if ((nids[j] != tri2Id) && (nids[j] != tri3Id) && (nids[j] != tri4Id))
957 for (j = 0; j < 3; j++)
958 if ((nids[j] != tri1Id) && (nids[j] != tri3Id) && (nids[j] != tri4Id))
967 for (j = 0; j < 3; j++)
968 if ((nids[j] != tri1Id) && (nids[j] != tri2Id) && (nids[j] != tri4Id))
977 for (j = 0; j < 3; j++)
978 if ((nids[j] != tri1Id) && (nids[j] != tri2Id) && (nids[j] != tri3Id))
993 int32_t tv =
m_line[(
unsigned int)linId].getLeftPolygon();
998 if (!
m_triang[(
unsigned int)tv].LinesId(linids))
1002 for (j = 0; j < 3; j++)
1003 if (linids[j] == linId)
1016 double xc, yc, xaux, yaux, raio2, dist2,
1018 int32_t nodid, neighids[3];
1023 double minx = std::numeric_limits< float >::max(),
1024 miny = std::numeric_limits< float >::max();
1029 if (neighids[nviz] == -1)
1033 int32_t linid =
m_triang[(
unsigned int)triId].LineAtEdge((
unsigned short)nviz);
1034 if (linid == -1 || linid > (int32_t)
m_linesize)
1046 for (i = 0; i < 3; i++)
1048 if (vert[i].getX() < minx)
1049 minx = vert[i].
getX();
1050 if (vert[i].getY() < miny)
1051 miny = vert[i].
getY();
1053 if ((minx < std::numeric_limits< float >::max()) && (miny < std::numeric_limits< float >::max()))
1055 for (i = 0; i < 3; i++)
1057 vert[i].
setX(vert[i].getX() - minx);
1058 vert[i].
setY(vert[i].getY() - miny);
1060 xo =
m_node[(
unsigned int)nodid].getNPoint().getX() - minx;
1061 yo =
m_node[(
unsigned int)nodid].getNPoint().getY() - miny;
1065 xo =
m_node[(
unsigned int)nodid].getNPoint().getX();
1066 yo =
m_node[(
unsigned int)nodid].getNPoint().getY();
1075 xaux = xc - vert[0].
getX();
1076 yaux = yc - vert[0].
getY();
1077 raio2 = xaux * xaux + yaux * yaux;
1082 dist2 = xaux * xaux + yaux * yaux;
1083 float fr = (float)sqrt(raio2);
1084 float fd = (float)sqrt(dist2);
1107 if (!
m_triang[(
unsigned int)t].LinesId(tEdges))
1115 for (i = 0; i < 3; i++)
1116 if (tEdges[i] == ai)
1119 if (i == 3)
return false;
1121 int32_t aj = tEdges[(i + 1) % 3];
1122 int32_t ak = tEdges[(i + 2) % 3];
1124 int32_t vi = nodeIds[i];
1125 int32_t vj = nodeIds[(i + 1) % 3];
1126 int32_t vk = nodeIds[(i + 2) % 3];
1138 if (!
m_triang[(
unsigned int)tv].LinesId(tvEdges))
1143 for (j = 0; j < 3; j++)
1145 if (tvEdges[j] == ai)
1148 if (
m_line[(
unsigned int)tvEdges[j]].getNodeFrom() == vn)
1150 if (
m_line[(
unsigned int)tvEdges[j]].getNodeTo() == vi)
1152 else if (
m_line[(
unsigned int)tvEdges[j]].getNodeTo() == vj)
1158 else if (
m_line[(
unsigned int)tvEdges[j]].getNodeTo() == vn)
1160 if (
m_line[(
unsigned int)tvEdges[j]].getNodeFrom() == vi)
1162 else if (
m_line[(
unsigned int)tvEdges[j]].getNodeFrom() == vj)
1182 if (
m_line[(
unsigned int)ai].getNodeTo() == vi)
1184 m_node[(
unsigned int)vi].removeEdge(ai);
1185 m_node[(
unsigned int)vk].setEdge(ai);
1186 m_node[(
unsigned int)vn].setEdge(ai);
1187 m_line[(
unsigned int)ai].setNodeTo(vk);
1188 m_line[(
unsigned int)ai].setNodeFrom(vn);
1190 else if (
m_line[(
unsigned int)ai].getNodeTo() == vj)
1192 m_node[(
unsigned int)vj].removeEdge(ai);
1193 m_node[(
unsigned int)vn].setEdge(ai);
1194 m_node[(
unsigned int)vk].setEdge(ai);
1195 m_line[(
unsigned int)ai].setNodeTo(vn);
1196 m_line[(
unsigned int)ai].setNodeFrom(vk);
1199 std::vector<int32_t>::iterator it;
1200 it = std::find(
m_node[(
unsigned int)vi].m_edge.begin(),
m_node[(
unsigned int)vi].m_edge.end(), ai);
1201 if (it !=
m_node[(
unsigned int)vi].m_edge.end())
1203 m_node[(
unsigned int)vi].m_edge.erase(it);
1204 m_node[(
unsigned int)vi].setEdge(ak);
1207 it = std::find(
m_node[(
unsigned int)vj].m_edge.begin(),
m_node[(
unsigned int)vj].m_edge.end(), ai);
1208 if (it !=
m_node[(
unsigned int)vj].m_edge.end())
1210 m_node[(
unsigned int)vj].m_edge.erase(it);
1211 m_node[(
unsigned int)vj].setEdge(aj);
1215 if (
m_line[(
unsigned int)an].getRightPolygon() == tv)
1216 m_line[(
unsigned int)an].setRightPolygon(t);
1218 m_line[(
unsigned int)an].setLeftPolygon(t);
1221 if (
m_line[(
unsigned int)ak].getRightPolygon() == t)
1222 m_line[(
unsigned int)ak].setRightPolygon(tv);
1224 m_line[(
unsigned int)ak].setLeftPolygon(tv);
1228 for (i = 0; i < 3; i++)
1229 if (tEdges[i] == ai)
1231 if (i < 3) tEdges[i] = an;
1232 tEdges[(i + 2) % 3] = ai;
1233 m_triang[(
unsigned int)t].setEdges((int32_t)tEdges[0], (int32_t)tEdges[1], (int32_t)tEdges[2]);
1236 for (i = 0; i < 3; i++)
1237 if (tvEdges[i] == ai)
1239 if (i < 3) tvEdges[i] = ak;
1242 for (i = 0; i < 3; i++)
1243 if (tvEdges[i] == an)
1245 if (i < 3) tvEdges[i] = ai;
1247 m_triang[(
unsigned int)tv].setEdges((int32_t)tvEdges[0], (int32_t)tvEdges[1], (int32_t)tvEdges[2]);
1256 linId =
m_triang[(
unsigned int)triangId].LineAtEdge(edge);
1271 if ((
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeTo()].getType() ==
Sample) ||
1272 (
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getType() ==
Sample))
1276 if ((
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeTo()].getType() >
Last) ||
1277 (
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getType() >
Last))
1281 nid0 =
m_line[(
unsigned int)linid].getNodeFrom();
1282 if (nid0 >
m_line[(
unsigned int)linid].getNodeTo())
1284 nid0 =
m_line[(
unsigned int)linid].getNodeTo();
1285 nid1 =
m_line[(
unsigned int)linid].getNodeFrom();
1288 nid1 =
m_line[(
unsigned int)linid].getNodeTo();
1290 if (
m_node[(
unsigned int)nid0].getType() ==
Last)
1294 if (
m_node[(
unsigned int)nid1].getType() ==
First)
1310 if ((
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeTo()].getType() ==
Sample) ||
1311 (
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getType() ==
Sample))
1320 nid0 =
m_line[(
unsigned int)linid].getNodeFrom();
1321 if (nid0 >
m_line[(
unsigned int)linid].getNodeTo())
1323 nid0 =
m_line[(
unsigned int)linid].getNodeTo();
1324 nid1 =
m_line[(
unsigned int)linid].getNodeFrom();
1327 nid1 =
m_line[(
unsigned int)linid].getNodeTo();
1351 linid =
m_triang[(
unsigned int)triId].LineAtEdge(nviz);
1361 int32_t triangid, contr = 0, npoly = -1;
1365 for (triangid = 0; triangid <
m_ltriang; triangid++)
1371 if (triangid > npoly)
1388 int32_t aux, neighids[3];
1397 for (j = 0; j < 3; j++)
1400 aux = neighids[(
unsigned int)j];
1425 std::vector<int32_t> lids;
1428 int32_t nids[4] = { 0, 0, 0, 0 }, tnids[3] = { 0, 0, 0 };
1429 int32_t trids[4] = {0, 0, 0, 0};
1430 unsigned short j, modified;
1433 for (nid = 1; nid < (int32_t)
m_node.size(); nid++)
1435 if (
m_node[(
unsigned int)nid].getType() !=
Box &&
1448 for (i = 0; i < 4; i++)
1450 if (!
NodeLines(nids[(
unsigned int)i], lids))
1452 for (
size_t ii = 0; ii < lids.size(); ii++)
1455 rtri =
m_line[(
unsigned int)linid].getRightPolygon();
1456 ltri =
m_line[(
unsigned int)linid].getLeftPolygon();
1457 if ((rtri != -1) && (ltri != -1))
1460 for (j = 0; j < 3; j++)
1470 if (((
m_line[(
unsigned int)linid].getNodeFrom() == nids[(
unsigned int)i]) &&
1471 ((
m_line[(
unsigned int)linid].getNodeTo() == nids[(
unsigned int)(i + 1) % 4]) ||
1472 (
m_line[(
unsigned int)linid].getNodeTo() == nids[(
unsigned int)(i + 2) % 4]) ||
1473 (
m_line[(
unsigned int)linid].getNodeTo() == nids[(
unsigned int)(i + 3) % 4]))) ||
1474 ((
m_line[(
unsigned int)linid].getNodeTo() == nids[(
unsigned int)i]) &&
1475 ((
m_line[(
unsigned int)linid].getNodeFrom() == nids[(
unsigned int)(i + 1) % 4]) ||
1476 (
m_line[(
unsigned int)linid].getNodeFrom() == nids[(
unsigned int)(i + 2) % 4]) ||
1477 (
m_line[(
unsigned int)linid].getNodeFrom() == nids[(
unsigned int)(i + 3) % 4]))))
1480 trids[(
unsigned int)i] = ltri;
1482 trids[(
unsigned int)i] = rtri;
1487 if ((i == 3) && (modified))
1493 for (i = 0; i < 4; i++)
1495 m_triang[(
unsigned int)trids[(
unsigned int)i]].LinesId(tnids);
1496 for (j = 0; j < 3; j++)
1498 rtri =
m_line[(
unsigned int)tnids[j]].getRightPolygon();
1499 ltri =
m_line[(
unsigned int)tnids[j]].getLeftPolygon();
1500 if ((rtri != -1) && (ltri != -1))
1521 int32_t linid1 = 0, lidaux, oldline,
1524 int32_t nid0, nid1, node, nidaux, nidaux1;
1525 int32_t vlins[3] = {-1, -1, -1};
1527 std::vector<int32_t> lids;
1530 bool modified =
false;
1531 std::vector<te::mnt::TinNode> p3dl;
1533 std::vector<int32_t> snode;
1535 for (nid0 = 0; nid0 <
m_lnode; nid0++)
1538 std::string msg(
"Testing Isolines(");
1539 std::stringstream ss;
1541 msg += ss.str() +
")...";
1550 if (
m_line[i].getNodeFrom() == -1)
1552 nid0 =
m_line[i].getNodeFrom();
1553 if (nid0 >
m_line[i].getNodeTo())
1555 nid0 =
m_line[i].getNodeTo();
1556 nid1 =
m_line[i].getNodeFrom();
1559 nid1 =
m_line[i].getNodeTo();
1563 snode[(
unsigned int)nid0] = 1;
1568 snode[(
unsigned int)nid0] = 1;
1572 for (nid0 = 0; nid0 <
m_lnode; nid0++)
1579 if (snode[(
unsigned int)nid0] == 1)
1587 (
m_node[(
unsigned int)nid1].getType() !=
Last))
1597 for (
size_t ii = 0; ii < lids.size(); ii++)
1618 for (i = 0; i < 3; i++)
1620 if (
NodeId(
m_line[(
unsigned int)lidaux].getRightPolygon(), (
short)i) == nid0)
1622 ntri =
m_line[(
unsigned int)lidaux].getLeftPolygon();
1625 if (
NodeId(
m_line[(
unsigned int)lidaux].getLeftPolygon(), (
short)i) == nid0)
1627 ntri =
m_line[(
unsigned int)lidaux].getRightPolygon();
1636 node =
m_line[(
unsigned int)lidaux].getNodeFrom();
1637 if (node >
m_line[(
unsigned int)lidaux].getNodeTo())
1639 node =
m_line[(
unsigned int)lidaux].getNodeTo();
1640 nidaux =
m_line[(
unsigned int)lidaux].getNodeFrom();
1643 nidaux =
m_line[(
unsigned int)lidaux].getNodeTo();
1646 if ((tnodid == nid1) || (vnodid == nid1))
1649 (nidaux1 != nidaux))
1660 ptaux.
setZ(
m_node[(
unsigned int)nid0].getZ());
1662 p3dl.push_back(ptaux);
1666 while (nidaux != nid1)
1669 m_triang[(
unsigned int)ntri].LinesId(vlins);
1670 for (i = 0; i < 3; i++)
1672 if (vlins[i] == oldline)
1674 if ((
m_line[(
unsigned int)vlins[i]].getNodeTo() == nid1) ||
1675 (
m_line[(
unsigned int)vlins[i]].getNodeFrom() == nid1))
1685 for (i = 0; i < 3; i++)
1687 if (vlins[i] == oldline)
1693 if ((
m_line[static_cast<size_t>(linid1)].getNodeTo() == nid0) ||
1694 (
m_line[static_cast<size_t>(linid1)].getNodeFrom() == nid0))
1710 ptaux.
setZ(
m_node[(
unsigned int)nid0].getZ());
1712 p3dl.push_back(ptaux);
1714 nidaux =
m_line[(
unsigned int)linid1].getNodeTo();
1716 if (
m_line[(
unsigned int)linid1].getLeftPolygon() == ntri)
1717 ntri =
m_line[(
unsigned int)linid1].getRightPolygon();
1719 ntri =
m_line[(
unsigned int)linid1].getLeftPolygon();
1730 if (
m_node[(
unsigned int)nid0].getType() ==
First)
1740 size_t npts = p3dl.size();
1749 for (
size_t ii = 0; ii < p3dl.size(); ii++)
1765 int32_t triangid, neighids[3];
1770 for (triangid = 0; triangid <
m_ltriang; triangid++)
1777 for (j = 0; j < 3; j++)
1781 if (neighids[j] < triangid)
1783 triangid = neighids[j] - 1;
1799 double nvector1[3], nvector2[3], cos1, cos2;
1800 int32_t nodid1, nodid2, linid, neighids[3], i;
1814 if (neighids[nviz] == -1)
1818 linid =
m_triang[(
unsigned int)triId].LineAtEdge((
unsigned short)nviz);
1821 nodid1 =
m_line[(
unsigned int)linid].getNodeTo();
1822 if (nodid1 >
m_line[(
unsigned int)linid].getNodeFrom())
1824 nodid1 =
m_line[(
unsigned int)linid].getNodeFrom();
1825 nodid2 =
m_line[(
unsigned int)linid].getNodeTo();
1828 nodid2 =
m_line[(
unsigned int)linid].getNodeFrom();
1834 for (i = 0; i < 3; i++)
1847 cos1 = nvector1[0] * nvector2[0] + nvector1[1] * nvector2[1] + nvector1[2] * nvector2[2];
1856 vert1[0].
setX(
m_node[(
unsigned int)nodid1].getX());
1857 vert1[0].
setY(
m_node[(
unsigned int)nodid1].getY());
1858 vert1[0].
setZ(
m_node[(
unsigned int)nodid1].getZ());
1859 vert1[1].
setX(
m_node[(
unsigned int)nodid2].getX());
1860 vert1[1].
setY(
m_node[(
unsigned int)nodid2].getY());
1861 vert1[1].
setZ(
m_node[(
unsigned int)nodid2].getZ());
1862 vert1[2].
setX(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getX());
1863 vert1[2].
setY(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getY());
1864 vert1[2].
setZ(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getZ());
1867 vert2[0].
setX(
m_node[(
unsigned int)nodid1].getX());
1868 vert2[0].
setY(
m_node[(
unsigned int)nodid1].getY());
1869 vert2[0].
setZ(
m_node[(
unsigned int)nodid1].getZ());
1870 vert2[1].
setX(
m_node[(
unsigned int)nodid2].getX());
1871 vert2[1].
setY(
m_node[(
unsigned int)nodid2].getY());
1872 vert2[1].
setZ(
m_node[(
unsigned int)nodid2].getZ());
1873 vert2[2].
setX(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeTo()].getX());
1874 vert2[2].
setY(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeTo()].getY());
1875 vert2[2].
setZ(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeTo()].getZ());
1886 cos2 = nvector1[0] * nvector2[0] + nvector1[1] * nvector2[1] + nvector1[2] * nvector2[2];
1902 std::unique_ptr<te::da::DataSet> inDset;
1909 inDset->moveBeforeFirst();
1911 while (inDset->moveNext())
1913 std::unique_ptr<te::gm::Geometry> gin = inDset->getGeometry(geo_pos);
1914 geostype = gin.get()->getGeometryType();
1916 if (geostype ==
"LineString")
1921 breaklines.
add(dynamic_cast<te::gm::Geometry*>(ls));
1922 nbreak += ls->
size();
1924 if (geostype ==
"MultiLineString")
1928 for (std::size_t i = 0; i < np; ++i)
1933 for (std::size_t il = 0; il < l->
size(); il++)
1939 breaklines.
add(dynamic_cast<te::gm::Geometry*>(ls));
1940 nbreak += ls->
size();
1946 std::unique_ptr<te::gm::Envelope> env = inDset->getExtent(geo_pos);
1961 std::vector<te::gm::Point> p3dl;
1962 std::vector<bool> fixed;
1969 if (!task.isActive())
1978 for (std::size_t j = 0; j < gout->
getNPoints()-1; ++j)
1980 std::unique_ptr<te::gm::Point> pf = gout->
getPointN(j);
1981 std::unique_ptr<te::gm::Point> pn = gout->
getPointN(j + 1);
1983 pfz.
setX(pf->getX());
1984 pfz.
setY(pf->getY());
1988 pnz.
setX(pn->getX());
1989 pnz.
setY(pn->getY());
2001 p3d.
setX(std::numeric_limits< float >::max());
2002 p3d.
setY(std::numeric_limits< float >::max());
2003 p3d.
setZ(std::numeric_limits< float >::max());
2004 p3dl.push_back(p3d);
2005 fixed.push_back(
false);
2017 std::string geostype;
2027 int32_t ftri, ltri, nids[3], lids[3],
2030 double dist, mindist;
2032 bool fixedf =
false;
2033 bool fixedn =
false;
2044 for (i = 0; i < 3; i++)
2056 for (k = 0; k < 3; k++)
2061 for (k = 0; k < 3; k++)
2067 if (!fixedf && !fixedn)
2077 fixed.push_back(fixedf);
2079 fixed.push_back(fixedn);
2089 pt.
setX(std::numeric_limits< float >::max());
2093 int auxj = -1, j, minj;
2094 for (j = 0; j < 3; j++)
2109 if ((j == 3) && (auxj != -1))
2117 mindist = std::numeric_limits< float >::max();
2118 for (j = 0; j < 3; j++)
2205 bool fixed1 =
false;
2206 bool fixed2 =
false;
2207 for (i = 0; i < 3; i++)
2218 for (k = 0; k < 3; k++)
2223 for (k = 0; k < 3; k++)
2229 if (!fixed1 && !fixed2)
2238 p3d.push_back(p3t1);
2239 fixed.push_back(fixed1);
2240 p3d.push_back(p3t2);
2241 fixed.push_back(fixed2);
2245 while (nids[j] != ltri)
2249 m_triang[(
unsigned int)ntri].LinesId(lids);
2255 for (j = 0; j < 3; j++)
2257 if (lids[j] == ledge)
2272 if ((j == 3) && (auxj != -1))
2280 mindist = std::numeric_limits< float >::max();
2281 for (j = 0; j < 3; j++)
2283 if (lids[j] == ledge)
2376 p3t1.
setZ(
m_node[(
unsigned int)
m_line[(
unsigned int)lids[j]].getNodeTo()].getZ());
2387 p3t2.
setZ(
m_node[(
unsigned int)
m_line[(
unsigned int)lids[j]].getNodeTo()].getZ());
2393 for (i = 0; i < 3; i++)
2406 if (!fixed1 && !fixed2)
2413 p3d.push_back(p3t1);
2414 fixed.push_back(fixed1);
2415 p3d.push_back(p3t2);
2416 fixed.push_back(fixed2);
2420 m_triang[(
unsigned int)ltri].LinesId(lids);
2425 for (i = 0; i < 3; i++)
2436 for (k = 0; k < 3; k++)
2445 p3d.push_back(p3t1);
2446 fixed.push_back(fixed1);
2452 for (i = 0; i < 3; i++)
2463 for (k = 0; k < 3; k++)
2468 for (k = 0; k < 3; k++)
2477 p3d.push_back(p3t1);
2478 fixed.push_back(fixed1);
2479 p3d.push_back(p3t2);
2480 fixed.push_back(fixed2);
2496 pt.
setZ(
m_node[(
unsigned int)
m_line[(
unsigned int)linid].getNodeFrom()].getZ());
2508 bline, nline, lline,
2522 if (node1 == -1)
continue;
2542 if (node2 == -1)
continue;
2555 if (
m_line[(
unsigned int)bline].getNodeTo() == i)
2556 m_line[(
unsigned int)bline].SwapNodePolygon();
2558 tri =
m_line[(
unsigned int)bline].getRightPolygon();
2562 while ((lline != nline) && (tri != -1))
2564 m_triang[(
unsigned int)tri].LinesId(lids);
2565 for (j = 0; j < 3; j++)
2567 if (lids[j] == lline)
2569 if (
m_line[(
unsigned int)lids[j]].getNodeTo() == node1)
2571 if (
m_line[(
unsigned int)lids[j]].getNodeFrom() == node1)
2574 m_line[(
unsigned int)lids[j]].SwapNodePolygon();
2581 nrtri =
m_line[(
unsigned int)lline].getRightPolygon();
2583 m_line[(
unsigned int)lline].SwapPolygon();
2584 tri =
m_line[(
unsigned int)lline].getRightPolygon();
2587 tri =
m_line[(
unsigned int)bline].getLeftPolygon();
2591 while ((lline != nline) && (tri != -1))
2593 m_triang[(
unsigned int)tri].LinesId(lids);
2594 for (j = 0; j < 3; j++)
2596 if (lids[j] == lline)
2598 if (
m_line[(
unsigned int)lids[j]].getNodeFrom() == node1)
2600 if (
m_line[(
unsigned int)lids[j]].getNodeTo() == node1)
2603 m_line[(
unsigned int)lids[j]].SwapNodePolygon();
2610 nrtri =
m_line[(
unsigned int)lline].getRightPolygon();
2612 m_line[(
unsigned int)lline].SwapPolygon();
2613 tri =
m_line[(
unsigned int)lline].getRightPolygon();
2622 int32_t triangid, contr = 0, npoly = -1;
2626 for (triangid = 0; triangid <
m_ltriang; triangid++)
2632 if (triangid > npoly)
2649 int32_t aux, neighids[3];
2658 for (j = 0; j < 3; j++)
2661 aux = neighids[(
unsigned int)j];
2698 std::vector<int32_t> used_tri;
2699 std::vector<te::gm::Point> p3dl;
2700 std::vector<bool> fixed;
2702 for (int32_t tri = 0; tri < (int32_t)
m_triangsize; tri++)
2704 if (std::find(used_tri.begin(), used_tri.end(), tri) != used_tri.end())
2707 used_tri.push_back(tri);
2709 if (vert[0].getZ() == vert[1].getZ() && vert[0].getZ() == vert[2].getZ())
2712 for (
int n = 0; n < 3; n++)
2717 if (vertn[0].getZ() == vertn[1].getZ() && vertn[0].getZ() == vertn[2].getZ())
2719 if (std::find(used_tri.begin(), used_tri.end(), neighs[n]) != used_tri.end())
2722 used_tri.push_back(neighs[n]);
2726 pc.
setX((vert[0].getX() + vert[1].getX()) / 2.);
2727 pc.
setY((vert[0].getY() + vert[1].getY()) / 2.);
2731 pc.
setX((vert[1].getX() + vert[2].getX()) / 2.);
2732 pc.
setY((vert[1].getY() + vert[2].getY()) / 2.);
2736 pc.
setX((vert[2].getX() + vert[0].getX()) / 2.);
2737 pc.
setY((vert[2].getY() + vert[0].getY()) / 2.);
2742 fixed.push_back(
false);
2762 for (
int n = 0; n < 3; n++)
2764 int trii = neighs[n];
2765 if (std::find(used_tri.begin(), used_tri.end(), trii) != used_tri.end())
2768 used_tri.push_back(trii);
2771 if (vert[0].getZ() == vert[1].getZ() && vert[0].getZ() == vert[2].getZ())
2773 used_tri.push_back(trii);
2776 for (std::size_t i = 0; i < 4; ++i)
2778 r.
setX(i, vert[i%3].getX());
2779 r.
setY(i, vert[i%3].getY());
2780 r.
setZ(i, vert[i%3].getZ());
2784 pol_tri.insert(std::pair<int32_t, te::gm::Polygon>(trii, tri_n));
2786 tri_union = tri_union->
Union(dynamic_cast<te::gm::Geometry*>(&tri_n));
2787 tri_union =
neigh_union(tri_union, trii, used_tri, pol_tri);
2797 size_t blnode = p3dl.size();
2799 size_t newtnodesize = blnode +
m_lnode + 6;
2803 bool frsflag =
true;
2804 int32_t nidaux, node;
2805 for (
size_t pp = 0; pp < p3dl.size(); pp++)
2816 else if (
m_node[(
unsigned int)nidaux].getType() ==
Last)
2825 m_node[(
unsigned int)node].setNPoint(p3d);
2857 for (int32_t vii = 0; vii < (int32_t)
m_node.size(); ++vii)
2859 if ((
m_node[(
unsigned int)vii].getType() ==
Box))
2862 std::vector <int32_t> lids;
2865 for (
size_t li = 0; li < lids.size(); li++)
2867 int32_t lii = lids[li];
2868 int32_t from =
m_line[(
unsigned int)lii].getNodeFrom();
2869 int32_t to =
m_line[(
unsigned int)lii].getNodeTo();
2873 m_node[(
unsigned int)from].removeEdge(lii);
2874 m_line[(
unsigned int)lii].setNodeFrom(-1);
2879 m_node[(
unsigned int)to].removeEdge(lii);
2880 m_line[(
unsigned int)lii].setNodeTo(-1);
2885 long tleft =
m_line[(
unsigned int)lii].getLeftPolygon();
2886 long tright =
m_line[(
unsigned int)lii].getRightPolygon();
2890 edge[0]= edge[1] = edge[2] = -1;
2894 m_triang[(
unsigned int)tleft].LinesId(edge);
2896 m_triang[(
unsigned int)tleft].setEdges(-1, edge[1], edge[2]);
2898 m_triang[(
unsigned int)tleft].setEdges(edge[0], -1, edge[2]);
2900 m_triang[(
unsigned int)tleft].setEdges(edge[0], edge[1], -1);
2905 m_triang[(
unsigned int)tright].LinesId(edge);
2907 m_triang[(
unsigned int)tright].setEdges(-1, edge[1], edge[2]);
2909 m_triang[(
unsigned int)tright].setEdges(edge[0], -1, edge[2]);
2911 m_triang[(
unsigned int)tright].setEdges(edge[0], edge[1], -1);
2914 std::vector <int32_t> edgesadj;
2919 std::vector<int32_t> edge1 =
m_node[(
unsigned int)from].getEdge();
2920 for (
size_t i_e = 0; i_e < edge1.size(); i_e++)
2922 if (edge1[i_e] == lii)
2925 for (
size_t iAdj = 0; iAdj < edgesadj.size(); iAdj++)
2927 if (edgesadj[iAdj] != -1 && edgesadj[iAdj] != lii)
2929 m_node[(
unsigned int)from].setEdge(edgesadj[iAdj]);
2939 std::vector<int32_t> edge1 =
m_node[(
unsigned int)to].getEdge();
2940 for (
size_t i_e = 0; i_e < edge1.size(); i_e++)
2942 if (edge1[i_e] == lii)
2945 for (
size_t iAdj = 0; iAdj < edgesadj.size(); iAdj++)
2947 if (edgesadj[iAdj] != -1 && edgesadj[iAdj] != lii)
2949 m_node[(
unsigned int)to].setEdge(edgesadj[iAdj]);
2961 for (int32_t tit = 0; tit < (int32_t)
m_triang.size(); ++tit)
2965 if (edge[0] == -1 || edge[1] == -1 || edge[2] == -1)
2971 int32_t left =
m_line[(
unsigned int)edge[0]].getLeftPolygon();
2972 int32_t right =
m_line[(
unsigned int)edge[0]].getRightPolygon();
2975 m_line[(
unsigned int)edge[0]].setLeftPolygon(-1);
2977 m_line[(
unsigned int)edge[0]].setRightPolygon(-1);
2982 long left =
m_line[(
unsigned int)edge[1]].getLeftPolygon();
2983 long right =
m_line[(
unsigned int)edge[1]].getRightPolygon();
2986 m_line[(
unsigned int)edge[1]].setLeftPolygon(-1);
2988 m_line[(
unsigned int)edge[1]].setRightPolygon(-1);
2992 long left =
m_line[(
unsigned int)edge[2]].getLeftPolygon();
2993 long right =
m_line[(
unsigned int)edge[2]].getRightPolygon();
2996 m_line[(
unsigned int)edge[2]].setLeftPolygon(-1);
2998 m_line[(
unsigned int)edge[2]].setRightPolygon(-1);
void insert(const kdKey &key, const kdDataItem &item)
It inserts the data with a given key in tree.
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.
int m_srid
Attribute with spatial reference information.
bool CreateMinAngleTriangulation()
Method used to create a Triangulation using the Minimum Angle Method.
bool CheckTopology()
Method that check the topology in a triangulation.
int32_t FindTriangle(te::gm::Point &ptr1)
Method that finds a triangle containing a given point.
size_t m_triangsize
Triangulation triangles vector size.
bool IsolinesConstrained()
Method that define the Constrained Isolines.
bool FindInterPoints(te::gm::Point &pf, te::gm::Point &pn, std::vector< te::gm::Point > &p3d, std::vector< bool > &fixed)
Method fint the point that intersects two triangles containing points pf and pn.
bool TrianglePoints(int32_t triangId, te::gm::Point *vertex)
Method that reads the vertex (points) of a given triangle.
void setTolerance(double tolerance)
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
int32_t PreviousNode(int32_t nodeId)
Method that finds out which is the previous node.
bool NodesId(int32_t triangId, int32_t *nodeIds)
Method that reads the identification number of the nodes of a given triangle.
void setNPoint(te::gm::Point npoint)
boost::shared_ptr< DataSource > DataSourcePtr
bool NodeDerivatives()
Method that calculates the first and second derivatives in the nodes of a given triangle.
bool CalcZvalueAkima(int32_t triid, te::gm::Point &pt1, te::gm::Point &pt2)
Method that evaluates Z values for pt1 and pt2 using the Akima polynomium fitted in a triangle...
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::Envelope m_env
Attribute used to restrict the area to generate the samples.
bool DupNeighTriangle(int32_t tv, int32_t an0, short, int32_t v, int32_t *testLines)
Method used to duplicate a neighbour triangle in a TIN (Triangular Irregular Network) ...
int32_t DuplicateTriangle(int32_t t, short n, int32_t v, int32_t *testLines)
Method used to duplicate a triangle in a TIN (Triangular Irregular Network)
bool NodeLines(int32_t v, std::vector< int32_t > &linids)
Method that includes a node in the tin line list.
bool NodeExchange(int32_t oldNode, int32_t newNode)
Method used to exchange two nodes in a TIN (Triangular Irregular Network)
size_t m_nodesize
Triangulation nodes vector size.
bool DeleteNode(int32_t node)
Method used to delete a node in a TIN (Triangular Irregular Network)
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
int32_t m_lline
Triangulation last line number.
std::string m_atrZ_sample
This class can be used to inform the progress of a task.
bool InsertNode(int32_t nodeid, int type)
Method used to insert a node in a TIN (Triangular Irregular Network)
bool UpdateTriangles(int32_t t, int32_t tv, int32_t ai)
Method used to Update Triangles of a given triangulation.
std::unique_ptr< Point > getPointN(std::size_t i) const
It returns the specified point in this LineString.
te::da::DataSourcePtr m_outDsrc
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
bool ReGenerateDelaunay(int32_t nt, int32_t ntbase, int32_t contr)
Method that regenerates a Delaunay triangulation.
int32_t ExchangePolygon(int32_t triangId, int32_t newPolyId, unsigned short edge)
Method that exchanges polygon.
An utility struct for representing 2D coordinates.
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
It sets the Datasource that is being used to save TIN.
te::gm::Geometry * neigh_union(te::gm::Geometry *tri_union, int32_t tri, std::vector< int32_t > &used_tri_all, std::map< int32_t, te::gm::Polygon > &pol_tri)
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
std::vector< TinLine > m_line
Triangulation lines vector.
TEMNTEXPORT double pointToSegmentDistance(te::gm::Point &fseg, te::gm::Point &lseg, te::gm::Point &pt, te::gm::Point *pti)
bool IsIsolineSegment(int32_t linid)
Method that veryfies if the Isoline is a segment.
std::string m_inDsetName_point
bool InsertNodes(const te::gm::MultiPoint &mpt, const te::gm::MultiLineString &mls)
virtual Geometry * Union(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set union with another geometry.
double m_tolerance
Triangulation lines simplification tolerance.
int32_t m_fbnode
First break node number.
bool TestAngleBetweenNormals(int32_t triId, short nviz)
Method used to test the angle between two normals.
bool TestDelaunay(int32_t tri1Id, int32_t tri2Id, int32_t tri3Id)
Method used to test if the triangulation follows the Delaunay rule.
bool isActive() const
Verify if the task is active.
bool IsNeighborOnIsoOrBreakline(int32_t triId, unsigned short nviz)
std::vector< TinTriang > m_triang
Triangulation triangles vector.
const double & getY(std::size_t i) const
It returns the n-th y coordinate value.
std::unique_ptr< te::da::DataSetType > m_inDsetType_sample
void setBreakLine(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType, double tol)
It sets the BreakLine Datasource that is being used to generate TIN.
std::unique_ptr< te::da::DataSetType > m_inDsetType_point
bool ReCreateDelaunay()
Method that recreates a Delaunay triangulation.
size_t m_linesize
Triangulation lines vector size.
TINGeneration()
Default constructor.
te::dt::AbstractData * clone() const
It clones the linear ring.
int32_t OppositeNode(int32_t triangId, int32_t linId)
Method that reads the identification number of the opposite node of a given edge. ...
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)
A LinearRing is a LineString that is both closed and simple.
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.
double m_tolerance_break
Triangulation breaklines simplification tolerance.
std::vector< TinNode > m_nsderiv
const double & getY() const
It returns the Point y-coordinate value.
A point with x and y coordinate values.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
bool CreateInitialTriangles(size_t nsamples)
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.
bool contains(const Envelope &rhs) const
It returns true if this envelope "spatially contains" the rhs envelope.
std::string m_inDsetName_sample
TEMNTEXPORT te::gm::LineString * pointListSimplify(te::gm::LineString *ls, double snap, double maxdist, double Zvalue)
bool NodeOppositeLines(int32_t v, std::vector< int32_t > &linids)
Method that find the oposite lines of a specific node.
const double & getX(std::size_t i) const
It returns the n-th x coordinate value.
bool NeighborsId(int32_t triangId, int32_t *neighsId)
te::da::DataSourcePtr m_inDsrc_point
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.
This file contains a class to generate TIN. Adapted from SPRING.
void setEnvelope(te::gm::Envelope &env)
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
A class that represents a two dimensional K-d Tree (2-d Tree).
bool InsertBreakNodes(te::gm::MultiLineString &breaklines)
Utility functions for the data access module.
std::unique_ptr< te::da::DataSetType > m_inDsetType_break
int32_t NextNode(int32_t nodeId)
Method that finds out which is the next node.
const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
bool TestIsolines(int iter)
Method that test the Isolines.
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.
void setMaxdist(double maxdist)
MultiLineString is a MultiCurve whose elements are LineStrings.
int m_method
Triangulation method Delanay or Smaller Angle.
bool CreateDelaunay()
Method that creates a Delaunay triangulation.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
bool SaveTin(te::da::DataSourcePtr &outDsrc, std::string &outDsetName)
bool run()
Generate TIN \ return true or false.
void setX(const double &x)
It sets the Point x-coordinate value.
te::sam::kdtree::Index< KD_NODE > KD_TREE
std::vector< TinNode > m_node
Triangulation nodes vector.
int32_t NodeId(int32_t triangId, short vertex)
Method that reads the identification number of the nodes of a given triangle.
A class that represents an Kd-tree node.
void clear()
It clears all tree nodes.
size_t ReadBreakLines(te::gm::MultiPoint &mpt, te::gm::MultiLineString &isolines, std::string &geostype)
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.
te::sam::kdtree::Node< te::gm::Coord2D, std::pair< int32_t, int32_t >, std::pair< int32_t, int32_t > > KD_NODE
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
bool OrderLines()
Method that order lines.
te::da::DataSourcePtr m_inDsrc_break
bool GenerateDelaunay(int32_t nt, int32_t ntbase, int32_t contr)
Method that generates a Delaunay triangulation.
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.
bool IsBreaklineSegment(int32_t linid)
Method that veryfies if the Breakline is a segment.
bool TestFlatTriangles()
Method that test if has flat triangles and regenerate them.
bool RegeneratewithNewPoints(std::vector< te::gm::Point > &p3dl, std::vector< bool > &fixed)
te::da::DataSourcePtr m_inDsrc_sample
double m_maxdist
Triangulation lines simplification maximum distance.
bool TwoNewTriangles(int32_t t, int32_t nodeId, int32_t *testLines)
Method used to create two new triangles in a TIN (Triangular Irregular Network)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
void setY(const double &y)
It sets the Point y-coordinate value.
void setY(std::size_t i, const double &y)
It sets the n-th y coordinate value.
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetType > inDsetType, InputType type)
It sets the Datasource that is being used to generate TIN.
std::string m_outDsetName
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.
bool ModifyBoundTriangles()
Method that modifies the bounds of Triangles.
void search(const te::gm::Envelope &e, std::vector< KdTreeNode * > &report) const
Range search query.
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.
std::string m_inDsetName_break
int32_t m_ltriang
Triangulation last triangle number.
TEMNTEXPORT bool triangleNormalVector(te::gm::Point *, double *)
Function that defines the triangle normal vector.
void setMinedgesize(double minedgesize)
bool OnIsolineSegment(int32_t linid, te::gm::Point &pt3d, bool &fixed)
Method that checks if a point 3D is on the isoline segment.
void setType(Ntype ntype)
te::gm::Point & getNPoint()
bool ReallocateVectors(size_t nSize)
Method that reallocates Vectors.
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 setParams(const double &tolerance, const double &maxdist, const double &minedgesize, const std::string &atrz_iso, const std::string &atrz_pt)
It sets the parameters to generate TIN.
int32_t m_lnode
Triangulation last node number.
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.
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.
double m_minedgesize
Triangulation edges minimum size.
std::vector< int32_t > FindLine(int32_t nid)
Method that find a line containing a specific node.