[fusion-commits] r2523 - in trunk: layers/MapGuide/php widgets/FeatureInfo widgets/SelectWithin

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Jan 20 00:16:28 EST 2012


Author: liuar
Date: 2012-01-19 21:16:28 -0800 (Thu, 19 Jan 2012)
New Revision: 2523

Modified:
   trunk/layers/MapGuide/php/GetSelectionProperties.php
   trunk/layers/MapGuide/php/Query.php
   trunk/layers/MapGuide/php/Selection.php
   trunk/layers/MapGuide/php/Utilities.php
   trunk/widgets/FeatureInfo/featureinfocontroller.php
   trunk/widgets/SelectWithin/SelectWithin.php
Log:
On behalf of Spark Liu: Fix ticket #517 - Feature info doesn't work
This is because when fixing problem of selecting layer 0. We change the way to collect features by adding a prefix before layer name. We changed all the places we thought which use that function. However, we missed those in widget folder. That's why the problem shows.
Also in feature info, there should not a prefix before layer name. So to fix both problems, we add a parameter in collect feature function indicating whether to add parameter or not.


Modified: trunk/layers/MapGuide/php/GetSelectionProperties.php
===================================================================
--- trunk/layers/MapGuide/php/GetSelectionProperties.php	2012-01-19 02:32:07 UTC (rev 2522)
+++ trunk/layers/MapGuide/php/GetSelectionProperties.php	2012-01-20 05:16:28 UTC (rev 2523)
@@ -136,7 +136,7 @@
 
             $properties = BuildSelectionArray($featureReader, $layerName, $properties,
                                               $bComputedProperties,
-                                              $srsLayer, $bNeedsTransform, $oLayer);
+                                              $srsLayer, $bNeedsTransform, $oLayer, true);
             $featureReader->Close();
         }
 

Modified: trunk/layers/MapGuide/php/Query.php
===================================================================
--- trunk/layers/MapGuide/php/Query.php	2012-01-19 02:32:07 UTC (rev 2522)
+++ trunk/layers/MapGuide/php/Query.php	2012-01-20 05:16:28 UTC (rev 2523)
@@ -261,7 +261,7 @@
                 $featureReader = $featureService->SelectFeatures($featureResId, $class, $queryOptions);
                 $properties = BuildSelectionArray($featureReader, $layerName, $properties,
                                                   $bComputedProperties,
-                                                  $srsLayer, $bNeedsTransform, $layerObj);
+                                                  $srsLayer, $bNeedsTransform, $layerObj, true);
                 $featureReader->Close();
             }
         } catch (MgObjectNotFoundException $onfe) {
@@ -343,7 +343,7 @@
 
                 $properties = BuildSelectionArray($featureReader, $layerName, $properties,
                                                   $bComputedProperties,
-                                                  $srsLayer, $bNeedsTransform, $oLayer);
+                                                  $srsLayer, $bNeedsTransform, $oLayer, true);
                 $featureReader->Close();
             }
         }

Modified: trunk/layers/MapGuide/php/Selection.php
===================================================================
--- trunk/layers/MapGuide/php/Selection.php	2012-01-19 02:32:07 UTC (rev 2522)
+++ trunk/layers/MapGuide/php/Selection.php	2012-01-20 05:16:28 UTC (rev 2523)
@@ -78,7 +78,7 @@
         for ($i=0; $i<count($aSelectedLayers); $i++)
         {
             $layerName =  $aSelectedLayers[$i];
-            $layerNameInProperties = GetLayerNameInProperties($layerName);
+            $layerNameInProperties = GetEncodedLayerName($layerName);
             if (($bAllLayers || in_array($layerName, $aLayers)) &&
                 isset($properties->$layerNameInProperties) &&
                 $properties->$layerNameInProperties->numelements > 0)

Modified: trunk/layers/MapGuide/php/Utilities.php
===================================================================
--- trunk/layers/MapGuide/php/Utilities.php	2012-01-19 02:32:07 UTC (rev 2522)
+++ trunk/layers/MapGuide/php/Utilities.php	2012-01-20 05:16:28 UTC (rev 2523)
@@ -754,21 +754,26 @@
     return $val;
 }
 
-function GetLayerNameInProperties($layerName)
+function GetEncodedLayerName($layerName)
 {
-	return 'layer'.$layerName;    // Add prefix to avoid layer name beginning with number
+    return 'layer'.$layerName;    // Add prefix to avoid layer name beginning with number
 }
 
 /**
    keep all the attributes of selected features in an array
  */
 function BuildSelectionArray($featureReader, $layerName, $properties, $bComputedProperties,
-                             $srsLayer, $bNeedsTransform, $layerObj)
+                             $srsLayer, $bNeedsTransform, $layerObj, $isLayerNameEncoded)
 {
     $agf = new MgAgfReaderWriter();
     $srsFactory = new MgCoordinateSystemFactory();
     
-    $layerName = GetLayerNameInProperties($layerName);    // Add prefix to avoid layer name beginning with number
+    if($isLayerNameEncoded)
+    {
+        // Add prefix to avoid layer name beginning with number
+        // So $isLayerNameEncoded should be true when and only when the properties will be stored in session
+        $layerName = GetEncodedLayerName($layerName);    
+    }
 
     $properties->$layerName->propertynames = array();
     $properties->$layerName->propertyvalues = array();

Modified: trunk/widgets/FeatureInfo/featureinfocontroller.php
===================================================================
--- trunk/widgets/FeatureInfo/featureinfocontroller.php	2012-01-19 02:32:07 UTC (rev 2522)
+++ trunk/widgets/FeatureInfo/featureinfocontroller.php	2012-01-20 05:16:28 UTC (rev 2523)
@@ -93,7 +93,7 @@
                   $srsXform = null;
                   $bNeedsTransform = ($srsLayer->GetUnitScale() != 1.0);
               }
-              $properties = BuildSelectionArray($featureReader, $layerName, $properties, true, $srsLayer, $bNeedsTransform, $layer);
+              $properties = BuildSelectionArray($featureReader, $layerName, $properties, true, $srsLayer, $bNeedsTransform, $layer, false);
 
         }
 

Modified: trunk/widgets/SelectWithin/SelectWithin.php
===================================================================
--- trunk/widgets/SelectWithin/SelectWithin.php	2012-01-19 02:32:07 UTC (rev 2522)
+++ trunk/widgets/SelectWithin/SelectWithin.php	2012-01-20 05:16:28 UTC (rev 2523)
@@ -112,7 +112,7 @@
                 $options->SetFilter($resultSel->GenerateFilter($layer, $layerClassName));
                 $resourceId = new MgResourceIdentifier($layer->GetFeatureSourceId());
                 $featureReader = $featureSrvc->SelectFeatures($resourceId, $layerClassName, $options);
-                $properties = BuildSelectionArray($featureReader, $layerName, $properties, false, NULL, false, $layer);
+                $properties = BuildSelectionArray($featureReader, $layerName, $properties, false, NULL, false, $layer, true);
                 $featureReader->Close();
                 array_push($result->layers, $layerName);
                 array_push($properties->layers, $layerName);



More information about the fusion-commits mailing list