PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_same()

char lwcollection_same ( const LWCOLLECTION p1,
const LWCOLLECTION p2 
)

check for same geometry composition

Definition at line 278 of file lwcollection.c.

279 {
280  uint32_t i;
281 
282  LWDEBUG(2, "lwcollection_same called");
283 
284  if ( c1->type != c2->type ) return LW_FALSE;
285  if ( c1->ngeoms != c2->ngeoms ) return LW_FALSE;
286 
287  for ( i = 0; i < c1->ngeoms; i++ )
288  {
289  if ( ! lwgeom_same(c1->geoms[i], c2->geoms[i]) )
290  return LW_FALSE;
291  }
292 
293  /* Former method allowed out-of-order equality between collections
294 
295  hit = lwalloc(sizeof(uint32_t)*c1->ngeoms);
296  memset(hit, 0, sizeof(uint32_t)*c1->ngeoms);
297 
298  for (i=0; i<c1->ngeoms; i++)
299  {
300  char found=0;
301  for (j=0; j<c2->ngeoms; j++)
302  {
303  if ( hit[j] ) continue;
304  if ( lwgeom_same(c1->geoms[i], c2->geoms[j]) )
305  {
306  hit[j] = 1;
307  found=1;
308  break;
309  }
310  }
311  if ( ! found ) return LW_FALSE;
312  }
313  */
314 
315  return LW_TRUE;
316 }
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
Definition: lwgeom.c:582
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
unsigned int uint32_t
Definition: uthash.h:78

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

Referenced by lwgeom_same().

Here is the call graph for this function:
Here is the caller graph for this function: