[mapserver-commits] r10618 - sandbox/sdlime/common-expressions/mapserver

svn at osgeo.org svn at osgeo.org
Mon Oct 18 21:50:12 EDT 2010


Author: sdlime
Date: 2010-10-18 18:50:12 -0700 (Mon, 18 Oct 2010)
New Revision: 10618

Modified:
   sandbox/sdlime/common-expressions/mapserver/mapcopy.c
   sandbox/sdlime/common-expressions/mapserver/mapdraw.c
   sandbox/sdlime/common-expressions/mapserver/mapfile.c
   sandbox/sdlime/common-expressions/mapserver/mapgeomtransform.c
   sandbox/sdlime/common-expressions/mapserver/mapserver.h
Log:
Changed style->_geomtransform to be a true expression...

Modified: sandbox/sdlime/common-expressions/mapserver/mapcopy.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapcopy.c	2010-10-19 00:29:41 UTC (rev 10617)
+++ sandbox/sdlime/common-expressions/mapserver/mapcopy.c	2010-10-19 01:50:12 UTC (rev 10618)
@@ -424,8 +424,8 @@
     MS_COPYSTELEM(minvalue);
     MS_COPYSTELEM(maxvalue);
     MS_COPYSTELEM(opacity);
-    MS_COPYSTRING(dst->_geomtransformexpression,src->_geomtransformexpression);
-    MS_COPYSTELEM(_geomtransform);
+    MS_COPYSTRING(dst->_geomtransform.string, src->_geomtransform.string);
+    MS_COPYSTELEM(_geomtransform.type);
     MS_COPYSTRING(dst->rangeitem, src->rangeitem);
     MS_COPYSTELEM(rangeitemindex);
     MS_COPYSTELEM(outlinewidth);

