PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ parse_gml_coord()

static POINTARRAY* parse_gml_coord ( xmlNodePtr  xnode,
bool *  hasz 
)
static

Parse gml:coord.

Definition at line 644 of file lwgeom_in_gml.c.

645 {
646  xmlNodePtr xyz;
647  POINTARRAY *dpa;
648  bool x,y,z;
649  xmlChar *c;
650  POINT4D p;
651 
652  /* HasZ?, !HasM, 1 Point */
653  dpa = ptarray_construct_empty(1, 0, 1);
654 
655  x = y = z = false;
656  for (xyz = xnode->children ; xyz != NULL ; xyz = xyz->next)
657  {
658  if (xyz->type != XML_ELEMENT_NODE) continue;
659  if (!is_gml_namespace(xyz, false)) continue;
660 
661  if (!strcmp((char *) xyz->name, "X"))
662  {
663  if (x) gml_lwpgerror("invalid GML representation", 21);
664  c = xmlNodeGetContent(xyz);
665  p.x = parse_gml_double((char *) c, true, true);
666  x = true;
667  xmlFree(c);
668  }
669  else if (!strcmp((char *) xyz->name, "Y"))
670  {
671  if (y) gml_lwpgerror("invalid GML representation", 22);
672  c = xmlNodeGetContent(xyz);
673  p.y = parse_gml_double((char *) c, true, true);
674  y = true;
675  xmlFree(c);
676  }
677  else if (!strcmp((char *) xyz->name, "Z"))
678  {
679  if (z) gml_lwpgerror("invalid GML representation", 23);
680  c = xmlNodeGetContent(xyz);
681  p.z = parse_gml_double((char *) c, true, true);
682  z = true;
683  xmlFree(c);
684  }
685  }
686  /* Check dimension consistancy */
687  if (!x || !y) gml_lwpgerror("invalid GML representation", 24);
688  if (!z) *hasz = false;
689 
690  ptarray_append_point(dpa, &p, LW_FALSE);
691 
692  return dpa; /* ptarray_clone_deep(dpa); */
693 }
#define LW_FALSE
Definition: liblwgeom.h:77
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition: ptarray.c:156
static double parse_gml_double(char *d, bool space_before, bool space_after)
Parse a string supposed to be a double.
static bool is_gml_namespace(xmlNodePtr xnode, bool is_strict)
Return false if current element namespace is not a GML one Return true otherwise.
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwgeom_in_gml.c:82
double x
Definition: liblwgeom.h:355
double z
Definition: liblwgeom.h:355
double y
Definition: liblwgeom.h:355

References gml_lwpgerror(), is_gml_namespace(), LW_FALSE, parse_gml_double(), ptarray_append_point(), ptarray_construct_empty(), POINT4D::x, pixval::x, POINT4D::y, pixval::y, and POINT4D::z.

Referenced by parse_gml_data().

Here is the call graph for this function:
Here is the caller graph for this function: