PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwcollection_same()

char lwcollection_same ( const LWCOLLECTION c1,
const LWCOLLECTION c2 
)

check for same geometry composition

Definition at line 262 of file lwcollection.c.

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

Referenced by lwgeom_same().

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