#define WKBZOFFSET 0x80000000
#define WKBMOFFSET 0x40000000
-#define TYPE_SETTYPE(c,t) ((c)=(((c)&0xF0)|t))
-#define TYPE_SETZM(t,z,m) ((t)=(((t)&0xCF)|(z<<5)|(m<<4)))
-#define TYPE_SETHASBBOX(t,b) ((t)=(((t)&0x7F)|(b<<7)))
-#define TYPE_SETHASSRID(t,s) ((t)=(((t)&0xBF)|(s<<6)))
+#define TYPE_SETTYPE(c,t) ((c)=(((c)&0xF0)|(t)))
+#define TYPE_SETZM(t,z,m) ((t)=(((t)&0xCF)|((z)<<5)|((m)<<4)))
+#define TYPE_SETHASBBOX(t,b) ((t)=(((t)&0x7F)|((b)<<7)))
+#define TYPE_SETHASSRID(t,s) ((t)=(((t)&0xBF)|((s)<<6)))
#define TYPE_HASZ(t) ( ((t)&0x20)>>5 )
#define TYPE_HASM(t) ( ((t)&0x10)>>4 )
Datum LWGEOM_forceRHR_poly(PG_FUNCTION_ARGS);
Datum LWGEOM_noop(PG_FUNCTION_ARGS);
Datum LWGEOM_zmflag(PG_FUNCTION_ARGS);
+Datum LWGEOM_makepoint2d(PG_FUNCTION_ARGS);
+Datum LWGEOM_makepoint3dz(PG_FUNCTION_ARGS);
+Datum LWGEOM_makepoint3dm(PG_FUNCTION_ARGS);
+Datum LWGEOM_makepoint4d(PG_FUNCTION_ARGS);
/*------------------------------------------------------------------*/
PG_RETURN_BOOL(result);
}
+PG_FUNCTION_INFO_V1(LWGEOM_makepoint2d);
+Datum LWGEOM_makepoint2d(PG_FUNCTION_ARGS)
+{
+ double x,y;
+ int SRID;
+ LWPOINT *point;
+ PG_LWGEOM *result;
+ size_t size;
+
+ SRID = PG_GETARG_INT32(0);
+ x = PG_GETARG_FLOAT8(1);
+ y = PG_GETARG_FLOAT8(2);
+
+ point = make_lwpoint2d(SRID, x, y);
+
+ size = lwpoint_serialize_size(point);
+ result = (PG_LWGEOM *)palloc(size+4);
+ result->size = (size+4);
+ lwpoint_serialize_buf(point, SERIALIZED_FORM(result), NULL);
+
+ PG_RETURN_POINTER(result);
+}
+
+PG_FUNCTION_INFO_V1(LWGEOM_makepoint3dz);
+Datum LWGEOM_makepoint3dz(PG_FUNCTION_ARGS)
+{
+ double x,y,z;
+ int SRID;
+ LWPOINT *point;
+ PG_LWGEOM *result;
+ size_t size;
+
+ SRID = PG_GETARG_INT32(0);
+ x = PG_GETARG_FLOAT8(1);
+ y = PG_GETARG_FLOAT8(2);
+ z = PG_GETARG_FLOAT8(3);
+
+ point = make_lwpoint3dz(SRID, x, y, z);
+
+ size = lwpoint_serialize_size(point);
+ result = (PG_LWGEOM *)palloc(size+4);
+ result->size = (size+4);
+ lwpoint_serialize_buf(point, SERIALIZED_FORM(result), NULL);
+
+ PG_RETURN_POINTER(result);
+}
+
+PG_FUNCTION_INFO_V1(LWGEOM_makepoint3dm);
+Datum LWGEOM_makepoint3dm(PG_FUNCTION_ARGS)
+{
+ double x,y,m;
+ int SRID;
+ LWPOINT *point;
+ PG_LWGEOM *result;
+ size_t size;
+
+ SRID = PG_GETARG_INT32(0);
+ x = PG_GETARG_FLOAT8(1);
+ y = PG_GETARG_FLOAT8(2);
+ m = PG_GETARG_FLOAT8(3);
+
+ point = make_lwpoint3dm(SRID, x, y, m);
+
+ size = lwpoint_serialize_size(point);
+ result = (PG_LWGEOM *)palloc(size+4);
+ result->size = (size+4);
+ lwpoint_serialize_buf(point, SERIALIZED_FORM(result), NULL);
+
+ PG_RETURN_POINTER(result);
+}
+
+PG_FUNCTION_INFO_V1(LWGEOM_makepoint4d);
+Datum LWGEOM_makepoint4d(PG_FUNCTION_ARGS)
+{
+ double x,y,z,m;
+ int SRID;
+ LWPOINT *point;
+ PG_LWGEOM *result;
+ size_t size;
+
+ SRID = PG_GETARG_INT32(0);
+ x = PG_GETARG_FLOAT8(1);
+ y = PG_GETARG_FLOAT8(2);
+ z = PG_GETARG_FLOAT8(3);
+ m = PG_GETARG_FLOAT8(4);
+
+ point = make_lwpoint4d(SRID, x, y, z, m);
+
+ size = lwpoint_serialize_size(point);
+ result = (PG_LWGEOM *)palloc(size+4);
+ result->size = (size+4);
+ lwpoint_serialize_buf(point, SERIALIZED_FORM(result), NULL);
+
+ PG_RETURN_POINTER(result);
+}
AS '@MODULE_FILENAME@', 'LWGEOM_zmflag'
LANGUAGE 'C' WITH (iscachable,isstrict);
+------------------------------------------------------------------------
+-- CONSTRUCTORS
+------------------------------------------------------------------------
+
+CREATEFUNCTION makepoint2d(integer, float8, float8)
+ RETURNS geometry
+ AS '@MODULE_FILENAME@', 'LWGEOM_makepoint2d'
+ LANGUAGE 'C' WITH (iscachable,isstrict);
+
+CREATEFUNCTION makepoint3dz(integer, float8, float8, float8)
+ RETURNS geometry
+ AS '@MODULE_FILENAME@', 'LWGEOM_makepoint3dz'
+ LANGUAGE 'C' WITH (iscachable,isstrict);
+
+CREATEFUNCTION makepoint3dm(integer, float8, float8, float8)
+ RETURNS geometry
+ AS '@MODULE_FILENAME@', 'LWGEOM_makepoint3dm'
+ LANGUAGE 'C' WITH (iscachable,isstrict);
+
+CREATEFUNCTION makepoint4d(integer, float8, float8, float8, float8)
+ RETURNS geometry
+ AS '@MODULE_FILENAME@', 'LWGEOM_makepoint4d'
+ LANGUAGE 'C' WITH (iscachable,isstrict);
+
------------------------------------------------------------------------
--