Modified: sandbox/sdlime/common-expressions/mapserver/mapdraw.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapdraw.c	2010-10-19 00:29:41 UTC (rev 10617)
+++ sandbox/sdlime/common-expressions/mapserver/mapdraw.c	2010-10-19 01:50:12 UTC (rev 10618)
@@ -1087,8 +1087,8 @@
       for(current=shpcache; current; current=current->next) {
         if(layer->class[current->shape.classindex]->numstyles > s) {
           styleObj *pStyle = layer->class[current->shape.classindex]->styles[s];
-          if(pStyle->_geomtransform!=MS_GEOMTRANSFORM_NONE)
-        	continue; /*skip this as it has already been rendered*/
+          if(pStyle->_geomtransform.type != MS_GEOMTRANSFORM_NONE)
+            continue; /*skip this as it has already been rendered*/
           if(map->scaledenom > 0) {
             if((pStyle->maxscaledenom != -1) && (map->scaledenom >= pStyle->maxscaledenom))
               continue;
@@ -1964,7 +1964,7 @@
     }
 
     for(s=0;s<layer->class[c]->numstyles;s++){
-      if(layer->class[c]->styles[s]->_geomtransform != MS_GEOMTRANSFORM_NONE) {
+      if(layer->class[c]->styles[s]->_geomtransform.type != MS_GEOMTRANSFORM_NONE) {
         hasGeomTransform = MS_TRUE;
         break;
       }
@@ -2005,7 +2005,7 @@
         if((curStyle->minscaledenom != -1) && (map->scaledenom < curStyle->minscaledenom))
           continue;
       }
-      if(curStyle->_geomtransform != MS_GEOMTRANSFORM_NONE)
+      if(curStyle->_geomtransform.type != MS_GEOMTRANSFORM_NONE)
         msDrawTransformedShape(map, &map->symbolset, image, &nonClippedShape, curStyle, layer->scalefactor);
       else if(style==-1 || s==style)
         msDrawLineSymbol(&map->symbolset, image, shape, curStyle, layer->scalefactor);
@@ -2174,7 +2174,7 @@
     }
 
     for(s=0;s<layer->class[c]->numstyles;s++){
-      if(layer->class[c]->styles[s]->_geomtransform != MS_GEOMTRANSFORM_NONE) {
+      if(layer->class[c]->styles[s]->_geomtransform.type != MS_GEOMTRANSFORM_NONE) {
         hasGeomTransform = MS_TRUE;
         break;
       }
@@ -2220,7 +2220,7 @@
         if((curStyle->minscaledenom != -1) && (map->scaledenom < curStyle->minscaledenom))
           continue;
       }
-      if(curStyle->_geomtransform==MS_GEOMTRANSFORM_NONE)
+      if(curStyle->_geomtransform.type == MS_GEOMTRANSFORM_NONE)
     	msDrawShadeSymbol(&map->symbolset, image, shape, curStyle, layer->scalefactor);
       else
     	msDrawTransformedShape(map, &map->symbolset, image, &nonClippedShape, curStyle, layer->scalefactor);
@@ -2515,7 +2515,7 @@
           needBillboard = MS_FALSE;
           if(MS_VALID_COLOR(labelPtr->backgroundcolor)) needBillboard = MS_TRUE;
           for(i=0; i<labelPtr->numstyles; i++) {
-            if(labelPtr->styles[i]->_geomtransform == MS_GEOMTRANSFORM_LABELPOLY) {
+            if(labelPtr->styles[i]->_geomtransform.type == MS_GEOMTRANSFORM_LABELPOLY) {
               needBillboard = MS_TRUE;
               break;
             }
@@ -2651,9 +2651,9 @@
           /* here's where we draw the label styles */
           if(cachePtr->label.numstyles > 0) {
             for(i=0; i<cachePtr->label.numstyles; i++) {
-              if(cachePtr->label.styles[i]->_geomtransform == MS_GEOMTRANSFORM_LABELPOINT)
+              if(cachePtr->label.styles[i]->_geomtransform.type == MS_GEOMTRANSFORM_LABELPOINT)
                 msDrawMarkerSymbol(&map->symbolset, image, &(cachePtr->point), cachePtr->label.styles[i], layerPtr->scalefactor);
-              else if(cachePtr->label.styles[i]->_geomtransform == MS_GEOMTRANSFORM_LABELPOLY) {
+              else if(cachePtr->label.styles[i]->_geomtransform.type == MS_GEOMTRANSFORM_LABELPOLY) {
                 msDrawShadeSymbol(&map->symbolset, image, &billboard, cachePtr->label.styles[i], layerPtr->scalefactor);
               } else {
                 /* need error msg about unsupported geomtransform */

Modified: sandbox/sdlime/common-expressions/mapserver/mapfile.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapfile.c	2010-10-19 00:29:41 UTC (rev 10617)
+++ sandbox/sdlime/common-expressions/mapserver/mapfile.c	2010-10-19 01:50:12 UTC (rev 10618)
@@ -1743,8 +1743,8 @@
         return(-1);
       initStyle(label->styles[label->numstyles]);
       if(loadStyle(label->styles[label->numstyles]) != MS_SUCCESS) return(-1);
-      if(label->styles[label->numstyles]->_geomtransform == MS_GEOMTRANSFORM_NONE) 
-        label->styles[label->numstyles]->_geomtransform = MS_GEOMTRANSFORM_LABELPOINT; /* set a default, a marker? */
+      if(label->styles[label->numstyles]->_geomtransform.type == MS_GEOMTRANSFORM_NONE) 
+        label->styles[label->numstyles]->_geomtransform.type = MS_GEOMTRANSFORM_LABELPOINT; /* set a default, a marker? */
       label->numstyles++;
       break;
     case(TYPE):
@@ -2117,9 +2117,10 @@
   style->angle = 360;
   style->autoangle= MS_FALSE;
   style->opacity = 100; /* fully opaque */
-  style->_geomtransformexpression = NULL;
-  style->_geomtransform = MS_GEOMTRANSFORM_NONE;
-  
+
+  style->_geomtransform.string = NULL;  
+  style->_geomtransform.type = MS_GEOMTRANSFORM_NONE;
+
   style->patternlength = 0; /* solid line */
   style->gap = 0;
   style->position = MS_CC;
@@ -2391,7 +2392,8 @@
   if( MS_REFCNT_DECR_IS_NOT_ZERO(style) ) { return MS_FAILURE; }
 
   msFree(style->symbolname);
-  msFree(style->_geomtransformexpression);
+  // msFree(style->_geomtransformexpression);
+  freeExpression(&style->_geomtransform);
   msFree(style->rangeitem);
 
   for(i=0; i<MS_STYLE_BINDING_LENGTH; i++)
@@ -2454,9 +2456,9 @@
     writeDimension(stream, indent, "DATARANGE", style->minvalue, style->maxvalue);
   }
 
-  if(style->_geomtransformexpression) {
+  if(style->_geomtransform.type != MS_GEOMTRANSFORM_NONE) {
     // TODO!!!
-    fprintf(stream, "        GEOMTRANSFORM \"%s\"\n",style->_geomtransformexpression);
+    // fprintf(stream, "        GEOMTRANSFORM \"%s\"\n",style->_geomtransformexpression);
   }
   writeBlockEnd(stream, indent, "STYLE");
 }

Modified: sandbox/sdlime/common-expressions/mapserver/mapgeomtransform.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapgeomtransform.c	2010-10-19 00:29:41 UTC (rev 10617)
+++ sandbox/sdlime/common-expressions/mapserver/mapgeomtransform.c	2010-10-19 01:50:12 UTC (rev 10618)
@@ -30,31 +30,31 @@
 #include "mapserver.h"
 
 void msStyleSetGeomTransform(styleObj *s, char *transform) {
-  msFree(s->_geomtransformexpression);
-  s->_geomtransformexpression = strdup(transform);
+  msFree(s->_geomtransform.string);                                                                                                                                                          
+  s->_geomtransform.string = strdup(transform);
   if(!strncasecmp("start",transform,5)) {
-    s->_geomtransform = MS_GEOMTRANSFORM_START;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_START;
   }
   else if(!strncasecmp("end",transform,3)) {
-    s->_geomtransform = MS_GEOMTRANSFORM_END;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_END;
   }
   else if(!strncasecmp("vertices",transform,8)) {
-    s->_geomtransform = MS_GEOMTRANSFORM_VERTICES;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_VERTICES;
   }
   else if(!strncasecmp("bbox",transform,4)) {
-    s->_geomtransform = MS_GEOMTRANSFORM_BBOX;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_BBOX;
   }
   else if(!strncasecmp("labelpnt",transform,8)) {
-    s->_geomtransform = MS_GEOMTRANSFORM_LABELPOINT;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_LABELPOINT;
   }
   else if(!strncasecmp("labelpoly",transform,9)) {
-    s->_geomtransform = MS_GEOMTRANSFORM_LABELPOLY;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_LABELPOLY;
   }
   else {
-    s->_geomtransform = MS_GEOMTRANSFORM_NONE;
+    s->_geomtransform.type = MS_GEOMTRANSFORM_NONE;
     msSetError(MS_MISCERR,"unknown transform expression","msStyleSetGeomTransform()");
-    msFree(s->_geomtransformexpression);
-    s->_geomtransformexpression = NULL;
+    msFree(s->_geomtransform.string);
+    s->_geomtransform.string = NULL;
   }
 }
 
@@ -64,9 +64,7 @@
  * returned char* must be freed by the caller
  */
 char *msStyleGetGeomTransform(styleObj *s) {
-  if(s->_geomtransformexpression==NULL)
-    return NULL;
-  return strdup(s->_geomtransformexpression);
+  return strdup(s->_geomtransform.string);
 }
 
 
@@ -91,7 +89,7 @@
  *  - use the styleObj to render the transformed shapeobj
  */
 int msDrawTransformedShape(mapObj *map, symbolSetObj *symbolset, imageObj *image, shapeObj *shape, styleObj *style, double scalefactor){
-  int type = style->_geomtransform;
+  int type = style->_geomtransform.type;
   int i,j;
   switch(type) {
     case MS_GEOMTRANSFORM_END: /*render point on last vertex only*/

Modified: sandbox/sdlime/common-expressions/mapserver/mapserver.h
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapserver.h	2010-10-19 00:29:41 UTC (rev 10617)
+++ sandbox/sdlime/common-expressions/mapserver/mapserver.h	2010-10-19 01:50:12 UTC (rev 10618)
@@ -751,8 +751,9 @@
 
 #ifndef SWIG
   /*private vars for rfc48*/
-  char *_geomtransformexpression;
-  int _geomtransform;
+  expressionObj _geomtransform;
+  // char *_geomtransformexpression;
+  // int _geomtransform;
 #endif
   
   /*should an angle be automatically computed*/



More information about the mapserver-commits mailing list