PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwcollection_same()

char lwcollection_same ( const LWCOLLECTION c1,
const LWCOLLECTION c2 
)

check for same geometry composition

Definition at line 279 of file lwcollection.c.

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

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: