static gaiaGeomCollPtr gaiaGeoJsonGeometryFromLinestringZ (struct geoJson_data *p_data, gaiaLinestringPtr line, int srid) { /* builds a GEOMETRY containing a LINESTRINGZ */ gaiaGeomCollPtr geom = NULL; gaiaLinestringPtr line2; int iv; double x; double y; double z; geom = gaiaAllocGeomCollXYZ (); geoJsonMapDynAlloc (p_data, GEOJSON_DYN_GEOMETRY, geom); geom->DeclaredType = GAIA_LINESTRING; geom->Srid = srid; line2 = gaiaAddLinestringToGeomColl (geom, line->Points); for (iv = 0; iv < line2->Points; iv++) { /* sets the POINTS for the exterior ring */ gaiaGetPointXYZ (line->Coords, iv, &x, &y, &z); gaiaSetPointXYZ (line2->Coords, iv, x, y, z); } geoJsonMapDynClean (p_data, line); gaiaFreeLinestring (line); return geom; }
static void geoJsonCleanMapDynAlloc (struct geoJson_data *p_data, int clean_all) { /* cleaning the dynamic allocations map */ int i; struct geoJson_dyn_block *pn; struct geoJson_dyn_block *p = p_data->geoJson_first_dyn_block; while (p) { if (clean_all) { for (i = 0; i < GEOJSON_DYN_BLOCK; i++) { /* deleting Geometry objects */ switch (p->type[i]) { case GEOJSON_DYN_POINT: gaiaFreePoint ((gaiaPointPtr) (p->ptr[i])); break; case GEOJSON_DYN_LINESTRING: gaiaFreeLinestring ((gaiaLinestringPtr) (p->ptr[i])); break; case GEOJSON_DYN_POLYGON: gaiaFreePolygon ((gaiaPolygonPtr) (p->ptr[i])); break; case GEOJSON_DYN_RING: gaiaFreeRing ((gaiaRingPtr) (p->ptr[i])); break; case GEOJSON_DYN_GEOMETRY: gaiaFreeGeomColl ((gaiaGeomCollPtr) (p->ptr[i])); break; }; } } /* deleting the map block */ pn = p->next; free (p); p = pn; } }
/* * Returns a geometry collection containing the created multilinestring object (?). * Creates a geometry collection containing 3D (xyz) linestrings. * Parameter first is a gaiaLinestringPtr to the first linestring in a linked list of linestrings which should be added to the * collection. All of the *linestrings in the list must be 3D (xyz) linestrings. There must be at least 1 linestring in the list. * Returns a pointer to the created geometry collection of 3D linestrings. The geometry must have FirstLinestring pointing to the * first linestring in the *list pointed by first and LastLinestring pointing to the last element of the same list. DimensionModel * must be GAIA_XYZ and DimensionType must be *GAIA_TYPE_LINESTRING. */ static gaiaGeomCollPtr geoJSON_multilinestring_xyz (struct geoJson_data *p_data, gaiaLinestringPtr first) { gaiaLinestringPtr p = first; gaiaLinestringPtr p_n; gaiaLinestringPtr new_line; gaiaGeomCollPtr a = gaiaAllocGeomCollXYZ (); geoJsonMapDynAlloc (p_data, GEOJSON_DYN_GEOMETRY, a); a->DeclaredType = GAIA_MULTILINESTRING; a->DimensionModel = GAIA_XY_Z; while (p) { new_line = gaiaAddLinestringToGeomColl (a, p->Points); gaiaCopyLinestringCoords (new_line, p); p_n = p->Next; geoJsonMapDynClean (p_data, p); gaiaFreeLinestring (p); p = p_n; } return a; }
int main (int argc, char *argv[]) { int result; int returnValue = 0; gaiaRingPtr interior; /* Common setup */ gaiaLinestringPtr linestr1 = gaiaAllocLinestring(0); gaiaLinestringPtr linestr2 = gaiaAllocLinestring(0); gaiaPolygonPtr poly1 = gaiaAllocPolygon(0, 0); gaiaPolygonPtr poly2 = gaiaAllocPolygon(0, 0); /* Tests start here */ /* zero length linestring */ result = gaiaLinestringEquals(linestr1, linestr2); if (result != 1) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -1; goto exit; } /* non-matching linestring lengths */ gaiaFreeLinestring (linestr1); gaiaFreeLinestring (linestr2); linestr1 = gaiaAllocLinestring(2); linestr2 = gaiaAllocLinestring(3); gaiaSetPoint(linestr1->Coords, 0, 1, 3); /* line1, first point */ gaiaSetPoint(linestr1->Coords, 1, 2, 4); /* line1, second point */ gaiaSetPoint(linestr2->Coords, 0, 4, -2); /* line2, first point */ gaiaSetPoint(linestr2->Coords, 1, 1, 5); /* line2, second point */ gaiaSetPoint(linestr2->Coords, 2, 3, 4); /* line2, third point */ result = gaiaLinestringEquals(linestr1, linestr2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -2; goto exit; } /* identical lines */ gaiaFreeLinestring (linestr2); linestr2 = gaiaCloneLinestring(linestr1); result = gaiaLinestringEquals(linestr1, linestr2); if (result != 1) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -3; goto exit; } /* not quite identical lines */ gaiaSetPoint(linestr2->Coords, 1, 2, -4); result = gaiaLinestringEquals(linestr1, linestr2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -4; goto exit; } /* zero length polygon */ result = gaiaPolygonEquals(poly1, poly2); if (result != 1) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -5; goto exit; } /* matching polygons */ gaiaFreePolygon (poly1); gaiaFreePolygon (poly2); poly1 = gaiaAllocPolygon(5, 0); gaiaSetPoint(poly1->Exterior->Coords, 0, 0, 0); gaiaSetPoint(poly1->Exterior->Coords, 1, 10, 0); gaiaSetPoint(poly1->Exterior->Coords, 2, 10, 10); gaiaSetPoint(poly1->Exterior->Coords, 3, 0, 10); gaiaSetPoint(poly1->Exterior->Coords, 4, 0, 0); poly2 = gaiaClonePolygon(poly1); result = gaiaPolygonEquals(poly1, poly2); if (result != 1) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -6; goto exit; } /* not quite matching polygons */ gaiaSetPoint(poly2->Exterior->Coords, 2, 10, -10); result = gaiaPolygonEquals(poly1, poly2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -7; goto exit; } /* polygons with different numbers of interiors */ gaiaFreePolygon (poly2); poly2 = gaiaAllocPolygon(5, 1); gaiaSetPoint(poly2->Exterior->Coords, 0, 0, 0); gaiaSetPoint(poly2->Exterior->Coords, 1, 10, 0); gaiaSetPoint(poly2->Exterior->Coords, 2, 10, 10); gaiaSetPoint(poly2->Exterior->Coords, 3, 0, 10); gaiaSetPoint(poly2->Exterior->Coords, 4, 0, 0); interior = gaiaAddInteriorRing(poly2, 0, 4); gaiaSetPoint(interior->Coords, 0, 1, 1); gaiaSetPoint(interior->Coords, 1, 3, 2); gaiaSetPoint(interior->Coords, 2, 3, 1); gaiaSetPoint(interior->Coords, 3, 1, 1); result = gaiaPolygonEquals(poly1, poly2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -8; goto exit; } /* same exteriors and interiors */ gaiaFreePolygon (poly1); poly1 = gaiaClonePolygon(poly2); result = gaiaPolygonEquals(poly1, poly2); if (result != 1) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -9; goto exit; } /* slightly different interiors */ gaiaSetPoint(interior->Coords, 2, 3, 3); result = gaiaPolygonEquals(poly1, poly2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -10; goto exit; } /* different number of exterior points */ gaiaFreePolygon(poly2); poly2 = gaiaAllocPolygon(4, 1); gaiaSetPoint(poly2->Exterior->Coords, 0, 0, 0); gaiaSetPoint(poly2->Exterior->Coords, 1, 10, 0); gaiaSetPoint(poly2->Exterior->Coords, 2, 10, 10); gaiaSetPoint(poly2->Exterior->Coords, 3, 0, 0); interior = gaiaAddInteriorRing(poly2, 0, 4); gaiaSetPoint(interior->Coords, 0, 1, 1); gaiaSetPoint(interior->Coords, 1, 3, 2); gaiaSetPoint(interior->Coords, 2, 3, 1); gaiaSetPoint(interior->Coords, 3, 1, 1); result = gaiaPolygonEquals(poly1, poly2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -11; goto exit; } /* same exterior points, but different number of points on first interior */ gaiaFreePolygon (poly2); poly2 = gaiaAllocPolygon(5, 1); gaiaSetPoint(poly2->Exterior->Coords, 0, 0, 0); gaiaSetPoint(poly2->Exterior->Coords, 1, 10, 0); gaiaSetPoint(poly2->Exterior->Coords, 2, 10, 10); gaiaSetPoint(poly2->Exterior->Coords, 3, 0, 10); gaiaSetPoint(poly2->Exterior->Coords, 4, 0, 0); interior = gaiaAddInteriorRing(poly2, 0, 5); gaiaSetPoint(interior->Coords, 0, 1, 1); gaiaSetPoint(interior->Coords, 1, 3, 2); gaiaSetPoint(interior->Coords, 2, 3, 3); gaiaSetPoint(interior->Coords, 3, 1, 3); gaiaSetPoint(interior->Coords, 4, 1, 1); result = gaiaPolygonEquals(poly1, poly2); if (result != 0) { fprintf(stderr, "bad result at %s:%i: %i\n", __FILE__, __LINE__, result); returnValue = -12; goto exit; } /* Cleanup and exit */ exit: gaiaFreeLinestring (linestr1); gaiaFreeLinestring (linestr2); gaiaFreePolygon (poly1); gaiaFreePolygon (poly2); return returnValue; }
static gaiaGeomCollPtr gaiaTransformCommon (projCtx handle, gaiaGeomCollPtr org, char *proj_from, char *proj_to) { /* creates a new GEOMETRY reprojecting coordinates from the original one */ int ib; int cnt; int i; double *xx; double *yy; double *zz; double *mm = NULL; double x; double y; double z = 0.0; double m = 0.0; int error = 0; int from_angle; int to_angle; gaiaPointPtr pt; gaiaLinestringPtr ln; gaiaLinestringPtr dst_ln; gaiaPolygonPtr pg; gaiaPolygonPtr dst_pg; gaiaRingPtr rng; gaiaRingPtr dst_rng; projPJ from_cs; projPJ to_cs; gaiaGeomCollPtr dst; if (handle != NULL) { from_cs = pj_init_plus_ctx (handle, proj_from); to_cs = pj_init_plus_ctx (handle, proj_to); } else { from_cs = pj_init_plus (proj_from); to_cs = pj_init_plus (proj_to); } if (!from_cs) { if (to_cs) pj_free (to_cs); return NULL; } if (!to_cs) { pj_free (from_cs); return NULL; } if (org->DimensionModel == GAIA_XY_Z) dst = gaiaAllocGeomCollXYZ (); else if (org->DimensionModel == GAIA_XY_M) dst = gaiaAllocGeomCollXYM (); else if (org->DimensionModel == GAIA_XY_Z_M) dst = gaiaAllocGeomCollXYZM (); else dst = gaiaAllocGeomColl (); /* setting up projection parameters */ from_angle = gaiaIsLongLat (proj_from); to_angle = gaiaIsLongLat (proj_to); cnt = 0; pt = org->FirstPoint; while (pt) { /* counting POINTs */ cnt++; pt = pt->Next; } if (cnt) { /* reprojecting POINTs */ xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); i = 0; pt = org->FirstPoint; while (pt) { /* inserting points to be converted in temporary arrays */ if (from_angle) { xx[i] = gaiaDegsToRads (pt->X); yy[i] = gaiaDegsToRads (pt->Y); } else { xx[i] = pt->X; yy[i] = pt->Y; } if (org->DimensionModel == GAIA_XY_Z || org->DimensionModel == GAIA_XY_Z_M) zz[i] = pt->Z; else zz[i] = 0.0; if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) mm[i] = pt->M; i++; pt = pt->Next; } /* applying reprojection */ if (pj_transform (from_cs, to_cs, cnt, 0, xx, yy, zz) == 0) { /* inserting the reprojected POINTs in the new GEOMETRY */ for (i = 0; i < cnt; i++) { if (to_angle) { x = gaiaRadsToDegs (xx[i]); y = gaiaRadsToDegs (yy[i]); } else { x = xx[i]; y = yy[i]; } if (org->DimensionModel == GAIA_XY_Z || org->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; if (dst->DimensionModel == GAIA_XY_Z) gaiaAddPointToGeomCollXYZ (dst, x, y, z); else if (dst->DimensionModel == GAIA_XY_M) gaiaAddPointToGeomCollXYM (dst, x, y, m); else if (dst->DimensionModel == GAIA_XY_Z_M) gaiaAddPointToGeomCollXYZM (dst, x, y, z, m); else gaiaAddPointToGeomColl (dst, x, y); } } else error = 1; free (xx); free (yy); free (zz); if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) free (mm); } if (error) goto stop; ln = org->FirstLinestring; while (ln) { /* reprojecting LINESTRINGs */ cnt = ln->Points; xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); for (i = 0; i < cnt; i++) { /* inserting points to be converted in temporary arrays */ if (ln->DimensionModel == GAIA_XY_Z) { gaiaGetPointXYZ (ln->Coords, i, &x, &y, &z); } else if (ln->DimensionModel == GAIA_XY_M) { gaiaGetPointXYM (ln->Coords, i, &x, &y, &m); } else if (ln->DimensionModel == GAIA_XY_Z_M) { gaiaGetPointXYZM (ln->Coords, i, &x, &y, &z, &m); } else { gaiaGetPoint (ln->Coords, i, &x, &y); } if (from_angle) { xx[i] = gaiaDegsToRads (x); yy[i] = gaiaDegsToRads (y); } else { xx[i] = x; yy[i] = y; } if (ln->DimensionModel == GAIA_XY_Z || ln->DimensionModel == GAIA_XY_Z_M) zz[i] = z; else zz[i] = 0.0; if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) mm[i] = m; } /* applying reprojection */ if (pj_transform (from_cs, to_cs, cnt, 0, xx, yy, zz) == 0) { /* inserting the reprojected LINESTRING in the new GEOMETRY */ dst_ln = gaiaAddLinestringToGeomColl (dst, cnt); for (i = 0; i < cnt; i++) { /* setting LINESTRING points */ if (to_angle) { x = gaiaRadsToDegs (xx[i]); y = gaiaRadsToDegs (yy[i]); } else { x = xx[i]; y = yy[i]; } if (ln->DimensionModel == GAIA_XY_Z || ln->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; if (dst_ln->DimensionModel == GAIA_XY_Z) { gaiaSetPointXYZ (dst_ln->Coords, i, x, y, z); } else if (dst_ln->DimensionModel == GAIA_XY_M) { gaiaSetPointXYM (dst_ln->Coords, i, x, y, m); } else if (dst_ln->DimensionModel == GAIA_XY_Z_M) { gaiaSetPointXYZM (dst_ln->Coords, i, x, y, z, m); } else { gaiaSetPoint (dst_ln->Coords, i, x, y); } } } else error = 1; free (xx); free (yy); free (zz); if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) free (mm); if (error) goto stop; ln = ln->Next; } pg = org->FirstPolygon; while (pg) { /* reprojecting POLYGONs */ rng = pg->Exterior; cnt = rng->Points; dst_pg = gaiaAddPolygonToGeomColl (dst, cnt, pg->NumInteriors); xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); for (i = 0; i < cnt; i++) { /* inserting points to be converted in temporary arrays [EXTERIOR RING] */ if (rng->DimensionModel == GAIA_XY_Z) { gaiaGetPointXYZ (rng->Coords, i, &x, &y, &z); } else if (rng->DimensionModel == GAIA_XY_M) { gaiaGetPointXYM (rng->Coords, i, &x, &y, &m); } else if (rng->DimensionModel == GAIA_XY_Z_M) { gaiaGetPointXYZM (rng->Coords, i, &x, &y, &z, &m); } else { gaiaGetPoint (rng->Coords, i, &x, &y); } if (from_angle) { xx[i] = gaiaDegsToRads (x); yy[i] = gaiaDegsToRads (y); } else { xx[i] = x; yy[i] = y; } if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) zz[i] = z; else zz[i] = 0.0; if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm[i] = m; } /* applying reprojection */ if (pj_transform (from_cs, to_cs, cnt, 0, xx, yy, zz) == 0) { /* inserting the reprojected POLYGON in the new GEOMETRY */ dst_rng = dst_pg->Exterior; for (i = 0; i < cnt; i++) { /* setting EXTERIOR RING points */ if (to_angle) { x = gaiaRadsToDegs (xx[i]); y = gaiaRadsToDegs (yy[i]); } else { x = xx[i]; y = yy[i]; } if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; if (dst_rng->DimensionModel == GAIA_XY_Z) { gaiaSetPointXYZ (dst_rng->Coords, i, x, y, z); } else if (dst_rng->DimensionModel == GAIA_XY_M) { gaiaSetPointXYM (dst_rng->Coords, i, x, y, m); } else if (dst_rng->DimensionModel == GAIA_XY_Z_M) { gaiaSetPointXYZM (dst_rng->Coords, i, x, y, z, m); } else { gaiaSetPoint (dst_rng->Coords, i, x, y); } } } else error = 1; free (xx); free (yy); free (zz); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) free (mm); if (error) goto stop; for (ib = 0; ib < pg->NumInteriors; ib++) { /* processing INTERIOR RINGS */ rng = pg->Interiors + ib; cnt = rng->Points; xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); for (i = 0; i < cnt; i++) { /* inserting points to be converted in temporary arrays [INTERIOR RING] */ if (rng->DimensionModel == GAIA_XY_Z) { gaiaGetPointXYZ (rng->Coords, i, &x, &y, &z); } else if (rng->DimensionModel == GAIA_XY_M) { gaiaGetPointXYM (rng->Coords, i, &x, &y, &m); } else if (rng->DimensionModel == GAIA_XY_Z_M) { gaiaGetPointXYZM (rng->Coords, i, &x, &y, &z, &m); } else { gaiaGetPoint (rng->Coords, i, &x, &y); } if (from_angle) { xx[i] = gaiaDegsToRads (x); yy[i] = gaiaDegsToRads (y); } else { xx[i] = x; yy[i] = y; } if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) zz[i] = z; else zz[i] = 0.0; if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm[i] = m; } /* applying reprojection */ if (pj_transform (from_cs, to_cs, cnt, 0, xx, yy, zz) == 0) { /* inserting the reprojected POLYGON in the new GEOMETRY */ dst_rng = gaiaAddInteriorRing (dst_pg, ib, cnt); for (i = 0; i < cnt; i++) { /* setting INTERIOR RING points */ if (to_angle) { x = gaiaRadsToDegs (xx[i]); y = gaiaRadsToDegs (yy[i]); } else { x = xx[i]; y = yy[i]; } if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; if (dst_rng->DimensionModel == GAIA_XY_Z) { gaiaSetPointXYZ (dst_rng->Coords, i, x, y, z); } else if (dst_rng->DimensionModel == GAIA_XY_M) { gaiaSetPointXYM (dst_rng->Coords, i, x, y, m); } else if (dst_rng->DimensionModel == GAIA_XY_Z_M) { gaiaSetPointXYZM (dst_rng->Coords, i, x, y, z, m); } else { gaiaSetPoint (dst_rng->Coords, i, x, y); } } } else error = 1; free (xx); free (yy); free (zz); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) free (mm); if (error) goto stop; } pg = pg->Next; } /* destroying the PROJ4 params */ stop: pj_free (from_cs); pj_free (to_cs); if (error) { /* some error occurred */ gaiaPointPtr pP; gaiaPointPtr pPn; gaiaLinestringPtr pL; gaiaLinestringPtr pLn; gaiaPolygonPtr pA; gaiaPolygonPtr pAn; pP = dst->FirstPoint; while (pP != NULL) { pPn = pP->Next; gaiaFreePoint (pP); pP = pPn; } pL = dst->FirstLinestring; while (pL != NULL) { pLn = pL->Next; gaiaFreeLinestring (pL); pL = pLn; } pA = dst->FirstPolygon; while (pA != NULL) { pAn = pA->Next; gaiaFreePolygon (pA); pA = pAn; } dst->FirstPoint = NULL; dst->LastPoint = NULL; dst->FirstLinestring = NULL; dst->LastLinestring = NULL; dst->FirstPolygon = NULL; dst->LastPolygon = NULL; } if (dst) { gaiaMbrGeometry (dst); dst->DeclaredType = org->DeclaredType; } return dst; }