[mapserver-commits] r12789 - sandbox/sdlime/rfc-77

svn at osgeo.org svn at osgeo.org
Mon Nov 21 08:25:43 EST 2011


Author: sdlime
Date: 2011-11-21 05:25:43 -0800 (Mon, 21 Nov 2011)
New Revision: 12789

Modified:
   sandbox/sdlime/rfc-77/mapfile.c
   sandbox/sdlime/rfc-77/mapprimitive.c
   sandbox/sdlime/rfc-77/mapprimitive.h
Log:
shapeObj needs to hold mutliple text values.

Modified: sandbox/sdlime/rfc-77/mapfile.c
===================================================================
--- sandbox/sdlime/rfc-77/mapfile.c	2011-11-19 00:37:17 UTC (rev 12788)
+++ sandbox/sdlime/rfc-77/mapfile.c	2011-11-21 13:25:43 UTC (rev 12789)
@@ -67,26 +67,24 @@
 static int loadGrid( layerObj *pLayer );
 static int loadStyle(styleObj *style);
 static void writeStyle(FILE* stream, int indent, styleObj *style);
-static int msResolveSymbolNames(mapObj *map);
+static int resolveSymbolNames(mapObj *map);
 
-
 /************************************************************************/
-/*                           int msIsAxisInverted                       */
-/*      check to see if we shoudl invert the axis.                      */
+/*                           int isAxisInverted                         */
+/*      check to see if we should invert the axis.                      */
 /*                                                                      */
 /************************************************************************/
-static int msIsAxisInverted(int epsg_code)
+static int isAxisInverted(int epsg_code)
 {
-    int i;
-    /*check the static table*/
-    for (i=0; i<AXIS_ORIENTATION_TABLE_SIZE; i++)
-    {
-        if (axisOrientationEpsgCodes[i].code == epsg_code)
-          return MS_TRUE;
-    }
+  int i;
 
-    return MS_FALSE;
-    
+  /* check the static table */
+  for (i=0; i<AXIS_ORIENTATION_TABLE_SIZE; i++) {
+    if (axisOrientationEpsgCodes[i].code == epsg_code)
+      return MS_TRUE;
+  }
+
+  return MS_FALSE;
 }
 
 /*
@@ -1316,7 +1314,7 @@
         p->numargs = 1;
         
 
-        if( msIsAxisInverted(atoi(value+5)))
+        if( isAxisInverted(atoi(value+5)))
         {
             p->args[1] = msStrdup("+epsgaxis=ne");
             p->numargs = 2;
@@ -1411,7 +1409,7 @@
       p->args[0] = init_string;
       p->numargs = 1;
 
-      if( msIsAxisInverted(atoi(code)))
+      if( isAxisInverted(atoi(code)))
       {
           p->args[1] = msStrdup("+epsgaxis=ne");
           p->numargs = 2;
@@ -1447,7 +1445,7 @@
       p->args[0] = init_string;
       p->numargs = 1;
 
-      if( msIsAxisInverted(atoi(code)))
+      if( isAxisInverted(atoi(code)))
       {
           p->args[1] = msStrdup("+epsgaxis=ne");
           p->numargs = 2;
@@ -1506,7 +1504,7 @@
       p->args[0] = msStrdup(init_string);
       p->numargs = 1;
 
-      if( msIsAxisInverted(atoi(code)))
+      if( isAxisInverted(atoi(code)))
       {
           p->args[1] = msStrdup("+epsgaxis=ne");
           p->numargs = 2;
@@ -5404,7 +5402,7 @@
 
       if(loadSymbolSet(&(map->symbolset), map) == -1) return MS_FAILURE;
 
-      if (msResolveSymbolNames(map) == MS_FAILURE) return MS_FAILURE;
+      if (resolveSymbolNames(map) == MS_FAILURE) return MS_FAILURE;
       
 
 #if defined (USE_GD_TTF) || defined (USE_GD_FT)
@@ -5619,7 +5617,7 @@
   if (mappath != NULL) free(mappath);
   msyylex_destroy();
 
-  if (msResolveSymbolNames(map) == MS_FAILURE) return NULL;
+  if (resolveSymbolNames(map) == MS_FAILURE) return NULL;
 
   return map;
 }
@@ -6237,20 +6235,17 @@
   }
 }
 
-void initResultCache(resultCacheObj *resultcache)
-{
-    if (resultcache)
-    {
-        resultcache->results = NULL;
-        resultcache->numresults = 0;
-        resultcache->cachesize = 0;
-        resultcache->bounds.minx = resultcache->bounds.miny = resultcache->bounds.maxx = resultcache->bounds.maxy = -1;
-        resultcache->usegetshape = MS_FALSE;
-    }
+void initResultCache(resultCacheObj *resultcache) {
+  if (resultcache) {
+    resultcache->results = NULL;
+    resultcache->numresults = 0;
+    resultcache->cachesize = 0;
+    resultcache->bounds.minx = resultcache->bounds.miny = resultcache->bounds.maxx = resultcache->bounds.maxy = -1;
+    resultcache->usegetshape = MS_FALSE;
+  }
 }
 
-static int msResolveSymbolNames(mapObj* map)
-{
+static int resolveSymbolNames(mapObj* map) {
   int i, j;
 
   /* step through layers and classes to resolve symbol names */

Modified: sandbox/sdlime/rfc-77/mapprimitive.c
===================================================================
--- sandbox/sdlime/rfc-77/mapprimitive.c	2011-11-19 00:37:17 UTC (rev 12788)
+++ sandbox/sdlime/rfc-77/mapprimitive.c	2011-11-21 13:25:43 UTC (rev 12789)
@@ -106,6 +106,7 @@
 
   /* annotation component */
   shape->text = NULL;
+  shape->numtext = 0;
 
   /* bookkeeping component */
   shape->classindex = 0; /* default class */
@@ -129,7 +130,12 @@
   to->bounds.maxx = from->bounds.maxx;
   to->bounds.maxy = from->bounds.maxy;
 
-  if(from->text) to->text = msStrdup(from->text);
+  if(from->text) {
+    to->text = (char **)msSmallMalloc(sizeof(char *)*from->numtext);
+    for(i=0; i<from->numtext; i++)
+      to->text[i] = msStrdup(from->text[i]);
+    to->numtext = from->numtext;
+  }
 
   to->classindex = from->classindex;
   to->index = from->index;
@@ -158,9 +164,9 @@
   for (c= 0; c < shape->numlines; c++)
     free(shape->line[c].point);
 
-  if (shape->line) free(shape->line);
+  if(shape->line) free(shape->line);
   if(shape->values) msFreeCharArray(shape->values, shape->numvalues);
-  if(shape->text) free(shape->text);
+  if(shape->text) msFreeCharArray(shape->text, shape->numtext);
   
 #ifdef USE_GEOS
   msGEOSFreeGeometry(shape);

Modified: sandbox/sdlime/rfc-77/mapprimitive.h
===================================================================
--- sandbox/sdlime/rfc-77/mapprimitive.h	2011-11-19 00:37:17 UTC (rev 12788)
+++ sandbox/sdlime/rfc-77/mapprimitive.h	2011-11-21 13:25:43 UTC (rev 12789)
@@ -70,6 +70,7 @@
 #endif
   int numlines;
   int numvalues;
+  int numtext;
 #ifndef SWIG
   lineObj *line;
   char **values;
@@ -86,7 +87,7 @@
   long index;
   int tileindex;
   int classindex;
-  char *text;
+  char **text;
   
   int scratch;
   int resultindex; /* index within a query result set */



More information about the mapserver-commits mailing list