[mapserver-commits] r13075 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Feb 6 17:54:30 EST 2012


Author: tbonfort
Date: 2012-02-06 14:54:30 -0800 (Mon, 06 Feb 2012)
New Revision: 13075

Modified:
   trunk/mapserver/mapserver.h
   trunk/mapserver/maptile.c
   trunk/mapserver/maputil.c
Log:
move msTileSetProjections to msMapSetLayerProjections so it can be used outside of tilemode


Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2012-02-06 22:39:30 UTC (rev 13074)
+++ trunk/mapserver/mapserver.h	2012-02-06 22:54:30 UTC (rev 13075)
@@ -2293,6 +2293,8 @@
 MS_DLL_EXPORT int *msGetLayersIndexByGroup(mapObj *map, char *groupname, int *nCount);
 MS_DLL_EXPORT unsigned char *msSaveImageBuffer(imageObj* image, int *size_ptr, outputFormatObj *format);
 MS_DLL_EXPORT shapeObj* msOffsetPolyline(shapeObj* shape, double offsetx, double offsety);
+MS_DLL_EXPORT int msMapSetLayerProjections(mapObj* map);
+
 /* Functions to chnage the drawing order of the layers. */
 /* Defined in mapobject.c */
 MS_DLL_EXPORT int msMoveLayerUp(mapObj *map, int nLayerIndex);

Modified: trunk/mapserver/maptile.c
===================================================================
--- trunk/mapserver/maptile.c	2012-02-06 22:39:30 UTC (rev 13074)
+++ trunk/mapserver/maptile.c	2012-02-06 22:54:30 UTC (rev 13075)
@@ -247,7 +247,7 @@
   /* 
   ** Ensure all the LAYERs have a projection. 
   */  
-  if( msTileSetProjections(msObj->map) != 0 ) {
+  if( msMapSetLayerProjections(msObj->map) != 0 ) {
     return(MS_FAILURE);
   }
 
@@ -506,49 +506,7 @@
 }
 
 
-/************************************************************************
- *                            msTileSetProjections                      *
- *                                                                      * 
- *   Ensure that all the layers in the map file have a projection       *
- *   by copying the map-level projection to all layers than have no     *
- *   projection.                                                        *
- ************************************************************************/
 
-int msTileSetProjections(mapObj* map) {
-
-  char *mapProjStr = NULL;
-  int i;
-    
-  if (map->projection.numargs <= 0) {
-    msSetError(MS_WMSERR, "Cannot set new SRS on a map that doesn't "
-                          "have any projection set. Please make sure your mapfile "
-                          "has a PROJECTION defined at the top level.", 
-                          "msTileSetProjectionst()");
-    return(MS_FAILURE);
-  }
-
-  for(i=0; i<map->numlayers; i++) {
-    /* This layer is turned on and needs a projection? */
-    if (GET_LAYER(map, i)->projection.numargs <= 0 &&
-        GET_LAYER(map, i)->status != MS_OFF &&
-        GET_LAYER(map, i)->transform == MS_TRUE) {
-   
-      /* Fetch main map projection string only now that we need it */
-      if (mapProjStr == NULL)
-        mapProjStr = msGetProjectionString(&(map->projection));
-      
-      /* Set the projection to the map file projection */  
-      if (msLoadProjectionString(&(GET_LAYER(map, i)->projection), mapProjStr) != 0) {
-        msSetError(MS_CGIERR, "Unable to set projection on layer.", "msTileSetProjectionst()");
-        return(MS_FAILURE);
-      }
-      GET_LAYER(map, i)->project = MS_TRUE;
-    }
-  }
-  msFree(mapProjStr);
-  return(MS_SUCCESS);
-}
-
 /************************************************************************
  *                            msDrawTile                                *
  *                                                                      * 

Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c	2012-02-06 22:39:30 UTC (rev 13074)
+++ trunk/mapserver/maputil.c	2012-02-06 22:54:30 UTC (rev 13075)
@@ -2315,3 +2315,47 @@
     }
     return MS_FALSE;
 }
+
+
+/************************************************************************
+ *                            msMapSetProjections                       *
+ *                                                                      * 
+ *   Ensure that all the layers in the map file have a projection       *
+ *   by copying the map-level projection to all layers than have no     *
+ *   projection.                                                        *
+ ************************************************************************/
+
+int msMapSetLayerProjections(mapObj* map) {
+
+  char *mapProjStr = NULL;
+  int i;
+    
+  if (map->projection.numargs <= 0) {
+    msSetError(MS_WMSERR, "Cannot set new SRS on a map that doesn't "
+                          "have any projection set. Please make sure your mapfile "
+                          "has a PROJECTION defined at the top level.", 
+                          "msTileSetProjectionst()");
+    return(MS_FAILURE);
+  }
+
+  for(i=0; i<map->numlayers; i++) {
+    /* This layer is turned on and needs a projection? */
+    if (GET_LAYER(map, i)->projection.numargs <= 0 &&
+        GET_LAYER(map, i)->status != MS_OFF &&
+        GET_LAYER(map, i)->transform == MS_TRUE) {
+   
+      /* Fetch main map projection string only now that we need it */
+      if (mapProjStr == NULL)
+        mapProjStr = msGetProjectionString(&(map->projection));
+      
+      /* Set the projection to the map file projection */  
+      if (msLoadProjectionString(&(GET_LAYER(map, i)->projection), mapProjStr) != 0) {
+        msSetError(MS_CGIERR, "Unable to set projection on layer.", "msTileSetProjectionst()");
+        return(MS_FAILURE);
+      }
+      GET_LAYER(map, i)->project = MS_TRUE;
+    }
+  }
+  msFree(mapProjStr);
+  return(MS_SUCCESS);
+}



More information about the mapserver-commits mailing list