Parse gml:pos.
782{
783 xmlChar *dimension, *gmlpos;
784 int dim, gml_dim;
786 char *pos, *p;
787 bool digit;
789
790
792
793 dimension =
gmlGetProp(xnode,
"srsDimension");
794 if (dimension == NULL)
796 if (dimension == NULL) dim = 2;
797 else
798 {
799 dim = atoi((char *) dimension);
800 xmlFree(dimension);
801 if (dim < 2 || dim > 3)
803 }
804 if (dim == 2) *hasz = false;
805
806
807 gmlpos = xmlNodeGetContent(xnode);
808 pos = (char *) gmlpos;
809 while (isspace(*pos)) pos++;
810
811
812
813
814 for (p=pos, gml_dim=0, digit=false ; *pos ; pos++)
815 {
816 if (isdigit(*pos)) digit = true;
817 if (digit && (*pos == ' ' || *(pos+1) == '\0'))
818 {
819 if (*pos == ' ') *pos = '\0';
820 gml_dim++;
821 if (gml_dim == 1)
823 else if (gml_dim == 2)
825 else if (gml_dim == 3)
827
828 p = pos+1;
829 digit = false;
830 }
831 }
832 xmlFree(gmlpos);
833
834
835 if (gml_dim == 2) *hasz = false;
836 if (gml_dim < 2 || gml_dim > 3 || gml_dim != dim)
838
840
841 return dpa;
842}
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)