The following commit has been merged in the upstream branch: commit 93aca18800f640556dd484b27aea010071876b00 Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Thu Jan 2 16:08:10 2014 +0100
Imported Upstream version 6.4.1 diff --git a/.travis.yml b/.travis.yml index c31ed27..62781fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,9 +41,11 @@ compiler: before_install: - git submodule update --init --recursive + - sudo mv /etc/apt/sources.list.d/pgdg-source.list* /tmp + - sudo apt-get -qq remove postgis - sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable - sudo apt-get update -qq - - sudo apt-get install -qq bison flex swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-noxpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp + - sudo apt-get install -qq bison flex swig cmake librsvg2-dev colordiff postgis postgresql-9.1-postgis-2.0-scripts libpq-dev libpng12-dev libjpeg-dev libgif-dev libgeos-dev libgd2-xpm-dev libfreetype6-dev libfcgi-dev libcurl4-gnutls-dev libcairo2-dev libgdal1-dev libproj-dev libxml2-dev python-dev php5-dev libexempi-dev lcov lftp - sudo pip install git+git://github.com/tbonfort/cpp-coveralls.git@extensions - cd msautotest - ./create_postgis_test_data.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 268e05d..5837920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,16 +2,22 @@ cmake_minimum_required (VERSION 2.6) project (MapServer) +if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building: + mkdir build; cd build; cmake .. +Before that, remove the files created by this failed run: + rm -rf CMakeCache.txt CMakeFiles") +endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + include(CheckLibraryExists) include(CheckFunctionExists) include(CheckIncludeFile) include(CheckCSourceCompiles) - set (MapServer_VERSION_MAJOR 6) set (MapServer_VERSION_MINOR 4) -set (MapServer_VERSION_REVISION 0) +set (MapServer_VERSION_REVISION 1) set (MapServer_VERSION_SUFFIX "") set(TARGET_VERSION_MAJOR ${MapServer_VERSION_MAJOR}) @@ -142,7 +148,33 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wdeclaration-after-statement") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif() -SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(_LIBDIR_DEFAULT "lib") + # Override this default 'lib' with 'lib64' iff: + # - we are on Linux system but NOT cross-compiling + # - we are NOT on debian + # - we are on a 64 bits system + # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf + # Note that the future of multi-arch handling may be even + # more complicated than that: http://wiki.debian.org/Multiarch + if(CMAKE_SYSTEM_NAME MATCHES "Linux" + AND NOT CMAKE_CROSSCOMPILING + AND NOT EXISTS "/etc/debian_version") + if(NOT DEFINED CMAKE_SIZEOF_VOID_P) + message(AUTHOR_WARNING + "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " + "Please enable at least one language before including GNUInstallDirs.") + else() + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_LIBDIR_DEFAULT "lib64") + endif() + endif() + endif() + set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") +endif() + +SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) SET(CMAKE_MACOSX_RPATH ON) @@ -858,6 +890,7 @@ status_optional_feature("Apache Module (Experimental)" "${USE_APACHE_MODULE}") message(STATUS "") message(STATUS "Will install files to ${CMAKE_INSTALL_PREFIX}") +message(STATUS "Will install libraries to ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") include_directories("${PROJECT_BINARY_DIR}") @@ -870,23 +903,23 @@ endif(WIN32) #INSTALL(FILES mapserver-api.h ${PROJECT_BINARY_DIR}/mapserver-version.h DESTINATION include) if(USE_ORACLE_PLUGIN) - INSTALL(TARGETS msplugin_oracle DESTINATION lib) + INSTALL(TARGETS msplugin_oracle DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(USE_ORACLE_PLUGIN) if(USE_MSSQL2008) - INSTALL(TARGETS msplugin_mssql2008 DESTINATION lib) + INSTALL(TARGETS msplugin_mssql2008 DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(USE_MSSQL2008) if(USE_SDE91) - INSTALL(TARGETS msplugin_sde91 DESTINATION lib) + INSTALL(TARGETS msplugin_sde91 DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(USE_SDE91) if(USE_SDE92) - INSTALL(TARGETS msplugin_sde92 DESTINATION lib) + INSTALL(TARGETS msplugin_sde92 DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(USE_SDE92) -INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION lib) +INSTALL(TARGETS sortshp shptree shptreevis msencrypt legend scalebar tile4ms shptreetst shp2img mapserv mapserver RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(BUILD_STATIC) - INSTALL(TARGETS mapserver_static DESTINATION lib) + INSTALL(TARGETS mapserver_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(BUILD_STATIC) diff --git a/cmake/FindFreetype.cmake b/cmake/FindFreetype.cmake index edb142d..37ae220 100644 --- a/cmake/FindFreetype.cmake +++ b/cmake/FindFreetype.cmake @@ -44,7 +44,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h HINTS $ENV{FREETYPE_DIR} - PATH_SUFFIXES include + PATH_SUFFIXES include include/freetype2 PATHS /usr/local/X11R6/include /usr/local/X11/include @@ -54,7 +54,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h /usr/freeware/include ) -FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h +FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h config/ftheader.h HINTS $ENV{FREETYPE_DIR}/include/freetype2 PATHS @@ -64,7 +64,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h /sw/include /opt/local/include /usr/freeware/include - PATH_SUFFIXES freetype2 + PATH_SUFFIXES freetype freetype2 ) set(FREETYPE_NAMES ${FREETYPE_NAMES} freetype libfreetype freetype219 freetype239 freetype241MT_D freetype2411) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index 1b5de7e..3bbf824 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -13,9 +13,10 @@ ENDIF (MYSQL_INCLUDE_DIR) FIND_PATH(MYSQL_INCLUDE_DIR mysql.h /usr/local/include/mysql /usr/include/mysql + PATH_SUFFIXES mysql ) -SET(MYSQL_NAMES mysqlclient mysqlclient_r) +SET(MYSQL_NAMES mysqlclient mysqlclient_r libmysqlclient) FIND_LIBRARY(MYSQL_LIBRARY NAMES ${MYSQL_NAMES} PATHS /usr/lib /usr/local/lib diff --git a/cmake/FindPostgreSQL.cmake b/cmake/FindPostgreSQL.cmake index c30a3db..9ed6dd5 100644 --- a/cmake/FindPostgreSQL.cmake +++ b/cmake/FindPostgreSQL.cmake @@ -5,10 +5,24 @@ # POSTGRESQL_LIBRARY, the libraries needed to use POSTGRESQL. # POSTGRESQL_FOUND, If false, do not try to use PostgreSQL. # -# Copyright (c) 2013 Thomas Bonfort +# Copyright (c) 2013 Thomas Bonfort, Andy Colson # +find_program(PG_CONFIG NAMES pg_config + PATHS + $ENV{ProgramFiles}/PostgreSQL/*/bin + $ENV{SystemDrive}/PostgreSQL/*/bin +) + +if (PG_CONFIG) + exec_program( ${PG_CONFIG} ARGS "--includedir" OUTPUT_VARIABLE PG_INC_PATH ) + exec_program( ${PG_CONFIG} ARGS "--libdir" OUTPUT_VARIABLE PG_LIB_PATH ) +else() + message(WARNING "pg_config not found, will try some defaults") +endif() + find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h + ${PG_INC_PATH} /usr/include/server /usr/include/postgresql /usr/include/pgsql/server @@ -23,6 +37,7 @@ find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h find_library(POSTGRESQL_LIBRARY NAMES pq libpq PATHS + ${PG_LIB_PATH} /usr/lib /usr/local/lib /usr/lib/postgresql diff --git a/hittest.c b/hittest.c index 6fdeaae..4c4b0a0 100644 --- a/hittest.c +++ b/hittest.c @@ -138,6 +138,9 @@ int msHitTestShape(mapObj *map, layerObj *layer, shapeObj *shape, int drawmode, int msHitTestLayer(mapObj *map, layerObj *layer, layer_hittest *hittest) { int status; +#ifdef USE_GEOS + shapeObj searchpoly; +#endif if(!msLayerIsVisible(map,layer)) { hittest->status = 0; return MS_SUCCESS; @@ -179,6 +182,10 @@ int msHitTestLayer(mapObj *map, layerObj *layer, layer_hittest *hittest) { searchrect.maxx = map->width-1; searchrect.maxy = map->height-1; } +#ifdef USE_GEOS + msInitShape(&searchpoly); + msRectToPolygon(searchrect,&searchpoly); +#endif status = msLayerWhichShapes(layer, searchrect, MS_FALSE); if(status == MS_DONE) { /* no overlap */ @@ -203,6 +210,12 @@ int msHitTestLayer(mapObj *map, layerObj *layer, layer_hittest *hittest) { while((status = msLayerNextShape(layer, &shape)) == MS_SUCCESS) { int drawmode = MS_DRAWMODE_FEATURES; +#ifdef USE_GEOS + if(!msGEOSIntersects(&shape,&searchpoly)) { + msFreeShape(&shape); + continue; + } +#else if(shape.type == MS_SHAPE_POLYGON) { msClipPolygonRect(&shape, map->extent); } else { @@ -212,6 +225,7 @@ int msHitTestLayer(mapObj *map, layerObj *layer, layer_hittest *hittest) { msFreeShape(&shape); continue; } +#endif /* Check if the shape size is ok to be drawn, we need to clip */ if((shape.type == MS_SHAPE_LINE || shape.type == MS_SHAPE_POLYGON) && (minfeaturesize > 0)) { msTransformShape(&shape, map->extent, map->cellsize, NULL); @@ -262,6 +276,11 @@ int msHitTestLayer(mapObj *map, layerObj *layer, layer_hittest *hittest) { } int msHitTestMap(mapObj *map, map_hittest *hittest) { int i,status; + map->cellsize = msAdjustExtent(&(map->extent),map->width,map->height); + status = msCalculateScale(map->extent,map->units,map->width,map->height, map->resolution, &map->scaledenom); + if(status != MS_SUCCESS) { + return MS_FAILURE; + } for(i=0; i<map->numlayers; i++) { layerObj *lp = map->layers[i]; status = msHitTestLayer(map,lp,&hittest->layerhits[i]); diff --git a/mapfile.c b/mapfile.c index 1389d49..6e0ae01 100644 --- a/mapfile.c +++ b/mapfile.c @@ -665,9 +665,9 @@ static void writeColor(FILE *stream, int indent, const char *name, colorObj *def sprintf(buffer+4, "%02x", color->blue); sprintf(buffer+6, "%02x", color->alpha); *(buffer+8) = 0; - fprintf(stream, "%s \"#%s\"\n", name, buffer); + msIO_fprintf(stream, "%s \"#%s\"\n", name, buffer); } else { - fprintf(stream, "%s %d %d %d\n", name, color->red, color->green, color->blue); + msIO_fprintf(stream, "%s %d %d %d\n", name, color->red, color->green, color->blue); } #endif } diff --git a/maplabel.c b/maplabel.c index cf97176..dbda6d6 100644 --- a/maplabel.c +++ b/maplabel.c @@ -351,25 +351,28 @@ int msAddLabelGroup(mapObj *map, int layerindex, int classindex, shapeObj *shape MS_IMAGE_RENDERER(maskLayer->maskimage)->getRasterBufferHandle(maskLayer->maskimage,&rb); x = MS_NINT(point->x); y = MS_NINT(point->y); + /* Using label repeatdistance, we might have a point with x/y below 0. See #4764 */ + if (x >= 0 && x < rb.width && y >= 0 && y < rb.height) { #ifdef USE_GD - if(rb.type == MS_BUFFER_BYTE_RGBA) { + if(rb.type == MS_BUFFER_BYTE_RGBA) { + alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x; + if(!*alphapixptr) { + /* label point does not intersect mask */ + return MS_SUCCESS; + } + } else { + if(!gdImageGetPixel(rb.data.gd_img,x,y)) + return MS_SUCCESS; + } +#else + assert(rb.type == MS_BUFFER_BYTE_RGBA); alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x; if(!*alphapixptr) { /* label point does not intersect mask */ return MS_SUCCESS; } - } else { - if(!gdImageGetPixel(rb.data.gd_img,x,y)) - return MS_SUCCESS; - } -#else - assert(rb.type == MS_BUFFER_BYTE_RGBA); - alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x; - if(!*alphapixptr) { - /* label point does not intersect mask */ - return MS_SUCCESS; - } #endif + } } else { msSetError(MS_MISCERR, "Layer (%s) references references a mask layer, but the selected renderer does not support them", "msAddLabelGroup()", layerPtr->name); return (MS_FAILURE); @@ -543,54 +546,60 @@ int msAddLabel(mapObj *map, labelObj *label, int layerindex, int classindex, sha if (point) { int x = MS_NINT(point->x); int y = MS_NINT(point->y); + /* Using label repeatdistance, we might have a point with x/y below 0. See #4764 */ + if (x >= 0 && x < rb.width && y >= 0 && y < rb.height) { #ifdef USE_GD - if(rb.type == MS_BUFFER_BYTE_RGBA) { + if(rb.type == MS_BUFFER_BYTE_RGBA) { + alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x; + if(!*alphapixptr) { + /* label point does not intersect mask */ + return MS_SUCCESS; + } + } else { + if(!gdImageGetPixel(rb.data.gd_img,x,y)) { + return MS_SUCCESS; + } + } +#else + assert(rb.type == MS_BUFFER_BYTE_RGBA); alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x; if(!*alphapixptr) { /* label point does not intersect mask */ return MS_SUCCESS; } - } else { - if(!gdImageGetPixel(rb.data.gd_img,x,y)) { - return MS_SUCCESS; - } - } -#else - assert(rb.type == MS_BUFFER_BYTE_RGBA); - alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x; - if(!*alphapixptr) { - /* label point does not intersect mask */ - return MS_SUCCESS; - } #endif + } } else if (labelpath) { int i = 0; for (i = 0; i < labelpath->path.numpoints; i++) { int x = MS_NINT(labelpath->path.point[i].x); int y = MS_NINT(labelpath->path.point[i].y); + /* Using label repeatdistance, we might have a point with x/y below 0. See #4764 */ + if (x >= 0 && x < rb.width && y >= 0 && y < rb.height) { #ifdef USE_GD - if (rb.type == MS_BUFFER_BYTE_RGBA) { + if (rb.type == MS_BUFFER_BYTE_RGBA) { + alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x; + if (!*alphapixptr) { + /* label point does not intersect mask */ + msFreeLabelPathObj(labelpath); + return MS_SUCCESS; + } + } else { + if (!gdImageGetPixel(rb.data.gd_img, x, y)) { + msFreeLabelPathObj(labelpath); + return MS_SUCCESS; + } + } +#else + assert(rb.type == MS_BUFFER_BYTE_RGBA); alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x; if (!*alphapixptr) { /* label point does not intersect mask */ msFreeLabelPathObj(labelpath); return MS_SUCCESS; } - } else { - if (!gdImageGetPixel(rb.data.gd_img, x, y)) { - msFreeLabelPathObj(labelpath); - return MS_SUCCESS; - } - } -#else - assert(rb.type == MS_BUFFER_BYTE_RGBA); - alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x; - if (!*alphapixptr) { - /* label point does not intersect mask */ - msFreeLabelPathObj(labelpath); - return MS_SUCCESS; - } #endif + } } } } else { diff --git a/maplegend.c b/maplegend.c index cad44f8..d8b82f7 100644 --- a/maplegend.c +++ b/maplegend.c @@ -119,6 +119,7 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass, } /* initialize the box used for polygons and for outlines */ + msInitShape(&box); box.line = (lineObj *)msSmallMalloc(sizeof(lineObj)); box.numlines = 1; box.line[0].point = (pointObj *)msSmallMalloc(sizeof(pointObj)*5); @@ -200,7 +201,6 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass, int symbolNum; styleObj imgStyle; symbolObj *symbol=NULL; - for(symbolNum=0; symbolNum<theclass->numstyles; symbolNum++) symbolNum = msAddImageSymbol(&(map->symbolset), msBuildPath(szPath, map->mappath, theclass->keyimage)); if(symbolNum == -1) { msSetError(MS_GDERR, "Failed to open legend key image", "msCreateLegendIcon()"); @@ -244,6 +244,7 @@ int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *theclass, else offset = theclass->styles[0]->width/2; } + msInitShape(&zigzag); zigzag.line = (lineObj *)msSmallMalloc(sizeof(lineObj)); zigzag.numlines = 1; zigzag.line[0].point = (pointObj *)msSmallMalloc(sizeof(pointObj)*4); diff --git a/mapogcsld.c b/mapogcsld.c index 1152c7c..9f019e2 100644 --- a/mapogcsld.c +++ b/mapogcsld.c @@ -1128,7 +1128,7 @@ int msSLDParseLineSymbolizer(CPLXMLNode *psRoot, layerObj *psLayer, psOffset = CPLGetXMLNode(psRoot, "PerpendicularOffset"); if (psOffset && psOffset->psChild && psOffset->psChild->pszValue) { psLayer->class[nClassId]->styles[iStyle]->offsetx = atoi(psOffset->psChild->pszValue); - psLayer->class[nClassId]->styles[iStyle]->offsety = psLayer->class[nClassId]->styles[iStyle]->offsetx; + psLayer->class[nClassId]->styles[iStyle]->offsety = MS_STYLE_SINGLE_SIDED_OFFSET; } } @@ -3030,7 +3030,7 @@ int ParseTextLinePlacement(CPLXMLNode *psRoot, classObj *psClass) psOffset = CPLGetXMLNode(psRoot, "PerpendicularOffset"); if (psOffset && psOffset->psChild && psOffset->psChild->pszValue) { psLabelObj->offsetx = atoi(psOffset->psChild->pszValue); - psLabelObj->offsety = atoi(psOffset->psChild->pszValue); + psLabelObj->offsety = MS_LABEL_PERPENDICULAR_OFFSET; /*if there is a PerpendicularOffset, we will assume that the best setting for mapserver would be to use angle=0 and the @@ -3039,6 +3039,7 @@ int ParseTextLinePlacement(CPLXMLNode *psRoot, classObj *psClass) set the angles if the parameter is not set*/ if (!psAligned) { psLabelObj->anglemode = MS_NONE; + psLabelObj->offsety = psLabelObj->offsetx; } } diff --git a/mappostgis.c b/mappostgis.c index 0631b79..bfee929 100644 --- a/mappostgis.c +++ b/mappostgis.c @@ -106,6 +106,7 @@ msPostGISLayerInfo *msPostGISCreateLayerInfo(void) layerinfo->rownum = 0; layerinfo->version = 0; layerinfo->paging = MS_TRUE; + layerinfo->force2d = MS_TRUE; return layerinfo; } @@ -1651,13 +1652,20 @@ char *msPostGISBuildSQLItems(layerObj *layer) ** which includes a 2D force in it) removes ordinates we don't ** need, saving transfer and encode/decode time. */ + char *force2d = ""; #if TRANSFER_ENCODING == 64 - static char *strGeomTemplate = "encode(ST_AsBinary(ST_Force_2D(\"%s\"),'%s'),'base64') as geom,\"%s\""; + static char *strGeomTemplate = "encode(ST_AsBinary(%s(\"%s\"),'%s'),'base64') as geom,\"%s\""; #else - static char *strGeomTemplate = "encode(ST_AsBinary(ST_Force_2D(\"%s\"),'%s'),'hex') as geom,\"%s\""; + static char *strGeomTemplate = "encode(ST_AsBinary(%s(\"%s\"),'%s'),'hex') as geom,\"%s\""; #endif - strGeom = (char*)msSmallMalloc(strlen(strGeomTemplate) + strlen(strEndian) + strlen(layerinfo->geomcolumn) + strlen(layerinfo->uid)); - sprintf(strGeom, strGeomTemplate, layerinfo->geomcolumn, strEndian, layerinfo->uid); + if( layerinfo->force2d ) { + if( layerinfo->version >= 20100 ) + force2d = "ST_Force2D"; + else + force2d = "ST_Force_2D"; + } + strGeom = (char*)msSmallMalloc(strlen(strGeomTemplate) + strlen(force2d) + strlen(strEndian) + strlen(layerinfo->geomcolumn) + strlen(layerinfo->uid)); + sprintf(strGeom, strGeomTemplate, force2d, layerinfo->geomcolumn, strEndian, layerinfo->uid); } if( layer->debug > 1 ) { @@ -2220,6 +2228,7 @@ int msPostGISLayerOpen(layerObj *layer) #ifdef USE_POSTGIS msPostGISLayerInfo *layerinfo; int order_test = 1; + const char* force2d_processing; assert(layer != NULL); @@ -2328,6 +2337,13 @@ int msPostGISLayerOpen(layerObj *layer) if (layer->debug) msDebug("msPostGISLayerOpen: Got PostGIS version %d.\n", layerinfo->version); + force2d_processing = msLayerGetProcessingKey( layer, "FORCE2D" ); + if(force2d_processing && !strcasecmp(force2d_processing,"no")) { + layerinfo->force2d = MS_FALSE; + } + if (layer->debug) + msDebug("msPostGISLayerOpen: Forcing 2D geometries: %s.\n", (layerinfo->force2d)?"yes":"no"); + /* Save the layerinfo in the layerObj. */ layer->layerinfo = (void*)layerinfo; @@ -3212,6 +3228,11 @@ int msPostGISLayerSetTimeFilter(layerObj *lp, const char *timestring, const char if (!lp || !timestring || !timefield) return MS_FALSE; + if( strchr(timestring,'\'') || strchr(timestring, '\\') ) { + msSetError(MS_MISCERR, "Invalid time filter.", "msPostGISLayerSetTimeFilter()"); + return MS_FALSE; + } + /* discrete time */ if (strstr(timestring, ",") == NULL && strstr(timestring, "/") == NULL) { /* discrete time */ diff --git a/mappostgis.h b/mappostgis.h index 4d3ced6..6ecd56a 100644 --- a/mappostgis.h +++ b/mappostgis.h @@ -64,6 +64,7 @@ typedef struct { int endian; /* Endianness of the mapserver host */ int version; /* PostGIS version of the database */ int paging; /* Driver handling of pagination, enabled by default */ + int force2d; /* Pass geometry through ST_Force2D */ } msPostGISLayerInfo; diff --git a/mapprimitive.c b/mapprimitive.c index b90962d..9a02589 100644 --- a/mapprimitive.c +++ b/mapprimitive.c @@ -1754,14 +1754,14 @@ labelPathObj** msPolylineLabelPath(mapObj *map, imageObj *img,shapeObj *p, int m labelpaths = (labelPathObj **) msSmallMalloc(sizeof(labelPathObj *) * labelpaths_size); (*regular_lines) = (int *) msSmallMalloc(sizeof(int) * regular_lines_size); - if(label->offsetx != 0 && (label->offsety == -99 || label->offsety == 99)) { + if(label->offsetx != 0 && IS_PERPENDICULAR_OFFSET(label->offsety)) { double offset; if(label->offsetx > 0) { offset = label->offsetx + label->size/2; } else { offset = label->offsetx - label->size/2; } - if(label->offsety == 99 && p->numlines>0 && p->line[0].numpoints > 0) { + if(label->offsety == MS_LABEL_PERPENDICULAR_TOP_OFFSET && p->numlines>0 && p->line[0].numpoints > 0) { /* is the line mostly left-to-right or right-to-left ? * FIXME this should be done line by line, by stepping through shape->lines, however * the OffsetPolyline function works on shapeObjs, not lineObjs @@ -1799,7 +1799,7 @@ labelPathObj** msPolylineLabelPath(mapObj *map, imageObj *img,shapeObj *p, int m /* set the number of paths in the array */ *numpaths = labelpaths_index; *num_regular_lines = regular_lines_index; - if(label->offsety == -99 && label->offsetx != 0) { + if(IS_PERPENDICULAR_OFFSET(label->offsety) && label->offsetx != 0) { msFreeShape(p); msFree(p); } diff --git a/maprasterquery.c b/maprasterquery.c index 4075c08..17f039a 100644 --- a/maprasterquery.c +++ b/maprasterquery.c @@ -666,7 +666,7 @@ int msRasterQueryByRect(mapObj *map, layerObj *layer, rectObj queryRect) int tileitemindex=-1, tilelayerindex=-1, tilesrsindex=-1; shapeObj tshp; char tilename[MS_PATH_LENGTH], tilesrsname[1024]; - int done; + int done, destroy_on_failure; char szPath[MS_MAXPATHLEN]; rectObj searchrect; @@ -675,7 +675,12 @@ int msRasterQueryByRect(mapObj *map, layerObj *layer, rectObj queryRect) /* -------------------------------------------------------------------- */ /* Get the layer info. */ /* -------------------------------------------------------------------- */ - msRasterLayerInfoInitialize( layer ); + if(!layer->layerinfo) { + msRasterLayerInfoInitialize( layer ); + destroy_on_failure = 1; + } else { + destroy_on_failure = 0; + } rlinfo = (rasterLayerInfo *) layer->layerinfo; /* -------------------------------------------------------------------- */ @@ -849,12 +854,14 @@ cleanup: /* On failure, or empty result set, cleanup the rlinfo since we */ /* likely won't ever have it accessed or cleaned up later. */ /* -------------------------------------------------------------------- */ - if( status == MS_FAILURE || rlinfo->query_results == 0 ) - msRasterLayerInfoFree( layer ); - - /* populate the items/numitems layer-level values */ - if( layer->layerinfo != NULL ) + if( status == MS_FAILURE || rlinfo->query_results == 0 ) { + if(destroy_on_failure) { + msRasterLayerInfoFree( layer ); + } + } else { + /* populate the items/numitems layer-level values */ msRASTERLayerGetItems(layer); + } return status; #endif /* def USE_GDAL */ diff --git a/mapresample.c b/mapresample.c index 1a47feb..419d07b 100644 --- a/mapresample.c +++ b/mapresample.c @@ -1253,12 +1253,20 @@ int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image, resampleMode = "NEAREST"; if(layer->mask) { - int ret; - layerObj *maskLayer = GET_LAYER(map, msGetLayerIndex(map,layer->mask)); + int ret, maskLayerIdx; + layerObj *maskLayer; + maskLayerIdx = msGetLayerIndex(map,layer->mask); + if(maskLayerIdx == -1) { + msSetError(MS_MISCERR, "Invalid mask layer specified", "msResampleGDALToMap()"); + return -1; + } + maskLayer = GET_LAYER(map, maskLayerIdx); mask_rb = msSmallCalloc(1,sizeof(rasterBufferObj)); ret = MS_IMAGE_RENDERER(maskLayer->maskimage)->getRasterBufferHandle(maskLayer->maskimage,mask_rb); - if(ret != MS_SUCCESS) + if(ret != MS_SUCCESS) { + free(mask_rb); return -1; + } } /* -------------------------------------------------------------------- */ diff --git a/mapscript/csharp/CMakeLists.txt b/mapscript/csharp/CMakeLists.txt index 079a0c1..a1f03bb 100644 --- a/mapscript/csharp/CMakeLists.txt +++ b/mapscript/csharp/CMakeLists.txt @@ -16,6 +16,7 @@ if (WIN32) else(CMAKE_CL_64) set(PLATFORM_TARGET /platform:x86) endif(CMAKE_CL_64) + set (KEYFILE_SPEC /keyfile:${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\mapscript.snk) endif (NOT MSVC71) if (MSVC10) set(PLATFORM_TARGET ${PLATFORM_TARGET} /define:CLR4) @@ -35,19 +36,21 @@ set_target_properties(csharpmapscript PROPERTIES OUTPUT_NAME "mapscript") SWIG_LINK_LIBRARIES(csharpmapscript ${MAPSERVER_LIBMAPSERVER}) + ADD_CUSTOM_COMMAND(TARGET csharpmapscript WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} POST_BUILD - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /t:library /out:mapscript_csharp.dll *.cs config\\AssemblyInfo.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:shpdump.exe examples\\shpdump.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:drawmap.exe examples\\drawmap.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:shapeinfo.exe examples\\shapeinfo.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:drawquery.exe examples\\drawquery.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /r:System.Drawing.dll /out:getbytes.exe examples\\getbytes.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:HTMLtemplate.exe examples\\HTMLtemplate.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:RFC24.exe examples\\RFC24.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /r:System.Drawing.dll /out:drawmapDirect.exe examples\\drawmapDirect.cs - COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /r:System.Drawing.dll /out:drawmapDirectPrint.exe examples\\drawmapDirectPrint.cs + COMMAND copy /Y ..\\..\\..\\mapscript\\csharp\\mapscript.snk + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /t:library /out:mapscript_csharp.dll ${KEYFILE_SPEC} *.cs ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\config\\AssemblyInfo.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:shpdump.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\shpdump.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:drawmap.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\drawmap.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:shapeinfo.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\shapeinfo.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:drawquery.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\drawquery.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /r:System.Drawing.dll /out:getbytes.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\getbytes.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:HTMLtemplate.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\HTMLtemplate.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /out:RFC24.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\RFC24.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /r:System.Drawing.dll /out:drawmapDirect.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\drawmapDirect.cs + COMMAND ${CSHARP_COMPILER} ${PLATFORM_TARGET} /r:mapscript_csharp.dll /r:System.Drawing.dll /out:drawmapDirectPrint.exe ${PROJECT_SOURCE_DIR}\\mapscript\\csharp\\examples\\drawmapDirectPrint.cs COMMENT "Compiling c# source files" ) diff --git a/mapscript/java/CMakeLists.txt b/mapscript/java/CMakeLists.txt index dea06c3..9987d42 100644 --- a/mapscript/java/CMakeLists.txt +++ b/mapscript/java/CMakeLists.txt @@ -26,5 +26,5 @@ ADD_CUSTOM_COMMAND(TARGET javamapscript ) get_target_property(LOC_MAPSCRIPT_LIB ${SWIG_MODULE_javamapscript_REAL_NAME} LOCATION) -install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION lib) +install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/mapscript/ruby/CMakeLists.txt b/mapscript/ruby/CMakeLists.txt index 95f5982..9fbfe6b 100644 --- a/mapscript/ruby/CMakeLists.txt +++ b/mapscript/ruby/CMakeLists.txt @@ -11,7 +11,10 @@ SWIG_LINK_LIBRARIES(rubymapscript ${RUBY_LIBRARY} ${MAPSERVER_LIBMAPSERVER}) set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES PREFIX "") set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES OUTPUT_NAME mapscript) +if(APPLE) + set_target_properties(${SWIG_MODULE_rubymapscript_REAL_NAME} PROPERTIES SUFFIX ".bundle") +endif(APPLE) get_target_property(LOC_MAPSCRIPT_LIB ${SWIG_MODULE_rubymapscript_REAL_NAME} LOCATION) -execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG['archdir']" OUTPUT_VARIABLE RUBY_ARCHDIR OUTPUT_STRIP_TRAILING_WHITESPACE) -install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION ${RUBY_ARCHDIR}) +execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG['sitearchdir']" OUTPUT_VARIABLE RUBY_SITEARCHDIR OUTPUT_STRIP_TRAILING_WHITESPACE) +install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION ${RUBY_SITEARCHDIR}) diff --git a/mapserver.h b/mapserver.h index e6a9d8e..9267b40 100644 --- a/mapserver.h +++ b/mapserver.h @@ -946,7 +946,7 @@ extern "C" { #define MS_STYLE_SINGLE_SIDED_OFFSET -99 #define MS_STYLE_DOUBLE_SIDED_OFFSET -999 -#define IS_PARALLEL_OFFSET(offsety) (offsety == MS_STYLE_SINGLE_SIDED_OFFSET || offsety == MS_STYLE_DOUBLE_SIDED_OFFSET) +#define IS_PARALLEL_OFFSET(offsety) ((offsety) == MS_STYLE_SINGLE_SIDED_OFFSET || (offsety) == MS_STYLE_DOUBLE_SIDED_OFFSET) @@ -1061,6 +1061,11 @@ extern "C" { labelLeaderObj leader; }; +#define MS_LABEL_PERPENDICULAR_OFFSET -99 +#define MS_LABEL_PERPENDICULAR_TOP_OFFSET 99 +#define IS_PERPENDICULAR_OFFSET(offsety) ((offsety) == MS_LABEL_PERPENDICULAR_OFFSET || (offsety) == MS_LABEL_PERPENDICULAR_TOP_OFFSET) + + /************************************************************************/ /* classObj */ /* */ diff --git a/maputil.c b/maputil.c index 8cce4e7..ef0d309 100644 --- a/maputil.c +++ b/maputil.c @@ -695,7 +695,7 @@ int msShapeGetAnnotation(layerObj *layer, shapeObj *shape) continue; /* next label */ } } - if(msEvalExpression(layer, shape, &(lbl->expression), -1) != MS_TRUE) { + if(msEvalExpression(layer, shape, &(lbl->expression), layer->labelitemindex) != MS_TRUE) { lbl->status = MS_OFF; continue; /* next label */ } @@ -1602,7 +1602,7 @@ imageObj *msImageCreate(int width, int height, outputFormatObj *format, for( ; i > 0; ) image->img.raw_16bit[--i] = nv; } else if( format->imagemode == MS_IMAGEMODE_FLOAT32 ) { - float nv = atoi(nullvalue); + float nv = atof(nullvalue); for( ; i > 0; ) image->img.raw_float[--i] = nv; } else if( format->imagemode == MS_IMAGEMODE_BYTE ) { diff --git a/mapuvraster.c b/mapuvraster.c index 471fefc..dc7e8c2 100644 --- a/mapuvraster.c +++ b/mapuvraster.c @@ -338,7 +338,7 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) double map_cellsize; unsigned int spacing; int width, height, u_src_off, v_src_off, i, x, y; - char **alteredProcessing = NULL; + char **alteredProcessing = NULL, *saved_layer_mask; char **savedProcessing = NULL; /* @@ -446,11 +446,21 @@ int msUVRASTERLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) layer->processing = alteredProcessing; } + /* disable masking at this level: we don't want to apply the mask at the raster level, + * it will be applied with the correct cellsize and image size in the vector rendering + * phase. + */ + saved_layer_mask = layer->mask; + layer->mask = NULL; if (msDrawRasterLayerLow(map_tmp, layer, image_tmp, NULL ) == MS_FAILURE) { msSetError(MS_MISCERR, "Unable to draw raster data.", "msUVRASTERLayerWhichShapes()"); + layer->mask = saved_layer_mask; return MS_FAILURE; } + /* restore layer mask */ + layer->mask = saved_layer_mask; + /* restore the saved processing */ if (alteredProcessing != NULL) { layer->processing = savedProcessing; diff --git a/mapwfs.c b/mapwfs.c index 8fc30bc..a1c726a 100644 --- a/mapwfs.c +++ b/mapwfs.c @@ -938,7 +938,20 @@ static void msWFSWriteItemElement(FILE *stream, gmlItemObj *item, const char *ta element_name = item->name; if(item->type) - element_type = item->type; + { + /* Map from MapServer types to XSD types */ + if( strcasecmp(item->type,"Integer") == 0 ) + element_type = "integer"; + else if( EQUAL(item->type,"Real") || + EQUAL(item->type,"double") /* just in case someone provided the xsd type directly */ ) + element_type = "double"; + else if( EQUAL(item->type,"Character") ) + element_type = "string"; + else if( EQUAL(item->type,"Date") ) + element_type = "date"; + else if( EQUAL(item->type,"Boolean") ) + element_type = "boolean"; + } msIO_fprintf(stream, "%s<element name=\"%s\" type=\"%s\"/>\n", tab, element_name, element_type); -- Packaging for MapServer _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel