[Mapbender-commits] r3318 - branches/2.5/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Dec 15 08:30:12 EST 2008
Author: christoph
Date: 2008-12-15 08:30:12 -0500 (Mon, 15 Dec 2008)
New Revision: 3318
Modified:
branches/2.5/http/classes/class_gml2.php
branches/2.5/http/classes/class_wfs_conf.php
Log:
http://trac.osgeo.org/mapbender/ticket/347
but the bug is not fixed in 2.5.1, because mod_wfs_result doesn't yet use JSON (trunk does)
Modified: branches/2.5/http/classes/class_gml2.php
===================================================================
--- branches/2.5/http/classes/class_gml2.php 2008-12-15 13:27:27 UTC (rev 3317)
+++ branches/2.5/http/classes/class_gml2.php 2008-12-15 13:30:12 UTC (rev 3318)
@@ -35,6 +35,7 @@
var $geometry = array();
var $bbox = array();
var $doc;
+ var $geomFeaturetypeElement = null;
function gml2(){
@@ -55,8 +56,10 @@
}
function parseXML($data) {
-
- $this->doc = $data;
+ if (func_num_args() == 2) {
+ $this->geomFeaturetypeElement = func_get_arg(1);
+ }
+ $this->doc = $this->removeWhiteSpace($data);
return $this->toGeoJSON();
}
@@ -78,6 +81,7 @@
$gmlDoc = new SimpleXMLElement($this->doc);
$gmlDoc->registerXPathNamespace('xls', 'http://www.opengis.net/xls');
+ $gmlDoc->registerXPathNamespace('wfs', 'http://www.opengis.net/wfs');
$gmlDoc->registerXPathNamespace('gml', 'http://www.opengis.net/gml');
// build feature collection
@@ -92,7 +96,12 @@
$featureMember_dom = dom_import_simplexml($gmlFeatureMember);
$feature = new Feature();
- $feature->parse($featureMember_dom);
+ if ($this->geomFeaturetypeElement != null) {
+ $feature->parse($featureMember_dom, $this->geomFeaturetypeElement);
+ }
+ else {
+ $feature->parse($featureMember_dom);
+ }
if (isset($feature->geometry)) {
$featureCollection->addFeature($feature);
}
@@ -102,7 +111,7 @@
return $featureCollection->toGeoJSON();
}
else{
- return "{'errorMessage':'Kein Ergebnis'}";
+ return "{}";
}
}
@@ -421,6 +430,7 @@
var $fid;
var $geometry = false;
var $properties = array();
+ var $geomFeaturetypeElement = null;
public function __construct() {
}
@@ -475,6 +485,10 @@
* (<gml:featureMember> in the above example)
*/
public function parse($domNode) {
+ if (func_num_args() == 2) {
+ $this->geomFeaturetypeElement = func_get_arg(1);
+ }
+
$currentSibling = $domNode->firstChild;
$this->fid = $currentSibling->getAttribute("fid");
@@ -489,13 +503,15 @@
$namespace = $this->sepNameSpace($name);
$ns = $namespace['ns'];
$columnName = $namespace['value'];
+
+ $isGeomColumn = ($this->geomFeaturetypeElement == null || $columnName == $this->geomFeaturetypeElement);
// check if this node is a geometry node.
// however, even if it is a property node,
// it has a child node, the text node!
// So we might need to do something more
// sophisticated here...
- if ($currentSibling->hasChildNodes()){
+ if ($currentSibling->hasChildNodes() && $isGeomColumn){
$geomNode = $currentSibling->firstChild;
$geomType = $geomNode->nodeName;
switch ($geomType) {
@@ -580,7 +596,7 @@
}
}
- private function addPoint ($x, $y) {
+ protected function addPoint ($x, $y) {
array_push($this->pointArray, array("x" => $x, "y" => $y));
}
@@ -621,7 +637,7 @@
}
}
- private function setPoint ($x, $y) {
+ protected function setPoint ($x, $y) {
# echo "x: " . $x . " y: " . $y . "\n";
$this->point = array("x" => $x, "y" => $y);
}
@@ -675,7 +691,7 @@
}
- private function addPoint ($x, $y) {
+ protected function addPoint ($x, $y) {
array_push($this->pointArray, array("x" => $x, "y" => $y));
}
@@ -735,8 +751,7 @@
}
- private function addPoint ($x, $y, $i) {
-
+ protected function addPoint ($x, $y, $i) {
array_push($this->lineArray[$i], array("x" => $x, "y" => $y));
}
@@ -807,7 +822,7 @@
}
- private function addPoint ($x, $y, $i) {
+ protected function addPoint ($x, $y, $i) {
array_push($this->polygonArray[$i], array("x" => $x, "y" => $y));
}
@@ -841,4 +856,4 @@
return $str;
}
}
-?>
\ No newline at end of file
+?>
Modified: branches/2.5/http/classes/class_wfs_conf.php
===================================================================
--- branches/2.5/http/classes/class_wfs_conf.php 2008-12-15 13:27:27 UTC (rev 3317)
+++ branches/2.5/http/classes/class_wfs_conf.php 2008-12-15 13:30:12 UTC (rev 3318)
@@ -49,7 +49,7 @@
// parameter is a number
if (!is_array($idOrIdArray) && is_numeric($idOrIdArray)) {
- $idArray = array(intval($idOrIdArray));
+ $idOrIdArray = array(intval($idOrIdArray));
}
// parameter is an array of numbers
@@ -69,7 +69,7 @@
$idArray = array_intersect($idArray, $user->getWfsConfByPermission());
}
- return $this->getWfsConfFromDB($idArray);
+ return $this->getWfsConfFromDbByArray($idArray);
}
// parameter is invalid
else {
More information about the Mapbender_commits
mailing list