[mapserver-commits] r9091 - in sandbox/graphics: . mapscript/csharp mapscript/java mapscript/php3 mapscript/swiginc renderers/agg/src

svn at osgeo.org svn at osgeo.org
Sun Jun 7 04:31:19 EDT 2009


Author: tbonfort
Date: 2009-06-07 04:31:18 -0400 (Sun, 07 Jun 2009)
New Revision: 9091

Modified:
   sandbox/graphics/HISTORY.TXT
   sandbox/graphics/Makefile.in
   sandbox/graphics/configure
   sandbox/graphics/configure.in
   sandbox/graphics/mapdraw.c
   sandbox/graphics/mapfile.c
   sandbox/graphics/mapgeomtransform.c
   sandbox/graphics/maphttp.c
   sandbox/graphics/mapogcsos.c
   sandbox/graphics/mappostgis.c
   sandbox/graphics/mappostgresql.c
   sandbox/graphics/mapprimitive.c
   sandbox/graphics/mapquery.c
   sandbox/graphics/mapscript/csharp/Makefile.in
   sandbox/graphics/mapscript/java/Makefile.in
   sandbox/graphics/mapscript/php3/mapscript_i.c
   sandbox/graphics/mapscript/swiginc/layer.i
   sandbox/graphics/mapsde.c
   sandbox/graphics/mapserv.c
   sandbox/graphics/mapserver.h
   sandbox/graphics/maptemplate.c
   sandbox/graphics/maputil.c
   sandbox/graphics/renderers/agg/src/agg_font_freetype.cpp
Log:
merge trunk from r8986 to HEAD


Modified: sandbox/graphics/HISTORY.TXT
===================================================================
--- sandbox/graphics/HISTORY.TXT	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/HISTORY.TXT	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1,6 +1,8 @@
 MapServer Revision History
 ==========================
- 
+
+$Id$
+
 This is a human-readable revision history which will attempt to document
 required changes for users to migrate from one version of MapServer to the
 next.  Developers are strongly encouraged to document their changes and
@@ -14,6 +16,22 @@
 - RFC49 implementation: min/max scale on style and label. outlinewidth
   on lines
 
