*/
extern int lwgeom_has_m(const LWGEOM *geom);
+/**
+* Return #LW_TRUE if geometry has SOLID flag.
+*/
+extern int lwgeom_is_solid(const LWGEOM *geom);
+
/**
* Return the number of dimensions (2, 3, 4) in a geometry
*/
return FLAGS_GET_M(geom->flags);
}
+int
+lwgeom_is_solid(const LWGEOM *geom)
+{
+ if ( ! geom ) return LW_FALSE;
+ return FLAGS_GET_GEODETIC(geom->flags);
+}
+
int
lwgeom_ndims(const LWGEOM *geom)
{
}
+
+
void
lwgeom_set_geodetic(LWGEOM *geom, int value)
{
static void analyze_geometry_flags(struct geobuf_agg_context *ctx,
LWGEOM *lwgeom)
{
- if (!ctx->has_dimensions) {
- if (FLAGS_GET_Z(lwgeom->flags) || FLAGS_GET_M(lwgeom->flags))
- ctx->dimensions = 3;
- else if (FLAGS_GET_ZM(lwgeom->flags))
+ if (!ctx->has_dimensions)
+ {
+ if (lwgeom_has_z(lwgeom) && lwgeom_has_m(lwgeom))
ctx->dimensions = 4;
+ else if (lwgeom_has_z(lwgeom) || lwgeom_has_m(lwgeom))
+ ctx->dimensions = 3;
else
ctx->dimensions = 2;
ctx->has_dimensions = 1;
gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df)
{
GSERIALIZED *gpart;
- uint8_t flags;
int result = LW_SUCCESS;
POSTGIS_DEBUG(4, "entered function");
** which makes slicing worthwhile.
*/
gpart = (GSERIALIZED*)PG_DETOAST_DATUM(gsdatum);
- flags = gpart->flags;
POSTGIS_DEBUGF(4, "got flags %d", gpart->flags);
/* Do we even have a serialized bounding box? */
- if ( FLAGS_GET_BBOX(flags) )
+ if (gserialized_has_bbox(gpart))
{
/* Yes! Copy it out into the box! */
POSTGIS_DEBUG(4, "copying box out of serialization");
if (state->pt <= 3) {
getPoint4d_p(tri->points, state->pt, &pt);
lwpoint = lwpoint_make(tri->srid,
- FLAGS_GET_Z(tri->points->flags),
- FLAGS_GET_M(tri->points->flags),
+ lwgeom_has_z(lwgeom),
+ lwgeom_has_m(lwgeom),
&pt);
}
if (state->pt > 3) {
*/
getPoint4d_p(poly->rings[state->ring], state->pt, &pt);
lwpoint = lwpoint_make(poly->srid,
- FLAGS_GET_Z(poly->rings[state->ring]->flags),
- FLAGS_GET_M(poly->rings[state->ring]->flags),
+ lwgeom_has_z(lwgeom),
+ lwgeom_has_m(lwgeom),
&pt);
}
break;
}
}
-/*
- * Geometry types of collection types for reference
- */
-
-#if 0
- case MULTIPOINTTYPE:
- case MULTILINETYPE:
- case MULTIPOLYGONTYPE:
- case COLLECTIONTYPE:
- case CURVEPOLYTYPE:
- case COMPOUNDTYPE:
- case MULTICURVETYPE:
- case MULTISURFACETYPE:
- case POLYHEDRALSURFACETYPE:
- case TINTYPE:
-
-#endif
getPoint4d_p(in_lwpoint->point, 0, &offsetpoint);
grid.ipx = offsetpoint.x;
grid.ipy = offsetpoint.y;
- if (FLAGS_GET_Z(in_lwpoint->flags) ) grid.ipz = offsetpoint.z;
+ if (lwgeom_has_z(in_lwpoint) ) grid.ipz = offsetpoint.z;
else grid.ipz=0;
- if (FLAGS_GET_M(in_lwpoint->flags) ) grid.ipm = offsetpoint.m;
+ if (lwgeom_has_m(in_lwpoint) ) grid.ipm = offsetpoint.m;
else grid.ipm=0;
#if POSTGIS_DEBUG_LEVEL >= 4
lwtype_name(gserialized_get_type(gser1)),
lwtype_name(gserialized_get_type(gser2)));
- if (FLAGS_GET_ZM(gser1->flags) != FLAGS_GET_ZM(gser2->flags))
+ if ((gserialized_has_z(gser1) != gserialized_has_z(gser2)) ||
+ (gserialized_has_m(gser1) != gserialized_has_m(gser2)))
{
elog(ERROR, "Cannot ST_Collect geometries with differing dimensionality.");
PG_RETURN_NULL();
else
{
lwcol = lwgeom_construct_empty(
- type, lwgeom->srid, FLAGS_GET_Z(lwgeom->flags), FLAGS_GET_M(lwgeom->flags));
+ type, lwgeom->srid, lwgeom_has_z(lwgeom), lwgeom_has_m(lwgeom));
}
}
else
lwgeom_in = lwgeom_from_gserialized(geom_in);
- hasm = FLAGS_GET_M(lwgeom_in->flags);
+ hasm = lwgeom_has_m(lwgeom_in);
if (!hasm)
{
lwgeom = lwgeom_from_gserialized(geom);
point = lwgeom_as_lwpoint(lwgeom);
- if ( lwgeom_is_empty(lwgeom) )
+ if (lwgeom_is_empty(lwgeom) || !lwgeom_has_m(lwgeom))
PG_RETURN_NULL();
- /* no M in input */
- if ( ! FLAGS_GET_M(point->flags) ) PG_RETURN_NULL();
-
getPoint3dm_p(point->point, 0, &p);
PG_FREE_IF_COPY(geom, 0);
lwgeoms = lwalloc(sizeof(LWGEOM *));
lwgeoms[0] = (LWGEOM *)root->segment;
- POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, FLAGS_GET_Z(root->segment->flags));
+ POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, lwgeom_has_z(root->segment));
result = (LWMLINE *)lwcollection_construct(MULTILINETYPE, SRID_UNKNOWN, NULL, 1, lwgeoms);
}
tmp = RTreeFindLineSegments(root->leftNode, value);
if (tmp)
{
- POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
+ POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, lwgeom_has_z(tmp));
if (result)
result = RTreeMergeMultiLines(result, tmp);
tmp = RTreeFindLineSegments(root->rightNode, value);
if (tmp)
{
- POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
+ POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, lwgeom_has_z(tmp));
if (result)
result = RTreeMergeMultiLines(result, tmp);
if (!lwgeom)
elog(ERROR, "sfcgal_is_solid: Unable to deserialize input");
- result = FLAGS_GET_SOLID(lwgeom->flags);
+ result = lwgeom_is_solid(lwgeom);
lwgeom_free(lwgeom);