Commit 43a8513e authored by Paul Ramsey's avatar Paul Ramsey

Update behavior of lwgeom_same to match "orderingequals" semantics (#289)


git-svn-id: http://svn.osgeo.org/postgis/trunk@4789 b70326c6-7e19-0410-871a-916f4a2858ee
parent 8d538ca1
......@@ -336,13 +336,21 @@ lwcollection_segmentize2d(LWCOLLECTION *col, double dist)
char
lwcollection_same(const LWCOLLECTION *c1, const LWCOLLECTION *c2)
{
unsigned int i, j;
unsigned int *hit;
unsigned int i;
// unsigned int *hit;
LWDEBUG(2, "lwcollection_same called");
if ( TYPE_GETTYPE(c1->type) != TYPE_GETTYPE(c2->type) ) return 0;
if ( c1->ngeoms != c2->ngeoms ) return 0;
if ( TYPE_GETTYPE(c1->type) != TYPE_GETTYPE(c2->type) ) return LW_FALSE;
if ( c1->ngeoms != c2->ngeoms ) return LW_FALSE;
for( i = 0; i < c1->ngeoms; i++ )
{
if ( ! lwgeom_same(c1->geoms[i], c2->geoms[i]) )
return LW_FALSE;
}
/* Former method allowed out-of-order equality between collections
hit = lwalloc(sizeof(unsigned int)*c1->ngeoms);
memset(hit, 0, sizeof(unsigned int)*c1->ngeoms);
......@@ -360,9 +368,11 @@ lwcollection_same(const LWCOLLECTION *c1, const LWCOLLECTION *c2)
break;
}
}
if ( ! found ) return 0;
if ( ! found ) return LW_FALSE;
}
return 1;
*/
return LW_TRUE;
}
int lwcollection_ngeoms(const LWCOLLECTION *col)
......
......@@ -781,14 +781,14 @@ lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
{
LWDEBUG(3, " type differ");
return 0;
return LW_FALSE;
}
if ( TYPE_GETZM(lwgeom1->type) != TYPE_GETZM(lwgeom2->type) )
{
LWDEBUG(3, " ZM flags differ");
return 0;
return LW_FALSE;
}
/* Check boxes if both already computed */
......@@ -799,7 +799,7 @@ lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
{
LWDEBUG(3, " bounding boxes differ");
return 0;
return LW_FALSE;
}
}
......@@ -824,7 +824,7 @@ lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
default:
lwerror("lwgeom_same: unsupported geometry type: %s",
lwgeom_typename(TYPE_GETTYPE(lwgeom1->type)));
return 0;
return LW_FALSE;
}
}
......
......@@ -84,9 +84,9 @@ HINT: "MULTIPOINT(1 1, 2 2" <-- parse error at position 19 within geometry
68|t
68a|t
69|t
69a|t
69a|f
70|t
70a|t
70a|f
71|t
71a|f
72|t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment