liblwgeom.h \
liblwgeom_internal.h \
libtgeom.h \
+ lwgeom_log.h \
lwgeom_geos.h
all: liblwgeom.la
**********************************************************************/
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include <math.h>
#include <stdlib.h>
**********************************************************************/
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/***********************************************************************
* GSERIALIZED metadata utility functions.
#define SRID_UNKNOWN -1
/**
-* Global functions for memory/logging handlers.
-*/
+ * Global functions for memory/logging handlers.
+ */
typedef void* (*lwallocator)(size_t size);
typedef void* (*lwreallocator)(void *mem, size_t size);
typedef void (*lwfreeor)(void* mem);
extern void lwgeom_install_default_allocators(void);
/**
-* Write a notice out to the notice handler. Uses standard printf() substitutions.
-* Use for messages you always want output. For debugging, use LWDEBUG() or LWDEBUGF().
-* @ingroup logging
-*/
+ * Write a notice out to the notice handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for messages you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
void lwnotice(const char *fmt, ...);
/**
-* Write a notice out to the error handler. Uses standard printf() substitutions.
-* Use for errors you always want output. For debugging, use LWDEBUG() or LWDEBUGF().
-* @ingroup logging
-*/
+ * Write a notice out to the error handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for errors you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
void lwerror(const char *fmt, ...);
/**
-* The default memory/logging handlers installed by lwgeom_install_default_allocators()
-*/
+ * The default memory/logging handlers installed by
+ * lwgeom_install_default_allocators()
+ */
void *default_allocator(size_t size);
void *default_reallocator(void *mem, size_t size);
void default_freeor(void *ptr);
#endif
-/* Debug macros */
-#if POSTGIS_DEBUG_LEVEL > 0
-
-/* Display a notice at the given debug level */
-#define LWDEBUG(level, msg) \
- do { \
- if (POSTGIS_DEBUG_LEVEL >= level) \
- lwnotice("[%s:%s:%d] " msg, __FILE__, __func__, __LINE__); \
- } while (0);
-
-/* Display a formatted notice at the given debug level (like printf, with variadic arguments) */
-#define LWDEBUGF(level, msg, ...) \
- do { \
- if (POSTGIS_DEBUG_LEVEL >= level) \
- lwnotice("[%s:%s:%d] " msg, __FILE__, __func__, __LINE__, __VA_ARGS__); \
- } while (0);
-
-#else
-
-/* Empty prototype that can be optimised away by the compiler for non-debug builds */
-#define LWDEBUG(level, msg) \
- ((void) 0)
-
-/* Empty prototype that can be optimised away by the compiler for non-debug builds */
-#define LWDEBUGF(level, msg, ...) \
- ((void) 0)
-
-#endif
-
/******************************************************************/
-
-
typedef struct {
double afac, bfac, cfac, dfac, efac, ffac, gfac, hfac, ifac, xoff, yoff, zoff;
} AFFINE;
#include <assert.h>
#include "liblwgeom.h"
+#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
char ptarray_isccw(const POINTARRAY *pa);
+
#endif /* _LIBLWGEOM_INTERNAL_H */
#include <stdlib.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include "libtgeom.h"
**********************************************************************/
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/**
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <string.h>
#include <math.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
BOX3D *lwcircle_compute_box3d(POINT4D *p1, POINT4D *p2, POINT4D *p3);
void printLWCIRCSTRING(LWCIRCSTRING *curve);
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#define CHECK_LWGEOM_ZM 1
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
LWCOMPOUND *
lwcompound_deserialize(uint8_t *serialized)
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
LWCURVEPOLY *
**********************************************************************/
#include "lwgeodetic.h"
+#include "lwgeom_log.h"
/**
* For testing geodetic bounding box, we have a magic global variable.
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdarg.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include "libtgeom.h"
+/**********************************************************************
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ *
+ * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************/
+
#include <math.h>
#include <float.h>
#include <errno.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/*
* Lower this to reduce integrity checks
#include "lwgeom_geos.h"
#include "liblwgeom.h"
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include "profile.h"
#include <stdlib.h>
#include "liblwgeom.h"
#include "lwgeom_geos.h"
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include <string.h>
#include <stdlib.h>
--- /dev/null
+/**********************************************************************
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ *
+ * Copyright 2011 Sandro Santilli <strk@keybit.net>
+ * Copyright 2008 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright 2007-2008 Mark Cave-Ayland
+ * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************
+ *
+ * Internal logging routines
+ *
+ **********************************************************************/
+
+#ifndef LWGEOM_LOG_H
+#define LWGEOM_LOG_H 1
+
+#include <stdarg.h>
+
+/*
+ * Debug macros
+ */
+#if POSTGIS_DEBUG_LEVEL > 0
+
+/* Display a notice at the given debug level */
+#define LWDEBUG(level, msg) \
+ do { \
+ if (POSTGIS_DEBUG_LEVEL >= level) \
+ lwnotice("[%s:%s:%d] " msg, __FILE__, __func__, __LINE__); \
+ } while (0);
+
+/* Display a formatted notice at the given debug level
+ * (like printf, with variadic arguments) */
+#define LWDEBUGF(level, msg, ...) \
+ do { \
+ if (POSTGIS_DEBUG_LEVEL >= level) \
+ lwnotice("[%s:%s:%d] " msg, \
+ __FILE__, __func__, __LINE__, __VA_ARGS__); \
+ } while (0);
+
+#else /* POSTGIS_DEBUG_LEVEL <= 0 */
+
+/* Empty prototype that can be optimised away by the compiler
+ * for non-debug builds */
+#define LWDEBUG(level, msg) \
+ ((void) 0)
+
+/* Empty prototype that can be optimised away by the compiler
+ * for non-debug builds */
+#define LWDEBUGF(level, msg, ...) \
+ ((void) 0)
+
+#endif /* POSTGIS_DEBUG_LEVEL <= 0 */
+
+#endif /* LWGEOM_LOG_H */
#include "proj_api.h"
#include "liblwgeom.h"
+#include "lwgeom_log.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include "lwhomogenize.h"
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
**********************************************************************/
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include <sys/param.h>
/**
*
* PostGIS - Spatial Types for PostgreSQL
*
- * Copyright 2010 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright (C) 2010 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include "lwin_wkt.h"
#include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
/*
#include <string.h>
#include "lwin_wkt.h"
#include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
static YY_BUFFER_STATE wkt_yy_buf_state;
#include <string.h>
#include "lwin_wkt.h"
#include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
static YY_BUFFER_STATE wkt_yy_buf_state;
#include <stdlib.h>
#include "lwin_wkt.h"
#include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
/* Prototypes to quiet the compiler */
#include <stdlib.h>
#include "lwin_wkt.h"
#include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
/* Prototypes to quiet the compiler */
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
void
lwmpoint_release(LWMPOINT *lwmpoint)
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
void
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
LWMSURFACE *
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
**********************************************************************/
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include <sys/param.h>
static uint8_t* lwgeom_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant);
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
**********************************************************************/
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include "stringbuffer.h"
static void lwgeom_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, int precision, uint8_t variant);
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/*
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#define CHECK_POLY_RINGS_ZM 1
/**********************************************************************
- * $Id:$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
LWPSURFACE *
#include <math.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
LWMLINE *lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad);
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
- * Copyright 2009 David Skea <David.Skea@gov.bc.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright (C) 2009 David Skea <David.Skea@gov.bc.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
**********************************************************************/
#include "lwgeodetic.h"
+#include "lwgeom_log.h"
/**
* Initialize spheroid object based on major and minor axis
/**********************************************************************
- * $Id:$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
LWTIN *
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
#include "lwtree.h"
/**********************************************************************
- * $Id:$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2010 - Oslandia
+ *
+ * Copyright (C) 2010 - Oslandia
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include <stdlib.h>
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/* Global variables */
#include "../postgis_config.h"
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
void *init_allocator(size_t size);
void init_freeor(void *mem);
-
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
#include <stdlib.h>
#include "measures.h"
+#include "lwgeom_log.h"
/*------------------------------------------------------------------------------------------------------------
#include <stdlib.h>\r
\r
#include "measures3d.h"\r
+#include "lwgeom_log.h"\r
\r
\r
/*------------------------------------------------------------------------------------------------------------\r
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
#include <string.h>
#include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
/*
* Size of point represeneted in the POINTARRAY
if (!projection)
elog(ERROR, "PROJ4SRSCacheDelete: Trying to delete non-existant projection object with MemoryContext key (%p)", (void *)context);
- LWDEBUGF(3, "deleting projection object (%p) with MemoryContext key (%p)", projection, context);
+ POSTGIS_DEBUGF(3, "deleting projection object (%p) with MemoryContext key (%p)", projection, context);
/* Free it */
pj_free(projection);
{
if (PROJ4Cache->PROJ4SRSCache[i].srid != other_srid && found == false)
{
- LWDEBUGF(3, "choosing to remove item from query cache with SRID %d and index %d", PROJ4Cache->PROJ4SRSCache[i].srid, i);
+ POSTGIS_DEBUGF(3, "choosing to remove item from query cache with SRID %d and index %d", PROJ4Cache->PROJ4SRSCache[i].srid, i);
DeleteFromPROJ4SRSCache(PROJ4Cache, PROJ4Cache->PROJ4SRSCache[i].srid);
PROJ4Cache->PROJ4SRSCacheCount = i;
* Now create a memory context for this projection and
* store it in the backend hash
*/
- LWDEBUGF(3, "adding SRID %d with proj4text \"%s\" to query cache at index %d", srid, proj_str, PROJ4Cache->PROJ4SRSCacheCount);
+ POSTGIS_DEBUGF(3, "adding SRID %d with proj4text \"%s\" to query cache at index %d", srid, proj_str, PROJ4Cache->PROJ4SRSCacheCount);
PJMemoryContext = MemoryContextCreate(T_AllocSetContext, 8192,
&PROJ4SRSCacheContextMethods,
* Add the MemoryContext to the backend hash so we can
* clean up upon portal shutdown
*/
- LWDEBUGF(3, "adding projection object (%p) to hash table with MemoryContext key (%p)", projection, PJMemoryContext);
+ POSTGIS_DEBUGF(3, "adding projection object (%p) to hash table with MemoryContext key (%p)", projection, PJMemoryContext);
AddPJHashEntry(PJMemoryContext, projection);
{
if (PROJ4Cache->PROJ4SRSCache[i].srid == srid)
{
- LWDEBUGF(3, "removing query cache entry with SRID %d at index %d", srid, i);
+ POSTGIS_DEBUGF(3, "removing query cache entry with SRID %d at index %d", srid, i);
/*
* Zero out the entries and free the PROJ4 handle
*
* PostGIS - Spatial Types for PostgreSQL
* http://www.postgis.org
- * Copyright 2001-2003 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2003 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#include "getopt.h"
#include "../liblwgeom/liblwgeom.h" /* for LWGEOM struct and funx */
+#include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */
/* Maximum DBF field width (according to ARCGIS) */
#define MAX_DBF_FIELD_SIZE 254
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://www.postgis.org
- * Copyright 2008 OpenGeo.org
- * Copyright 2009 Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
+ *
+ * Copyright (C) 2008 OpenGeo.org
+ * Copyright (C) 2009 Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
+ *
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
*
#include "shp2pgsql-core.h"
#include "../liblwgeom/liblwgeom.h" /* for lw_vasprintf */
+#include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */
/* Internal ring/point structures */
* $Id: geography_inout.c 4535 2009-09-28 18:16:21Z colivier $
*
* PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
if ( gserialized_get_gbox_p(g, &gbox) == LW_FAILURE )
{
LWGEOM *lwgeom = lwgeom_from_gserialized(g);
- LWDEBUGF(4,"unable to read gbox from gserialized, calculating from lwgeom (%p)", lwgeom);
+ POSTGIS_DEBUGF(4,"unable to read gbox from gserialized, calculating from lwgeom (%p)", lwgeom);
if ( lwgeom_calculate_gbox(lwgeom, &gbox) == LW_FAILURE )
{
- LWDEBUG(4,"lwgeom_calculate_gbox returned LW_FAILURE");
+ POSTGIS_DEBUG(4,"lwgeom_calculate_gbox returned LW_FAILURE");
elog(ERROR, "Error in lwgeom_calculate_gbox calculation.");
PG_RETURN_NULL();
}
}
- LWDEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
+ POSTGIS_DEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
/* Get an exterior point, based on this gbox */
gbox_pt_outside(&gbox, &pt);
if ( ! empty1 && lwgeom_calculate_gbox_cartesian(lwgeom1, &gbox1) == LW_FAILURE )
elog(ERROR, "Error in geography_bestsrid calling lwgeom_calculate_gbox(lwgeom1, &gbox1)");
- LWDEBUGF(4, "calculated gbox = %s", gbox_to_string(&gbox1));
+ POSTGIS_DEBUGF(4, "calculated gbox = %s", gbox_to_string(&gbox1));
/* If we have a unique second argument, fill in all the necessarily variables. */
if ( d1 != d2 )
+/**********************************************************************
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ *
+ * Copyright (C) 2004 Refractions Research Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************/
#include "lwgeom_pg.h"
#include "liblwgeom.h"
int i;
char *pad="";
- LWDEBUG(2, "lwcollection_summary called");
+ POSTGIS_DEBUG(2, "lwcollection_summary called");
result = (char *)lwalloc(size);
size += strlen(tmp)+1;
result = lwrealloc(result, size);
- LWDEBUGF(4, "Reallocated %d bytes for result", size);
+ POSTGIS_DEBUGF(4, "Reallocated %d bytes for result", size);
strcat(result, tmp);
lwfree(tmp);
}
- LWDEBUG(3, "lwcollection_summary returning");
+ POSTGIS_DEBUG(3, "lwcollection_summary returning");
return result;
}
int i;
char *pad="";
- LWDEBUG(2, "lwpoly_summary called");
+ POSTGIS_DEBUG(2, "lwpoly_summary called");
result = lwalloc(size);
strcat(result,tmp);
}
- LWDEBUG(3, "lwpoly_summary returning");
+ POSTGIS_DEBUG(3, "lwpoly_summary returning");
return result;
}
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2005 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2005 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
int ipn, opn; /* point numbers (input/output) */
POINTARRAY *dpa;
- LWDEBUGF(2, "ptarray_grid called on %p", pa);
+ POSTGIS_DEBUGF(2, "ptarray_grid called on %p", pa);
dpa = ptarray_construct_empty(FLAGS_GET_Z(pa->flags),FLAGS_GET_M(pa->flags), pa->npoints);
nrings = 0;
- LWDEBUGF(3, "grid_polygon3d: applying grid to polygon with %d rings",
+ POSTGIS_DEBUGF(3, "grid_polygon3d: applying grid to polygon with %d rings",
poly->nrings);
for (ri=0; ri<poly->nrings; ri++)
getPoint2d_p(ring, 0, &p1);
getPoint2d_p(ring, ring->npoints-1, &p2);
if ( ! SAMEPOINT(&p1, &p2) )
- LWDEBUG(4, "Before gridding: first point != last point");
+ POSTGIS_DEBUG(4, "Before gridding: first point != last point");
#endif
newring = ptarray_grid(ring, grid);
{
pfree(newring);
- LWDEBUGF(3, "grid_polygon3d: ring%d skipped ( <4 pts )", ri);
+ POSTGIS_DEBUGF(3, "grid_polygon3d: ring%d skipped ( <4 pts )", ri);
if ( ri ) continue;
else break; /* this is the external ring, no need to work on holes */
getPoint2d_p(newring, 0, &p1);
getPoint2d_p(newring, newring->npoints-1, &p2);
if ( ! SAMEPOINT(&p1, &p2) )
- LWDEBUG(4, "After gridding: first point != last point");
+ POSTGIS_DEBUG(4, "After gridding: first point != last point");
#endif
- LWDEBUGF(3, "grid_polygon3d: ring%d simplified from %d to %d points", ri,
+ POSTGIS_DEBUGF(3, "grid_polygon3d: ring%d simplified from %d to %d points", ri,
ring->npoints, newring->npoints);
/*
newrings[nrings++] = newring;
}
- LWDEBUGF(3, "grid_polygon3d: simplified polygon with %d rings", nrings);
+ POSTGIS_DEBUGF(3, "grid_polygon3d: simplified polygon with %d rings", nrings);
if ( ! nrings ) return NULL;
/* TODO: grid bounding box ? */
opoint = lwpoint_construct(point->srid, NULL, opa);
- LWDEBUG(2, "lwpoint_grid called");
+ POSTGIS_DEBUG(2, "lwpoint_grid called");
return opoint;
}
minY = seg1->y;
}
- LWDEBUGF(3, "maxX minX/maxY minY: %.8f %.8f/%.8f %.8f", maxX, minX, maxY, minY);
+ POSTGIS_DEBUGF(3, "maxX minX/maxY minY: %.8f %.8f/%.8f %.8f", maxX, minX, maxY, minY);
if (maxX < point->x || minX > point->x)
{
- LWDEBUGF(3, "X value %.8f falls outside the range %.8f-%.8f", point->x, minX, maxX);
+ POSTGIS_DEBUGF(3, "X value %.8f falls outside the range %.8f-%.8f", point->x, minX, maxX);
return 0;
}
else if (maxY < point->y || minY > point->y)
{
- LWDEBUGF(3, "Y value %.8f falls outside the range %.8f-%.8f", point->y, minY, maxY);
+ POSTGIS_DEBUGF(3, "Y value %.8f falls outside the range %.8f-%.8f", point->y, minY, maxY);
return 0;
}
POINT2D seg2;
LWMLINE *lines;
- LWDEBUG(2, "point_in_ring called.");
+ POSTGIS_DEBUG(2, "point_in_ring called.");
lines = findLineSegments(root, point->y);
if (!lines)
side = determineSide(&seg1, &seg2, point);
- LWDEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
- LWDEBUGF(3, "side result: %.8f", side);
- LWDEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
+ POSTGIS_DEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
+ POSTGIS_DEBUGF(3, "side result: %.8f", side);
+ POSTGIS_DEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
/* zero length segments are ignored. */
if (((seg2.x-seg1.x)*(seg2.x-seg1.x)+(seg2.y-seg1.y)*(seg2.y-seg1.y)) < 1e-12*1e-12)
{
- LWDEBUG(3, "segment is zero length... ignoring.");
+ POSTGIS_DEBUG(3, "segment is zero length... ignoring.");
continue;
}
{
if (isOnSegment(&seg1, &seg2, point) == 1)
{
- LWDEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
+ POSTGIS_DEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
return 0;
}
*/
if (FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y) && side>0)
{
- LWDEBUG(3, "incrementing winding number.");
+ POSTGIS_DEBUG(3, "incrementing winding number.");
++wn;
}
*/
else if (FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y) && side<0)
{
- LWDEBUG(3, "decrementing winding number.");
+ POSTGIS_DEBUG(3, "decrementing winding number.");
--wn;
}
}
- LWDEBUGF(3, "winding number %d", wn);
+ POSTGIS_DEBUGF(3, "winding number %d", wn);
if (wn == 0)
return -1;
POINT2D seg1;
POINT2D seg2;
- LWDEBUG(2, "point_in_ring called.");
+ POSTGIS_DEBUG(2, "point_in_ring called.");
for (i=0; i<pts->npoints-1; i++)
side = determineSide(&seg1, &seg2, point);
- LWDEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
- LWDEBUGF(3, "side result: %.8f", side);
- LWDEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
+ POSTGIS_DEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
+ POSTGIS_DEBUGF(3, "side result: %.8f", side);
+ POSTGIS_DEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
/* zero length segments are ignored. */
if (((seg2.x-seg1.x)*(seg2.x-seg1.x)+(seg2.y-seg1.y)*(seg2.y-seg1.y)) < 1e-12*1e-12)
{
- LWDEBUG(3, "segment is zero length... ignoring.");
+ POSTGIS_DEBUG(3, "segment is zero length... ignoring.");
continue;
}
{
if (isOnSegment(&seg1, &seg2, point) == 1)
{
- LWDEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
+ POSTGIS_DEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
return 0;
}
*/
if (FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y) && side>0)
{
- LWDEBUG(3, "incrementing winding number.");
+ POSTGIS_DEBUG(3, "incrementing winding number.");
++wn;
}
*/
else if (FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y) && side<0)
{
- LWDEBUG(3, "decrementing winding number.");
+ POSTGIS_DEBUG(3, "decrementing winding number.");
--wn;
}
}
- LWDEBUGF(3, "winding number %d", wn);
+ POSTGIS_DEBUGF(3, "winding number %d", wn);
if (wn == 0)
return -1;
int i;
POINT2D pt;
- LWDEBUGF(2, "point_in_polygon called for %p %d %p.", root, ringCount, point);
+ POSTGIS_DEBUGF(2, "point_in_polygon called for %p %d %p.", root, ringCount, point);
getPoint2d_p(point->point, 0, &pt);
/* assume bbox short-circuit has already been attempted */
if (point_in_ring_rtree(root[0], &pt) != 1)
{
- LWDEBUG(3, "point_in_polygon_rtree: outside exterior ring.");
+ POSTGIS_DEBUG(3, "point_in_polygon_rtree: outside exterior ring.");
return 0;
}
{
if (point_in_ring_rtree(root[i], &pt) != -1)
{
- LWDEBUGF(3, "point_in_polygon_rtree: within hole %d.", i);
+ POSTGIS_DEBUGF(3, "point_in_polygon_rtree: within hole %d.", i);
return 0;
}
POINT2D pt;
int result = -1;
- LWDEBUGF(2, "point_in_multipolygon_rtree called for %p %d %p.", root, polyCount, point);
+ POSTGIS_DEBUGF(2, "point_in_multipolygon_rtree called for %p %d %p.", root, polyCount, point);
getPoint2d_p(point->point, 0, &pt);
/* assume bbox short-circuit has already been attempted */
for ( p = 0; p < polyCount; p++ )
{
in_ring = point_in_ring_rtree(root[i], &pt);
- LWDEBUGF(4, "point_in_multipolygon_rtree: exterior ring (%d), point_in_ring returned %d", p, in_ring);
+ POSTGIS_DEBUGF(4, "point_in_multipolygon_rtree: exterior ring (%d), point_in_ring returned %d", p, in_ring);
if ( in_ring == -1 ) /* outside the exterior ring */
{
- LWDEBUG(3, "point_in_multipolygon_rtree: outside exterior ring.");
+ POSTGIS_DEBUG(3, "point_in_multipolygon_rtree: outside exterior ring.");
}
else if ( in_ring == 0 ) /* on the boundary */
{
- LWDEBUGF(3, "point_in_multipolygon_rtree: on edge of exterior ring %d", p);
+ POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: on edge of exterior ring %d", p);
return 0;
} else {
result = in_ring;
for(r=1; r<ringCounts[p]; r++)
{
in_ring = point_in_ring_rtree(root[i+r], &pt);
- LWDEBUGF(4, "point_in_multipolygon_rtree: interior ring (%d), point_in_ring returned %d", r, in_ring);
+ POSTGIS_DEBUGF(4, "point_in_multipolygon_rtree: interior ring (%d), point_in_ring returned %d", r, in_ring);
if (in_ring == 1) /* inside a hole => outside the polygon */
{
- LWDEBUGF(3, "point_in_multipolygon_rtree: within hole %d of exterior ring %d", r, p);
+ POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: within hole %d of exterior ring %d", r, p);
result = -1;
break;
}
if (in_ring == 0) /* on the edge of a hole */
{
- LWDEBUGF(3, "point_in_multipolygon_rtree: on edge of hole %d of exterior ring %d", r, p);
+ POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: on edge of hole %d of exterior ring %d", r, p);
return 0;
}
}
POINTARRAY *ring;
POINT2D pt;
- LWDEBUG(2, "point_in_polygon called.");
+ POSTGIS_DEBUG(2, "point_in_polygon called.");
getPoint2d_p(point->point, 0, &pt);
/* assume bbox short-circuit has already been attempted */
in_ring = point_in_ring(polygon->rings[0], &pt);
if ( in_ring == -1) /* outside the exterior ring */
{
- LWDEBUG(3, "point_in_polygon: outside exterior ring.");
+ POSTGIS_DEBUG(3, "point_in_polygon: outside exterior ring.");
return -1;
}
result = in_ring;
in_ring = point_in_ring(polygon->rings[i], &pt);
if (in_ring == 1) /* inside a hole => outside the polygon */
{
- LWDEBUGF(3, "point_in_polygon: within hole %d.", i);
+ POSTGIS_DEBUGF(3, "point_in_polygon: within hole %d.", i);
return -1;
}
if (in_ring == 0) /* on the edge of a hole */
{
- LWDEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
+ POSTGIS_DEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
return 0;
}
}
POINTARRAY *ring;
POINT2D pt;
- LWDEBUG(2, "point_in_polygon called.");
+ POSTGIS_DEBUG(2, "point_in_polygon called.");
getPoint2d_p(point->point, 0, &pt);
/* assume bbox short-circuit has already been attempted */
in_ring = point_in_ring(polygon->rings[0], &pt);
if ( in_ring == -1) /* outside the exterior ring */
{
- LWDEBUG(3, "point_in_polygon: outside exterior ring.");
+ POSTGIS_DEBUG(3, "point_in_polygon: outside exterior ring.");
continue;
}
if ( in_ring == 0 )
in_ring = point_in_ring(polygon->rings[i], &pt);
if (in_ring == 1) /* inside a hole => outside the polygon */
{
- LWDEBUGF(3, "point_in_polygon: within hole %d.", i);
+ POSTGIS_DEBUGF(3, "point_in_polygon: within hole %d.", i);
result = -1;
break;
}
if (in_ring == 0) /* on the edge of a hole */
{
- LWDEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
+ POSTGIS_DEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
return 0;
}
}
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2005 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2005 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
int swapped=0;
int ret=0;
- LWDEBUGF(3, "m0: %g m1: %g", m0, m1);
+ POSTGIS_DEBUGF(3, "m0: %g m1: %g", m0, m1);
/* Handle corner case of m values being the same */
if ( p1->m == p2->m )
dY=p2->y-p1->y;
dZ=p2->z-p1->z;
- LWDEBUGF(3, "dM0:%g dM1:%g", dM0, dM1);
- LWDEBUGF(3, "dX:%g dY:%g dZ:%g", dX, dY, dZ);
- LWDEBUGF(3, "swapped: %d", swapped);
+ POSTGIS_DEBUGF(3, "dM0:%g dM1:%g", dM0, dM1);
+ POSTGIS_DEBUGF(3, "dX:%g dY:%g dZ:%g", dX, dY, dZ);
+ POSTGIS_DEBUGF(3, "swapped: %d", swapped);
/*
* First point out of range, project
{
memcpy(p1, p2, sizeof(POINT4D));
- LWDEBUG(3, "Projected p1 on range (as copy of p2)");
+ POSTGIS_DEBUG(3, "Projected p1 on range (as copy of p2)");
}
else
{
p1->z += (dZ*dM0);
p1->m = m0;
- LWDEBUG(3, "Projected p1 on range");
+ POSTGIS_DEBUG(3, "Projected p1 on range");
}
if ( swapped ) ret |= 0x0100;
{
memcpy(p2, p1, sizeof(POINT4D));
- LWDEBUG(3, "Projected p2 on range (as copy of p1)");
+ POSTGIS_DEBUG(3, "Projected p2 on range (as copy of p1)");
}
else
{
p2->z += (dZ*dM1);
p2->m = m1;
- LWDEBUG(3, "Projected p2 on range");
+ POSTGIS_DEBUG(3, "Projected p2 on range");
}
if ( swapped ) ret |= 0x0010;
*/
ret.ptarrays=lwalloc(sizeof(POINTARRAY *)*ipa->npoints-1);
- LWDEBUGF(2, "ptarray_locate...: called for pointarray %x, m0:%g, m1:%g",
+ POSTGIS_DEBUGF(2, "ptarray_locate...: called for pointarray %x, m0:%g, m1:%g",
ipa, m0, m1);
getPoint4d_p(ipa, i-1, &p1);
getPoint4d_p(ipa, i, &p2);
- LWDEBUGF(3, " segment %d-%d [ %g %g %g %g - %g %g %g %g ]",
+ POSTGIS_DEBUGF(3, " segment %d-%d [ %g %g %g %g - %g %g %g %g ]",
i-1, i,
p1.x, p1.y, p1.z, p1.m,
p2.x, p2.y, p2.z, p2.m);
/* segment completely outside, nothing to do */
if (! clipval ) continue;
- LWDEBUGF(3, " clipped to: [ %g %g %g %g - %g %g %g %g ] clipval: %x", p1.x, p1.y, p1.z, p1.m,
+ POSTGIS_DEBUGF(3, " clipped to: [ %g %g %g %g - %g %g %g %g ] clipval: %x", p1.x, p1.y, p1.z, p1.m,
p2.x, p2.y, p2.z, p2.m, clipval);
/* If no points have been accumulated so far, then if clipval != 0 the first point must be the
start of the intersection */
if (dpa == NULL)
{
- LWDEBUGF(3, " 1 creating new POINTARRAY with first point %g,%g,%g,%g", p1.x, p1.y, p1.z, p1.m);
+ POSTGIS_DEBUGF(3, " 1 creating new POINTARRAY with first point %g,%g,%g,%g", p1.x, p1.y, p1.z, p1.m);
dpa = ptarray_construct_empty(FLAGS_GET_Z(ipa->flags), FLAGS_GET_M(ipa->flags), ipa->npoints-i);
ptarray_append_point(dpa, &p1, LW_TRUE);
*/
if ( clipval & 0x0100 || i == ipa->npoints-1 )
{
- LWDEBUGF(3, " closing pointarray %x with %d points", dpa, dpa->npoints);
+ POSTGIS_DEBUGF(3, " closing pointarray %x with %d points", dpa, dpa->npoints);
ret.ptarrays[ret.nptarrays++] = dpa;
dpa = NULL;
{
POINT3DM p3dm;
- LWDEBUGF(2, "lwpoint_locate_between called for lwpoint %x", lwpoint);
+ POSTGIS_DEBUGF(2, "lwpoint_locate_between called for lwpoint %x", lwpoint);
lwpoint_getPoint3dm_p(lwpoint, &p3dm);
if ( p3dm.m >= m0 && p3dm.m <= m1)
{
- LWDEBUG(3, " lwpoint... returning a clone of input");
+ POSTGIS_DEBUG(3, " lwpoint... returning a clone of input");
return (LWGEOM *)lwpoint_clone(lwpoint);
}
else
{
- LWDEBUG(3, " lwpoint... returning a clone of input");
+ POSTGIS_DEBUG(3, " lwpoint... returning a clone of input");
return NULL;
}
const int lineflag=0x10;
POINTARRAYSET paset=ptarray_locate_between_m(ipa, m0, m1);
- LWDEBUGF(2, "lwline_locate_between called for lwline %x", lwline_in);
+ POSTGIS_DEBUGF(2, "lwline_locate_between called for lwline %x", lwline_in);
- LWDEBUGF(3, " ptarray_locate... returned %d pointarrays",
+ POSTGIS_DEBUGF(3, " ptarray_locate... returned %d pointarrays",
paset.nptarrays);
if ( paset.nptarrays == 0 )
int ngeoms=0;
LWGEOM **geoms;
- LWDEBUGF(2, "lwcollection_locate_between_m called for lwcoll %x", lwcoll);
+ POSTGIS_DEBUGF(2, "lwcollection_locate_between_m called for lwcoll %x", lwcoll);
geoms=lwalloc(sizeof(LWGEOM *)*lwcoll->ngeoms);
for (i=0; i<lwcoll->ngeoms; i++)
static LWGEOM *
lwgeom_locate_between_m(LWGEOM *lwin, double m0, double m1)
{
- LWDEBUGF(2, "lwgeom_locate_between called for lwgeom %x", lwin);
+ POSTGIS_DEBUGF(2, "lwgeom_locate_between called for lwgeom %x", lwin);
switch (lwin->type)
{
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2005 Refractions Research Inc.
+ * Copyright (C) 2001-2005 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
int i, nodeCount;
int childNodes, parentNodes;
- LWDEBUGF(2, "createTree called with pointarray %p", pointArray);
+ POSTGIS_DEBUGF(2, "createTree called with pointarray %p", pointArray);
nodeCount = pointArray->npoints - 1;
- LWDEBUGF(3, "Total leaf nodes: %d", nodeCount);
+ POSTGIS_DEBUGF(3, "Total leaf nodes: %d", nodeCount);
/*
* Create a leaf node for every line segment.
parentNodes = nodeCount / 2;
while (parentNodes > 0)
{
- LWDEBUGF(3, "Merging %d children into %d parents.", childNodes, parentNodes);
+ POSTGIS_DEBUGF(3, "Merging %d children into %d parents.", childNodes, parentNodes);
i = 0;
while (i < parentNodes)
*/
if (parentNodes * 2 < childNodes)
{
- LWDEBUGF(3, "Shuffling child %d to parent %d", childNodes - 1, i);
+ POSTGIS_DEBUGF(3, "Shuffling child %d to parent %d", childNodes - 1, i);
nodes[i] = nodes[childNodes - 1];
parentNodes++;
root = nodes[0];
lwfree(nodes);
- LWDEBUGF(3, "createTree returning %p", root);
+ POSTGIS_DEBUGF(3, "createTree returning %p", root);
return root;
}
{
RTREE_NODE *parent;
- LWDEBUGF(2, "createInteriorNode called for children %p, %p", left, right);
+ POSTGIS_DEBUGF(2, "createInteriorNode called for children %p, %p", left, right);
parent = lwalloc(sizeof(RTREE_NODE));
parent->leftNode = left;
parent->interval = mergeIntervals(left->interval, right->interval);
parent->segment = NULL;
- LWDEBUGF(3, "createInteriorNode returning %p", parent);
+ POSTGIS_DEBUGF(3, "createInteriorNode returning %p", parent);
return parent;
}
POINT4D tmp;
POINTARRAY *npa;
- LWDEBUGF(2, "createLeafNode called for point %d of %p", startPoint, pa);
+ POSTGIS_DEBUGF(2, "createLeafNode called for point %d of %p", startPoint, pa);
if (pa->npoints < startPoint + 2)
{
parent->leftNode = NULL;
parent->rightNode = NULL;
- LWDEBUGF(3, "createLeafNode returning %p", parent);
+ POSTGIS_DEBUGF(3, "createLeafNode returning %p", parent);
return parent;
}
{
INTERVAL *interval;
- LWDEBUGF(2, "mergeIntervals called with %p, %p", inter1, inter2);
+ POSTGIS_DEBUGF(2, "mergeIntervals called with %p, %p", inter1, inter2);
interval = lwalloc(sizeof(INTERVAL));
interval->max = FP_MAX(inter1->max, inter2->max);
interval->min = FP_MIN(inter1->min, inter2->min);
- LWDEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
+ POSTGIS_DEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
return interval;
}
{
INTERVAL *interval;
- LWDEBUGF(2, "createInterval called with %8.3f, %8.3f", value1, value2);
+ POSTGIS_DEBUGF(2, "createInterval called with %8.3f, %8.3f", value1, value2);
interval = lwalloc(sizeof(INTERVAL));
interval->max = FP_MAX(value1, value2);
interval->min = FP_MIN(value1, value2);
- LWDEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
+ POSTGIS_DEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
return interval;
}
*/
void freeTree(RTREE_NODE *root)
{
- LWDEBUGF(2, "freeTree called for %p", root);
+ POSTGIS_DEBUGF(2, "freeTree called for %p", root);
if (root->leftNode)
freeTree(root->leftNode);
void clearCache(RTREE_POLY_CACHE *cache)
{
int g, r, i;
- LWDEBUGF(2, "clearCache called for %p", cache);
+ POSTGIS_DEBUGF(2, "clearCache called for %p", cache);
i = 0;
for (g = 0; g < cache->polyCount; g++)
{
LWMLINE *tmp, *result;
LWGEOM **lwgeoms;
- LWDEBUGF(2, "findLineSegments called for tree %p and value %8.3f", root, value);
+ POSTGIS_DEBUGF(2, "findLineSegments called for tree %p and value %8.3f", root, value);
result = NULL;
if (!isContained(root->interval, value))
{
- LWDEBUGF(3, "findLineSegments %p: not contained.", root);
+ POSTGIS_DEBUGF(3, "findLineSegments %p: not contained.", root);
return NULL;
}
/* If there is a segment defined for this node, include it. */
if (root->segment)
{
- LWDEBUGF(3, "findLineSegments %p: adding segment %p %d.", root, root->segment, root->segment->type);
+ POSTGIS_DEBUGF(3, "findLineSegments %p: adding segment %p %d.", root, root->segment, root->segment->type);
lwgeoms = lwalloc(sizeof(LWGEOM *));
lwgeoms[0] = (LWGEOM *)root->segment;
- LWDEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, FLAGS_GET_Z(root->segment->flags));
+ POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, FLAGS_GET_Z(root->segment->flags));
result = (LWMLINE *)lwcollection_construct(lwgeom_makeType_full(0, 0, 0, MULTILINETYPE, 0), -1, NULL, 1, lwgeoms);
}
/* If there is a left child node, recursively include its results. */
if (root->leftNode)
{
- LWDEBUGF(3, "findLineSegments %p: recursing left.", root);
+ POSTGIS_DEBUGF(3, "findLineSegments %p: recursing left.", root);
tmp = findLineSegments(root->leftNode, value);
if (tmp)
{
- LWDEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
+ POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
if (result)
result = mergeMultiLines(result, tmp);
/* Same for any right child. */
if (root->rightNode)
{
- LWDEBUGF(3, "findLineSegments %p: recursing right.", root);
+ POSTGIS_DEBUGF(3, "findLineSegments %p: recursing right.", root);
tmp = findLineSegments(root->rightNode, value);
if (tmp)
{
- LWDEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
+ POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
if (result)
result = mergeMultiLines(result, tmp);
LWCOLLECTION *col;
int i, j, ngeoms;
- LWDEBUGF(2, "mergeMultiLines called on %p, %d, %d; %p, %d, %d", line1, line1->ngeoms, line1->type, line2, line2->ngeoms, line2->type);
+ POSTGIS_DEBUGF(2, "mergeMultiLines called on %p, %d, %d; %p, %d, %d", line1, line1->ngeoms, line1->type, line2, line2->ngeoms, line2->type);
ngeoms = line1->ngeoms + line2->ngeoms;
geoms = lwalloc(sizeof(LWGEOM *) * ngeoms);
}
col = lwcollection_construct(MULTILINETYPE, -1, NULL, ngeoms, geoms);
- LWDEBUGF(3, "mergeMultiLines returning %p, %d, %d", col, col->ngeoms, col->type);
+ POSTGIS_DEBUGF(3, "mergeMultiLines returning %p, %d, %d", col, col->ngeoms, col->type);
return (LWMLINE *)col;
}
LWPOLY *poly;
int nrings;
- LWDEBUGF(2, "populateCache called with cache %p geom %p", currentCache, lwgeom);
+ POSTGIS_DEBUGF(2, "populateCache called with cache %p geom %p", currentCache, lwgeom);
if (lwgeom->type == MULTIPOLYGONTYPE)
{
- LWDEBUG(2, "populateCache MULTIPOLYGON");
+ POSTGIS_DEBUG(2, "populateCache MULTIPOLYGON");
mpoly = (LWMPOLY *)lwgeom;
nrings = 0;
/*
}
else if ( lwgeom->type == POLYGONTYPE )
{
- LWDEBUG(2, "populateCache POLYGON");
+ POSTGIS_DEBUG(2, "populateCache POLYGON");
poly = (LWPOLY *)lwgeom;
currentCache->polyCount = 1;
currentCache->ringCounts = lwalloc(sizeof(int));
length = VARSIZE(serializedPoly);
currentCache->poly = lwalloc(length);
memcpy(currentCache->poly, serializedPoly, length);
- LWDEBUGF(3, "populateCache returning %p", currentCache);
+ POSTGIS_DEBUGF(3, "populateCache returning %p", currentCache);
}
/**
{
int length;
- LWDEBUGF(2, "retrieveCache called with %p %p %p", lwgeom, serializedPoly, currentCache);
+ POSTGIS_DEBUGF(2, "retrieveCache called with %p %p %p", lwgeom, serializedPoly, currentCache);
/* Make sure this isn't someone else's cache object. */
if ( currentCache && currentCache->type != 1 ) currentCache = NULL;
if (!currentCache)
{
- LWDEBUG(3, "No existing cache, create one.");
+ POSTGIS_DEBUG(3, "No existing cache, create one.");
return createCache();
}
if (!(currentCache->poly))
{
- LWDEBUG(3, "Cache contains no polygon, populating it.");
+ POSTGIS_DEBUG(3, "Cache contains no polygon, populating it.");
populateCache(currentCache, lwgeom, serializedPoly);
return currentCache;
}
if (VARSIZE(currentCache->poly) != length)
{
- LWDEBUG(3, "Polygon size mismatch, creating new cache.");
+ POSTGIS_DEBUG(3, "Polygon size mismatch, creating new cache.");
clearCache(currentCache);
return currentCache;
}
if ( memcmp(serializedPoly, currentCache->poly, length) )
{
- LWDEBUG(3, "Polygon mismatch, creating new cache.");
+ POSTGIS_DEBUG(3, "Polygon mismatch, creating new cache.");
clearCache(currentCache);
return currentCache;
}
- LWDEBUGF(3, "Polygon match, retaining current cache, %p.", currentCache);
+ POSTGIS_DEBUGF(3, "Polygon match, retaining current cache, %p.",
+ currentCache);
return currentCache;
}
/**********************************************************************
- * $Id$
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
- * Copyright 2001-2003 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2003 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
#if POSTGIS_DEBUG_LEVEL >= 4
result2 = distance_sphere_method(lat1, long1,lat2,long2, sphere);
- LWDEBUGF(4, "delta = %lf, skae says: %.15lf,2 circle says: %.15lf",
+ POSTGIS_DEBUGF(4, "delta = %lf, skae says: %.15lf,2 circle says: %.15lf",
(result2-result),result,result2);
- LWDEBUGF(4, "2 circle says: %.15lf",result2);
+ POSTGIS_DEBUGF(4, "2 circle says: %.15lf",result2);
#endif
if (result != result) /* NaN check