Changeset: c7eb7021c894 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c7eb7021c894
Removed Files:
geom/monetdb5/cleanup.md
geom/monetdb5/geod.c
geom/monetdb5/geod.h
geom/monetdb5/geom_io.c
geom/monetdb5/geom_io.h
geom/monetdb5/geom_srid.c
geom/monetdb5/geom_srid.h
geom/monetdb5/mbr.c
geom/monetdb5/mbr.h
geom/monetdb5/wkb.c
geom/monetdb5/wkb.h
geom/monetdb5/wkba.c
geom/monetdb5/wkba.h
geom/sql/40_geom_OGC.sql
geom/sql/40_geom_PostGIS.sql
geom/sql/spatial_ref_sys.sql
Modified Files:
geom/lib/libgeom.c
geom/lib/libgeom.h
geom/monetdb5/CMakeLists.txt
geom/monetdb5/geom.c
geom/monetdb5/geom.h
geom/monetdb5/geomBulk.c
geom/sql/40_geom.sql
Branch: geo-update
Log Message:
Backout of commits 85590, 85589, 85588 and 85587. Resetting the repo to commit
85335, before any moving of geom functions and modularisation.
diffs (truncated from 17554 to 300 lines):
diff --git a/geom/lib/libgeom.c b/geom/lib/libgeom.c
--- a/geom/lib/libgeom.c
+++ b/geom/lib/libgeom.c
@@ -52,25 +52,6 @@ is_wkb_nil(const wkb *w)
return 0;
}
-/* returns the size of variable-sized atom wkb */
-var_t
-wkb_size(size_t len)
-{
- if (len == ~(size_t) 0)
- len = 0;
- assert(offsetof(wkb, data) + len <= VAR_MAX);
- return (var_t) (offsetof(wkb, data) + len);
-}
-
-wkb *
-wkbNULLcopy(void)
-{
- wkb *n = GDKmalloc(sizeof(wkb_nil));
- if (n)
- *n = wkb_nil;
- return n;
-}
-
GEOSGeom
wkb2geos(const wkb *geomWKB)
{
@@ -87,45 +68,6 @@ wkb2geos(const wkb *geomWKB)
return geosGeometry;
}
-/* create the WKB out of the GEOSGeometry
- * It makes sure to make all checks before returning
- * the input geosGeometry should not be altered by this function
- * return NULL on error */
-wkb *
-geos2wkb(const GEOSGeometry *geosGeometry)
-{
- size_t wkbLen = 0;
- unsigned char *w = NULL;
- wkb *geomWKB;
-
- // if the geosGeometry is NULL create a NULL WKB
- if (geosGeometry == NULL) {
- return wkbNULLcopy();
- }
-
- GEOS_setWKBOutputDims(GEOSGeom_getCoordinateDimension(geosGeometry));
- w = GEOSGeomToWKB_buf(geosGeometry, &wkbLen);
-
- if (w == NULL)
- return NULL;
-
- assert(wkbLen <= GDK_int_max);
-
- geomWKB = GDKmalloc(wkb_size(wkbLen));
- //If malloc failed create a NULL wkb
- if (geomWKB == NULL) {
- GEOSFree(w);
- return NULL;
- }
-
- geomWKB->len = (int) wkbLen;
- geomWKB->srid = GEOSGetSRID(geosGeometry);
- memcpy(&geomWKB->data, w, wkbLen);
- GEOSFree(w);
-
- return geomWKB;
-}
-
const char *
geom_type2str(int t, int flag)
{
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -132,14 +132,7 @@ libgeom_export void libgeom_exit(void);
#define mbr_nil mbrFromGeos(NULL);
-/* variables */
-int TYPE_mbr;
-static const wkb wkb_nil = { ~0, 0 };
-
libgeom_export bool is_wkb_nil(const wkb *wkbp);
-libgeom_export var_t wkb_size(size_t len);
-libgeom_export wkb * wkbNULLcopy(void);
libgeom_export GEOSGeom wkb2geos(const wkb *geomWKB);
-libgeom_export wkb * geos2wkb(const GEOSGeometry *geosGeometry);
#endif /* LIBGEOM_H */
diff --git a/geom/monetdb5/CMakeLists.txt b/geom/monetdb5/CMakeLists.txt
--- a/geom/monetdb5/CMakeLists.txt
+++ b/geom/monetdb5/CMakeLists.txt
@@ -10,10 +10,7 @@ if(GEOS_FOUND)
add_library(geomodule MODULE)
set(include_sql_files
- 40_geom
- 40_geom_PostGIS
- 40_geom_OGC
- spatial_ref_sys)
+ 40_geom)
create_include_object(
SQL_LANGUAGE
@@ -26,11 +23,6 @@ if(GEOS_FOUND)
geom.c
geomBulk.c
geom_upgrade.c
- geod.c
- geom_io.c
- mbr.c
- wkb.c
- wkba.c
${MONETDB_CURRENT_SQL_SOURCES}
PUBLIC
${geomodule_public_headers})
diff --git a/geom/monetdb5/cleanup.md b/geom/monetdb5/cleanup.md
deleted file mode 100644
--- a/geom/monetdb5/cleanup.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# geom module cleanup
-## Structure
-### C functions
-- **geod.c** -> Geodetic functions
-- **wkb.c** -> WKB atom functions
-- **wkba.c** -> WKBA atom functions + functions that use WKBA
-- **mbr.c** -> MBR atom functions + functions that use WKBA
-- **geom_srid.c** -> Projection functions + SRID functions
-- **geomBulk.c** -> Bulk functions
-- **geom_io.c** -> Geometry input/output functions
-
-### SQL
-- **40_geom.sql** -> Geodetic + mbr funtcions -> TODO Cleanup
-- **40_geom_OGC.sql** -> OGC Simple Features functions
-- **40_geom_PostGIS.sql** -> PostGIS functions
-
-## Changes
-### Removed C functions:
-- geometryHasZ/geoHasZ
-- geometryHasM/geoHasM
-- geoGetType
-
-### Removed MAL functions:
-- geom.hasZ
-- geom.hasM
-- geom.getType
-
-### Removed SQL functions:
-- HasZ
-- HasM
-- get_type
-- wkbIsnil (no usages, libgeom.c has *is_wkb_nil*)
-- ST_M
-- ST_CurveToLine
-- Functions that were commented out:
- - ST_GeomFromWKB (and similar geometry-specific functions)
- - ST_GeomFromText (and similar geometry-specific functions)
- - ST_SetInteriorRings
-
-### Moved:
-- Moved spatial_ref_sys and geometry_columns tables to **spatial_ref_sys.sql**
-- Moved COPY INTO spatial_ref_sys to **spatial_ref_sys.sql**
-- Moved Geodetic functions (except bulk versions) to **geod.c** (MAL functions
still on geom.c)
-- Moved Geodetic headers to **geod.h**
-- Moved MBR functions (including atom functions) to **mbr.c** (MAL functions
still on geom.c)
-- Moved MBR headers to **mbr.h**
-- Moved WKBA functions to **wkba.c** (MAL functions still on geom.c)
-- Moved WKBA headers to **wkba.h**
-- Merged *geoGetType* into *wkbGeometryType* (geoGetType wasn't being used
outside of this func)
-- Moved WKB atom functions to **wkb.c**
-- OGC sql functions to **40_geom_OGC.sql**
-- PostGIS sql functions to **40_geom_PostGIS.sql**
-- Moved geos2wkb C function to **libgeom.c** (is used in a lot of modules)
-
-
-### Other changes:
-- **MBR** atom functions are now on the header file (mbr.h) and are *not
static*
-- **WKBA** atom functions are now on the header file (wkba.h) and are *not
static*
-- **WKB** atom functions are now on the header file (wkb.h) and are *not
static*
-
-## TODO:
-- Remove libgeom.c/.h ? (or add a file with the start up and end functions +
MAL ones?)
-- Clean mbr.c
-- Clean wkba.c
-- Clean geomBulk.c (and change name?)
-- Clean geom_srid.c
-- Clean geod.c
-- Clean geom_io.c
-- Should we allow z and m in constructor functions? (e.g. ST_MakePoint)
-- SQL Clean:
- - Functions on Polyhedral Surfaces
- - Management functions
- - PostGIS Geometry Constructors
- - PostGIS Geometry Editors
- - PostGIS SQL functions in general
- - PostGIS from "Operators" onwards (most aren't implemented)
-
-## Check with Stefanos
-- Changing atom functions to other files (mbr and wkba)
-- Should we keep wkba (and even mbr?)
-- Header include standards (everything on the .h, some includes in the .c?)
-- How to remove libgeom
-- Check the SQL division
diff --git a/geom/monetdb5/geod.c b/geom/monetdb5/geod.c
deleted file mode 100644
--- a/geom/monetdb5/geod.c
+++ /dev/null
@@ -1,1339 +0,0 @@
-#include "geom.h"
-#include "geod.h"
-
-/**
-* Convertions
-*
-**/
-
-const double earth_radius = 6371.009;
-const double earth_radius_meters = 6371009;
-
-/* Converts a longitude value in degrees to radians */
-static double
-deg2RadLongitude(double lon_degrees)
-{
- //Convert
- double lon = M_PI * lon_degrees / 180.0;
- //Normalize
- //TODO PostGIS code, refactor
- if (lon == -1.0 * M_PI)
- return M_PI;
- if (lon == -2.0 * M_PI)
- return 0.0;
- if (lon > 2.0 * M_PI)
- lon = remainder(lon, 2.0 * M_PI);
-
- if (lon < -2.0 * M_PI)
- lon = remainder(lon, -2.0 * M_PI);
-
- if (lon > M_PI)
- lon = -2.0 * M_PI + lon;
-
- if (lon < -1.0 * M_PI)
- lon = 2.0 * M_PI + lon;
-
- if (lon == -2.0 * M_PI)
- lon *= -1.0;
-
- return lon;
-}
-
-/* Converts a latitude value in degrees to radians */
-static double
-deg2RadLatitude(double lat_degrees)
-{
- //Convert
- double lat = M_PI * lat_degrees / 180.0;
- //Normalize
- //TODO PostGIS code, refactor
- if (lat > 2.0 * M_PI)
- lat = remainder(lat, 2.0 * M_PI);
-
- if (lat < -2.0 * M_PI)
- lat = remainder(lat, -2.0 * M_PI);
-
- if (lat > M_PI)
- lat = M_PI - lat;
-
- if (lat < -1.0 * M_PI)
- lat = -1.0 * M_PI - lat;
-
- if (lat > M_PI_2)
- lat = M_PI - lat;
-
- if (lat < -1.0 * M_PI_2)
- lat = -1.0 * M_PI - lat;
-
- return lat;
-}
-
-/* Converts the GeoPoint from degrees to radians latitude and longitude*/
-static GeoPoint
-deg2RadPoint(GeoPoint geo)
-{
- geo.lon = deg2RadLongitude(geo.lon);
- geo.lat = deg2RadLatitude(geo.lat);
- return geo;
-}
-
-/**
- * Converts a longitude value in radians to degrees
- */
-static double
-rad2DegLongitude(double lon_radians)
-{
- //Convert
- double lon = lon_radians * 180.0 / M_PI;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]