[Mapbender-commits] r2245 - branches/2.5/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 13 11:47:54 EDT 2008


Author: christoph
Date: 2008-03-13 11:47:54 -0400 (Thu, 13 Mar 2008)
New Revision: 2245

Removed:
   branches/2.5/http/classes/class_kml_parser_2.2.php
Log:
obsolete

Deleted: branches/2.5/http/classes/class_kml_parser_2.2.php
===================================================================
--- branches/2.5/http/classes/class_kml_parser_2.2.php	2008-03-13 15:18:21 UTC (rev 2244)
+++ branches/2.5/http/classes/class_kml_parser_2.2.php	2008-03-13 15:47:54 UTC (rev 2245)
@@ -1,186 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_wmc.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.
-
-require_once(dirname(__FILE__) . "/../classes/class_mb_exception.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml_polygon.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml_linearring.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml_line.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml_point.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml_multigeometry.php");
-require_once(dirname(__FILE__) . "/../classes/class_kml_placemark.php");
-
-/**
- * not used in OGC KML Mapbender project, may be buggy
- */
-class Kml22Parser {
-	public function __construct($kml) {
-		$doc = new DOMDocument("1.0");
-		$doc->preserveWhiteSpace = false;
-		$doc->loadXML($kml);
-
-		/*
-		 * Get geometry information only, store it in placemarkArray
-		 */
-		$placemarkTagArray = $doc->getElementsByTagName("Placemark");
-		
-		foreach ($placemarkTagArray as $node) {
-
-			$geometryArray = $this->getGeometryArrayFromPlacemarkOrMultigeometryNode($node);
-			
-			/*
-			 * For a placemark, the geometryArray should only contain 1 geometry!
-			 */
-			for ($i=0; $i < count($geometryArray); $i++) {
-				$currentPlacemark = new KMLPlacemark($geometryArray[$i]);
-				$currentPlacemark->setName($this->getNameFromPlacemarkNode($node));
-				array_push($this->placemarkArray, $currentPlacemark);
-			}		    
-		}
-	}
-
-	/**
-	 * Given a "Point" node, this function returns the geometry (KMLPoint)
-	 * from within the node.
-	 */
-	private function getGeometryFromPointNode ($node) {
-		$coordinatesNode = $this->getCoordinatesNode($node);
-		$geomString = $coordinatesNode->nodeValue;
-		return new KMLPoint($geomString);
-	}
-	
-	/**
-	 * Given a "LineString" node, this function returns the geometry (KMLLine)
-	 * from within the node.
-	 */
-	private function getGeometryFromLinestringNode ($node) {
-		$coordinatesNode = $this->getCoordinatesNode($node);
-		$geomString = $coordinatesNode->nodeValue;
-		return new KMLLine($geomString);
-	}
-	
-	/**
-	 * Given a "Polygon" node, this function returns the geometry (KMLPolygon)
-	 * from within the node.
-	 */
-	private function getGeometryFromPolygonNode ($node) {
-		$polygon = null;
-
-	    $children = $node->childNodes;
-	    
-		// create new KMLPolygon
-		foreach ($children as $child) {
-			if (mb_strtoupper($child->nodeName) == "OUTERBOUNDARYIS") {
-				// create a new Linear Ring
-				$outerBoundary = $this->getGeometryFromLinearRingNode($child);
-				$polygon = new KMLPolygon($outerBoundary);
-			}
-		}
-		
-		if ($polygon !== null) {
-			// append inner boundaries to KMLPolygon
-			foreach ($children as $child) {
-				if (mb_strtoupper($child->nodeName) == "INNERBOUNDARYIS") {
-					// create a new Linear Ring
-					$innerBoundary = $this->getGeometryFromLinearRingNode($child);
-					$polygon->appendInnerBoundary($innerBoundary);
-				}
-			}
-		}
-		return $polygon;
-	}
-	
-	/**
-	 * Given a "OuterBoundaryIs" or "InnerBoundaryIs" node, this function 
-	 * returns the geometry (KMLLinearRing) within the child node named "linearring"
-	 */
-	private function getGeometryFromLinearRingNode ($node) {
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($child->nodeName) == "LINEARRING") {
-				$coordinatesNode = $this->getCoordinatesNode($child);
-				$geomString = $coordinatesNode->nodeValue;
-				return new KMLLinearRing($geomString);
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * Checks if the child nodes of a given KML node contains any geometries and
-	 * returns an array of geometries (KMLPoint, KMLPolygon, KMLLinestring and KMLMultigeometry)
-	 */
-	private function getGeometryArrayFromPlacemarkOrMultigeometryNode ($node) {
-	    $geometryArray = array();
-	    
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($child->nodeName) == "POINT") {
-				array_push($geometryArray, $this->getGeometryFromPointNode($child));
-			}
-			elseif (mb_strtoupper($child->nodeName) == "POLYGON") {
-				array_push($geometryArray, $this->getGeometryFromPolygonNode($child));
-			}
-			elseif (mb_strtoupper($child->nodeName) == "LINESTRING") {
-				array_push($geometryArray, $this->getGeometryFromLinestringNode($child));
-			}
-			elseif (mb_strtoupper($child->nodeName) == "MULTIGEOMETRY") {
-				$geometryArray = $this->getGeometryArrayFromPlacemarkOrMultigeometryNode($child);
-				$multigeometry = new KMLMultiGeometry();
-				
-				for ($i=0; $i < count($geometryArray); $i++) {
-					$multigeometry->append($geometryArray[$i]);	
-				}
-				array_push($geometryArray, $multigeometry);
-			}
-		}
-		return $geometryArray;
-	}
-	
-	/**
-	 * Returns the name of the placemark from the placemark node
-	 */
-	function getNameFromPlacemarkNode($node) {
-	    $name = "new";
-	    
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($child->nodeName) == "NAME") {
-				$name = $child->nodeValue;
-			}
-		}
-		return $name;
-	}
-	
-	/**
-	 * Returns the child node with node name "coordinates" of a given KML node.
-	 * If no node is found, null is returned.
-	 */
-	private function getCoordinatesNode ($node) {
-	    $children = $node->childNodes;
-		foreach($children as $child) {
-			if (mb_strtoupper($child->nodeName) == "COORDINATES") {
-				return $child;
-			}
-		}
-		return null;
-	}
-}
-
-// end class
-?>
\ No newline at end of file



More information about the Mapbender_commits mailing list