[mapserver] 01/07: New upstream version 7.0.6

Bas Couwenberg sebastic at debian.org
Wed Jun 21 19:27:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mapserver.

commit 85b8750cd55f57f72e5f1c725178c1220bb4f74b
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Jun 21 20:53:49 2017 +0200

    New upstream version 7.0.6
---
 CMakeLists.txt |  2 +-
 maplabel.c     |  1 +
 mapmssql2008.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 mapogr.cpp     | 19 ++++++++++++-
 mapquery.c     |  4 ++-
 maprendering.c | 35 ++++++++++++++++++++++-
 mapresample.c  |  7 ++++-
 maputil.c      |  2 ++
 8 files changed, 149 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25bc2d1..d8373ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ include(CheckCSourceCompiles)
 
 set (MapServer_VERSION_MAJOR 7)
 set (MapServer_VERSION_MINOR 0)
-set (MapServer_VERSION_REVISION 5)
+set (MapServer_VERSION_REVISION 6)
 set (MapServer_VERSION_SUFFIX "")
 
 set(TARGET_VERSION_MAJOR ${MapServer_VERSION_MAJOR})
diff --git a/maplabel.c b/maplabel.c
index dffab3c..76be835 100644
--- a/maplabel.c
+++ b/maplabel.c
@@ -217,6 +217,7 @@ void msCopyTextPath(textPathObj *dst, textPathObj *src) {
   if(src->bounds.poly) {
     dst->bounds.poly = msSmallMalloc(sizeof(lineObj));
     dst->bounds.poly->numpoints = src->bounds.poly->numpoints;
+    dst->bounds.poly->point = msSmallMalloc(src->bounds.poly->numpoints * sizeof(pointObj));
     for(i=0; i<src->bounds.poly->numpoints; i++) {
       dst->bounds.poly->point[i] = src->bounds.poly->point[i];
     }
diff --git a/mapmssql2008.c b/mapmssql2008.c
index 9be58ba..7e95d21 100644
--- a/mapmssql2008.c
+++ b/mapmssql2008.c
@@ -2463,7 +2463,11 @@ int process_node(layerObj* layer, expressionObj *filter)
     case MS_TOKEN_BINDING_DOUBLE:
     case MS_TOKEN_BINDING_INTEGER:
     case MS_TOKEN_BINDING_STRING:
-      strtmpl = "%s";
+      if(layerinfo->current_node->next->token == MS_TOKEN_COMPARISON_IRE)
+        strtmpl = "LOWER(%s)";
+      else
+        strtmpl = "%s";
+
       stresc = msMSSQL2008LayerEscapePropertyName(layer, layerinfo->current_node->tokenval.bindval.item);
       snippet = (char *) msSmallMalloc(strlen(strtmpl) + strlen(stresc));
       sprintf(snippet, strtmpl, stresc);
@@ -2486,9 +2490,85 @@ int process_node(layerObj* layer, expressionObj *filter)
     case MS_TOKEN_COMPARISON_IN:
       filter->native_string = msStringConcatenate(filter->native_string, " IN ");
       break;
-    case MS_TOKEN_COMPARISON_LIKE:
-      filter->native_string = msStringConcatenate(filter->native_string, " LIKE ");
-      break;
+    case MS_TOKEN_COMPARISON_RE: 
+    case MS_TOKEN_COMPARISON_IRE: 
+    case MS_TOKEN_COMPARISON_LIKE: {
+      /* process regexp */
+      size_t i = 0, j = 0;
+      char c;
+      char c_next;
+      int bCaseInsensitive = (layerinfo->current_node->token == MS_TOKEN_COMPARISON_IRE);
+      int nEscapeLen = 0;
+      if (bCaseInsensitive)
+        filter->native_string = msStringConcatenate(filter->native_string, " LIKE LOWER(");
+      else
+        filter->native_string = msStringConcatenate(filter->native_string, " LIKE ");
+
+      layerinfo->current_node = layerinfo->current_node->next;
+      if (layerinfo->current_node->token != MS_TOKEN_LITERAL_STRING) return 0;
+
+      strtmpl = msStrdup(layerinfo->current_node->tokenval.strval);
+      if (strtmpl[0] == '/') {
+        stresc = strtmpl + 1;
+        strtmpl[strlen(strtmpl) - 1] = '\0';
+      }
+      else if (strtmpl[0] == '^')
+        stresc = strtmpl + 1;
+      else
+        stresc = strtmpl;
+
+      while (*stresc) {
+        c = stresc[i];
+        if (c == '%' || c == '_' || c == '[' || c == ']' || c == '^') {
+           nEscapeLen++;
+        }
+        stresc++;
+      }
+      snippet = (char *)msSmallMalloc(strlen(strtmpl) + nEscapeLen + 3);
+      snippet[j++] = '\'';
+      while (i < strlen(strtmpl)) {
+        c = strtmpl[i];
+        c_next = strtmpl[i+1];
+
+        if (i == 0 && c == '^') {
+          i++;
+          continue;
+        }
+
+        if (c == '\\') {
+          i++;
+          c = c_next;
+        }
+         
+        if (c == '%' || c == '_' || c == '[' || c == ']' || c == '^') {
+           snippet[j++] = '\\';
+        }
+        
+        if (c == '.' && c_next == '*') {
+          i++;
+          c = '%';
+        }
+        else if (c == '.')
+          c = '_';
+
+        
+        snippet[j++] = c;
+        i++;          
+      }
+      snippet[j++] = '\'';
+      snippet[j] = '\0';
+
+      filter->native_string = msStringConcatenate(filter->native_string, snippet);
+      msFree(strtmpl);
+      msFree(snippet);
+
+      if (bCaseInsensitive)
+        filter->native_string = msStringConcatenate(filter->native_string, ")");
+
+      if (nEscapeLen > 0)
+        filter->native_string = msStringConcatenate(filter->native_string, " ESCAPE '\\'");
+    }
+    break;
     case MS_TOKEN_COMPARISON_EQ:
       filter->native_string = msStringConcatenate(filter->native_string, " = ");
       break;
diff --git a/mapogr.cpp b/mapogr.cpp
index 5460c33..9bf0af6 100644
--- a/mapogr.cpp
+++ b/mapogr.cpp
@@ -2585,7 +2585,12 @@ static int msOGRFileWhichShapes(layerObj *layer, rectObj rect, msOGRFileInfo *ps
 
             CPLErrorReset();
             if( OGR_L_SetAttributeFilter( psInfo->hLayer, pszOGRFilter ) != OGRERR_NONE ) {
+                msSetError(MS_OGRERR, "SetAttributeFilter() failed on layer %s. Check logs.", "msOGRFileWhichShapes()", layer->name?layer->name:"(null)");
                 msDebug("SetAttributeFilter(%s) failed on layer %s.\n%s\n", pszOGRFilter, layer->name?layer->name:"(null)", CPLGetLastErrorMsg() );
+                RELEASE_OGR_LOCK;
+                msFree(pszOGRFilter);
+                msFree(select);
+                return MS_FAILURE;
             }
             msFree(pszOGRFilter);
         } else
@@ -3263,6 +3268,7 @@ static msExprNode* BuildExprTree(tokenListNodeObjPtr node,
         {
             if( node->next && node->next->token == '(' )
             {
+                int node_token = node->token;
                 msExprNode* subExpr = BuildExprTree(node->next->next, &node,
                                                     nParenthesisLevel + 1);
                 if( subExpr == NULL )
@@ -3270,7 +3276,7 @@ static msExprNode* BuildExprTree(tokenListNodeObjPtr node,
                     goto fail;
                 }
                 msExprNode* newNode = new msExprNode;
-                newNode->m_nToken = node->token;
+                newNode->m_nToken = node_token;
                 if( subExpr->m_nToken == 0 )
                 {
                     newNode->m_aoChildren = subExpr->m_aoChildren;
@@ -3388,6 +3394,8 @@ fail:
 
 /**********************************************************************
  *                 msOGRExtractTopSpatialFilter()
+ * 
+ * Recognize expressions like "Intersects([shape], wkt) == TRUE [AND ....]"
  **********************************************************************/
 static int  msOGRExtractTopSpatialFilter( msOGRFileInfo *info,
                                           const msExprNode* expr,
@@ -3396,6 +3404,15 @@ static int  msOGRExtractTopSpatialFilter( msOGRFileInfo *info,
   if( expr == NULL )
       return MS_FALSE;
 
+  if( expr->m_nToken == MS_TOKEN_COMPARISON_EQ &&
+      expr->m_aoChildren.size() == 2 &&
+      expr->m_aoChildren[1]->m_nToken == MS_TOKEN_LITERAL_BOOLEAN &&
+      expr->m_aoChildren[1]->m_dfVal == 1.0 )
+  {
+      return msOGRExtractTopSpatialFilter(info, expr->m_aoChildren[0],
+                                          pSpatialFilterNode);
+  }
+
   if( expr->m_nToken == MS_TOKEN_COMPARISON_INTERSECTS &&
       expr->m_aoChildren.size() == 2 &&
       expr->m_aoChildren[1]->m_nToken == MS_TOKEN_LITERAL_SHAPE )
diff --git a/mapquery.c b/mapquery.c
index df0b2ee..a076691 100644
--- a/mapquery.c
+++ b/mapquery.c
@@ -881,6 +881,7 @@ int msQueryByRect(mapObj *map)
   char status;
   shapeObj shape, searchshape;
   rectObj searchrect, searchrectInMapProj;
+  const rectObj invalid_rect = MS_INIT_INVALID_RECT;
   double layer_tolerance = 0, tolerance = 0;
 
   int paging;
@@ -982,7 +983,8 @@ int msQueryByRect(mapObj *map)
 
 #ifdef USE_PROJ
     lp->project = msProjectionsDiffer(&(lp->projection), &(map->projection));
-    if(lp->project)
+    if(lp->project &&
+       memcmp( &searchrect, &invalid_rect, sizeof(searchrect) ) != 0 )
       msProjectRect(&(map->projection), &(lp->projection), &searchrect); /* project the searchrect to source coords */
 #endif
 
diff --git a/maprendering.c b/maprendering.c
index 7ee3692..b32716c 100644
--- a/maprendering.c
+++ b/maprendering.c
@@ -996,6 +996,7 @@ int msDrawTextSymbol(mapObj *map, imageObj *image, pointObj labelPnt, textSymbol
   colorObj *c = NULL, *oc = NULL;
   int ow;
   assert(ts->textpath);
+  if(!renderer->renderGlyphs) return MS_FAILURE;
 
   if(!ts->textpath->absolute) {
     int g;
@@ -1019,12 +1020,44 @@ int msDrawTextSymbol(mapObj *map, imageObj *image, pointObj labelPnt, textSymbol
       }
     }
   }
+
+  if(MS_VALID_COLOR(ts->label->shadowcolor)) {
+    textSymbolObj *ts_shadow;
+    int g;
+    double ox, oy;
+    double cosa,sina;
+    if(ts->rotation != 0) {
+      cosa = cos(ts->rotation);
+      sina = sin(ts->rotation);
+      ox = ts->scalefactor * (cosa * ts->label->shadowsizex + 
+          sina * ts->label->shadowsizey);
+      oy = ts->scalefactor * (-sina * ts->label->shadowsizex + 
+          cosa * ts->label->shadowsizey);
+    }
+    else {
+      ox = ts->scalefactor * ts->label->shadowsizex;
+      oy = ts->scalefactor * ts->label->shadowsizey;
+    }
+
+    ts_shadow = msSmallMalloc(sizeof(textSymbolObj));
+    initTextSymbol(ts_shadow);
+    msCopyTextSymbol(ts_shadow,ts);
+
+    for(g=0;g<ts_shadow->textpath->numglyphs;g++) {
+      ts_shadow->textpath->glyphs[g].pnt.x += ox;
+      ts_shadow->textpath->glyphs[g].pnt.y += oy;
+    }
+
+    renderer->renderGlyphs(image,ts_shadow->textpath,&ts->label->shadowcolor,NULL,0);
+    freeTextSymbol(ts_shadow);
+    msFree(ts_shadow);
+  }
+
   if(MS_VALID_COLOR(ts->label->color))
     c = &ts->label->color;
   if(MS_VALID_COLOR(ts->label->outlinecolor))
     oc = &ts->label->outlinecolor;
   ow = MS_NINT((double)ts->label->outlinewidth * ((double)ts->textpath->glyph_size / (double)ts->label->size));
-  if(!renderer->renderGlyphs) return MS_FAILURE;
   return renderer->renderGlyphs(image,ts->textpath,c,oc,ow);
   
 }
diff --git a/mapresample.c b/mapresample.c
index b0fa1c1..1179ab4 100644
--- a/mapresample.c
+++ b/mapresample.c
@@ -1547,7 +1547,12 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
   /* matches the sSrcExtent, even if that generates non-square pixels (#1715) */
   /* The rotated case should ideally be dealt with, but not for now... */
   if( adfSrcGeoTransform[2] == 0 && adfSrcGeoTransform[4] == 0 &&
-      adfSrcGeoTransform[5] < 0 )
+      adfSrcGeoTransform[5] < 0 &&
+      /* But do that only if the pixels were square before, otherwise */
+      /* this is going to mess with source rasters whose pixels aren't at */
+      /* all square (#5445) */
+      fabs(fabs(adfSrcGeoTransform[1]) - fabs(adfSrcGeoTransform[5])) <
+                                        0.01 * fabs(adfSrcGeoTransform[1]) )
   {
       adfSrcGeoTransform[1] = (sSrcExtent.maxx - sSrcExtent.minx) *
                                             dfNominalCellSize / nLoadImgXSize;
diff --git a/maputil.c b/maputil.c
index 4c720d0..d6f23d2 100644
--- a/maputil.c
+++ b/maputil.c
@@ -1759,6 +1759,8 @@ shapeObj *msOffsetCurve(shapeObj *p, double offset)
    if that is the case.*/
   if(ret)
     return ret;
+  /* clear error raised by geos in this case */
+  msResetErrorList();
 #endif
   /*
   ** For offset corner point calculation 1/sin() is used

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapserver.git



More information about the Pkg-grass-devel mailing list