[mapserver-commits] r11167 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Mar 16 09:43:29 EDT 2011


Author: warmerdam
Date: 2011-03-16 06:43:29 -0700 (Wed, 16 Mar 2011)
New Revision: 11167

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapdrawgdal.c
Log:
support style level opacity for raster classification

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-03-15 21:08:49 UTC (rev 11166)
+++ trunk/mapserver/HISTORY.TXT	2011-03-16 13:43:29 UTC (rev 11167)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Added raster classification support for STYLE level OPACITY.
+
 - Allow attribute references, that is [itemname], within a TEXT string (#3736)
 
 - Fixed segmentation fault when parsing invalid extent arguments in shp2img (#3734)

Modified: trunk/mapserver/mapdrawgdal.c
===================================================================
--- trunk/mapserver/mapdrawgdal.c	2011-03-15 21:08:49 UTC (rev 11166)
+++ trunk/mapserver/mapdrawgdal.c	2011-03-16 13:43:29 UTC (rev 11167)
@@ -233,7 +233,7 @@
             if( layer->debug )
                 msDebug( "msDrawRasterLayerGDAL(): Error in overlap calculation.\n" );
             return 0;
-		}
+        }
 
         /*
          * Copy the source and destination raster coordinates.
@@ -257,12 +257,13 @@
             return 0;
         }
 
-      if (map->cellsize == 0)
-      {
-          if( layer->debug )
-              msDebug( "msDrawRasterLayerGDAL(): Cellsize can't be 0.\n" );
-          return 0;
-      }
+        if (map->cellsize == 0)
+        {
+            if( layer->debug )
+                msDebug( "msDrawRasterLayerGDAL(): Cellsize can't be 0.\n" );
+            return 0;
+        }
+
         dst_xoff = (int) ((copyRect.minx - mapRect.minx) / map->cellsize);
         dst_yoff = (int) ((mapRect.maxy - copyRect.maxy) / map->cellsize);
 
@@ -655,7 +656,7 @@
                             rb_cmap[0][i] = layer->class[c]->styles[0]->color.red;
                             rb_cmap[1][i] = layer->class[c]->styles[0]->color.green;
                             rb_cmap[2][i] = layer->class[c]->styles[0]->color.blue;
-                            rb_cmap[3][i] = 255;
+                            rb_cmap[3][i] = (255*layer->class[c]->styles[0]->opacity / 100);
                         }
 
                         else /* Use raster color */
@@ -859,7 +860,7 @@
                 */
 
                 if( result != -1 && alpha >= 128 )
-                	rb->data.gd_img->pixels[i][j] = result;
+                    rb->data.gd_img->pixels[i][j] = result;
             }
         }
 
@@ -883,7 +884,7 @@
                 result = cmap[pabyRaw1[k++]];
                 if( result != -1 )
                 {
-                	rb->data.gd_img->pixels[i][j] = result;
+                    rb->data.gd_img->pixels[i][j] = result;
                 }
             }
         }
@@ -1100,8 +1101,8 @@
             }
         }
         else {
-        	msSetError(MS_MISCERR,"Unsupported raster configuration","msDrawRasterLayerGDAL()");
-        	return MS_FAILURE;
+            msSetError(MS_MISCERR,"Unsupported raster configuration","msDrawRasterLayerGDAL()");
+            return MS_FAILURE;
         }
     }
 



More information about the mapserver-commits mailing list