PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ parse_gml_coord()

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

Parse gml:coord.

Definition at line 774 of file lwgeom_in_gml.c.

775 {
776  xmlNodePtr xyz;
777  POINTARRAY *dpa;
778  bool x,y,z;
779  xmlChar *c;
780  POINT4D p = {0};
781 
782  /* HasZ?, !HasM, 1 Point */
783  dpa = ptarray_construct_empty(1, 0, 1);
784 
785  x = y = z = false;
786  for (xyz = xnode->children ; xyz != NULL ; xyz = xyz->next)
787  {
788  if (xyz->type != XML_ELEMENT_NODE) continue;
789  if (!is_gml_namespace(xyz, false)) continue;
790 
791  if (is_gml_element(xyz, "X"))
792  {
793  if (x) gml_lwpgerror("invalid GML representation", 21);
794  c = xmlNodeGetContent(xyz);
795  p.x = parse_gml_double((char *) c, true, true);
796  x = true;
797  xmlFree(c);
798  }
799  else if (is_gml_element(xyz, "Y"))
800  {
801  if (y) gml_lwpgerror("invalid GML representation", 22);
802  c = xmlNodeGetContent(xyz);
803  p.y = parse_gml_double((char *) c, true, true);
804  y = true;
805  xmlFree(c);
806  }
807  else if (is_gml_element(xyz, "Z"))
808  {
809  if (z) gml_lwpgerror("invalid GML representation", 23);
810  c = xmlNodeGetContent(xyz);
811  p.z = parse_gml_double((char *) c, true, true);
812  z = true;
813  xmlFree(c);
814  }
815  }
816  /* Check dimension consistancy */
817  if (!x || !y) gml_lwpgerror("invalid GML representation", 24);
818  if (!z) *hasz = false;
819 
820  ptarray_append_point(dpa, &p, LW_FALSE);
821 
822  return dpa; /* ptarray_clone_deep(dpa); */
823 }
#define LW_FALSE
Definition: liblwgeom.h:108
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:59
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:147
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:81
static bool is_gml_element(xmlNodePtr xn, const char *gml_name)
double x
Definition: liblwgeom.h:428
double z
Definition: liblwgeom.h:428
double y
Definition: liblwgeom.h:428

References gml_lwpgerror(), is_gml_element(), 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: