1088{
1089 xmlNodePtr xa;
1090 size_t lss;
1091 bool found=false;
1096 uint32 npoints=0;
1097 xmlChar *interpolation=NULL;
1098
1100 if (xnode == NULL)
1102
1103
1104 for (xa = xnode->children ; xa != NULL ; xa = xa->next)
1105 {
1106 if (xa->type != XML_ELEMENT_NODE) continue;
1109 {
1110 found = true;
1111 break;
1112 }
1113 }
1114 if (!found)
gml_lwpgerror(
"invalid GML representation", 37);
1115
1117
1118
1119 for (xa = xa->children, lss=0; xa != NULL ; xa = xa->next)
1120 {
1121 if (xa->type != XML_ELEMENT_NODE) continue;
1123
1125
1126
1127 interpolation =
gmlGetProp(xa,
"interpolation");
1128 if (interpolation != NULL)
1129 {
1130 if (strcmp((char *) interpolation, "linear"))
1132 xmlFree(interpolation);
1133 }
1134
1137
1140 if (ppa[lss]->npoints < 2)
1142 lss++;
1143 }
1144 if (lss == 0)
gml_lwpgerror(
"invalid GML representation", 40);
1145
1146
1147 if (lss == 1) pa = ppa[0];
1148
1149 if (lss > 1)
1150 {
1151
1152
1153
1154
1155
1156
1157
1158
1159 size_t cp_point_size =
sizeof(
POINT3D);
1160 size_t final_point_size = *hasz ?
sizeof(
POINT3D) : sizeof(
POINT2D);
1162
1163
1167
1168
1169
1170
1171
1172 for (size_t i = 1; i < lss; i++)
1173 {
1176
1179 cp_point_size * (ppa[i]->npoints - 1));
1180
1181 npoints += ppa[i]->
npoints - 1;
1183 }
1184 }
1185
1187
1193
1194 return geom;
1195}
void * lwrealloc(void *mem, size_t size)
void * lwalloc(size_t size)
POINTARRAY * ptarray_flip_coordinates(POINTARRAY *pa)
Reverse X and Y axis on a given POINTARRAY.
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
#define SRID_UNKNOWN
Unknown SRID value.
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
static xmlNodePtr get_xlink_node(xmlNodePtr xnode)
Return a xmlNodePtr on a node referenced by a XLink or NULL otherwise.
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 bool is_xlink(xmlNodePtr node)
Return true if current node contains a simple XLink Return false otherwise.
static POINTARRAY * gml_reproject_pa(POINTARRAY *pa, int32_t epsg_in, int32_t epsg_out)
Use Proj to reproject a given POINTARRAY.
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 parse_gml_srs(xmlNodePtr xnode, gmlSrs *srs)
Parse gml srsName attribute.
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
static POINTARRAY * parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
Parse data coordinates.
static bool is_gml_element(xmlNodePtr xn, const char *gml_name)
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)