geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0))", LW_PARSER_CHECK_NONE);
col = lwcollection_extract((LWCOLLECTION*)geom, 1);
- CU_ASSERT_EQUAL(TYPE_GETTYPE(col->type), MULTIPOINTTYPE);
+ CU_ASSERT_EQUAL(col->type, MULTIPOINTTYPE);
/* How to properly release 'col' ?
* See http://http://trac.osgeo.org/postgis/ticket/1102
/*
NOTA: Theses 3 ASSERT results will change a day cf #294
*/
- CU_ASSERT_EQUAL(TYPE_GETTYPE(geom->type), TINTYPE);
+ CU_ASSERT_EQUAL(geom->type, TINTYPE);
// CU_ASSERT_STRING_EQUAL("GEOMETRYCOLLECTION EMPTY", lwgeom_to_ewkt(geom));
lwgeom_free(geom);
if (strlen(cu_error_msg)) printf("\n[%s], %s\n", ewkt, cu_error_msg);
CU_ASSERT_EQUAL(strlen(cu_error_msg), 0);
- if (TYPE_GETTYPE(g1->type) != type)
+ if (g1->type != type)
printf("\n[%s], TYPE %s\n", ewkt, lwtype_name(g1->type));
CU_ASSERT_EQUAL(g1->type, type);
tgeom = tgeom_from_lwgeom(g1);
#define WKBSRIDFLAG 0x20000000
#define WKBBBOXFLAG 0x10000000
-/*
-* TODO: Remove these
-*/
-#define TYPE_HASZ(t) ( ((t)&0x20)>>5 )
-#define TYPE_NDIMS(t) ((((t)&0x20)>>5)+(((t)&0x10)>>4)+2)
-#define TYPE_GETTYPE(t) ((t)&0x0F)
-
/**
* Macros for manipulating the 'flags' byte. A uint8_t used as follows:
* ---RGBMZ
/**
* Return a char string with ASCII version of type flags
*/
-extern const char *lwtype_zmflags(uint8_t type);
+extern char *lwtype_zmflags(uint8_t type);
/**
* Return the type name string associated with a type number
else return 1;
}
+static char tflags[4];
-const char *
+char *
lwtype_zmflags(uint8_t flags)
{
- static char tflags[4];
- int flagno=0;
+ int flagno = 0;
if ( FLAGS_GET_Z(flags) ) tflags[flagno++] = 'Z';
if ( FLAGS_GET_M(flags) ) tflags[flagno++] = 'M';
if ( FLAGS_GET_BBOX(flags) ) tflags[flagno++] = 'B';
LWGEOM **lines;
int i;
- LWDEBUGF(2, "lwmcurve_segmentize called, geoms=%d, dim=%d.", mcurve->ngeoms, TYPE_NDIMS(mcurve->type));
+ LWDEBUGF(2, "lwmcurve_segmentize called, geoms=%d, dim=%d.", mcurve->ngeoms, FLAGS_NDIMS(mcurve->flags));
lines = lwalloc(sizeof(LWGEOM *)*mcurve->ngeoms);
LWTRIANGLE *patch;
/* If surface is not 3D, it's can't be closed */
- if (!TYPE_HASZ(tin->type)) return 0;
+ if (!FLAGS_GET_Z(tin->flags)) return 0;
/* Max theorical arcs number if no one is shared ... */
narcs = 3 * tin->ngeoms;
LWCOLLECTION *c1 = NULL;\r
LWCOLLECTION *c2 = NULL;\r
\r
- LWDEBUGF(2, "lw_dist3d_recursive is called with type1=%d, type2=%d", TYPE_GETTYPE(lwg1->type), TYPE_GETTYPE(lwg2->type));\r
+ LWDEBUGF(2, "lw_dist3d_recursive is called with type1=%d, type2=%d", lwg1->type, lwg2->type);\r
\r
if (lwgeom_is_collection(lwg1))\r
{\r
int t1 = lwg1->type;\r
int t2 = lwg2->type;\r
\r
- LWDEBUGF(2, "lw_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", TYPE_GETTYPE(lwg1->type), TYPE_GETTYPE(lwg2->type));\r
+ LWDEBUGF(2, "lw_dist3d_distribute_bruteforce is called with typ1=%d, type2=%d", lwg1->type, lwg2->type);\r
\r
if ( t1 == POINTTYPE )\r
{\r
case COLLECTIONTYPE:
return lwcollection_summary((LWCOLLECTION *)lwgeom, offset);
default:
- result = palloc(256);
+ result = lwalloc(256);
sprintf(result, "Object is of unknown type: %d",
lwgeom->type);
return result;
{
char *result;
char *pad="";
+ char *zmflags = lwtype_zmflags(point->flags);
result = lwalloc(128+offset);
sprintf(result, "%*.s%s[%s]\n",
offset, pad, lwtype_name(point->type),
- lwtype_zmflags(point->flags));
+ zmflags);
return result;
}
{
char *result;
char *pad="";
+ char *zmflags = lwtype_zmflags(line->flags);
result = lwalloc(128+offset);
sprintf(result, "%*.s%s[%s] with %d points\n",
offset, pad, lwtype_name(line->type),
- lwtype_zmflags(line->flags),
+ zmflags,
line->points->npoints);
return result;
}
char *tmp;
int i;
char *pad="";
+ char *zmflags = lwtype_zmflags(col->flags);
POSTGIS_DEBUG(2, "lwcollection_summary called");
sprintf(result, "%*.s%s[%s] with %d elements\n",
offset, pad, lwtype_name(col->type),
- lwtype_zmflags(col->flags),
+ zmflags,
col->ngeoms);
for (i=0; i<col->ngeoms; i++)
char *result;
int i;
char *pad="";
+ char *zmflags = lwtype_zmflags(poly->flags);
POSTGIS_DEBUG(2, "lwpoly_summary called");
sprintf(result, "%*.s%s[%s] with %i rings\n",
offset, pad, lwtype_name(poly->type),
- lwtype_zmflags(poly->flags),
+ zmflags,
poly->nrings);
for (i=0; i<poly->nrings; i++)