PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcollection_same()

char lwcollection_same ( const LWCOLLECTION c1,
const LWCOLLECTION c2 
)

check for same geometry composition

Definition at line 248 of file lwcollection.c.

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

Referenced by lwgeom_same().

249 {
250  uint32_t i;
251 
252  LWDEBUG(2, "lwcollection_same called");
253 
254  if ( c1->type != c2->type ) return LW_FALSE;
255  if ( c1->ngeoms != c2->ngeoms ) return LW_FALSE;
256 
257  for ( i = 0; i < c1->ngeoms; i++ )
258  {
259  if ( ! lwgeom_same(c1->geoms[i], c2->geoms[i]) )
260  return LW_FALSE;
261  }
262 
263  /* Former method allowed out-of-order equality between collections
264 
265  hit = lwalloc(sizeof(uint32_t)*c1->ngeoms);
266  memset(hit, 0, sizeof(uint32_t)*c1->ngeoms);
267 
268  for (i=0; i<c1->ngeoms; i++)
269  {
270  char found=0;
271  for (j=0; j<c2->ngeoms; j++)
272  {
273  if ( hit[j] ) continue;
274  if ( lwgeom_same(c1->geoms[i], c2->geoms[j]) )
275  {
276  hit[j] = 1;
277  found=1;
278  break;
279  }
280  }
281  if ( ! found ) return LW_FALSE;
282  }
283  */
284 
285  return LW_TRUE;
286 }
uint8_t type
Definition: liblwgeom.h:487
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
LWGEOM ** geoms
Definition: liblwgeom.h:493
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
Definition: lwgeom.c:495
Here is the call graph for this function:
Here is the caller graph for this function: