Parse gml:posList.
845{
846 xmlChar *dimension, *gmlposlist;
847 char *poslist, *p;
848 int dim, gml_dim;
851 bool digit;
852
853
854 dimension =
gmlGetProp(xnode,
"srsDimension");
855 if (dimension == NULL)
857 if (dimension == NULL) dim = 2;
858 else
859 {
860 dim = atoi((char *) dimension);
861 xmlFree(dimension);
862 if (dim < 2 || dim > 3)
gml_lwpgerror(
"invalid GML representation", 27);
863 }
864 if (dim == 2) *hasz = false;
865
866
867 gmlposlist = xmlNodeGetContent(xnode);
868 poslist = (char *) gmlposlist;
869
870
872
873
874
875
876 while (isspace(*poslist)) poslist++;
877 for (p=poslist, gml_dim=0, digit=false ; *poslist ; poslist++)
878 {
879 if (isdigit(*poslist)) digit = true;
880 if (digit && (*poslist == ' ' || *(poslist+1) == '\0'))
881 {
882 if (*poslist == ' ') *poslist = '\0';
883
884 gml_dim++;
888
889 if (gml_dim == dim)
890 {
892 pt.
x = pt.
y = pt.
z = pt.
m = 0.0;
893 gml_dim = 0;
894 }
895 else if (*(poslist+1) == '\0')
897
898 p = poslist+1;
899 digit = false;
900 }
901 }
902
903 xmlFree(gmlposlist);
904
905 return dpa;
906}
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)