+- Do pre-emptive test for map.extent/layer.extent interaction (#3043)
+
+- Add centroid geomtransform (#2825)
+
+- Test database connections before using them (#2932)
+
+- Support non-numeric join criteria (#2006)
+
+- Ensure there's enough room in the SQL to hold a long (#1284)
+
+- Fix filter error in multi-clause filters (#2937)
+
+- Fix agg freetype character lookup when no unicode charmap is present (#3018)
+
+- Fix memory leak in SQL building (#2997)
+
 - Fork AGG rendering library in our trunk
 
 - Fixed a memory leak when unescaping quotes in	logical	expressions (#2938)
@@ -75,6 +93,10 @@
 
 - fix time advertising in WMS 1.3.0 (#2935)
 
+- fix SOS blockSeparator output (#3014)
+
+- fix MIME type support (#3020)
+
 Version 5.4.0-beta3 (2009-3-5):
 --------------------------------
 

Modified: sandbox/graphics/Makefile.in
===================================================================
--- sandbox/graphics/Makefile.in	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/Makefile.in	2009-06-07 08:31:18 UTC (rev 9091)
@@ -267,7 +267,7 @@
 
 RM= /bin/rm -f
 
-OBJS= $(AGG_OBJ) mapimageio.o mapcairo.o maprendering.o mapgeomtransform.o maprgbapng.o maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapagg.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o  mapwfs11.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapwcs11.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o mapogcsos.o mappostgresql.o mapcrypto.o mapowscommon.o maplibxml2.o mapdebug.o mapchart.o maptclutf.o $(EPPL_OBJ) 
+OBJS= $(AGG_OBJ) mapogl.o mapoglrenderer.o mapoglcontext.o mapimageio.o mapcairo.o maprendering.o mapgeomtransform.o maprgbapng.o maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapagg.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o  mapwfs11.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapwcs11.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o mapogcsos.o mappostgresql.o mapcrypto.o mapowscommon.o maplibxml2.o mapdebug.o mapchart.o maptclutf.o $(EPPL_OBJ) 
 
 EXE_LIST = 	shp2img shp2pdf legend mapserv shptree shptreevis \
 		shptreetst scalebar sortshp mapscriptvars tile4ms \

Modified: sandbox/graphics/configure
===================================================================
--- sandbox/graphics/configure	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/configure	2009-06-07 08:31:18 UTC (rev 9091)
@@ -5355,12 +5355,12 @@
   { $as_echo "$as_me:$LINENO: result:         using libfreetype from $FT_LIB" >&5
 $as_echo "        using libfreetype from $FT_LIB" >&6; }
 
-  if test ""$FT_LIBDIR"" != "/usr/lib"; then
+  if test ""$FT_LIB"" != "/usr/lib"; then
 
-  if test -z ""$FT_LIBDIR"" || echo ""$FT_LIBDIR"" | grep '^/' >/dev/null ; then
-    ai_p=""$FT_LIBDIR""
+  if test -z ""$FT_LIB"" || echo ""$FT_LIB"" | grep '^/' >/dev/null ; then
+    ai_p=""$FT_LIB""
   else
-    ai_p="`pwd`/"$FT_LIBDIR""
+    ai_p="`pwd`/"$FT_LIB""
   fi
 
 
@@ -5376,8 +5376,7 @@
 
   fi
 
-else
-    { $as_echo "$as_me:$LINENO: checking for FT_Init_FreeType in -lfreetype" >&5
+elif test -z "$FT_LIBDIR" -a -z "$FT_BIN" ; then     { $as_echo "$as_me:$LINENO: checking for FT_Init_FreeType in -lfreetype" >&5
 $as_echo_n "checking for FT_Init_FreeType in -lfreetype... " >&6; }
 if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then
   $as_echo_n "(cached) " >&6
@@ -9745,8 +9744,16 @@
 
 
     if test "$FT_BIN" == "no" ; then
-      { { $as_echo "$as_me:$LINENO: error: freetype-config required for agg support - please configure --with-freetype." >&5
-$as_echo "$as_me: error: freetype-config required for agg support - please configure --with-freetype." >&2;}
+      { { $as_echo "$as_me:$LINENO: error: the freetype-config executable could not be found and is required for agg support
+        to fix this, you should either:
+        * install the freetype development headers
+        * rerun configure with --with-freetype=/path/to/freetype-config
+        * disable agg support with --with-agg=no " >&5
+$as_echo "$as_me: error: the freetype-config executable could not be found and is required for agg support
+        to fix this, you should either:
+        * install the freetype development headers
+        * rerun configure with --with-freetype=/path/to/freetype-config
+        * disable agg support with --with-agg=no " >&2;}
    { (exit 1); exit 1; }; }
     fi
   fi
@@ -9800,6 +9807,8 @@
     test -f $PNG_DIR/lib/png.h && PNG_INCLUDE="$PNG_DIR/lib"
     test -f $PNG_DIR/png.h && PNG_INCLUDE="$PNG_DIR"
     if test -n "$PNG_INCLUDE" ; then
+            old_cflags="$CFLAGS"
+      CFLAGS="$ZLIB_INC $CFLAGS"
       # On IRIX 5.3, sys/types and inttypes.h are conflicting.
 
 
@@ -10014,6 +10023,7 @@
 fi
 
 
+      CFLAGS="$old_cflags"
     else
         { { $as_echo "$as_me:$LINENO: error: cannot find png headers in $PNG_DIR" >&5
 $as_echo "$as_me: error: cannot find png headers in $PNG_DIR" >&2;}

Modified: sandbox/graphics/configure.in
===================================================================
--- sandbox/graphics/configure.in	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/configure.in	2009-06-07 08:31:18 UTC (rev 9091)
@@ -165,8 +165,8 @@
 if test -n "$FT_LIBDIR" -a -z "$FT_BIN" ; then
   FT_LIB="-L$FT_LIBDIR $FT_TYPE"
   AC_MSG_RESULT([        using libfreetype from $FT_LIB])
-  AC_ADD_RUNPATH("$FT_LIBDIR")
-else
+  AC_ADD_RUNPATH("$FT_LIB")
+elif test -z "$FT_LIBDIR" -a -z "$FT_BIN" ; then dnl replaced else by elif
   dnl check for lib in system libs  
   AC_CHECK_LIB(freetype, FT_Init_FreeType, FT_LIB="-lfreetype",,)
 
@@ -961,7 +961,11 @@
   if test -z "$FT_BIN" ; then
     AC_PATH_PROG(FT_BIN, freetype-config, no)
     if test "$FT_BIN" == "no" ; then
-      AC_MSG_ERROR([freetype-config required for agg support - please configure --with-freetype.])
+      AC_MSG_ERROR([the freetype-config executable could not be found and is required for agg support
+        to fix this, you should either:
+        * install the freetype development headers
+        * rerun configure with --with-freetype=/path/to/freetype-config
+        * disable agg support with --with-agg=no ])
     fi
   fi
   
@@ -1006,8 +1010,12 @@
     test -f $PNG_DIR/lib/png.h && PNG_INCLUDE="$PNG_DIR/lib"
     test -f $PNG_DIR/png.h && PNG_INCLUDE="$PNG_DIR"
     if test -n "$PNG_INCLUDE" ; then
+      dnl make sure we'll be able to find zlib.h
+      old_cflags="$CFLAGS"
+      CFLAGS="$ZLIB_INC $CFLAGS"
       AC_CHECK_HEADER([$PNG_INCLUDE/png.h],,
         [AC_MSG_ERROR([cannot find png headers])])
+      CFLAGS="$old_cflags"
     else
         AC_MSG_ERROR([cannot find png headers in $PNG_DIR])
     fi

Modified: sandbox/graphics/mapdraw.c
===================================================================
--- sandbox/graphics/mapdraw.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapdraw.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -631,6 +631,11 @@
 
   if(layer->type == MS_LAYER_QUERY || layer->type == MS_LAYER_TILEINDEX) return(MS_FALSE);
   if((layer->status != MS_ON) && (layer->status != MS_DEFAULT)) return(MS_FALSE);
+
+  /* Only return MS_FALSE if it is definitely false. Sometimes it will return MS_UNKNOWN, which we 
+  ** consider true, for this use case (it might be visible, try and draw it, see what happens). */
+  if ( msExtentsOverlap(map, layer) == MS_FALSE ) return(MS_FALSE);  
+  
   if(msEvalContext(map, layer, layer->requires) == MS_FALSE) return(MS_FALSE);
 
   if(map->scaledenom > 0) {
@@ -2285,10 +2290,14 @@
             if(labelPtr->position == MS_AUTO) {
               int positions[MS_POSITIONS_LENGTH], npositions=0;
 
-              if(layerPtr->type == MS_LAYER_POLYGON || (layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->shapetype == MS_SHAPE_POLYGON)) {
+              /*
+	      ** If the ANNOTATION has an associated marker then the position is handled like a point regardless of underlying shape type. (#2993)
+              **   (Note: might be able to re-order this for more speed.)
+              */
+              if(layerPtr->type == MS_LAYER_POLYGON || (layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->shapetype == MS_SHAPE_POLYGON && cachePtr->numstyles == 0)) {
 		positions[0]=MS_CC; positions[1]=MS_UC; positions[2]=MS_LC; positions[3]=MS_CL; positions[4]=MS_CR;
                 npositions = 5;
-              } else if(layerPtr->type == MS_LAYER_LINE || (layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->shapetype == MS_SHAPE_LINE)) {
+              } else if(layerPtr->type == MS_LAYER_LINE || (layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->shapetype == MS_SHAPE_LINE && cachePtr->numstyles == 0)) {
                 positions[0]=MS_UC; positions[1]=MS_LC; positions[2]=MS_CC;
                 npositions = 3;
               } else {

Modified: sandbox/graphics/mapfile.c
===================================================================
--- sandbox/graphics/mapfile.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapfile.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1660,7 +1660,7 @@
   writeColor(&(label->shadowcolor), stream, "  SHADOWCOLOR", tab);
   if(label->shadowsizex != 1 && label->shadowsizey != 1) fprintf(stream, "  %sSHADOWSIZE %d %d\n", tab, label->shadowsizex, label->shadowsizey);
   if(label->wrap) fprintf(stream, "  %sWRAP '%c'\n", tab, label->wrap);
-  if(label->maxlength>0) fprintf(stream, "  %sMAXLENGTH '%c'\n", tab, label->maxlength);
+  if(label->maxlength>0) fprintf(stream, "  %sMAXLENGTH %d\n", tab, label->maxlength);
   fprintf(stream, "%sEND\n", tab);  
 }
 

Modified: sandbox/graphics/mapgeomtransform.c
===================================================================
--- sandbox/graphics/mapgeomtransform.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapgeomtransform.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -44,6 +44,9 @@
   else if(!strncasecmp("bbox",transform,4)) {
     s->_geomtransform = MS_GEOMTRANSFORM_BBOX;
   }
+  else if(!strncasecmp("centroid",transform,8)) {
+    s->_geomtransform = MS_GEOMTRANSFORM_CENTROID;
+  }
   else {
     s->_geomtransform = MS_GEOMTRANSFORM_NONE;
     msSetError(MS_MISCERR,"unknown transform expression","msStyleSetGeomTransform()");
@@ -159,6 +162,14 @@
   	    msDrawShadeSymbol(symbolset, image, &bbox, style, scalefactor);
       }
       break;
+    case MS_GEOMTRANSFORM_CENTROID:
+      {
+        double unused; /*used by centroid function*/
+        pointObj centroid;
+        if(MS_SUCCESS == msGetPolygonCentroid(shape,&centroid,&unused,&unused)){
+          msDrawMarkerSymbol(symbolset,image,&centroid,style,scalefactor);
+        }
+      }
     default:
      msSetError(MS_MISCERR, "unknown geomtransform", "msDrawTransformedShape()");
      return MS_FAILURE;

Modified: sandbox/graphics/maphttp.c
===================================================================
--- sandbox/graphics/maphttp.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/maphttp.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -267,6 +267,7 @@
     CURLM   *multi_handle;
     CURLMsg *curl_msg;
     char     debug = MS_FALSE;
+    const char *pszCurlCABundle = NULL;
 
     if (numRequests == 0)
         return MS_SUCCESS;  /* Nothing to do */
@@ -291,9 +292,17 @@
     if (nTimeout <= 0)
         nTimeout = 30;
 
+    /* Check if we've got a CURL_CA_BUNDLE env. var.
+     * If set then the value is the full path to the ca-bundle.crt file
+     * e.g. CURL_CA_BUNDLE=/usr/local/share/curl/curl-ca-bundle.crt
+     */
+    pszCurlCABundle = getenv("CURL_CA_BUNDLE");
+
     if (debug)
     {
         msDebug("HTTP: Starting to prepare HTTP requests.\n");
+        if (pszCurlCABundle)
+            msDebug("Using CURL_CA_BUNDLE=%s\n", pszCurlCABundle);
     }
 
     /* Alloc a curl-multi handle, and add a curl-easy handle to it for each
@@ -394,7 +403,11 @@
 
         /* Set timeout.*/
         curl_easy_setopt(http_handle, CURLOPT_TIMEOUT, nTimeout );
-        
+
+        /* Pass CURL_CA_BUNDLE if set */
+        if (pszCurlCABundle)
+            curl_easy_setopt(http_handle, CURLOPT_CAINFO, pszCurlCABundle );
+
         /* Set proxying settings */
         if (pasReqInfo[i].pszProxyAddress != NULL
             && strlen(pasReqInfo[i].pszProxyAddress) > 0)

Modified: sandbox/graphics/mapogcsos.c
===================================================================
--- sandbox/graphics/mapogcsos.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapogcsos.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -54,8 +54,8 @@
 const char *pszSOSNamespacePrefix        = "sos";
 const char *pszOMNamespaceUri            = "http://www.opengis.net/om/1.0";
 const char *pszOMNamespacePrefix         = "om";
-const char *pszSOSDescribeSensorMimeType = "text/xml; subtype=sensorML/1.0.0";
-const char *pszSOSGetObservationMimeType = "text/xml; subtype=om/1.0.0";
+const char *pszSOSDescribeSensorMimeType = "text/xml; subtype=\"sensorML/1.0.0\"";
+const char *pszSOSGetObservationMimeType = "text/xml; subtype=\"om/1.0.0\"";
 
 typedef struct {
   char *pszProcedure;
@@ -548,6 +548,7 @@
     char szTmp[100];
     int i=0;
     char *pszTokenValue = NULL;
+    char *pszBlockValue = NULL;
     const char *pszBlockSep=NULL, *pszTokenSep=NULL;
 
     if (psParent)
@@ -629,15 +630,16 @@
         xmlNewNsProp(psSubNode, NULL, BAD_CAST "tokenSeparator", BAD_CAST pszTokenValue);
 
         if (pszBlockSep)
-          pszTokenValue = msStringConcatenate(pszTokenValue, (char *)pszBlockSep);
+          pszBlockValue = msStringConcatenate(pszBlockValue, (char *)pszBlockSep);
         else
-          pszTokenValue = msStringConcatenate(pszTokenValue, "\n");
+          pszBlockValue = msStringConcatenate(pszBlockValue, "\n");
 
-        xmlNewNsProp(psSubNode, NULL, BAD_CAST "blockSeparator", BAD_CAST pszTokenValue);
+        xmlNewNsProp(psSubNode, NULL, BAD_CAST "blockSeparator", BAD_CAST pszBlockValue);
 
         xmlNewNsProp(psSubNode, NULL, BAD_CAST "decimalSeparator", BAD_CAST ".");
 
         msFree(pszTokenValue);
+        msFree(pszBlockValue);
     }   
 }
 

Modified: sandbox/graphics/mappostgis.c
===================================================================
--- sandbox/graphics/mappostgis.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mappostgis.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1041,6 +1041,7 @@
         }
         strSRID = malloc(strlen(strSRIDTemplate) + strlen(f_table_name) + strlen(layerinfo->geomcolumn));
         sprintf(strSRID, strSRIDTemplate, f_table_name, layerinfo->geomcolumn);
+        if ( f_table_name ) free(f_table_name);
     }
     return strSRID;
 }
@@ -1195,14 +1196,16 @@
 
     /* Populate strFilter, if necessary. */
     if ( layer->filter.string ) {
-        strFilter = strdup(layer->filter.string);
+        static char *strFilterTemplate = "(%s)";
+        strFilter = (char*)malloc(strlen(strFilterTemplate) + strlen(layer->filter.string));
+        sprintf(strFilter, strFilterTemplate, layer->filter.string);
         strFilterLength = strlen(strFilter);
     }
 
     /* Populate strUid, if necessary. */
     if ( uid ) {
         static char *strUidTemplate = "\"%s\" = %ld";
-        strUid = (char*)malloc(strlen(strUidTemplate) + strlen(layerinfo->uid) + 9);
+        strUid = (char*)malloc(strlen(strUidTemplate) + strlen(layerinfo->uid) + 64);
         sprintf(strUid, strUidTemplate, layerinfo->uid, *uid);
         strUidLength = strlen(strUid);
     }
@@ -1516,6 +1519,19 @@
         /* Save this connection in the pool for later. */
         msConnPoolRegister(layer, layerinfo->pgconn, msPostGISCloseConnection);
     }
+    else {
+        /* Connection in the pool should be tested to see if backend is alive. */
+        if( PQstatus(layerinfo->pgconn) != CONNECTION_OK ) {
+            /* Uh oh, bad connection. Can we reset it? */
+            PQreset(layerinfo->pgconn);
+            if( PQstatus(layerinfo->pgconn) != CONNECTION_OK ) {
+                /* Nope, time to bail out. */
+                msSetError(MS_QUERYERR, "PostgreSQL database connection gone bad (%s)", "msPostGISLayerOpen()", PQerrorMessage(layerinfo->pgconn));
+                return MS_FAILURE;
+            }
+            
+        }
+    }
 
     /* Save the layerinfo in the layerObj. */
     layer->layerinfo = (void*)layerinfo;

Modified: sandbox/graphics/mappostgresql.c
===================================================================
--- sandbox/graphics/mappostgresql.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mappostgresql.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id:$
+ * $Id$
  *
  * Project:  MapServer
  * Purpose:  Postgres CONNECTIONTYPE support.
@@ -328,7 +328,7 @@
                     "msPOSTGRESQLJoinNext()");
             return MS_FAILURE;
         }
-        sprintf(sql, "SELECT %s FROM %s WHERE %s = %s", columns, join->table, join->to, joininfo->from_value);
+        sprintf(sql, "SELECT %s FROM %s WHERE %s = '%s'", columns, join->table, join->to, joininfo->from_value);
         if(joininfo->layer_debug) {
             msDebug("msPOSTGRESQLJoinNext(): executing %s.\n", sql);
         }

Modified: sandbox/graphics/mapprimitive.c
===================================================================
--- sandbox/graphics/mapprimitive.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapprimitive.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1035,7 +1035,7 @@
   return MS_SUCCESS;
 }
 
-static int getPolygonCentroid(shapeObj *p, pointObj *lp, double *miny, double *maxy)
+int msGetPolygonCentroid(shapeObj *p, pointObj *lp, double *miny, double *maxy)
 {
   int i,j;
   double cent_weight_x=0.0, cent_weight_y=0.0;
@@ -1098,7 +1098,7 @@
     lp->y = cp.y;
     break;
   case 1: /* centroid */
-    if(getPolygonCentroid(p, lp, &miny, &maxy) != MS_SUCCESS) return(MS_FAILURE);  
+    if(msGetPolygonCentroid(p, lp, &miny, &maxy) != MS_SUCCESS) return(MS_FAILURE);  
     break;
   case 2: /* center of gravity */
     if(getPolygonCenterOfGravity(p, lp) != MS_SUCCESS) return(MS_FAILURE);

Modified: sandbox/graphics/mapquery.c
===================================================================
--- sandbox/graphics/mapquery.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapquery.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -686,7 +686,7 @@
     /* Get the layer tolerance
        default is 3 for point and line layers, 0 for others */
     if(lp->tolerance == -1) {
-      if(lp->status == MS_LAYER_POINT || lp->status == MS_LAYER_LINE)
+      if(lp->type == MS_LAYER_POINT || lp->type == MS_LAYER_LINE)
         layer_tolerance = 3;
        else
         layer_tolerance = 0;
@@ -971,7 +971,7 @@
     /* Get the layer tolerance
        default is 3 for point and line layers, 0 for others */
     if(lp->tolerance == -1)
-        if(lp->status == MS_LAYER_POINT || lp->status == MS_LAYER_LINE)
+        if(lp->type == MS_LAYER_POINT || lp->type == MS_LAYER_LINE)
             layer_tolerance = 3;
         else
             layer_tolerance = 0;
@@ -1159,7 +1159,7 @@
     /* Get the layer tolerance
        default is 3 for point and line layers, 0 for others */
     if(lp->tolerance == -1)
-        if(lp->status == MS_LAYER_POINT || lp->status == MS_LAYER_LINE)
+        if(lp->type == MS_LAYER_POINT || lp->type == MS_LAYER_LINE)
             layer_tolerance = 3;
         else
             layer_tolerance = 0;

Modified: sandbox/graphics/mapscript/csharp/Makefile.in
===================================================================
--- sandbox/graphics/mapscript/csharp/Makefile.in	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapscript/csharp/Makefile.in	2009-06-07 08:31:18 UTC (rev 9091)
@@ -46,7 +46,6 @@
 # Optional Anti-Grain Geometry Support.
 #
 AGG=     @AGG_ENABLED@
-AGG_LIB=  @AGG_LIB@
 AGG_INC=  @AGG_INC@
 
 
@@ -188,7 +187,7 @@
 CCFLAGS   = @CFLAGS@ $(FLAGS)
 
 # Link flags and shared libs only
-SUP_LIBS =  $(GD_LIB) $(AGG_LIB) $(PDF_LIB) $(TIFF_LIB) $(PROJ_LIBS) \
+SUP_LIBS =  $(GD_LIB) $(PDF_LIB) $(TIFF_LIB) $(PROJ_LIBS) \
           $(JPEG_LIB) $(SDE_LIB) $(GDAL_LIB) $(MING_LIB) $(POSTGIS_LIB) \
 	  $(MYGIS_LIB) $(CURL_LIB) $(ORACLESPATIAL_LIB) $(GEOS_LIB) \
 	  $(THREAD_LIB) $(ICONV_LIB) $(ZLIB_LIB) $(XML2_LIB) $(XTRALIBS)

Modified: sandbox/graphics/mapscript/java/Makefile.in
===================================================================
--- sandbox/graphics/mapscript/java/Makefile.in	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapscript/java/Makefile.in	2009-06-07 08:31:18 UTC (rev 9091)
@@ -51,7 +51,6 @@
 # Optional Anti-Grain Geometry Support.
 #
 AGG=     @AGG_ENABLED@
-AGG_LIB=  @AGG_LIB@
 AGG_INC=  @AGG_INC@
 
 
@@ -185,7 +184,7 @@
 	$(CURL_INC) $(MING_INC) $(ORACLESPATIAL_INC) $(GEOS_INC) $(ICONV_INC) $(XML2_INC)
 
 # Link flags and shared libs only
-SUP_LIBS =  $(GD_LIB) $(AGG_LIB) $(PDF_LIB) $(TIFF_LIB) $(PROJ_LIBS) \
+SUP_LIBS =  $(GD_LIB) $(PDF_LIB) $(TIFF_LIB) $(PROJ_LIBS) \
           $(JPEG_LIB) $(SDE_LIB) $(GDAL_LIB) $(MING_LIB) $(POSTGIS_LIB) \
 	  $(MYGIS_LIB) $(CURL_LIB) $(ORACLESPATIAL_LIB) \
 	  $(THREAD_LIB) $(XTRALIBS) $(GEOS_LIB) $(ICONV_INC) $(XML2_LIB)

Modified: sandbox/graphics/mapscript/php3/mapscript_i.c
===================================================================
--- sandbox/graphics/mapscript/php3/mapscript_i.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapscript/php3/mapscript_i.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -401,11 +401,16 @@
 
 
 int layerObj_whichShapes(layerObj *self, rectObj *poRect) {
-  /* 
-  ** We assume folks use this like a simple query so retrieve all items with each shape.
-  */
-  if(msLayerWhichItems(self, MS_TRUE, MS_FALSE, NULL) != MS_SUCCESS) return MS_FAILURE;
-  return msLayerWhichShapes(self, *poRect);
+    int oldconnectiontype = self->connectiontype;
+    self->connectiontype = MS_INLINE;
+
+    if(msLayerWhichItems(self, MS_TRUE, MS_FALSE, NULL) != MS_SUCCESS) {
+        self->connectiontype = oldconnectiontype;
+        return MS_FAILURE;
+    }
+    self->connectiontype = oldconnectiontype;
+
+    return msLayerWhichShapes(self, *poRect);
 }
 
 

Modified: sandbox/graphics/mapscript/swiginc/layer.i
===================================================================
--- sandbox/graphics/mapscript/swiginc/layer.i	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapscript/swiginc/layer.i	2009-06-07 08:31:18 UTC (rev 9091)
@@ -156,10 +156,15 @@
 
     int whichShapes(rectObj rect)
     {
-        /* 
-        ** We assume folks use this like a simple query so retrieve all items with each shape.
-        */
-        if(msLayerWhichItems(self, MS_TRUE, MS_FALSE, NULL) != MS_SUCCESS) return MS_FAILURE;
+        int oldconnectiontype = self->connectiontype;
+        self->connectiontype = MS_INLINE;
+
+        if(msLayerWhichItems(self, MS_TRUE, MS_FALSE, NULL) != MS_SUCCESS) {
+            self->connectiontype = oldconnectiontype;
+            return MS_FAILURE;
+        }
+        self->connectiontype = oldconnectiontype;
+
         return msLayerWhichShapes(self, rect);
     }	
 

Modified: sandbox/graphics/mapsde.c
===================================================================
--- sandbox/graphics/mapsde.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapsde.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -604,14 +604,23 @@
     
     SE_COLUMN_DEF *itemdefs;
     SE_SHAPE shapeval=0;
-    SE_BLOB_INFO blobval;
-    /* blobval = (SE_BLOB_INFO *) malloc(sizeof(SE_BLOB_INFO)); */
     msSDELayerInfo *sde;
 
+    SE_BLOB_INFO blobval;
+
+#ifdef SE_CLOB_TYPE
+    SE_CLOB_INFO clobval;
+#endif
+
+#ifdef SE_NCLOB_TYPE
+    SE_NCLOB_INFO nclobval;
+#endif
+
 #ifdef SE_NSTRING_TYPE
     SE_WCHAR* wide=NULL;
 #endif
 
+
     if(!msSDELayerIsOpen(layer)) {
         msSetError( MS_SDEERR, 
                     "SDE layer has not been opened.", 
@@ -775,6 +784,53 @@
             break;
             
 #endif
+
+#ifdef SE_CLOB_TYPE
+
+        case SE_CLOB_TYPE:
+            status = SE_stream_get_clob(sde->connPoolInfo->stream, (short) (i+1), &clobval);
+            if(status == SE_SUCCESS) {
+                shape->values[i] = (char *)malloc(sizeof(char)*clobval.clob_length);
+                shape->values[i] = memcpy(  shape->values[i],
+                                            clobval.clob_buffer, 
+                                            clobval.clob_length);
+                SE_clob_free(&clobval);
+            }
+            else if (status == SE_NULL_VALUE) {
+                shape->values[i] = strdup(MS_SDE_NULLSTRING);
+            }
+            else {
+                sde_error(  status,  
+                            "sdeGetRecord()", 
+                            "SE_stream_get_clob()");
+                return(MS_FAILURE);
+            }
+            break;    
+#endif
+
+#ifdef SE_CLOB_TYPE
+
+        case SE_NCLOB_TYPE:
+            status = SE_stream_get_nclob(sde->connPoolInfo->stream, (short) (i+1), &nclobval);
+            if(status == SE_SUCCESS) {
+                shape->values[i] = (char *)malloc(sizeof(char)*nclobval.nclob_length);
+                shape->values[i] = memcpy(  shape->values[i],
+                                            nclobval.nclob_buffer, 
+                                            nclobval.nclob_length);
+                SE_nclob_free(&nclobval);
+            }
+            else if (status == SE_NULL_VALUE) {
+                shape->values[i] = strdup(MS_SDE_NULLSTRING);
+            }
+            else {
+                sde_error(  status,  
+                            "sdeGetRecord()", 
+                            "SE_stream_get_nclob()");
+                return(MS_FAILURE);
+            }
+            break;    
+#endif
+
         case SE_BLOB_TYPE:
             status = SE_stream_get_blob(sde->connPoolInfo->stream, (short) (i+1), &blobval);
             if(status == SE_SUCCESS) {
@@ -794,6 +850,7 @@
                 return(MS_FAILURE);
             }
             break;
+            
         case SE_DATE_TYPE:
             status = SE_stream_get_date(sde->connPoolInfo->stream, (short)(i+1), &dateval);
             if(status == SE_SUCCESS) {

Modified: sandbox/graphics/mapserv.c
===================================================================
--- sandbox/graphics/mapserv.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapserv.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1493,7 +1493,7 @@
       }
 
       if((layerindex = msGetLayerIndex(mapserv->map, tokens[0])) == -1) {
-        msSetError(MS_WEBERR, "Icon layer=%s not found in mapfile.", "mapserv()", GET_LAYER(mapserv->map, layerindex)->name);
+        msSetError(MS_WEBERR, "Icon layer=%s not found in mapfile.", "mapserv()", tokens[0]);
         writeError();
       }
 

Modified: sandbox/graphics/mapserver.h
===================================================================
--- sandbox/graphics/mapserver.h	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/mapserver.h	2009-06-07 08:31:18 UTC (rev 9091)
@@ -144,6 +144,7 @@
 
 #define MS_TRUE 1 /* logical control variables */
 #define MS_FALSE 0
+#define MS_UNKNOWN -1
 #define MS_ON 1
 #define MS_OFF 0
 #define MS_DEFAULT 2
@@ -1776,7 +1777,7 @@
 MS_DLL_EXPORT int msImageTruetypePolyline(symbolSetObj *symbolset, gdImagePtr img, shapeObj *p, styleObj *style, double scalefactor);
 MS_DLL_EXPORT int msImageTruetypeArrow(symbolSetObj *symbolset, gdImagePtr img, shapeObj *p, styleObj *style, double scalefactor);
 
-MS_DLL_EXPORT void msFreeShape(shapeObj *shape); /* in mapprimative.c */
+MS_DLL_EXPORT void msFreeShape(shapeObj *shape); /* in mapprimitive.c */
 MS_DLL_EXPORT void msFreeLabelPathObj(labelPathObj *path);
 MS_DLL_EXPORT shapeObj *msShapeFromWKT(const char *string);
 MS_DLL_EXPORT char *msShapeToWKT(shapeObj *shape);
@@ -1802,6 +1803,7 @@
 MS_DLL_EXPORT int msAddLineDirectly(shapeObj *p, lineObj *new_line);
 MS_DLL_EXPORT int msAddPointToLine(lineObj *line, pointObj *point );
 MS_DLL_EXPORT double msGetPolygonArea(shapeObj *p);
+MS_DLL_EXPORT int msGetPolygonCentroid(shapeObj *p, pointObj *lp, double *miny, double *maxy);
 
 MS_DLL_EXPORT int msDrawRasterLayer(mapObj *map, layerObj *layer, imageObj *image); /* in mapraster.c */
 MS_DLL_EXPORT imageObj *msDrawReferenceMap(mapObj *map);
@@ -2055,6 +2057,9 @@
 /* ==================================================================== */
 /*      Prototypes for functions in maputil.c                           */
 /* ==================================================================== */
+
+MS_DLL_EXPORT int msExtentsOverlap(mapObj *map, layerObj *layer);
+
 /* For mappdf */
 MS_DLL_EXPORT int getRgbColor(mapObj *map,int i,int *r,int *g,int *b); /* maputil.c */
 MS_DLL_EXPORT int msBindLayerToShape(layerObj *layer, shapeObj *shape, int querymapMode);

Modified: sandbox/graphics/maptemplate.c
===================================================================
--- sandbox/graphics/maptemplate.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/maptemplate.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -1068,7 +1068,7 @@
     fclose(includeStream);
 
      /* find the end of the tag */
-    tagEnd = strchr(tagStart, ']');
+    tagEnd = findTagEnd(tagStart);
     tagEnd++;
 
     /* build the complete tag so we can do substitution */
@@ -1228,7 +1228,7 @@
     }
 
     /* find the end of the tag */
-    tagEnd = strchr(tagStart, ']');
+    tagEnd = findTagEnd(tagStart);
     tagEnd++;
 
     /* build the complete tag so we can do substitution */
@@ -1394,7 +1394,7 @@
     tagValue = msReplaceSubstring(tagValue, "$maxy", number);
 
      /* find the end of the tag */
-    tagEnd = strchr(tagStart, ']');
+    tagEnd = findTagEnd(tagStart);
     tagEnd++;
 
     /* build the complete tag so we can do substitution */

Modified: sandbox/graphics/maputil.c
===================================================================
--- sandbox/graphics/maputil.c	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/maputil.c	2009-06-07 08:31:18 UTC (rev 9091)
@@ -39,6 +39,7 @@
 #include "mapparser.h"
 #include "mapthread.h"
 #include "mapfile.h"
+#include "mapcopy.h"
 
 #ifdef _WIN32
 #include <fcntl.h>
@@ -1858,7 +1859,6 @@
     return MS_SUCCESS;
 }
 
-
 inline void msBufferInit(bufferObj *buffer) {
     buffer->data=NULL;
     buffer->size=0;
@@ -1891,3 +1891,62 @@
 void msFreeRasterBuffer(rasterBufferObj *b) {
     msFree(b->pixelbuffer);
 }
+
+/*
+** Issue #3043: Layer extent comparison short circuit.
+**
+** msExtentsOverlap()
+**
+** Returns MS_TRUE if map extent and layer extent overlap, 
+** MS_FALSE if they are disjoint, and MS_UNKNOWN if there is 
+** not enough info to calculate a deterministic answer.
+**
+*/
+int msExtentsOverlap(mapObj *map, layerObj *layer)
+{
+    rectObj map_extent;
+    rectObj layer_extent;
+    
+    /* No extent info? Nothing we can do, return MS_UNKNOWN. */
+    if( (map->extent.minx == -1) && (map->extent.miny == -1) && (map->extent.maxx == -1 ) && (map->extent.maxy == -1) ) return MS_UNKNOWN;
+    if( (layer->extent.minx == -1) && (layer->extent.miny == -1) && (layer->extent.maxx == -1 ) && (layer->extent.maxy == -1) ) return MS_UNKNOWN;
+        
+#ifdef USE_PROJ
+
+    /* No map projection? Let someone else sort this out. */
+    if( ! (map->projection.numargs > 0) ) 
+        return MS_UNKNOWN;
+
+    /* No layer projection? Perform naive comparison, because they are 
+    ** in the same projection. */
+    if( ! (layer->projection.numargs > 0) ) 
+        return msRectOverlap( &(map->extent), &(layer->extent) );
+    
+    /* We need to transform our rectangles for comparison, 
+    ** so we will work with copies and leave the originals intact. */
+    MS_COPYRECT(&map_extent, &(map->extent) );
+    MS_COPYRECT(&layer_extent, &(layer->extent) );
+
+    /* Transform map extents into geographics for comparison. */
+    if( msProjectRect(&(map->projection), &(map->latlon), &map_extent) )
+        return MS_UNKNOWN;
+        
+    /* Transform layer extents into geographics for comparison. */
+    if( msProjectRect(&(layer->projection), &(map->latlon), &layer_extent) )
+        return MS_UNKNOWN;
+
+    /* Simple case? Return simple answer. */
+    if ( map_extent.minx < map_extent.maxx && layer_extent.minx < layer_extent.maxx )
+        return msRectOverlap( &(map_extent), &(layer_extent) );
+        
+    /* Uh oh, one of the rects crosses the dateline!
+    ** Let someone else handle it. */
+    return MS_UNKNOWN;
+   
+#else
+    /* No proj? Naive comparison. */
+    if( msRectOverlap( &(map->extent), &(layer->extent) ) return MS_TRUE;
+    return MS_FALSE;
+#endif
+
+}

Modified: sandbox/graphics/renderers/agg/src/agg_font_freetype.cpp
===================================================================
--- sandbox/graphics/renderers/agg/src/agg_font_freetype.cpp	2009-06-06 23:17:10 UTC (rev 9090)
+++ sandbox/graphics/renderers/agg/src/agg_font_freetype.cpp	2009-06-07 08:31:18 UTC (rev 9091)
@@ -663,6 +663,15 @@
                     m_cur_face = 0;
                     m_name = 0;
                 }
+                if( FT_Select_Charmap(m_cur_face, FT_ENCODING_UNICODE) ) {
+                    if( FT_Select_Charmap(m_cur_face, FT_ENCODING_APPLE_ROMAN) ) {
+                        m_char_map = FT_ENCODING_NONE;
+                    } else {
+                        m_char_map = FT_ENCODING_APPLE_ROMAN;
+                    }
+                } else {
+                    m_char_map = FT_ENCODING_UNICODE;
+                }   
             }
 
 
@@ -903,7 +912,7 @@
         m_glyph_index = FT_Get_Char_Index(m_cur_face, glyph_code);
         m_last_error = FT_Load_Glyph(m_cur_face, 
                                      m_glyph_index, 
-                                     m_hinting ? FT_LOAD_DEFAULT : FT_LOAD_NO_HINTING);
+                                     m_hinting ? FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP : FT_LOAD_NO_HINTING|FT_LOAD_NO_BITMAP);
 //                                     m_hinting ? FT_LOAD_FORCE_AUTOHINT : FT_LOAD_NO_HINTING);
         if(m_last_error == 0)
         {



More information about the mapserver-commits mailing list