[Mapbender-commits] r1808 - branches/mapbender_sld/http/sld

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 15 10:52:00 EST 2007


Author: mschulz
Date: 2007-11-15 10:52:00 -0500 (Thu, 15 Nov 2007)
New Revision: 1808

Modified:
   branches/mapbender_sld/http/sld/sld_edit_filter.php
   branches/mapbender_sld/http/sld/sld_filter_parse.php
   branches/mapbender_sld/http/sld/sld_parse.php
Log:
Added copyright and license

Modified: branches/mapbender_sld/http/sld/sld_edit_filter.php
===================================================================
--- branches/mapbender_sld/http/sld/sld_edit_filter.php	2007-11-15 15:51:05 UTC (rev 1807)
+++ branches/mapbender_sld/http/sld/sld_edit_filter.php	2007-11-15 15:52:00 UTC (rev 1808)
@@ -1,4 +1,22 @@
 <?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 /**
  * This file contains the source of the filter-expression-editor-module.
  * This was separated from the sld-editor's parsing and functionhandling


Property changes on: branches/mapbender_sld/http/sld/sld_edit_filter.php
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: branches/mapbender_sld/http/sld/sld_filter_parse.php
===================================================================
--- branches/mapbender_sld/http/sld/sld_filter_parse.php	2007-11-15 15:51:05 UTC (rev 1807)
+++ branches/mapbender_sld/http/sld/sld_filter_parse.php	2007-11-15 15:52:00 UTC (rev 1808)
@@ -1,4 +1,22 @@
 <?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 /**
  * This file parses the filter expressions and creates the corresponding objects.
  *


Property changes on: branches/mapbender_sld/http/sld/sld_filter_parse.php
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: branches/mapbender_sld/http/sld/sld_parse.php
===================================================================
--- branches/mapbender_sld/http/sld/sld_parse.php	2007-11-15 15:51:05 UTC (rev 1807)
+++ branches/mapbender_sld/http/sld/sld_parse.php	2007-11-15 15:52:00 UTC (rev 1808)
@@ -1,4 +1,22 @@
 <?php
+# $Id$
+# http://www.mapbender.org/index.php/SLD/sld_config.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 /**
  * Parses the sld-documents and creates the object structure.
  * This file does the parsing of the sld-data.
@@ -15,13 +33,32 @@
  * @author Markus Krzyzanowski
  */
 
-
-
-
 session_start();
 
+/**
+ *  Creates a empty SLD object up to the rule object
+ * 
+ *  @return StyledLayerDescriptor
+ */
+function createEmptySLD() {
+	$styledlayerdescriptor = new StyledLayerDescriptor();
+	$layer = new NamedLayer();
+	$style = new UserStyle();
+	$fts = new FeatureTypeStyle();
+	$rule = new Rule();
+	
+	$fts->rules[] = $rule;
+	$style->featuretypestyles[] = $fts;
+	$layer->styles[] = $style;
+	$layer->name = $_SESSION["sld_layer_name"];
+	$styledlayerdescriptor->layers[] = $layer;
+	$styledlayerdescriptor->version = "1.0.0";
+	$styledlayerdescriptor->id = 0;
+	$styledlayerdescriptor->parent = false;
+	
+	return $styledlayerdescriptor;
+}
 
-
 /**
  * Opens the file at the specified URL and returns the content.
  *
@@ -58,7 +95,6 @@
 	xml_parse_into_struct($xml_parser, $data, $vals, $index);
 	xml_parser_free($xml_parser);
 	
-	
 	$styledlayerdescriptor;
 	$parent = array();
 	$objects = array();
@@ -77,9 +113,12 @@
 				{
 					$parent[] = false;
 					$parentactual = 0;
+					/*
 					$styledlayerdescriptor = new StyledLayerDescriptor();
 					$styledlayerdescriptor->version = "1.0.0";
 					//Experimental:
+					*/
+					$styledlayerdescriptor = createEmptySLD();
 					$styledlayerdescriptor->id = 0;
 					$styledlayerdescriptor->parent = false;
 					//END Experimental
@@ -715,14 +754,41 @@
 					$objects[$parentactual]->colormapentries[count($objects[$parentactual]->colormapentries)-1]->label = $element["attributes"]["label"];
 				}
 				break;
-			//TODO: Kl�ren mit sld:parameterValueType
-			//bei den folgenden XML Elementen
 			case "LABEL":
 				if ($element["type"] == "complete")
 				{
 					//Kl�ren, ob Label nur so vorkommen kann - TODO
-					$objects[$parentactual]->label = $element["value"];
+					//$objects[$parentactual]->label = $element["value"];
+					
+					//use the new ParameterValue class to store the mixed content value
+					//simple case no extra markup ...
+					//the label is instanciated by TextSymbolizer
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new ParameterValue();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					$objects[count($parent)-1]->value = $element["value"];
+					//END Experimental
+					$objects[$parentactual]->label = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
+					$parentactual = $parent[$parentactual];
+				}				
+				elseif ($element["type"] == "open")
+				{
+					$parent[] = $parentactual;
+					$objects[count($parent)-1] = new ParameterValue();
+					//Experimental:
+					$objects[count($parent)-1]->id = count($parent)-1;
+					$objects[count($parent)-1]->parent = $parentactual;
+					//END Experimental
+					$objects[$parentactual]->label = &$objects[count($parent)-1];
+					$parentactual = count($parent)-1;
 				}
+				elseif ($element["type"] == "close")
+				{
+					$parentactual = $parent[$parentactual];
+				}
 				break;
 			case "RADIUS":
 				if ($element["type"] == "complete")
@@ -776,6 +842,20 @@
 					$objects[$parentactual]->displacementy = $element["value"];
 				}
 				break;
+			//TODO: Kl�ren mit sld:parameterValueType
+			//bei den folgenden XML Elementen
+			case "PROPERTYNAME":
+				if ($element["type"] == "complete")
+				{
+					if ($temp == "") {
+						$objects[$parentactual]->value = $element["value"];
+						$parentactual = count($parent)-1;
+					}
+					else {
+						die($temp);
+					}
+				}
+				break;
 			//END TODO
 			//von den vorhergegangenen XML Elementen
 			
@@ -809,6 +889,7 @@
 					if (strtoupper(get_class($objects[$parentactual])) == "RULE")
 					{
 						$objects[$parentactual]->filter .= $temp;
+						$temp = "";
 					}
 		}
 	}


Property changes on: branches/mapbender_sld/http/sld/sld_parse.php
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the Mapbender_commits mailing list