[mapserver-commits] r11521 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Apr 11 08:09:16 EDT 2011
Author: tbonfort
Date: 2011-04-11 05:09:16 -0700 (Mon, 11 Apr 2011)
New Revision: 11521
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapimageio.c
trunk/mapserver/mapkmlrenderer.cpp
trunk/mapserver/mapserver.h
trunk/mapserver/maputil.c
Log:
allow palette file path to be relative to mapfile (#2115)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-04-11 10:37:42 UTC (rev 11520)
+++ trunk/mapserver/HISTORY.TXT 2011-04-11 12:09:16 UTC (rev 11521)
@@ -15,6 +15,8 @@
Current Version (SVN trunk):
----------------------------
+- allow palette file path to be relative to mapfile (#2115)
+
- use supplied offset for brushed lines (#3825, #3792)
- fix division by 0 error in bar charts for some ill-defined cases (#3218)
Modified: trunk/mapserver/mapimageio.c
===================================================================
--- trunk/mapserver/mapimageio.c 2011-04-11 10:37:42 UTC (rev 11520)
+++ trunk/mapserver/mapimageio.c 2011-04-11 12:09:16 UTC (rev 11521)
@@ -119,7 +119,8 @@
}
-int saveAsJPEG(rasterBufferObj *rb, streamInfo *info, outputFormatObj *format) {
+int saveAsJPEG(mapObj *map /*not used*/, rasterBufferObj *rb, streamInfo *info,
+ outputFormatObj *format) {
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
int quality = atoi(msGetOutputFormatOption( format, "QUALITY", "75"));
@@ -349,7 +350,7 @@
return MS_SUCCESS;
}
-int saveAsPNG(rasterBufferObj *rb, streamInfo *info, outputFormatObj *format) {
+int saveAsPNG(mapObj *map,rasterBufferObj *rb, streamInfo *info, outputFormatObj *format) {
int force_pc256 = MS_FALSE;
int force_palette = MS_FALSE;
@@ -381,7 +382,11 @@
} else {
int colorsWanted = atoi(msGetOutputFormatOption( format, "QUANTIZE_COLORS", "0"));
const char *palettePath = msGetOutputFormatOption( format, "PALETTE", "palette.txt");
-
+ char szPath[MS_MAXPATHLEN];
+ if(map) {
+ msBuildPath(szPath, map->mappath, palettePath);
+ palettePath = szPath;
+ }
if(readPalette(palettePath,paletteGiven,&numPaletteGivenEntries,format->transparent) != MS_SUCCESS) {
return MS_FAILURE;
}
@@ -872,7 +877,7 @@
return MS_SUCCESS;
}
-int msSaveRasterBuffer(rasterBufferObj *rb, FILE *stream,
+int msSaveRasterBuffer(mapObj *map, rasterBufferObj *rb, FILE *stream,
outputFormatObj *format) {
if(rb->type == MS_BUFFER_GD) {
return saveGdImage(rb->data.gd_img, stream, format);
@@ -882,12 +887,12 @@
info.fp = stream;
info.buffer = NULL;
- return saveAsPNG(rb,&info,format);
+ return saveAsPNG(map, rb,&info,format);
} else if(strcasestr(format->driver,"/jpeg")) {
streamInfo info;
info.fp = stream;
info.buffer=NULL;
- return saveAsJPEG(rb,&info,format);
+ return saveAsJPEG(map, rb,&info,format);
} else {
msSetError(MS_MISCERR,"unsupported image format\n", "msSaveRasterBuffer()");
return MS_FAILURE;
@@ -903,12 +908,12 @@
streamInfo info;
info.fp = NULL;
info.buffer = buffer;
- return saveAsPNG(data,&info,format);
+ return saveAsPNG(NULL, data,&info,format);
} else if(strcasestr(format->driver,"/jpeg")) {
streamInfo info;
info.fp = NULL;
info.buffer=buffer;
- return saveAsJPEG(data,&info,format);
+ return saveAsJPEG(NULL, data,&info,format);
} else {
msSetError(MS_MISCERR,"unsupported image format\n", "msSaveRasterBuffer()");
return MS_FAILURE;
Modified: trunk/mapserver/mapkmlrenderer.cpp
===================================================================
--- trunk/mapserver/mapkmlrenderer.cpp 2011-04-11 10:37:42 UTC (rev 11520)
+++ trunk/mapserver/mapkmlrenderer.cpp 2011-04-11 12:09:16 UTC (rev 11521)
@@ -489,7 +489,7 @@
if (!aggFormat->vtable)
msInitializeRendererVTable(aggFormat);
- msSaveRasterBuffer(rb,tmpFile,aggFormat);
+ msSaveRasterBuffer(map,rb,tmpFile,aggFormat);
tmpUrl = msStrdup( image->imageurl);
tmpUrl = msStringConcatenate(tmpUrl, (char *)(msGetBasename(tmpFileName)));
tmpUrl = msStringConcatenate(tmpUrl, ".png");
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2011-04-11 10:37:42 UTC (rev 11520)
+++ trunk/mapserver/mapserver.h 2011-04-11 12:09:16 UTC (rev 11521)
@@ -2604,7 +2604,7 @@
/* in mapimageio.c */
int msQuantizeRasterBuffer(rasterBufferObj *rb, unsigned int *reqcolors, rgbaPixel *palette, rgbaPixel *forced_palette, int num_forced_palette_entries);
int msClassifyRasterBuffer(rasterBufferObj *rb, rasterBufferObj *qrb);
-int msSaveRasterBuffer(rasterBufferObj *data, FILE *stream, outputFormatObj *format);
+int msSaveRasterBuffer(mapObj *map, rasterBufferObj *data, FILE *stream, outputFormatObj *format);
int msSaveRasterBufferToBuffer(rasterBufferObj *data, bufferObj *buffer, outputFormatObj *format);
int msLoadMSRasterBufferFromFile(char *path, rasterBufferObj *rb);
int msLoadGDRasterBufferFromFile(char *path, rasterBufferObj *rb);
Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c 2011-04-11 10:37:42 UTC (rev 11520)
+++ trunk/mapserver/maputil.c 2011-04-11 12:09:16 UTC (rev 11521)
@@ -779,7 +779,7 @@
if(renderer->getRasterBufferHandle(img,&data) != MS_SUCCESS)
return MS_FAILURE;
- nReturnVal = msSaveRasterBuffer(&data,stream,img->format );
+ nReturnVal = msSaveRasterBuffer(map,&data,stream,img->format );
} else {
nReturnVal = renderer->saveImage(img, stream, img->format);
}
More information about the mapserver-commits
mailing list