[fusion-commits] r2700 - sandbox/createruntimemap/layers/MapGuide/php

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue May 14 08:09:45 PDT 2013


Author: jng
Date: 2013-05-14 08:09:43 -0700 (Tue, 14 May 2013)
New Revision: 2700

Modified:
   sandbox/createruntimemap/layers/MapGuide/php/GetSelectionProperties.php
Log:
Load layer property mappings if not found in the PHP session stash, which would be the case if we took the CREATERUNTIMEMAP shortcut and bypassed LoadMap.php which would've pre-populated this information.

Modified: sandbox/createruntimemap/layers/MapGuide/php/GetSelectionProperties.php
===================================================================
--- sandbox/createruntimemap/layers/MapGuide/php/GetSelectionProperties.php	2013-05-14 14:55:11 UTC (rev 2699)
+++ sandbox/createruntimemap/layers/MapGuide/php/GetSelectionProperties.php	2013-05-14 15:09:43 UTC (rev 2700)
@@ -81,12 +81,17 @@
             //the one causing a problem when the properies are limited ?
             if (isset($_SESSION['property_mappings']) && isset($_SESSION['property_mappings'][$oLayer->GetObjectId()])) {
                 $mappings = $_SESSION['property_mappings'][$oLayer->GetObjectId()];
-                if (count($mappings) > 0) {
-                    foreach($mappings as $name => $value) {
-                        if ($geomName != $name) {
-                            $queryOptions->AddFeatureProperty($name);
-                            //echo "$name $value <br>\n";
-                        }
+            } else {
+                //This is normally pre-stashed by LoadMap.php, but if the client is using the new
+                //CREATERUNTIMEMAP shortcut, this information does not exist yet, so fetch and stash
+                $mappings = GetLayerPropertyMappings($resourceService, $oLayer);
+                $_SESSION['property_mappings'][$oLayer->GetObjectId()] = $mappings;
+            }
+            if (count($mappings) > 0) {
+                foreach($mappings as $name => $value) {
+                    if ($geomName != $name) {
+                        $queryOptions->AddFeatureProperty($name);
+                        //echo "$name $value <br>\n";
                     }
                 }
             }
@@ -108,33 +113,33 @@
             $srsLayer = NULL;
             if ($bComputedProperties)
             {
-        $spatialContext = $featureService->GetSpatialContexts($featureResId, true);
-        $srsLayerWkt = false;
-        if($spatialContext != null && $spatialContext->ReadNext() != null) {
-            $srsLayerWkt = $spatialContext->GetCoordinateSystemWkt();
-            /* skip this layer if the srs is empty */
-        }
-        if ($srsLayerWkt == null) {
-            $srsLayerWkt = $srsDefMap;
-        }
-        /* create a coordinate system from the layer's SRS wkt */
-        $srsLayer = $srsFactory->Create($srsLayerWkt);
+                $spatialContext = $featureService->GetSpatialContexts($featureResId, true);
+                $srsLayerWkt = false;
+                if($spatialContext != null && $spatialContext->ReadNext() != null) {
+                    $srsLayerWkt = $spatialContext->GetCoordinateSystemWkt();
+                    /* skip this layer if the srs is empty */
+                }
+                if ($srsLayerWkt == null) {
+                    $srsLayerWkt = $srsDefMap;
+                }
+                /* create a coordinate system from the layer's SRS wkt */
+                $srsLayer = $srsFactory->Create($srsLayerWkt);
 
-        // exclude layer if:
-        //  the map is non-arbitrary and the layer is arbitrary or vice-versa
-        //     or
-        //  layer and map are both arbitrary but have different units
-        //
-        $bLayerSrsIsArbitrary = ($srsLayer->GetType() == MgCoordinateSystemType::Arbitrary);
-        $bMapSrsIsArbitrary = ($srsMap->GetType() == MgCoordinateSystemType::Arbitrary);
-        if (($bLayerSrsIsArbitrary != $bMapSrsIsArbitrary) ||
-            ($bLayerSrsIsArbitrary && ($srsLayer->GetUnits() != $srsMap->GetUnits()))) {
-            $bComputedProperties = false;
-        } else {
-            $srsTarget = null;
-            $srsXform = null;
-            $bNeedsTransform = ($srsLayer->GetUnitScale() != 1.0);
-        }
+                // exclude layer if:
+                //  the map is non-arbitrary and the layer is arbitrary or vice-versa
+                //     or
+                //  layer and map are both arbitrary but have different units
+                //
+                $bLayerSrsIsArbitrary = ($srsLayer->GetType() == MgCoordinateSystemType::Arbitrary);
+                $bMapSrsIsArbitrary = ($srsMap->GetType() == MgCoordinateSystemType::Arbitrary);
+                if (($bLayerSrsIsArbitrary != $bMapSrsIsArbitrary) ||
+                    ($bLayerSrsIsArbitrary && ($srsLayer->GetUnits() != $srsMap->GetUnits()))) {
+                    $bComputedProperties = false;
+                } else {
+                    $srsTarget = null;
+                    $srsXform = null;
+                    $bNeedsTransform = ($srsLayer->GetUnitScale() != 1.0);
+                }
             }
 
             $properties = BuildSelectionArray($featureReader, $layerName, $properties,



More information about the fusion-commits mailing list