PostGIS  2.5.0dev-r@@SVN_REVISION@@
char lwcollection_same ( const LWCOLLECTION c1,
const LWCOLLECTION c2 
)

check for same geometry composition

Definition at line 264 of file lwcollection.c.

References LWCOLLECTION::geoms, LW_FALSE, LW_TRUE, LWDEBUG, lwgeom_same(), LWCOLLECTION::ngeoms, and LWCOLLECTION::type.

Referenced by lwgeom_same().

265 {
266  uint32_t i;
267 
268  LWDEBUG(2, "lwcollection_same called");
269 
270  if ( c1->type != c2->type ) return LW_FALSE;
271  if ( c1->ngeoms != c2->ngeoms ) return LW_FALSE;
272 
273  for ( i = 0; i < c1->ngeoms; i++ )
274  {
275  if ( ! lwgeom_same(c1->geoms[i], c2->geoms[i]) )
276  return LW_FALSE;
277  }
278 
279  /* Former method allowed out-of-order equality between collections
280 
281  hit = lwalloc(sizeof(uint32_t)*c1->ngeoms);
282  memset(hit, 0, sizeof(uint32_t)*c1->ngeoms);
283 
284  for (i=0; i<c1->ngeoms; i++)
285  {
286  char found=0;
287  for (j=0; j<c2->ngeoms; j++)
288  {
289  if ( hit[j] ) continue;
290  if ( lwgeom_same(c1->geoms[i], c2->geoms[j]) )
291  {
292  hit[j] = 1;
293  found=1;
294  break;
295  }
296  }
297  if ( ! found ) return LW_FALSE;
298  }
299  */
300 
301  return LW_TRUE;
302 }
uint8_t type
Definition: liblwgeom.h:502
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
uint32_t ngeoms
Definition: liblwgeom.h:506
unsigned int uint32_t
Definition: uthash.h:78
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
LWGEOM ** geoms
Definition: liblwgeom.h:508
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
Definition: lwgeom.c:575

Here is the call graph for this function:

Here is the caller graph for this function: