From: David Blasby Date: Fri, 2 Nov 2001 23:00:15 +0000 (+0000) Subject: Added CHIP info X-Git-Tag: pgis_0_6_2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0da16fbc3f9b5823f3171646ccb25198c69f6c37;p=postgis Added CHIP info git-svn-id: http://svn.osgeo.org/postgis/trunk@102 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/Makefile b/Makefile index 1baecddff..40181e363 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ SO_MINOR_VERSION=6 override CPPFLAGS := -g -I$(srcdir) $(CPPFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"' override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) -OBJS=postgis_debug.o postgis_ops.o postgis_fn.o postgis_inout.o postgis_proj.o +OBJS=postgis_debug.o postgis_ops.o postgis_fn.o postgis_inout.o postgis_proj.o postgis_chip.o # Add libraries that libpq depends (or might depend) on into the # shared library link. (The order in which you list them here doesn't diff --git a/postgis.h b/postgis.h index c65f5b470..1d02fbc1e 100644 --- a/postgis.h +++ b/postgis.h @@ -184,6 +184,25 @@ typedef struct } GEOMETRY; +typedef struct { + int32 size; //postgresql varlength header + int32 endian_hint; // number '1' in the endian of this structure + BOX3D bvol; + int32 SRID; + char future[8]; // for future expantion + + int32 datatype; // 1 = float32 (XDR), 2 = unsigned int (XDR), 3 = RGBA, 4 = signed integer (XDR) + // 11 = float32(NDR), 22 = unsigned int (NDR), 44 = signed integer (NDR) + int32 height; + int32 width; + int32 compression; // 0 = no compression + // this is provided for convenience, it should be set to + // sizeof(chip) bytes into the struct because the serialized form is: + //
+ unsigned int *data; // data[0] = bottm left, data[width] = 1st pixel, 2nd row +} CHIP; + + //for GiST indexing //This is the BOX type from geo_decls.h @@ -424,6 +443,15 @@ Datum postgis_gist_sel(PG_FUNCTION_ARGS); Datum WKB_in(PG_FUNCTION_ARGS); Datum WKB_out(PG_FUNCTION_ARGS); +Datum CHIP_in(PG_FUNCTION_ARGS); +Datum CHIP_out(PG_FUNCTION_ARGS); +Datum CHIP_to_geom(PG_FUNCTION_ARGS); +Datum srid_chip(PG_FUNCTION_ARGS); +Datum setsrid_chip(PG_FUNCTION_ARGS); +Datum width_chip(PG_FUNCTION_ARGS); +Datum height_chip(PG_FUNCTION_ARGS); +Datum datatype_chip(PG_FUNCTION_ARGS); +Datum compression_chip(PG_FUNCTION_ARGS); //for GIST index typedef char* (*BINARY_UNION)(char*, char*, int*); diff --git a/postgis.sql.in b/postgis.sql.in index e6f64d32f..2749b37d6 100644 --- a/postgis.sql.in +++ b/postgis.sql.in @@ -259,6 +259,62 @@ CREATE TYPE WKB ( storage= extended ); +create function CHIP_in(opaque) + RETURNS CHIP + AS '@MODULE_FILENAME@','CHIP_in' + LANGUAGE 'c' with (isstrict); + +create function CHIP_out(opaque) + RETURNS opaque + AS '@MODULE_FILENAME@','CHIP_out' + LANGUAGE 'c' with (isstrict); + + +CREATE TYPE CHIP ( + alignment = double, + internallength = VARIABLE, + input = CHIP_in, + output = CHIP_out, + storage= extended +); + + + +create function geometry(CHIP) + RETURNS GEOMETRY + AS '@MODULE_FILENAME@','CHIP_to_geom' + LANGUAGE 'c' with (isstrict,iscachable); + +CREATE FUNCTION srid(chip) + RETURNS INT4 + AS '@MODULE_FILENAME@','srid_chip' + LANGUAGE 'c' with (isstrict); + +CREATE FUNCTION height(chip) + RETURNS INT4 + AS '@MODULE_FILENAME@','height_chip' + LANGUAGE 'c' with (isstrict); + +CREATE FUNCTION width(chip) + RETURNS INT4 + AS '@MODULE_FILENAME@','width_chip' + LANGUAGE 'c' with (isstrict); + +CREATE FUNCTION datatype(chip) + RETURNS INT4 + AS '@MODULE_FILENAME@','datatype_chip' + LANGUAGE 'c' with (isstrict); + +CREATE FUNCTION compression(chip) + RETURNS INT4 + AS '@MODULE_FILENAME@','compression_chip' + LANGUAGE 'c' with (isstrict); + + +CREATE FUNCTION setSRID(chip,int4) + RETURNS chip + AS '@MODULE_FILENAME@','setsrid_chip' + LANGUAGE 'c' with (isstrict); create function geometry_in(opaque) @@ -443,7 +499,7 @@ CREATE FUNCTION geometryfromtext(geometry,int4) CREATE FUNCTION setSRID(geometry,int4) RETURNS geometry AS '@MODULE_FILENAME@','geometry_from_text' - LANGUAGE 'c' with (isstrict,iscachable); + LANGUAGE 'c' with (isstrict); ------- spheroid calcs