Loading...
Searching...
No Matches
Tin.h
Go to the documentation of this file.
1/*!
2\file terralib/mnt/core/Tin.h
3
4\brief This file contains a class to define a TIN.
5Adapted from SPRING
6*/
7
8#ifndef __TERRALIB_MNT_INTERNAL_TIN_H
9#define __TERRALIB_MNT_INTERNAL_TIN_H
10
11// Terralib Includes
12#include "Config.h"
13#include "Enums.h"
14
15#include "../../dataaccess/dataset/DataSet.h"
16#include "../../dataaccess/dataset/DataSetType.h"
17#include "../../dataaccess/datasource/DataSource.h"
18
19#include "../../geometry/Envelope.h"
20#include "../../geometry/Point.h"
21
22#include "../../sam.h"
23
24#include <vector>
25
26//const int32_t MAXTRIANGLES = 50;
27const int32_t CLNODES = 10;
28
31
32
33namespace te
34{
35 namespace mnt
36 {
38 {
39 public:
41 m_line[0] = -1;
42 m_line[1] = -1;
43 m_line[2] = -1;
44 }
45
46 /*! Set triangle edges.*/
47 void setEdges(int32_t fLine, int32_t sLine, int32_t tLine)
48 {
49 m_line[0] = fLine;
50 m_line[1] = sLine;
51 m_line[2] = tLine;
52 }
53
54 //....Fill in vector of triangle lines Ids.
55 bool LinesId(int32_t *linesId)
56 {
57 if (m_line[0] < 0 || m_line[1] < 0 || m_line[2] < 0)
58 return false;
59 linesId[0] = m_line[0];
60 linesId[1] = m_line[1];
61 linesId[2] = m_line[2];
62 return true;
63 }
64
65 //....Get the line at an edge of the triangle.
66 //....Input:
67 //......edge: edge number (0, 1 or 2).
68 //....Return:
69 //......Line at edge number.
70 int32_t LineAtEdge(unsigned short edge)
71 {
72 if (edge < 3)
73 return m_line[edge];
74 else
75 return -1;
76 }
77 protected:
78 int32_t m_line[3];// line numbers vector
79 };
80
81
82 class TinLine
83 {
84 public:
86
87 TinLine(int32_t& nodefrom, int32_t &nodeto, int32_t &leftpoly, int32_t &rightpoly, Ltype type)
88 : m_nodefrom(nodefrom), m_nodeto(nodeto), m_leftpoly(leftpoly), m_rightpoly(rightpoly), m_type(type) {}
89
90 bool operator==(const TinLine &rhs) const;
91
92 bool operator>(const TinLine &rhs) const;
93
94 bool operator<(const TinLine &rhs) const;
95
96 /*! Set initial node number.*/
97 void setNodeFrom(int32_t nodeid) { m_nodefrom = nodeid; }
98
99 /*! Get initial node number.*/
100 int32_t getNodeFrom() { return m_nodefrom; }
101
102 /*! Set last node number.*/
103 void setNodeTo(int32_t nodeid) { m_nodeto = nodeid; }
104
105 /*! Get last node number.*/
106 int32_t getNodeTo() { return m_nodeto; }
107
108 /*! Set initial and last node numbers.*/
109 void Nodes(int32_t nodefrom, int32_t nodeto)
110 {
111 m_nodefrom = nodefrom;
112 m_nodeto = nodeto;
113 }
114
115 /*! Set left polygon number.*/
116 void setLeftPolygon(int32_t polyid) { m_leftpoly = polyid; }
117
118 /*! Get left polygon number.*/
119 int32_t getLeftPolygon() { return m_leftpoly; }
120
121 /*! Set right polygon number.*/
122 void setRightPolygon(int32_t polyid) { m_rightpoly = polyid; }
123
124 /*! Get right polygon number.*/
125 int32_t getRightPolygon() { return m_rightpoly; }
126
127 /*! Set left and right polygon numbers*/
128 void Polygons(int32_t leftpoly, int32_t rightpoly)
129 {
130 m_leftpoly = leftpoly;
131 m_rightpoly = rightpoly;
132 }
133
134 /*!
135 \brief Method for exchange polygons in the triangulation
136 \param oldPolyId is the identification number of the old polygon
137 \param newPolyId is the identification number of the new polygon
138 \return TRUE if the polygons are the polygons are exchanged or FALSE otherwise
139 */
140 bool ExchangePolygon(int32_t oldPolyId, int32_t newPolyId);
141
142 /*!
143 \brief Method for exchange nodes in the triangulation
144 \param oldNodeId is the identification number of the old node
145 \param newNodeId is the identification number of the new node
146 \return TRUE if the nodes are the polygons are exchanged or FALSE otherwise
147 */
148 bool ExchangeNode(int32_t oldNodeId, int32_t newNodeId);
149
150 /*! Set line type.*/
151 void setType(Ltype ltype) { m_type = ltype; }
152
153 /*! Get line type.*/
154 Ltype getType() { return m_type; }
155
156 /*!
157 \brief Method for swap two nodes
158 \return TRUE always
159 */
160 bool SwapNode();
161
162 /*!
163 \brief Method for swap two adjacent polygons
164 \return TRUE always
165 */
167
168 /*!
169 \brief Method for swap two nodes and two adjacent polygons
170 \return TRUE always
171 */
173
174 protected:
175 int32_t m_nodefrom; //!< initial node number
176 int32_t m_nodeto; //!< last node number
177 int32_t m_leftpoly; //!< left polygon number
178 int32_t m_rightpoly; //!< right polygon number
179 Ltype m_type; //!< line type
180
181 };
182
183
184 /*!
185 \class TinNode
186 Class that defines a node for triangular irregular network
187 */
188
190 {
191
192 public:
194
195 TinNode(const TinNode &rhs){ m_type = rhs.m_type; m_edge = rhs.m_edge; m_point = rhs.m_point; }
196
197 bool operator== (const TinNode &rhs) const;
198
199 bool operator> (const TinNode &rhs) const;
200
201 bool operator< (const TinNode &rhs) const;
202
203 bool setEdge(int32_t edge);
204
205 bool removeEdge(int32_t edge);
206
207 std::vector<int32_t> &getEdge() { return m_edge; }
208
209 /*! Set node height value.*/
210 void setZ(double zvalue) { m_point.setZ(zvalue); }
211
212 /*! Get node height value.*/
213 double getZ() { return m_point.getZ(); }
214
215 /*! Set node X axis coordinate. */
216 void setX(double xvalue) { m_point.setX(xvalue); }
217
218 /*! Get node X axis coordinate.*/
219 double getX() { return m_point.getX(); }
220
221 /*! Set node Y axis coordinate.*/
222 void setY(double yvalue) { m_point.setY(yvalue); }
223
224 /*! Get node Y axis coordinate.*/
225 double getY() { return m_point.getY(); }
226
227 /*! Set node coordinates. */
228 void setNPoint(te::gm::Point npoint) { m_point = npoint; }
229
230 /*! Get node coordinates.*/
232
233 /*!Set node type. */
234 void setType(Ntype ntype) { m_type = ntype; }
235
236 /*!Get node type. */
237 Ntype getType() { return m_type; }
238
239 //!\brief Set node coordinates and height.
240 //!\param npoint: Point with coordinates.
241 //!\param ntype: Type (default value = NORMAL).
242 void Init(te::gm::Point& npoint, Ntype ntype = Normalnode)
243 {
244 m_point = npoint;
245 m_type = ntype;
246 }
247
248 //!\brief Set node coordinates, height and type.
249 //!\param xvalue: X axis coordinate.
250 //!\param yvalue: Y axis coordinate.
251 //!\param zvalue: Height value.
252 //!\param ntype: Type (default value = NORMAL).
253 void Init(double xvalue, double yvalue, double zvalue, Ntype ntype = Normalnode)
254 {
255 m_point.setX(xvalue);
256 m_point.setY(yvalue);
257 m_point.setZ(zvalue);
258 m_type = ntype;
259 }
260 protected:
261 Ntype m_type; //!< node type
262 te::gm::Point m_point; //!< Node point
263
264 public:
265 std::vector<int32_t> m_edge;
266 };
267
268 /*!
269 \class Tin
270
271 \brief Class to define TIN strutures.
272
273 \ingroup mnt
274
275 */
277 {
278 public:
279 Tin() : m_nodatavalue(std::numeric_limits<double>::max()), m_min(std::numeric_limits<double>::max()), m_max(std::numeric_limits<double>::min()) {}
280
282
283 /*! Function used to set the Spatial Reference System ID */
284 void setSRID(int srid);
285
286 /*! Function used to set the envelope parameter */
288
289 /*!
290 \brief Method used to load a triangular network (TIN)
291 \return true if the TIN is loaded with no errors or false otherwise
292 */
293 bool LoadTin(te::da::DataSourcePtr &inDsrc, std::string &inDsetName, double zmin = std::numeric_limits<double>::min(), double zmax = std::numeric_limits<double>::max());
294
295 /*!
296 \brief Method used to load a triangular network (TIN) generated by QGIS
297 \return true if the TIN is loaded with no errors or false otherwise
298 */
299 bool LoadTinQGIS(te::da::DataSourcePtr &inDsrc, std::string &inDsetName, double zmin, double zmax);
300
301 bool SaveTin(te::da::DataSourcePtr &outDsrc, std::string &outDsetName);
302
303 bool BuildTriangle(int32_t id, te::gm::LinearRing* lr, double *val, int32_t *right, int32_t *left, te::mnt::Ntype *type, \
304 double zmin, double zmax, bool &first, KD_TREE &nodetree, te::sam::rtree::Index<std::size_t>& linetree);
305
306 double getMin() { return m_min; }
307 double getMax() { return m_max; }
308
309 protected:
310
311 te::da::DataSetType* GetDataSetType(std::string &outDsetName);
312
313 /*!
314 \brief Method that finds a triangle containing a given point
315 \param ptr1 is a pointer to a Point object
316 \return true if the triangle was found or false (-1L)otherwise
317 */
319
320 /*!
321 \brief Method that reads the vertex (points) of a given triangle
322 \param triangId is the triangle identification number
323 \param vertex is a pointer to a list of Point object, the triangle vertices
324 \return true always
325 */
326 bool TrianglePoints(int32_t triangId, te::gm::Point *vertex);
327
328 bool NeighborsId(int32_t triangId, int32_t *neighsId);
329
330 /*!
331 \brief Method that reads the identification number of the opposite node of a given edge
332 \param triangId is the triangle identification number
333 \param linId is the line identification number
334 \return the opposite node identification considering the linId
335 */
336 int32_t OppositeNode(int32_t triangId, int32_t linId);
337
338 /*!
339 \brief Method that reads the identification number of the opposite edge of a given node
340 \param triangId is the triangle identification number
341 \param nodeId is the node identification number
342 \return the opposite edge identification considering the nodeId or -1 if error
343 */
344 int32_t OppositeEdge(int32_t triangId, int32_t nodeId);
345
346 /*!
347 \brief Method that find the oposite lines of a specific node
348 \param v is the node identification number
349 \param linids is pointer to a list of line identificators
350 \return true if the line is found with no errors or false otherwise
351 */
352 bool NodeOppositeLines(int32_t v, std::vector<int32_t> &linids);
353
354 /*!
355 \brief Method that finds out which is the previous node
356 \param nodeId is the node identification number
357 \return the number of the previous node
358 */
359 int32_t PreviousNode(int32_t nodeId);
360
361 /*!
362 \brief Method that finds out which is the next node
363 \param nodeId is the node identification number
364 \return the number of the next node
365 */
366 int32_t NextNode(int32_t nodeId);
367
368 /*!
369 \brief Method that verifies if a triangle contains a given point
370 \param triangId is the triangle identification number
371 \param pt is a pointer to a te::gm::PointZ object
372 \return TRUE if the point is in the triangle or FALSE (-1L)otherwise
373 */
374 bool ContainsPoint(int32_t triangId, te::gm::Point &pt);
375
376 /*!
377 \brief Method that find a line containing a specific node
378 \param nid is the node identification number
379 \return the number of the line if it was found with no errors or FALSE (-1L) otherwise
380 */
381 std::vector<int32_t> FindLine(int32_t nid);
382
383 /*!
384 \brief Method that find a line given two nodes identification
385 \param fnid is the first node identification number
386 \param snid is the second node identification number
387 \return the number of the line if it was found with no errors or FALSE (-1L) otherwise
388 */
389 int32_t FindLine(int32_t fnid, int32_t snid);
390
391 /*!
392 \brief Method that includes a node in the tin line list
393 \param v is the node identificator number
394 \param linids is a pointer to a list of line identificators
395 \return TRUE if the node is included with no errors or FALSE otherwise
396 */
397 bool NodeLines(int32_t v, std::vector<int32_t> &linids);
398
399 /*!
400 \brief Method that reads the identification number of the nodes of a given triangle
401 \param triangId is the triangle identification number
402 \param vertex is the number of the vertex to be considered
403 \return the node identification related to the vertex
404 */
405 int32_t NodeId(int32_t triangId, short vertex);
406
407 /*!
408 \brief Method that reads the identification number of the nodes of a given triangle
409 \param triangId is the triangle identification number
410 \param nodesIds is a pointer to a list of node identification numbers
411 \return TRUE always
412 */
413 bool NodesId(int32_t triangId, int32_t *nodeIds);
414
415
416 /*!
417 \brief Method that includes a node in the tin node list
418 \param v is the node identification number
419 \param nodids is a pointer to a list of node identificators
420 \return TRUE if the node is included with no errors or FALSE otherwise
421 */
422 bool NodeNodes(int32_t v, std::vector<int32_t>& nodids);
423
424 /*!
425 \brief Method that search a node in a triangulation
426 \param v is the node identification number
427 \return the right or left polygon of a line containing v or FALSE (-1L) otherwise
428 */
429 int32_t NodeTriangle(int32_t v);
430
431 /*!
432 \brief Method that includes a node in a triangle list
433 \param v is the node identification number
434 \param triangles is pointer to a vetor of triangles
435 \return TRUE if the node is included with no errors or FALSE otherwise
436 */
437 bool NodeTriangles(int32_t v, std::vector<int32_t>& triangles);
438
439 /*!
440 \brief Method that reallocates Vectors
441 \param nSize is the vector size
442 \return true always
443 */
444 bool ReallocateVectors(size_t nSize);
445
446 /*!
447 \brief Method that calculates the first and second derivatives in the nodes of a given triangle
448 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
449 */
451
452 /*!
453 \brief Method that calculates the first derivatives in the nodes of a given triangle
454 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
455 */
457
458 /*!
459 \brief Method that calculates the second derivatives in the nodes of a given triangle
460 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
461 */
463
464 /*!
465 \brief Method that calculates the first derivatives in the nodes of a given triangle
466 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
467 */
469
470 /*!
471 \brief Method that calculates the second derivative at all triangulation nodes
472 \return TRUE if the derivatives are calculated with no errors or False otherwise
473 */
475
476 /*!
477 \brief Method that find the triangle list sharing a given node
478 \param nodeid is the node identification number
479 \param rightri is a pointer to the triangles at right side
480 \param lefttri is a pointer to the triangles at left side
481 \return TRUE if the lists are find with no errors or FALSE otherwise
482 */
483 bool NodeTriangles(int32_t nodeid, std::vector<int32_t> &rightri, std::vector<int32_t> &leftri);
484
485 /*!
486 \brief Method that searches the closest points of a specific node
487 \param nid is the node identification number
488 \param clstNids is a pointer to a list of closest node identificators
489 \param useBrNode is the break nodeidentification
490 \return TRUE if the points are found with no errors or FALSE otherwise
491 */
492 bool NodeClosestPoints(int32_t nid, int32_t *clstNids, bool useBrNode = true);
493
494 /*!
495 \brief Method that calculates the first derivative in a given node
496 \param nodeid is the node identification number
497 \param clstNodes is the vector of a list of nodes)
498 \return a Point object containing the first derivative in x and y directions
499 */
500 te::gm::Point CalcNodeFirstDeriv(int32_t nodeId, int32_t clstNodes[CLNODES]);
501
502 /*!
503 \brief Method that calculates the second derivative in a given node
504 \param nodeid is the node identification number
505 \param clstNIds is the vector of a list of nodes identification
506 \return a Point object containing the first derivative in x and y directions
507 */
508 TinNode CalcNodeSecondDeriv(int32_t nodeId, int32_t clstNIds[CLNODES]);
509
510 /*!
511 \brief Method that calculates the first derivatives in the nodes of a given break triangle
512 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
513 */
515
516 /*!
517 \brief Method that calculates the second derivatives in the nodes of a given break triangle
518 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
519 */
521
522 /*!
523 \brief Method that searches the Break node closest points
524 \param nid is the node identification number
525 \param rClstNids is a pointer to a list of right node identificators
526 \param lClstNids is a pointer to a list of left node identificators
527 \return TRUE if the points are found with no errors or FALSE otherwise
528 */
529 bool BreakNodeClosestPoints(int32_t nid, int32_t *rClstNids, int32_t *lClstNids);
530
531 /*!
532 \brief Method that calculates the second derivatives in a node of a given triangle
533 \param triangles is a pointer to a list of triangle identificators (SIDList object)
534 \param fderiv is a pointer to a Point object representing the first derivative in x and y directions
535 \return TRUE if the derivatives are calculate with no errors or FALSE otherwise
536 */
537 bool CalcTriangleSecondDeriv(std::vector<int32_t> &triangles, std::vector<te::gm::Point> &fderiv);
538
539 /*!
540 \brief Method that calculates the second derivative at all triangulation break nodes
541 \return TRUE if the derivatives are calculated with no errors or False otherwise
542 */
544
545 /*!
546 \brief Method that check the topology in a triangulation
547 \return TRUE if the topology was checked with no errors or FALSE otherwise
548 */
550
551 /*!
552 \brief Method that check the lines in a triangulation
553 \return TRUE if the lines was checked with no errors or FALSE otherwise
554 */
555 bool CheckLines(int32_t trid);
556
557 /*!
558 \brief Method that evaluates Z values for pt1 and pt2 using the Akima polynomium fitted in a triangle
559 \param triid is the triangle identificator number
560 \param pt1 is a pointer to a Point3d object
561 \param pt2 is a pointer to a Point3d object
562 \return TRUE always
563 */
564 bool CalcZvalueAkima(int32_t triid, te::gm::Point &pt1, te::gm::Point &pt2);
565
566 /*!
567 \brief Method that defines the coefficients of the Akima polynomium fitted in a given triangle
568 \param triid is the triangle identification number
569 \param coef is a pointer to a double vector containing the polynomium coefficients
570 \return TRUE if the coefficients are determined with no errors or FALSE otherwise
571 */
572 bool DefineAkimaCoeficients(int32_t triid, double *coef);
573
574 /*!
575 \brief Method that defines the coefficients of the Akima polynomium fitted in a given triangle
576 \param triid is the triangle identification number
577 \param nodesid is the list of triangle nodes identification
578 \param p3d is a pointer to a Point3d object
579 \param coef is a pointer to a double vector containing the polynomium coefficients
580 \return TRUE if the coefficients are determined with no errors or FALSE otherwise
581 */
582 bool DefineAkimaCoeficients(int32_t triid, int32_t *nodesid, te::gm::Point *p3d, double *coef);
583
584 bool FillGridValue(int32_t triid, int32_t flin, int32_t llin, int32_t fcol, int32_t lcol, double zvalue);
585
586 /*!
587 \brief Method that calculates the lines and the columns intercepted by a triangle
588 \param grid is a pointer to a grid object that will be created
589 \param nodesid is a vector with nodes identification of the current triangle
590 \param flin and llin are the first and the last lines (rows) of the grid
591 \param fcol and lcol are the first and the last columns of the grid
592 \return TRUE if the gradient grid is filled or FALSE otherwise
593 */
594 bool DefineInterLinesColumns(int32_t *nodesid, int32_t &flin, int32_t &llin, int32_t &fcol, int32_t &lcol);
595
596 int m_srid; //!< Attribute with spatial reference information
597
598 te::gm::Envelope m_env; //!< Attribute used to restrict the area to generate the samples.
599
600 size_t m_linesize; //!< Triangulation lines vector size.
601 size_t m_triangsize; //!< Triangulation triangles vector size.
602 size_t m_nodesize; //!< Triangulation nodes vector size.
603
604 std::vector<TinLine> m_line; //!< Triangulation lines vector.
605 std::vector<TinTriang> m_triang; //!< Triangulation triangles vector.
606 std::vector<TinNode> m_node; //!< Triangulation nodes vector.
607
608 std::vector<te::gm::Point> m_tfderiv; //Pointer to triangles first derivatives vector.
609 std::vector<te::gm::Point> m_nfderiv; //Pointer to nodes first derivatives vector.
610 std::vector<te::gm::Point> m_nbrfderiv; //Pointer to right side nodes first derivatives vector.
611 std::vector<te::gm::Point> m_nblfderiv; //Pointer to left side nodes first derivatives vector.
612 std::vector<TinNode> m_tsderiv; //Pointer to triangles second derivatives vector.
613 std::vector<TinNode> m_nsderiv; //Pointer to nodes second derivatives vector.
614 std::vector<TinNode> m_nbrsderiv; //Pointer to right side nodes second derivatives vector.
615 std::vector<TinNode> m_nblsderiv; //Pointer to left side nodes second derivatives vector.
616
617 int32_t m_fbnode; //!<First break node number.
618 int32_t m_lnode; //!<Triangulation last node number.
619 int32_t m_ltriang; //!<Triangulation last triangle number.
620 int32_t m_lline; //!<Triangulation last line number.
621
623 double m_min;
624 double m_max;
625
627 double m_resx, m_resy;
628
629 };
630
631 } // end namespace mnt
632} // end namespace te
633
634#endif
te::sam::kdtree::Index< KD_NODE > KD_TREE
Definition: Tin.h:30
const int32_t CLNODES
Definition: Tin.h:27
te::sam::kdtree::Node< te::gm::Coord2D, int32_t, int32_t > KD_NODE
Definition: Tin.h:29
A class that models the description of a dataset.
Definition: DataSetType.h:73
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:54
A point with x and y coordinate values.
Definition: Point.h:51
void setZ(const double &z)
It sets the Point z-coordinate value.
Definition: Point.h:173
const double & getY() const
It returns the Point y-coordinate value.
Definition: Point.h:152
const double & getX() const
It returns the Point x-coordinate value.
Definition: Point.h:138
void setY(const double &y)
It sets the Point y-coordinate value.
Definition: Point.h:159
const double & getZ() const
It returns the Point z-coordinate value, if it has one or DoubleNotANumber otherwise.
Definition: Point.h:166
void setX(const double &x)
It sets the Point x-coordinate value.
Definition: Point.h:145
void setNodeTo(int32_t nodeid)
Definition: Tin.h:103
int32_t getNodeTo()
Definition: Tin.h:106
int32_t getLeftPolygon()
Definition: Tin.h:119
void Polygons(int32_t leftpoly, int32_t rightpoly)
Definition: Tin.h:128
bool ExchangePolygon(int32_t oldPolyId, int32_t newPolyId)
Method for exchange polygons in the triangulation.
bool operator==(const TinLine &rhs) const
void setRightPolygon(int32_t polyid)
Definition: Tin.h:122
void Nodes(int32_t nodefrom, int32_t nodeto)
Definition: Tin.h:109
int32_t getNodeFrom()
Definition: Tin.h:100
void setNodeFrom(int32_t nodeid)
Definition: Tin.h:97
Ltype getType()
Definition: Tin.h:154
bool operator>(const TinLine &rhs) const
bool SwapPolygon()
Method for swap two adjacent polygons.
Ltype m_type
line type
Definition: Tin.h:179
int32_t m_nodeto
last node number
Definition: Tin.h:176
int32_t getRightPolygon()
Definition: Tin.h:125
bool SwapNodePolygon()
Method for swap two nodes and two adjacent polygons.
bool operator<(const TinLine &rhs) const
int32_t m_leftpoly
left polygon number
Definition: Tin.h:177
bool SwapNode()
Method for swap two nodes.
bool ExchangeNode(int32_t oldNodeId, int32_t newNodeId)
Method for exchange nodes in the triangulation.
void setLeftPolygon(int32_t polyid)
Definition: Tin.h:116
void setType(Ltype ltype)
Definition: Tin.h:151
int32_t m_nodefrom
initial node number
Definition: Tin.h:175
TinLine(int32_t &nodefrom, int32_t &nodeto, int32_t &leftpoly, int32_t &rightpoly, Ltype type)
Definition: Tin.h:87
int32_t m_rightpoly
right polygon number
Definition: Tin.h:178
void setNPoint(te::gm::Point npoint)
Definition: Tin.h:228
bool removeEdge(int32_t edge)
Ntype m_type
node type
Definition: Tin.h:261
void setType(Ntype ntype)
Definition: Tin.h:234
bool setEdge(int32_t edge)
double getZ()
Definition: Tin.h:213
void setX(double xvalue)
Definition: Tin.h:216
double getX()
Definition: Tin.h:219
te::gm::Point & getNPoint()
Definition: Tin.h:231
te::gm::Point m_point
Node point.
Definition: Tin.h:262
bool operator>(const TinNode &rhs) const
void Init(double xvalue, double yvalue, double zvalue, Ntype ntype=Normalnode)
Set node coordinates, height and type.
Definition: Tin.h:253
std::vector< int32_t > & getEdge()
Definition: Tin.h:207
void setZ(double zvalue)
Definition: Tin.h:210
bool operator<(const TinNode &rhs) const
TinNode(const TinNode &rhs)
Definition: Tin.h:195
void Init(te::gm::Point &npoint, Ntype ntype=Normalnode)
Set node coordinates and height.
Definition: Tin.h:242
void setY(double yvalue)
Definition: Tin.h:222
double getY()
Definition: Tin.h:225
bool operator==(const TinNode &rhs) const
Ntype getType()
Definition: Tin.h:237
std::vector< int32_t > m_edge
Definition: Tin.h:265
int32_t LineAtEdge(unsigned short edge)
Definition: Tin.h:70
int32_t m_line[3]
Definition: Tin.h:78
void setEdges(int32_t fLine, int32_t sLine, int32_t tLine)
Definition: Tin.h:47
bool LinesId(int32_t *linesId)
Definition: Tin.h:55
Class to define TIN strutures.
Definition: Tin.h:277
int32_t OppositeEdge(int32_t triangId, int32_t nodeId)
Method that reads the identification number of the opposite edge of a given node.
int32_t NodeTriangle(int32_t v)
Method that search a node in a triangulation.
bool DefineAkimaCoeficients(int32_t triid, double *coef)
Method that defines the coefficients of the Akima polynomium fitted in a given triangle.
te::da::DataSetType * GetDataSetType(std::string &outDsetName)
int32_t m_fbnode
First break node number.
Definition: Tin.h:617
TinNode CalcNodeSecondDeriv(int32_t nodeId, int32_t clstNIds[CLNODES])
Method that calculates the second derivative in a given node.
bool TriangleSecondDeriv()
Method that calculates the second derivatives in the nodes of a given triangle.
bool DefineInterLinesColumns(int32_t *nodesid, int32_t &flin, int32_t &llin, int32_t &fcol, int32_t &lcol)
Method that calculates the lines and the columns intercepted by a triangle.
bool BreakNodeClosestPoints(int32_t nid, int32_t *rClstNids, int32_t *lClstNids)
Method that searches the Break node closest points.
bool CheckTopology()
Method that check the topology in a triangulation.
te::gm::Envelope m_env
Attribute used to restrict the area to generate the samples.
Definition: Tin.h:598
bool NodeNodes(int32_t v, std::vector< int32_t > &nodids)
Method that includes a node in the tin node list.
bool NodeSecondDeriv()
Method that calculates the second derivative at all triangulation nodes.
bool NodeTriangles(int32_t nodeid, std::vector< int32_t > &rightri, std::vector< int32_t > &leftri)
Method that find the triangle list sharing a given node.
size_t m_nodesize
Triangulation nodes vector size.
Definition: Tin.h:602
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.
bool BreakNodeFirstDeriv()
Method that calculates the first derivatives in the nodes of a given break triangle.
int32_t NodeId(int32_t triangId, short vertex)
Method that reads the identification number of the nodes of a given triangle.
std::vector< TinNode > m_nsderiv
Definition: Tin.h:613
bool TriangleFirstDeriv()
Method that calculates the first derivatives in the nodes of a given triangle.
double m_min
Definition: Tin.h:623
bool NodeFirstDeriv()
Method that calculates the first derivatives in the nodes of a given triangle.
bool NodeTriangles(int32_t v, std::vector< int32_t > &triangles)
Method that includes a node in a triangle list.
bool CheckLines(int32_t trid)
Method that check the lines in a triangulation.
bool NeighborsId(int32_t triangId, int32_t *neighsId)
te::rst::Raster * m_rst
Definition: Tin.h:626
std::vector< TinNode > m_nblsderiv
Definition: Tin.h:615
double m_resx
Definition: Tin.h:627
size_t m_linesize
Triangulation lines vector size.
Definition: Tin.h:600
std::vector< TinLine > m_line
Triangulation lines vector.
Definition: Tin.h:604
int32_t m_lline
Triangulation last line number.
Definition: Tin.h:620
bool TrianglePoints(int32_t triangId, te::gm::Point *vertex)
Method that reads the vertex (points) of a given triangle.
bool NodeLines(int32_t v, std::vector< int32_t > &linids)
Method that includes a node in the tin line list.
size_t m_triangsize
Triangulation triangles vector size.
Definition: Tin.h:601
std::vector< TinTriang > m_triang
Triangulation triangles vector.
Definition: Tin.h:605
std::vector< TinNode > m_nbrsderiv
Definition: Tin.h:614
std::vector< te::gm::Point > m_nbrfderiv
Definition: Tin.h:610
bool ContainsPoint(int32_t triangId, te::gm::Point &pt)
Method that verifies if a triangle contains a given point.
bool SaveTin(te::da::DataSourcePtr &outDsrc, std::string &outDsetName)
std::vector< te::gm::Point > m_tfderiv
Definition: Tin.h:608
bool NodeClosestPoints(int32_t nid, int32_t *clstNids, bool useBrNode=true)
Method that searches the closest points of a specific node.
bool BreakNodeSecondDeriv()
Method that calculates the second derivative at all triangulation break nodes.
std::vector< TinNode > m_tsderiv
Definition: Tin.h:612
bool ReallocateVectors(size_t nSize)
Method that reallocates Vectors.
int32_t FindLine(int32_t fnid, int32_t snid)
Method that find a line given two nodes identification.
int32_t FindTriangle(te::gm::Point &ptr1)
Method that finds a triangle containing a given point.
bool NodesId(int32_t triangId, int32_t *nodeIds)
Method that reads the identification number of the nodes of a given triangle.
std::vector< int32_t > FindLine(int32_t nid)
Method that find a line containing a specific node.
int32_t m_lnode
Triangulation last node number.
Definition: Tin.h:618
bool NodeOppositeLines(int32_t v, std::vector< int32_t > &linids)
Method that find the oposite lines of a specific node.
bool CalcTriangleSecondDeriv(std::vector< int32_t > &triangles, std::vector< te::gm::Point > &fderiv)
Method that calculates the second derivatives in a node of a given triangle.
std::vector< te::gm::Point > m_nblfderiv
Definition: Tin.h:611
int m_srid
Attribute with spatial reference information.
Definition: Tin.h:596
void setEnvelope(te::gm::Envelope &env)
void setSRID(int srid)
double m_max
Definition: Tin.h:624
int32_t OppositeNode(int32_t triangId, int32_t linId)
Method that reads the identification number of the opposite node of a given edge.
bool BreakTriangleSecondDeriv()
Method that calculates the second derivatives in the nodes of a given break triangle.
bool FillGridValue(int32_t triid, int32_t flin, int32_t llin, int32_t fcol, int32_t lcol, double zvalue)
int32_t NextNode(int32_t nodeId)
Method that finds out which is the next node.
std::vector< TinNode > m_node
Triangulation nodes vector.
Definition: Tin.h:606
double m_nodatavalue
Definition: Tin.h:622
int32_t m_ltriang
Triangulation last triangle number.
Definition: Tin.h:619
bool DefineAkimaCoeficients(int32_t triid, int32_t *nodesid, te::gm::Point *p3d, double *coef)
Method that defines the coefficients of the Akima polynomium fitted in a given triangle.
double getMin()
Definition: Tin.h:306
double getMax()
Definition: Tin.h:307
bool LoadTinQGIS(te::da::DataSourcePtr &inDsrc, std::string &inDsetName, double zmin, double zmax)
Method used to load a triangular network (TIN) generated by QGIS.
std::vector< te::gm::Point > m_nfderiv
Definition: Tin.h:609
bool BuildTriangle(int32_t id, te::gm::LinearRing *lr, double *val, int32_t *right, int32_t *left, te::mnt::Ntype *type, double zmin, double zmax, bool &first, KD_TREE &nodetree, te::sam::rtree::Index< std::size_t > &linetree)
bool NodeDerivatives()
Method that calculates the first and second derivatives in the nodes of a given triangle.
bool LoadTin(te::da::DataSourcePtr &inDsrc, std::string &inDsetName, double zmin=std::numeric_limits< double >::min(), double zmax=std::numeric_limits< double >::max())
Method used to load a triangular network (TIN)
int32_t PreviousNode(int32_t nodeId)
Method that finds out which is the previous node.
te::gm::Point CalcNodeFirstDeriv(int32_t nodeId, int32_t clstNodes[CLNODES])
Method that calculates the first derivative in a given node.
An abstract class for raster data strucutures.
Definition: Raster.h:72
A class that represents a two dimensional K-d Tree (2-d Tree).
Definition: Index.h:68
A class that represents an Kd-tree node.
Definition: Node.h:62
A class that represents an R-tree.
Definition: Index.h:57
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
Ltype
Definition: Enums.h:20
@ Normalline
Definition: Enums.h:22
Ntype
Definition: Enums.h:32
@ Normalnode
Definition: Enums.h:34
@ Deletednode
Definition: Enums.h:33
TerraLib.
#define TEMNTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:41
Proxy configuration file for TerraView (see terraview_config.h).
Enumerations of XML module.