Parse gml:pos.
778{
779 xmlChar *dimension, *gmlpos;
780 int dim, gml_dim;
782 char *pos, *p;
783 bool digit;
785
786
788
789 dimension =
gmlGetProp(xnode,
"srsDimension");
790 if (dimension == NULL)
792 if (dimension == NULL) dim = 2;
793 else
794 {
795 dim = atoi((char *) dimension);
796 xmlFree(dimension);
797 if (dim < 2 || dim > 3)
799 }
800 if (dim == 2) *hasz = false;
801
802
803 gmlpos = xmlNodeGetContent(xnode);
804 pos = (char *) gmlpos;
805 while (isspace(*pos)) pos++;
806
807
808
809
810 for (p=pos, gml_dim=0, digit=false ; *pos ; pos++)
811 {
812 if (isdigit(*pos)) digit = true;
813 if (digit && (*pos == ' ' || *(pos+1) == '\0'))
814 {
815 if (*pos == ' ') *pos = '\0';
816 gml_dim++;
817 if (gml_dim == 1)
819 else if (gml_dim == 2)
821 else if (gml_dim == 3)
823
824 p = pos+1;
825 digit = false;
826 }
827 }
828 xmlFree(gmlpos);
829
830
831 if (gml_dim == 2) *hasz = false;
832 if (gml_dim < 2 || gml_dim > 3 || gml_dim != dim)
834
836
837 return dpa;
838}
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
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,...
static xmlChar * gmlGetProp(xmlNodePtr xnode, const char *charProp)
Retrieve a GML property from a node or NULL otherwise Respect namespaces if presents in the node elem...
static double parse_gml_double(char *d, bool space_before, bool space_after)
Parse a string supposed to be a double.
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)