[fusion-commits] r2263 - in trunk/layers/MapServer: . php
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Oct 26 15:44:48 EDT 2010
Author: madair
Date: 2010-10-26 12:44:48 -0700 (Tue, 26 Oct 2010)
New Revision: 2263
Modified:
trunk/layers/MapServer/MapServer.js
trunk/layers/MapServer/php/Query.php
Log:
closes #410: only pass layers if QueryActiveLayer is set to true; otherwise do the queryByShape action through the map object; applied to trunk
Modified: trunk/layers/MapServer/MapServer.js
===================================================================
--- trunk/layers/MapServer/MapServer.js 2010-10-26 19:44:21 UTC (rev 2262)
+++ trunk/layers/MapServer/MapServer.js 2010-10-26 19:44:48 UTC (rev 2263)
@@ -802,7 +802,7 @@
var layers = options.layers || '';
/* if no layes are given, query only visible layers. This is ususally the most common case*/
if (layers == '') {
- layers = this.aVisibleLayers.join(',');
+ //layers = this.aVisibleLayers.join(',');
}
var zoomTo = options.zoomTo || false;
var sl = Fusion.getScriptLanguage();
Modified: trunk/layers/MapServer/php/Query.php
===================================================================
--- trunk/layers/MapServer/php/Query.php 2010-10-26 19:44:21 UTC (rev 2262)
+++ trunk/layers/MapServer/php/Query.php 2010-10-26 19:44:48 UTC (rev 2263)
@@ -103,55 +103,65 @@
$bAllLayers = false;
$nLayers = count($layers);
$nSelections = 0;
+
+$result = NULL;
+$result->hasSelection = false;
+$result->layers = array();
+
if ($nLayers == 0) {
$nLayers = $oMap->numlayers;
$bAllLayers = true;
-}
-$result = NULL;
-$result->hasSelection = false;
-$result->layers = array();
-for ($i=0; $i<$nLayers; $i++) {
- if (!$bAllLayers) {
- $oLayer = $oMap->GetLayerByName($layers[$i]);
- } else {
- $oLayer = $oMap->GetLayer($i);
- }
- $oLayer->set('tolerance', 0);
- if ($oLayer->type == MS_LAYER_RASTER || $oLayer->type == MS_LAYER_QUERY ||
- $oLayer->type == MS_LAYER_CIRCLE || $oLayer->type == MS_LAYER_CHART) {
- continue;
- }
+
if ($spatialFilter !== false ) {
- if (@$oLayer->queryByShape($oSpatialFilter) == MS_SUCCESS) {
- $result->hasSelection = true;
- $layerName = $oLayer->name;
- array_push($result->layers, $layerName);
- $result->$layerName->featureCount = $oLayer->getNumResults();
- //TODO: dump out the extents of the selection
+ if (@$oMap->queryByShape($oSpatialFilter) == MS_SUCCESS) {
+ $result->hasSelection = true;
}
}
- if ($filter !== false ) {
- if ($oLayer->connectiontype == MS_POSTGIS && $filterItem != '') {
- $f = $filter;
- $filter = $filterItem . ' IN (' . $filter . ')';
- }
- if (@$oLayer->queryByAttributes($filterItem,$filter,MS_MULTIPLE) == MS_SUCCESS) {
- //if (@$oLayer->queryByAttributes($filterItem,'([REG_CODE] eq 61)',MS_MULTIPLE) == MS_SUCCESS) {
- //if (@$oLayer->queryByAttributes('NAME_E','/.*Buffalo.*/gi',MS_MULTIPLE) == MS_SUCCESS) {
- $result->hasSelection = true;
- $layerName = $oLayer->name;
- array_push($result->layers, $layerName);
- $result->$layerName->featureCount = $oLayer->getNumResults();
- //TODO: dump out the extents of the selection
- }
- if ($oLayer->connectiontype == MS_POSTGIS && $filterItem != '') {
- $filter = $f;
- }
- }
-
- if ($bExtendSelection) {
- } else {
- }
+
+} else {
+ for ($i=0; $i<$nLayers; $i++) {
+ if (!$bAllLayers) {
+ $oLayer = $oMap->GetLayerByName($layers[$i]);
+ } else {
+ $oLayer = $oMap->GetLayer($i);
+ }
+ $oLayer->set('tolerance', 0);
+ if ($oLayer->type == MS_LAYER_RASTER || $oLayer->type == MS_LAYER_QUERY ||
+ $oLayer->type == MS_LAYER_CIRCLE || $oLayer->type == MS_LAYER_CHART) {
+ continue;
+ }
+ if ($spatialFilter !== false ) {
+ if (@$oLayer->queryByShape($oSpatialFilter) == MS_SUCCESS) {
+ $result->hasSelection = true;
+ $layerName = $oLayer->name;
+ array_push($result->layers, $layerName);
+ $result->$layerName->featureCount = $oLayer->getNumResults();
+ //TODO: dump out the extents of the selection
+ }
+ }
+ if ($filter !== false ) {
+ if ($oLayer->connectiontype == MS_POSTGIS && $filterItem != '') {
+ $f = $filter;
+ $filter = $filterItem . ' IN (' . $filter . ')';
+ }
+ if (@$oLayer->queryByAttributes($filterItem,$filter,MS_MULTIPLE) == MS_SUCCESS) {
+ //if (@$oLayer->queryByAttributes($filterItem,'([REG_CODE] eq 61)',MS_MULTIPLE) == MS_SUCCESS) {
+ //if (@$oLayer->queryByAttributes('NAME_E','/.*Buffalo.*/gi',MS_MULTIPLE) == MS_SUCCESS) {
+ $result->hasSelection = true;
+ $layerName = $oLayer->name;
+ array_push($result->layers, $layerName);
+ $result->$layerName->featureCount = $oLayer->getNumResults();
+ //TODO: dump out the extents of the selection
+ }
+ if ($oLayer->connectiontype == MS_POSTGIS && $filterItem != '') {
+ $filter = $f;
+ }
+ }
+
+ if ($bExtendSelection) {
+ } else {
+ }
+ }
}
if ($bExtendSelection) {
}
More information about the fusion-commits
mailing list