gg_transform.c | gg_transform.c | |||
---|---|---|---|---|
/* | /* | |||
gg_transform.c -- Gaia PROJ.4 wrapping | gg_transform.c -- Gaia PROJ.4 wrapping | |||
version 2.4, 2009 September 17 | version 3.0, 2011 July 20 | |||
Author: Sandro Furieri a.furieri@lqt.it | Author: Sandro Furieri a.furieri@lqt.it | |||
-------------------------------------------------------------------------- ---- | -------------------------------------------------------------------------- ---- | |||
Version: MPL 1.1/GPL 2.0/LGPL 2.1 | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
The contents of this file are subject to the Mozilla Public License Versio n | The contents of this file are subject to the Mozilla Public License Versio n | |||
1.1 (the "License"); you may not use this file except in compliance with | 1.1 (the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | the License. You may obtain a copy of the License at | |||
skipping to change at line 54 | skipping to change at line 54 | |||
*/ | */ | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <string.h> | #include <string.h> | |||
#ifndef OMIT_PROJ /* including PROJ.4 */ | #ifndef OMIT_PROJ /* including PROJ.4 */ | |||
#include <proj_api.h> | #include <proj_api.h> | |||
#endif | #endif | |||
#ifdef SPL_AMALGAMATION /* spatialite-amalgamation */ | #ifdef SPL_AMALGAMATION /* spatialite-amalgamation */ | |||
#include <spatialite/sqlite3ext.h> | #include <spatialite/sqlite3ext.h> | |||
#else | #else | |||
#include <sqlite3ext.h> | #include <sqlite3ext.h> | |||
#endif | #endif | |||
#include <spatialite/gaiageo.h> | #include <spatialite/gaiageo.h> | |||
GAIAGEO_DECLARE void | GAIAGEO_DECLARE void | |||
gaiaShiftCoords (gaiaGeomCollPtr geom, double shift_x, double shift_y) | gaiaShiftCoords (gaiaGeomCollPtr geom, double shift_x, double shift_y) | |||
{ | { | |||
skipping to change at line 1045 | skipping to change at line 1045 | |||
mm = malloc (sizeof (double) * cnt); | mm = malloc (sizeof (double) * cnt); | |||
for (i = 0; i < cnt; i++) | for (i = 0; i < cnt; i++) | |||
{ | { | |||
/* inserting points to be converted in temporary arrays */ | /* inserting points to be converted in temporary arrays */ | |||
if (ln->DimensionModel == GAIA_XY_Z) | if (ln->DimensionModel == GAIA_XY_Z) | |||
{ | { | |||
gaiaGetPointXYZ (ln->Coords, i, &x, &y, &z); | gaiaGetPointXYZ (ln->Coords, i, &x, &y, &z); | |||
} | } | |||
else if (ln->DimensionModel == GAIA_XY_M) | else if (ln->DimensionModel == GAIA_XY_M) | |||
{ | { | |||
gaiaGetPointXYZ (ln->Coords, i, &x, &y, &m); | gaiaGetPointXYM (ln->Coords, i, &x, &y, &m); | |||
} | } | |||
else if (ln->DimensionModel == GAIA_XY_Z_M) | else if (ln->DimensionModel == GAIA_XY_Z_M) | |||
{ | { | |||
gaiaGetPointXYZM (ln->Coords, i, &x, &y, &z, &m); | gaiaGetPointXYZM (ln->Coords, i, &x, &y, &z, &m); | |||
} | } | |||
else | else | |||
{ | { | |||
gaiaGetPoint (ln->Coords, i, &x, &y); | gaiaGetPoint (ln->Coords, i, &x, &y); | |||
} | } | |||
if (from_angle) | if (from_angle) | |||
skipping to change at line 1154 | skipping to change at line 1154 | |||
mm = malloc (sizeof (double) * cnt); | mm = malloc (sizeof (double) * cnt); | |||
for (i = 0; i < cnt; i++) | for (i = 0; i < cnt; i++) | |||
{ | { | |||
/* inserting points to be converted in temporary arrays [EXT ERIOR RING] */ | /* inserting points to be converted in temporary arrays [EXT ERIOR RING] */ | |||
if (rng->DimensionModel == GAIA_XY_Z) | if (rng->DimensionModel == GAIA_XY_Z) | |||
{ | { | |||
gaiaGetPointXYZ (rng->Coords, i, &x, &y, &z); | gaiaGetPointXYZ (rng->Coords, i, &x, &y, &z); | |||
} | } | |||
else if (rng->DimensionModel == GAIA_XY_M) | else if (rng->DimensionModel == GAIA_XY_M) | |||
{ | { | |||
gaiaGetPointXYZ (rng->Coords, i, &x, &y, &m); | gaiaGetPointXYM (rng->Coords, i, &x, &y, &m); | |||
} | } | |||
else if (rng->DimensionModel == GAIA_XY_Z_M) | else if (rng->DimensionModel == GAIA_XY_Z_M) | |||
{ | { | |||
gaiaGetPointXYZM (rng->Coords, i, &x, &y, &z, &m); | gaiaGetPointXYZM (rng->Coords, i, &x, &y, &z, &m); | |||
} | } | |||
else | else | |||
{ | { | |||
gaiaGetPoint (rng->Coords, i, &x, &y); | gaiaGetPoint (rng->Coords, i, &x, &y); | |||
} | } | |||
if (from_angle) | if (from_angle) | |||
skipping to change at line 1259 | skipping to change at line 1259 | |||
mm = malloc (sizeof (double) * cnt); | mm = malloc (sizeof (double) * cnt); | |||
for (i = 0; i < cnt; i++) | for (i = 0; i < cnt; i++) | |||
{ | { | |||
/* inserting points to be converted in temporary array s [INTERIOR RING] */ | /* inserting points to be converted in temporary array s [INTERIOR RING] */ | |||
if (rng->DimensionModel == GAIA_XY_Z) | if (rng->DimensionModel == GAIA_XY_Z) | |||
{ | { | |||
gaiaGetPointXYZ (rng->Coords, i, &x, &y, &z); | gaiaGetPointXYZ (rng->Coords, i, &x, &y, &z); | |||
} | } | |||
else if (rng->DimensionModel == GAIA_XY_M) | else if (rng->DimensionModel == GAIA_XY_M) | |||
{ | { | |||
gaiaGetPointXYZ (rng->Coords, i, &x, &y, &m); | gaiaGetPointXYM (rng->Coords, i, &x, &y, &m); | |||
} | } | |||
else if (rng->DimensionModel == GAIA_XY_Z_M) | else if (rng->DimensionModel == GAIA_XY_Z_M) | |||
{ | { | |||
gaiaGetPointXYZM (rng->Coords, i, &x, &y, &z, &m ); | gaiaGetPointXYZM (rng->Coords, i, &x, &y, &z, &m ); | |||
} | } | |||
else | else | |||
{ | { | |||
gaiaGetPoint (rng->Coords, i, &x, &y); | gaiaGetPoint (rng->Coords, i, &x, &y); | |||
} | } | |||
if (from_angle) | if (from_angle) | |||
skipping to change at line 1292 | skipping to change at line 1292 | |||
else | else | |||
zz[i] = 0.0; | zz[i] = 0.0; | |||
if (rng->DimensionModel == GAIA_XY_M | if (rng->DimensionModel == GAIA_XY_M | |||
|| rng->DimensionModel == GAIA_XY_Z_M) | || rng->DimensionModel == GAIA_XY_Z_M) | |||
mm[i] = m; | mm[i] = m; | |||
} | } | |||
/* applying reprojection */ | /* applying reprojection */ | |||
if (pj_transform (from_cs, to_cs, cnt, 0, xx, yy, zz) == 0) | if (pj_transform (from_cs, to_cs, cnt, 0, xx, yy, zz) == 0) | |||
{ | { | |||
/* inserting the reprojected POLYGON in the new GEOMET RY */ | /* inserting the reprojected POLYGON in the new GEOMET RY */ | |||
dst_rng = dst_pg->Interiors + ib; | dst_rng = gaiaAddInteriorRing (dst_pg, ib, cnt); | |||
dst_rng->Points = cnt; | ||||
dst_rng->Coords = | ||||
malloc (sizeof (double) * (dst_rng->Points * 2)); | ||||
for (i = 0; i < cnt; i++) | for (i = 0; i < cnt; i++) | |||
{ | { | |||
/* setting INTERIOR RING points */ | /* setting INTERIOR RING points */ | |||
if (to_angle) | if (to_angle) | |||
{ | { | |||
x = gaiaRadsToDegs (xx[i]); | x = gaiaRadsToDegs (xx[i]); | |||
y = gaiaRadsToDegs (yy[i]); | y = gaiaRadsToDegs (yy[i]); | |||
} | } | |||
else | else | |||
{ | { | |||
End of changes. 6 change blocks. | ||||
9 lines changed or deleted | 6 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |