[Mapbender-commits] r3511 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Feb 3 05:49:32 EST 2009
Author: christoph
Date: 2009-02-03 05:49:32 -0500 (Tue, 03 Feb 2009)
New Revision: 3511
Added:
trunk/mapbender/http/classes/class_universal_gml_factory.php
Log:
WFS redesign
Added: trunk/mapbender/http/classes/class_universal_gml_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_universal_gml_factory.php (rev 0)
+++ trunk/mapbender/http/classes/class_universal_gml_factory.php 2009-02-03 10:49:32 UTC (rev 3511)
@@ -0,0 +1,68 @@
+<?php
+# $Id: class_wfs.php 3094 2008-10-01 13:52:35Z christoph $
+# http://www.mapbender.org/index.php/class_wfs.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__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_2_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_gml_3_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+
+class UniversalGmlFactory extends GmlFactory {
+
+ private function getVersionFromXml ($xml) {
+
+ return "2";
+ throw new Exception("WFS version could not be determined from XML.");
+ }
+
+ /**
+ * Creates a GML object by parsing its XML representation.
+ *
+ * The GML version is determined by parsing
+ * the XML document up-front.
+ *
+ * @return Wfs
+ * @param $xml String
+ */
+ public function createFromXml ($xml) {
+ try {
+ $version = $this->getVersionFromXml($xml);
+
+ switch ($version) {
+ case "2":
+ $factory = new Gml_2_Factory();
+ break;
+ case "3":
+ $factory = new Gml_3_Factory();
+ break;
+ default:
+ throw new Exception("Unknown GML version " . $version);
+ break;
+ }
+ return $factory->createFromXml($xml);
+ }
+ catch (Exception $e) {
+ new mb_exception($e);
+ return null;
+ }
+ }
+}
+?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list