[Mapbender-commits] r7067 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Oct 27 06:29:52 EDT 2010


Author: christoph
Date: 2010-10-27 03:29:52 -0700 (Wed, 27 Oct 2010)
New Revision: 7067

Modified:
   trunk/mapbender/http/classes/class_ows.php
   trunk/mapbender/http/classes/class_universal_gml_factory.php
Log:
createFromJson is now taking wfsConfs into account. Formerly, GML2 was assumed

Modified: trunk/mapbender/http/classes/class_ows.php
===================================================================
--- trunk/mapbender/http/classes/class_ows.php	2010-10-26 18:36:03 UTC (rev 7066)
+++ trunk/mapbender/http/classes/class_ows.php	2010-10-27 10:29:52 UTC (rev 7067)
@@ -71,7 +71,7 @@
 	 * @return String
 	 * @param $s String
 	 */
-	final protected function getNameSpace($s) {
+	final public function getNameSpace($s) {
 		$c = strpos($s, ":"); 
 		if ($c !== false) {
 			return substr($s, 0, $c);

Modified: trunk/mapbender/http/classes/class_universal_gml_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_universal_gml_factory.php	2010-10-26 18:36:03 UTC (rev 7066)
+++ trunk/mapbender/http/classes/class_universal_gml_factory.php	2010-10-27 10:29:52 UTC (rev 7067)
@@ -64,9 +64,24 @@
 	 * @return Gml
 	 * @param $geoJson String
 	 */
-	public function createFromGeoJson ($geoJson) {
-		$gml2Factory = new Gml_2_Factory();
-		return $gml2Factory->createFromGeoJson($geoJson);
+	public function createFromGeoJson ($geoJson, $wfsConf = null) {
+		if (is_a($wfsConf, "WfsConfiguration")) {
+			$wfsFactory = new UniversalWfsFactory();
+			$myWfsFactory = $wfsFactory->createFromDb($wfsConf->wfsId);
+			if (is_a($myWfsFactory, "Wfs_1_1")) {
+				$gml3Factory = new Gml_3_Factory();
+				return $gml3Factory->createFromGeoJson($geoJson);
+			}
+			if (is_a($myWfsFactory, "Wfs_1_0")) {
+				$gml2Factory = new Gml_2_Factory();
+				return $gml2Factory->createFromGeoJson($geoJson);
+			}
+			throw new Exception ("UniversalGmlFactory: Unknown WFS version");
+		}
+		else {
+			$gml2Factory = new Gml_2_Factory();
+			return $gml2Factory->createFromGeoJson($geoJson);
+		}
 	}
 	
 	/**



More information about the Mapbender_commits mailing list