[mapserver-commits] r11155 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Mar 11 15:19:13 EST 2011
Author: assefa
Date: 2011-03-11 12:19:13 -0800 (Fri, 11 Mar 2011)
New Revision: 11155
Added:
trunk/mapserver/mapaxisorder.csv
trunk/mapserver/mapaxisorder.h
trunk/mapserver/mapaxisorder.sh
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapfile.c
Log:
add a static table to define axis order for some epsg codes (#3582)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-03-11 19:59:30 UTC (rev 11154)
+++ trunk/mapserver/HISTORY.TXT 2011-03-11 20:19:13 UTC (rev 11155)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Add a static table to define the axis order for soem epsg codes (/3582)
+
- Add possibility to use KML_NAME_ITEM (#3728)
- Fixed mapfile parsing error when a label angle referenced an attribute
Added: trunk/mapserver/mapaxisorder.csv
===================================================================
--- trunk/mapserver/mapaxisorder.csv (rev 0)
+++ trunk/mapserver/mapaxisorder.csv 2011-03-11 20:19:13 UTC (rev 11155)
@@ -0,0 +1,8 @@
+epsg_code,inverted
+3034,1
+3035,1
+3042,1
+3043,1
+4326,1
+4559,1
+4471,0
Property changes on: trunk/mapserver/mapaxisorder.csv
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/mapserver/mapaxisorder.h
===================================================================
--- trunk/mapserver/mapaxisorder.h (rev 0)
+++ trunk/mapserver/mapaxisorder.h 2011-03-11 20:19:13 UTC (rev 11155)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * $Id: $
+ *
+ * Project: MapServer
+ * Purpose: Axis lookup table
+ *
+ ******************************************************************************
+ * Copyright (c) 1996-2005 Regents of the University of Minnesota.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies of this Software or works derived from this Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+/*
+ * Generated file
+ *
+ * This file was generated from by means of a script. Do not edit manually.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static struct axisOrientationEpsgCodes_s {
+ int code;
+ int inverted; /*true=1, false =0*/
+} axisOrientationEpsgCodes[] = {
+ {3034,1},
+ {3035,1},
+ {3042,1},
+ {3043,1},
+ {4326,1},
+ {4559,1},
+ {4471,0},
+};
+
+#define AXIS_ORIENTATION_TABLE_SIZE 8
+
+#ifdef __cplusplus
+}
+#endif
Added: trunk/mapserver/mapaxisorder.sh
===================================================================
--- trunk/mapserver/mapaxisorder.sh (rev 0)
+++ trunk/mapserver/mapaxisorder.sh 2011-03-11 20:19:13 UTC (rev 11155)
@@ -0,0 +1,87 @@
+#!/bin/bash
+INFILE="./mapaxisorder.csv"
+OUTFILE="./mapaxisorder.h"
+
+# create array of elements from $INFILE
+unset ARRAY i
+while read -r LINE; do ARRAY[i++]=$LINE; done < $INFILE
+
+print_header ()
+{
+
+ echo '/******************************************************************************'
+ echo ' * $Id: $'
+ echo ' *'
+ echo ' * Project: MapServer'
+ echo ' * Purpose: Axis lookup table'
+ echo ' *'
+ echo ' ******************************************************************************'
+ echo ' * Copyright (c) 1996-2005 Regents of the University of Minnesota.'
+ echo ' *'
+ echo ' * Permission is hereby granted, free of charge, to any person obtaining a'
+ echo ' * copy of this software and associated documentation files (the "Software"),'
+ echo ' * to deal in the Software without restriction, including without limitation'
+ echo ' * the rights to use, copy, modify, merge, publish, distribute, sublicense,'
+ echo ' * and/or sell copies of the Software, and to permit persons to whom the'
+ echo ' * Software is furnished to do so, subject to the following conditions:'
+ echo ' *'
+ echo ' * The above copyright notice and this permission notice shall be included in '
+ echo ' * all copies of this Software or works derived from this Software.'
+ echo ' *'
+ echo ' * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS'
+ echo ' * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,'
+ echo ' * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL'
+ echo ' * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER'
+ echo ' * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING'
+ echo ' * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER'
+ echo ' * DEALINGS IN THE SOFTWARE.'
+ echo ' ****************************************************************************/'
+
+}
+
+print_comment ()
+{
+ echo ' '
+ echo '/*'
+ echo ' * Generated file'
+ echo ' *'
+ echo ' * This file was generated from by means of a script. Do not edit manually.'
+ echo ' */'
+ echo ' '
+
+}
+
+print_body ()
+{
+
+ echo '#ifdef __cplusplus'
+ echo 'extern "C" '{
+ echo '#endif'
+ echo ' '
+ echo 'static struct axisOrientationEpsgCodes_s {'
+ echo ' int code;'
+ echo ' int inverted; /*true=1, false =0*/'
+ echo '} axisOrientationEpsgCodes[] = {'
+
+ # unset first array element
+ unset ARRAY[0]
+ # traverse array and print out elements
+ for x in "${ARRAY[@]}"; do
+ echo " {${x}},"
+ done
+
+ echo '};'
+ echo ' '
+ echo '#define AXIS_ORIENTATION_TABLE_SIZE 8'
+ echo ' '
+ echo '#ifdef __cplusplus'
+ echo '}'
+ echo '#endif'
+
+}
+
+print_header > ./$OUTFILE
+print_comment >> ./$OUTFILE
+print_body >> ./$OUTFILE
+
+exit 0
\ No newline at end of file
Property changes on: trunk/mapserver/mapaxisorder.sh
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c 2011-03-11 19:59:30 UTC (rev 11154)
+++ trunk/mapserver/mapfile.c 2011-03-11 20:19:13 UTC (rev 11155)
@@ -37,6 +37,7 @@
#include "mapfile.h"
#include "mapthread.h"
#include "maptime.h"
+#include "mapaxisorder.h"
#ifdef USE_GDAL
# include "cpl_conv.h"
@@ -66,6 +67,29 @@
static int loadStyle(styleObj *style);
static void writeStyle(FILE* stream, int indent, styleObj *style);
static int msResolveSymbolNames(mapObj *map);
+
+
+/************************************************************************/
+/* int msIsAxisInverted */
+/* check to see if we shoudl invert the axis. */
+/* */
+/************************************************************************/
+static int msIsAxisInverted(int epsg_code)
+{
+ int i;
+ /*check first in the static table*/
+ for (i=0; i<AXIS_ORIENTATION_TABLE_SIZE; i++)
+ {
+ if (axisOrientationEpsgCodes[i].code == epsg_code)
+ return axisOrientationEpsgCodes[i].inverted;
+ }
+ if ( epsg_code >=4000 && epsg_code < 5000)
+ return MS_TRUE;
+
+ return MS_FALSE;
+
+}
+
/*
** Symbol to string static arrays needed for writing map files.
** Must be kept in sync with enumerations and defines found in mapserver.h.
@@ -1258,8 +1282,9 @@
p->args = (char**)msSmallMalloc(sizeof(char*) * 2);
p->args[0] = init_string;
p->numargs = 1;
+
- if( atoi(value+5) >= 4000 && atoi(value+5) < 5000 )
+ if( msIsAxisInverted(atoi(value+5)))
{
p->args[1] = msStrdup("+epsgaxis=ne");
p->numargs = 2;
More information about the mapserver-commits
mailing list