PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ parse_gml_tin()

static LWGEOM* parse_gml_tin ( xmlNodePtr  xnode,
bool *  hasz,
int *  root_srid 
)
static

Parse GML Tin (and TriangulatedSurface) (3.1.1)

TODO handle also Tin attributes:

  • stopLines
  • breakLines
  • maxLength
  • position

Definition at line 1426 of file lwgeom_in_gml.c.

References get_xlink_node(), is_gml_namespace(), is_xlink(), lwcollection_construct_empty(), lwtin_add_lwtriangle(), parse_gml_srs(), parse_gml_triangle(), struct_gmlSrs::srid, SRID_UNKNOWN, and TINTYPE.

Referenced by parse_gml().

1427 {
1428  gmlSrs srs;
1429  xmlNodePtr xa;
1430  LWGEOM *geom=NULL;
1431  bool found=false;
1432 
1433  if (is_xlink(xnode)) xnode = get_xlink_node(xnode);
1434 
1435  parse_gml_srs(xnode, &srs);
1436  if (*root_srid == SRID_UNKNOWN && srs.srid != SRID_UNKNOWN)
1437  *root_srid = srs.srid;
1438 
1439  geom = (LWGEOM *)lwcollection_construct_empty(TINTYPE, *root_srid, 1, 0);
1440 
1441  if (xnode->children == NULL)
1442  return geom;
1443 
1444  /* Looking for gml:patches or gml:trianglePatches */
1445  for (xa = xnode->children ; xa != NULL ; xa = xa->next)
1446  {
1447  if (xa->type != XML_ELEMENT_NODE) continue;
1448  if (!is_gml_namespace(xa, false)) continue;
1449  if (!strcmp((char *) xa->name, "patches") ||
1450  !strcmp((char *) xa->name, "trianglePatches"))
1451  {
1452  found = true;
1453  break;
1454  }
1455  }
1456  if (!found) return geom; /* empty one */
1457 
1458  /* Processing each gml:Triangle */
1459  for (xa = xa->children ; xa != NULL ; xa = xa->next)
1460  {
1461  if (xa->type != XML_ELEMENT_NODE) continue;
1462  if (!is_gml_namespace(xa, false)) continue;
1463  if (strcmp((char *) xa->name, "Triangle")) continue;
1464 
1465  if (xa->children != NULL)
1466  geom = (LWGEOM*) lwtin_add_lwtriangle((LWTIN *) geom,
1467  (LWTRIANGLE *) parse_gml_triangle(xa, hasz, root_srid));
1468  }
1469 
1470  return geom;
1471 }
static LWGEOM * parse_gml_triangle(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse GML Triangle (3.1.1)
LWTIN * lwtin_add_lwtriangle(LWTIN *mobj, const LWTRIANGLE *obj)
Definition: lwtin.c:21
static void parse_gml_srs(xmlNodePtr xnode, gmlSrs *srs)
Parse gml srsName attribute.
static xmlNodePtr get_xlink_node(xmlNodePtr xnode)
Return a xmlNodePtr on a node referenced by a XLink or NULL otherwise.
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
#define TINTYPE
Definition: liblwgeom.h:84
static bool is_xlink(xmlNodePtr node)
Return true if current node contains a simple XLink Return false otherwise.
static bool is_gml_namespace(xmlNodePtr xnode, bool is_strict)
Return false if current element namespace is not a GML one Return true otherwise. ...
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
Here is the call graph for this function:
Here is the caller graph for this function: