[fusion-commits] r2944 - in branches/fusion-mg30: . layers/MapGuide/php lib widgets widgets/Search widgets/SelectWithin widgets/widgetinfo

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed May 4 10:53:31 PDT 2016


Author: jng
Date: 2016-05-04 10:53:31 -0700 (Wed, 04 May 2016)
New Revision: 2944

Modified:
   branches/fusion-mg30/
   branches/fusion-mg30/layers/MapGuide/php/Utilities.php
   branches/fusion-mg30/lib/Map.js
   branches/fusion-mg30/widgets/BasemapSwitcher.js
   branches/fusion-mg30/widgets/Search.js
   branches/fusion-mg30/widgets/Search/Search.php
   branches/fusion-mg30/widgets/Search/Search.templ
   branches/fusion-mg30/widgets/Search/SearchPrompt.php
   branches/fusion-mg30/widgets/Search/SearchPrompt.templ
   branches/fusion-mg30/widgets/SelectWithin.js
   branches/fusion-mg30/widgets/SelectWithin/SelectWithin.php
   branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.php
   branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.templ
   branches/fusion-mg30/widgets/widgetinfo/measure.xml
   branches/fusion-mg30/widgets/widgetinfo/search.xml
   branches/fusion-mg30/widgets/widgetinfo/selectwithin.xml
Log:
Merged revision(s) 2936-2942 from trunk:
#645: Fix measure not measuring in units other than meters (whatever configured unit was being clobbered by the Map widget). Also expand the list of supported units in the widgetinfo.
........
Fix some PHP warnings/errors:
 - Not initializing arbitrary objects with "new stdClass()"
 - Blindly accessing 'property_mappings' of $_SESSION without first checking if it exists first.
........
#647: Remove support for the long shut down Yahoo Maps service from BasemapSwitcher widget

Also clean up the documentation for this widget.
........
Clear up search widgetinfo
........
#641: Add support for zooming of point features in Search widget through a new PointZoomLevel property. Because point features don't have a bounding box, the default zoom to selection behaviour (which is extent-based) does nothing for points. This submission adds a separate point cell click handler for point-feature search results, that will compute an appropriate extent from (x, y, PointZoomLevel) and zoom to that extent. Through the new widget extension property, the author can customize the zoom level of this widget based on the map they intend to use this widget for.
........
#638: Fix "headers already sent" PHP error on large selections. Patch by morkl, reviewed and verified by me.
........
#637: Allow invisible layers to be hidden from the layer list of the Select Within UI. This behaviour can be toggled through a new OmitInvisibleLayers extension property. The default value is false, preserving the existing behaviour.

Original patch by morkl, tweaked by me to allow for configurability and to avoid usage of browser APIs that are not uniform across browsers (Array.prototype.filter)
........



Property changes on: branches/fusion-mg30
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/adsk/2.6l:2911
/sandbox/adsk/3.1n:2925-2927
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/stamen:2873-2875
/sandbox/tiling:2845-2846
/trunk:2896-2899,2905-2908,2915,2920-2932
   + /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/adsk/2.6l:2911
/sandbox/adsk/3.1n:2925-2927
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/stamen:2873-2875
/sandbox/tiling:2845-2846
/trunk:2896-2899,2905-2908,2915,2920-2932,2936-2942

Modified: branches/fusion-mg30/layers/MapGuide/php/Utilities.php
===================================================================
--- branches/fusion-mg30/layers/MapGuide/php/Utilities.php	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/layers/MapGuide/php/Utilities.php	2016-05-04 17:53:31 UTC (rev 2944)
@@ -791,7 +791,7 @@
     array_push($properties->$layerName->metadatanames, 'area');
     array_push($properties->$layerName->metadatanames, 'length');
 
-    if (isset($_SESSION)) {
+    if (isset($_SESSION) && array_key_exists('property_mappings', $_SESSION)) {
         $mappings = $_SESSION['property_mappings'][$layerObj->GetObjectId()];    
         foreach((array)$mappings as $name => $value)
         {

Modified: branches/fusion-mg30/lib/Map.js
===================================================================
--- branches/fusion-mg30/lib/Map.js	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/lib/Map.js	2016-05-04 17:53:31 UTC (rev 2944)
@@ -337,7 +337,6 @@
             fillOpacity: 0.4,
             strokeWidth: 2,
             strokeOpacity: 1,
-            strokeColor: "#666666",
             strokeColor: "#666666"
         }));
         this.keyHandler = OpenLayers.Function.bind(this.onKeyPress, this);
@@ -1461,17 +1460,21 @@
      *
      */
     setWidgetParam: function(param, data) {
-      for (var i=0; i<Fusion.applicationDefinition.widgetSets.length; ++i) {
-        var widgetSet = Fusion.applicationDefinition.widgetSets[i];
-        for (var j=0; j<widgetSet.widgetInstances.length; ++j) {
-          var widget = widgetSet.widgetInstances[j];
-          for (var k=0; k<widget.paramRegister.length; ++k) {
-            if (widget.paramRegister[k] == param) {
-              widget.setParameter(param, data);
+        for (var i = 0; i < Fusion.applicationDefinition.widgetSets.length; ++i) {
+            var widgetSet = Fusion.applicationDefinition.widgetSets[i];
+            for (var j = 0; j < widgetSet.widgetInstances.length; ++j) {
+                var widget = widgetSet.widgetInstances[j];
+                // Respect the unit value of the measure widget
+                if (widget.type == "Measure" && param == "Units") {
+                    continue;
+                }
+                for (var k = 0; k < widget.paramRegister.length; ++k) {
+                    if (widget.paramRegister[k] == param) {
+                        widget.setParameter(param, data);
+                    }
+                }
             }
-          }
         }
-      }
     },
 
     /**

Modified: branches/fusion-mg30/widgets/BasemapSwitcher.js
===================================================================
--- branches/fusion-mg30/widgets/BasemapSwitcher.js	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/BasemapSwitcher.js	2016-05-04 17:53:31 UTC (rev 2944)
@@ -16,10 +16,21 @@
  * Class: Fusion.Widget.BasemapSwitcher
  *
  * A widget to allow selection of the basemaps display under the overlay MapGuide layer
- * Currently, Google Street, Google Satellite, Google Hybrid, Yahoo Street, Yahoo Satellite,
- * Yahoo Hybrid, OpenStreetMap Mapnik, OpenStreetMap Cycle, OpenStreetMap Transport,
- * Bing Street, Bing Satellite and Bing Hybrid is supported. 
+ * Currently the following basemaps are supported:
  * 
+ *  - Google Street
+ *  - Google Satellite
+ *  - Google Hybrid
+ *  - OpenStreetMap Mapnik
+ *  - OpenStreetMap CycleMap
+ *  - OpenStreetMap Transport
+ *  - Bing Street
+ *  - Bing Satellite
+ *  - Bing Hybrid
+ *  - Stamen Toner
+ *  - Stamen Watercolor
+ *  - Stamen Terrain
+ * 
  *  Inherits from:
  *  - <Fusion.Widget>
  ****************************************************************************/
@@ -42,9 +53,6 @@
         'G_SATELLITE_MAP': 0,
         'G_HYBRID_MAP': 0,
         'G_PHYSICAL_MAP': 0,
-        'YAHOO_MAP_REG': 0,
-        'YAHOO_MAP_SAT': 0,
-        'YAHOO_MAP_HYB': 0,
         'Road': -1,
         'Aerial': -1,
         'Hybrid': -1,
@@ -68,9 +76,6 @@
             'G_SATELLITE_MAP': null,
             'G_HYBRID_MAP': null,
             'G_PHYSICAL_MAP': null,
-            'YAHOO_MAP_REG': null,
-            'YAHOO_MAP_SAT': null,
-            'YAHOO_MAP_HYB': null,
             'Road': null,
             'Aerial': null,
             'Hybrid': null,
@@ -152,56 +157,6 @@
                         }
                     }
                     break;
-
-                case 'Yahoo':
-                    // if user didn't indicate basemap types, use the default Yahoo Street
-                    if (!map.mapTag.extension.Options || !map.mapTag.extension.Options[0].type) {
-                        this.options['YAHOO_MAP_REG'] = OpenLayers.i18n('yahooStreet');
-                        this.baseMaps['YAHOO_MAP_REG'] = map;
-
-                        // The first non-MapGuide basemap will be the default basemap
-                        if (!this.defaultBasemap) {
-                            this.defaultBasemap = "YAHOO_MAP_REG";
-                        }
-                    }
-                    else {
-                        switch (map.mapTag.extension.Options[0].type[0]) {
-                            case 'YAHOO_MAP_REG':
-                                if (map.mapTag.extension.Options[0].name) {
-                                    this.options['YAHOO_MAP_REG'] = map.mapTag.extension.Options[0].name[0];
-                                }
-                                else {
-                                    this.options['YAHOO_MAP_REG'] = "Yahoo Street";
-                                }
-                                this.baseMaps['YAHOO_MAP_REG'] = map;
-                                break;
-                            case 'YAHOO_MAP_SAT':
-                                if (map.mapTag.extension.Options[0].name) {
-                                    this.options['YAHOO_MAP_SAT'] = map.mapTag.extension.Options[0].name[0];
-                                }
-                                else {
-                                    this.options['YAHOO_MAP_SAT'] = OpenLayers.i18n('yahooStreet');
-                                }
-                                this.baseMaps['YAHOO_MAP_SAT'] = map;
-                                break;
-                            case 'YAHOO_MAP_HYB':
-                                if (map.mapTag.extension.Options[0].name) {
-                                    this.options['YAHOO_MAP_HYB'] = map.mapTag.extension.Options[0].name[0];
-                                }
-                                else {
-                                    this.options['YAHOO_MAP_HYB'] = OpenLayers.i18n('yahooHybrid');
-                                }
-                                this.baseMaps['YAHOO_MAP_HYB'] = map;
-                                break;
-                            default:
-                                break;
-                        }
-                        // The first non-MapGuide basemap will be the default basemap
-                        if (!this.defaultBasemap) {
-                            this.defaultBasemap = map.mapTag.extension.Options[0].type[0];
-                        }
-                    }
-                    break;
                 case 'VirtualEarth':
                     // if user didn't indicate basemap types, use the default Bing Street
                     if (!map.mapTag.extension.Options || !map.mapTag.extension.Options[0].type) {


Property changes on: branches/fusion-mg30/widgets/BasemapSwitcher.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/fusion-mg24/widgets/BasemapSwitcher.js:2560
/sandbox/adsk/2.4j/widgets/BasemapSwitcher.js:2486-2526
/sandbox/createruntimemap/widgets/BasemapSwitcher.js:2699-2708
/sandbox/jxlib-3.0/widgets/BasemapSwitcher.js:1957-2248
/sandbox/ol213/widgets/BasemapSwitcher.js:2801-2803
/sandbox/robust_error_handling/widgets/BasemapSwitcher.js:2818-2825
/sandbox/stamen/widgets/BasemapSwitcher.js:2873-2875
/trunk/widgets/BasemapSwitcher.js:2469-2485
   + /branches/fusion-mg24/widgets/BasemapSwitcher.js:2560
/sandbox/adsk/2.4j/widgets/BasemapSwitcher.js:2486-2526
/sandbox/createruntimemap/widgets/BasemapSwitcher.js:2699-2708
/sandbox/jxlib-3.0/widgets/BasemapSwitcher.js:1957-2248
/sandbox/ol213/widgets/BasemapSwitcher.js:2801-2803
/sandbox/robust_error_handling/widgets/BasemapSwitcher.js:2818-2825
/sandbox/stamen/widgets/BasemapSwitcher.js:2873-2875
/trunk/widgets/BasemapSwitcher.js:2469-2485,2936-2942

Modified: branches/fusion-mg30/widgets/Search/Search.php
===================================================================
--- branches/fusion-mg30/widgets/Search/Search.php	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/Search/Search.php	2016-05-04 17:53:31 UTC (rev 2944)
@@ -58,6 +58,7 @@
     $resProps = array();
     $matchLimit = "";
     $features = NULL;
+    $pointZoom = 500.0;
 
     GetRequestParameters();
     SetLocalizedFilesPath(GetLocalizationPath());
@@ -132,6 +133,36 @@
             print sprintf($templ, $colCount, $target, $popup, $mapName);
 
             $classDef = $features->GetClassDefinition();
+            $clsProps = $classDef->GetProperties();
+            $geomName = $classDef->GetDefaultGeometryPropertyName();
+            $bHasPoint = false;
+            $xform = NULL; // layer -> map transform
+            $agfRw = new MgAgfReaderWriter();
+            if ($geomName != NULL && $geomName != "") {
+                $gidx = $clsProps->IndexOf($geomName);
+                if ($gidx >= 0) {
+                    $geomProp = $clsProps->GetItem($gidx);
+                    if ($geomProp->GetGeometryTypes() & MgFeatureGeometricType::Point == MgFeatureGeometricType::Point) {
+                        $bHasPoint = true;
+                        // Set layer -> map transform if required
+                        $scReader = $featureSrvc->GetSpatialContexts($srcId, false);
+                        while ($scReader->ReadNext()) {
+                            if ($scReader->GetName() == $geomProp->GetSpatialContextAssociation()) {
+                                $csFactory = new MgCoordinateSystemFactory();
+                                try {
+                                    $mapCs = $csFactory->Create($map->GetMapSRS());
+                                    $layerCs = $csFactory->Create($scReader->GetCoordinateSystemWkt());
+                                    $xform = $csFactory->GetTransform($layerCs, $mapCs);
+                                } catch (MgException $ex) {
+                                    
+                                }
+                            }
+                        }
+                        $scReader->Close();
+                    }
+                }
+            }
+            
             $idProps = $classDef->GetIdentityProperties();
             $idPropNames = array();
             for($j = 0; $j < $idProps->GetCount(); $j++)
@@ -235,7 +266,23 @@
                     $sel->AddFeatureIds($layer, $featureClassName, $idProps);
                     $selText = EscapeForHtml($sel->ToXml(), true);
 
-                    echo sprintf("<td class=\"%s\" id=\"%d:%d\" onmousemove=\"SelectRow(%d)\" onclick=\"CellClicked('%s')\"> %s</td>\n", !($row%2)? "Search" : "Search2", $row, $i, $row, $selText, $val);
+                    //For points, we want to wire up a different cell click handler
+                    if ($bHasPoint) {
+                        try {
+                            $agf = $features->GetGeometry($geomName);
+                            $geom = $agfRw->Read($agf, $xform);
+                            if ($geom->GetGeometryType() == MgGeometryType::Point) {
+                                $coord = $geom->GetCoordinate();
+                                $x = $coord->GetX();
+                                $y = $coord->GetY();
+                            }
+                            echo sprintf("<td class=\"%s\" id=\"%d:%d\" onmousemove=\"SelectRow(%d)\" onclick=\"PointCellClicked('%s', %g, %g, %g)\"> %s</td>\n", !($row%2)? "Search" : "Search2", $row, $i, $row, $selText, $x, $y, $pointZoom, $val);
+                        } catch (MgException $ex) {
+                            echo sprintf("<td class=\"%s\" id=\"%d:%d\" onmousemove=\"SelectRow(%d)\" onclick=\"CellClicked('%s')\"> %s</td>\n", !($row%2)? "Search" : "Search2", $row, $i, $row, $selText, $val);
+                        }
+                    } else {
+                        echo sprintf("<td class=\"%s\" id=\"%d:%d\" onmousemove=\"SelectRow(%d)\" onclick=\"CellClicked('%s')\"> %s</td>\n", !($row%2)? "Search" : "Search2", $row, $i, $row, $selText, $val);
+                    }
                 }
                 echo "</tr>";
                 if (++ $row == $matchLimit)
@@ -290,6 +337,7 @@
 {
     global $userInput, $target, $layerName, $popup, $locale;
     global $mapName, $sessionId, $filter, $resNames, $resProps, $matchLimit;
+    global $pointZoom;
 
     if(isset($params['locale']))
         $locale = $params['locale'];
@@ -310,6 +358,9 @@
             array_push($resProps, $params['CP' . $i]);
         }
     }
+    if (isset($params['pointZoom'])) {
+        $pointZoom = $params['pointZoom'];
+    }
 }
 
 function GetRequestParameters()

Modified: branches/fusion-mg30/widgets/Search/Search.templ
===================================================================
--- branches/fusion-mg30/widgets/Search/Search.templ	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/Search/Search.templ	2016-05-04 17:53:31 UTC (rev 2944)
@@ -86,6 +86,14 @@
     map.setSelection(sel, true);
 }
 
+function PointCellClicked(sel, x, y, zoom)
+{
+    var map = GetParent().Fusion.getMapByName(mapName);
+    map.setSelection(sel, true);
+    var extents = map.mapWidget.getExtentFromPoint(x, y, zoom);
+    map.mapWidget.setExtents(extents);
+}
+
 function highlightRow(index, mode)
 {
     for(var i=0; i < colCount; i++)

Modified: branches/fusion-mg30/widgets/Search/SearchPrompt.php
===================================================================
--- branches/fusion-mg30/widgets/Search/SearchPrompt.php	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/Search/SearchPrompt.php	2016-05-04 17:53:31 UTC (rev 2944)
@@ -37,6 +37,7 @@
     $mapName = "";
     $sessionId = "";
     $widgetName = "";
+    $pointZoomLevel = 500.0;
 
     GetRequestParameters();
 
@@ -44,7 +45,7 @@
     SetLocalizedFilesPath(GetLocalizationPath());
     $templ = Localize($templ, $locale, GetClientOS());
     $vpath = GetSurroundVirtualPath();
-    print sprintf($templ, $popup, $properties, $propNames, $title, $prompt, $target, $filter, $layer, $limit, $vpath."Search.php", $mapName, $sessionId, $locale);
+    print sprintf($templ, $popup, $properties, $propNames, $title, $prompt, $target, $filter, $layer, $limit, $vpath."Search.php", $mapName, $sessionId, $locale, $pointZoomLevel);
 
 
 
@@ -54,6 +55,7 @@
     global $mapName, $sessionId;
     global $title, $prompt, $target, $filter, $layer, $limit;
     global $propNames, $properties;
+    global $pointZoomLevel;
 
     if(isset($params['locale'])) {
         $locale = $params['locale'];
@@ -69,6 +71,9 @@
     $filter = $params['filter'];
     $layer = $params['layer'];
     $limit = $params['limit'];
+    if (isset($params['pointZoomLevel'])) {
+        $pointZoomLevel = $params['pointZoomLevel'];
+    }
 }
 
 function GetRequestParameters()

Modified: branches/fusion-mg30/widgets/Search/SearchPrompt.templ
===================================================================
--- branches/fusion-mg30/widgets/Search/SearchPrompt.templ	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/Search/SearchPrompt.templ	2016-05-04 17:53:31 UTC (rev 2944)
@@ -122,6 +122,7 @@
         <input type="hidden" name="layer" id="layer">
         <input type="hidden" name="filter" id="filter">
         <input type="hidden" name="limit" id="limit">
+        <input type="hidden" name="pointZoom" id="pointZoom" value="%s">
         <div id="MatchLabel">
         </div>
         <br><br>

Modified: branches/fusion-mg30/widgets/Search.js
===================================================================
--- branches/fusion-mg30/widgets/Search.js	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/Search.js	2016-05-04 17:53:31 UTC (rev 2944)
@@ -50,6 +50,7 @@
         this.limit = json.MatchLimit ? json.MatchLimit[0] : 100;
         this.resultColumns = json.ResultColumns ? json.ResultColumns[0].Column : [];
         this.title = json.Title ? json.Title[0] : widgetTag.label;
+        this.pointZoomLevel = json.PointZoomLevel ? json.PointZoomLevel[0] : 500.0;
     },
 
     activate: function() {
@@ -75,6 +76,7 @@
         params.push('filter='+this.filter);
         params.push('layer='+this.layer);
         params.push('limit='+this.limit);
+        params.push('pointZoomLevel='+this.pointZoomLevel);
         var names = [];
         var props = [];
         for (var i=0; i<this.resultColumns.length; ++i) {

Modified: branches/fusion-mg30/widgets/SelectWithin/SelectWithin.php
===================================================================
--- branches/fusion-mg30/widgets/SelectWithin/SelectWithin.php	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/SelectWithin/SelectWithin.php	2016-05-04 17:53:31 UTC (rev 2944)
@@ -42,6 +42,7 @@
   GetRequestParameters();
 
   try {
+    ob_start();
     $featureSrvc = $siteConnection->CreateService(MgServiceType::FeatureService);
     $renderingSrvc = $siteConnection->CreateService(MgServiceType::RenderingService);
 
@@ -50,11 +51,11 @@
     $map->Open($mapName);
 
     //object to hold response
-    $result = NULL;
+    $result = new stdClass();
     $result->hasSelection = false;
 
     /*holds selection array*/
-    $properties = NULL;
+    $properties = new stdClass();
     $properties->layers = array();
 
     $layers = explode(",", $layers);
@@ -88,14 +89,14 @@
               if ($oExtents) {
                 $oMin = $oExtents->GetLowerLeftCoordinate();
                 $oMax = $oExtents->GetUpperRightCoordinate();
-                $result->extents = NULL;
+                $result->extents = new stdClass();
                 $result->extents->minx = $oMin->GetX();
                 $result->extents->miny = $oMin->GetY();
                 $result->extents->maxx = $oMax->GetX();
                 $result->extents->maxy = $oMax->GetY();
 
                 /*keep the full extents of the selection when saving the selection in the session*/
-                $properties->extents = NULL;
+                $properties->extents = new stdClass();
                 $properties->extents->minx = $oMin->GetX();
                 $properties->extents->miny = $oMin->GetY();
                 $properties->extents->maxx = $oMax->GetX();
@@ -117,6 +118,7 @@
                 array_push($result->layers, $layerName);
                 array_push($properties->layers, $layerName);
                 $count = $resultSel->GetSelectedFeaturesCount($layer, $layerClassName);
+                $result->$layerName = new stdClass();
                 $result->$layerName->featureCount = $count;
               }
 
@@ -131,10 +133,13 @@
 
     //return XML
     header("Content-type: text/xml");
+    ob_end_flush();
   } catch(MgException $e) {
+    ob_end_clean();
     echo "\nException: " . $e->GetDetails();
     return;
   } catch(Exception $ne) {
+    ob_end_clean();
     return;
   }
 

Modified: branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.php
===================================================================
--- branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.php	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.php	2016-05-04 17:53:31 UTC (rev 2944)
@@ -36,24 +36,27 @@
     $popup = "";
     $mapName = "";
     $sessionId = "";
+    $bOmitInvisibleLayers = false;
 
     GetRequestParameters();
 
     $templ = file_get_contents("./SelectWithinPanel.templ");
     SetLocalizedFilesPath(GetLocalizationPath());
     $templ = Localize($templ, $locale, GetClientOS());
-    print sprintf($templ, $popup, "./widgets/SelectWithin/SelectWithin.php", $mapName, $sessionId);
+    print sprintf($templ, $popup, "./widgets/SelectWithin/SelectWithin.php", $mapName, $sessionId, ($bOmitInvisibleLayers ? "true" : "false"));
 
 
 function GetParameters($params)
 {
-    global $mapName, $sessionId, $locale, $popup;
+    global $mapName, $sessionId, $locale, $popup, $bOmitInvisibleLayers;
 
-    if(isset($params['locale']))
+    if (isset($params['locale']))
         $locale = $params['locale'];
     $mapName = $params['mapname'];
     $sessionId = $params['session'];
     $popup = $params['popup'];
+    if (isset($params['omit_invisible_layers']))
+        $bOmitInvisibleLayers = ($params['omit_invisible_layers'] == "1");
 }
 
 function GetRequestParameters()

Modified: branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.templ
===================================================================
--- branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.templ	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/SelectWithin/SelectWithinPanel.templ	2016-05-04 17:53:31 UTC (rev 2944)
@@ -40,6 +40,7 @@
 var webAgent = '%s';
 var mapName = '%s';
 var sessionId = '%s';
+var bOmitInvisibleLayers = %s;
 var zoomTo = false;
 
 function InitDocument()
@@ -119,13 +120,39 @@
     }
 }
 
+function CheckVisibility(groupOrLayer)
+{
+    if (!groupOrLayer.isVisible())
+        return false;
+    if (groupOrLayer.parentGroup)
+        return CheckVisibility(groupOrLayer.parentGroup);
+    return true;
+}
+
+function GetSelectableLayers(layers)
+{
+    if (bOmitInvisibleLayers) {
+        var filtered = [];
+        for (var i = 0; i < layers.length; i++) {
+            var groupOrLayer = layers[i];
+            if (CheckVisibility(groupOrLayer))
+            {
+                filtered.push(groupOrLayer);
+            }
+        }
+        return filtered;
+    } else {
+        return layers;
+    }
+}
+
 function FillLayerList()
 {
     var list = document.getElementById("layers");
     var listNames = document.getElementById("layerNames");
     list.options.length = 0;
     var map = GetParent().Fusion.getMapByName(mapName);
-    var layers = map.getSelectableLayers();
+    var layers = GetSelectableLayers(map.getSelectableLayers());
     if(layers.length > 0) {
       for(var i = 0; i < layers.length; i++) {
         var layer = layers[i];

Modified: branches/fusion-mg30/widgets/SelectWithin.js
===================================================================
--- branches/fusion-mg30/widgets/SelectWithin.js	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/SelectWithin.js	2016-05-04 17:53:31 UTC (rev 2944)
@@ -45,7 +45,9 @@
         this.bSelectionOnly = (json.DisableIfSelectionEmpty &&
                            (json.DisableIfSelectionEmpty[0] == 'true' ||
                             json.DisableIfSelectionEmpty[0] == '1')) ? true : false;
-                            
+        this.bOmitInvisibleLayers = (json.OmitInvisibleLayers &&
+                           (json.OmitInvisibleLayers[0] == 'true' ||
+                            json.OmitInvisibleLayers[0] == '1')) ? true : false;
         this.additionalParameters = [];
         if (json.AdditionalParameter) {
             for (var i=0; i<json.AdditionalParameter.length; i++) {
@@ -104,6 +106,7 @@
         } else {
           params.push('popup=true');
         }
+        params.push('omit_invisible_layers=' + (this.bOmitInvisibleLayers ? "1" : "0"));
         params = params.concat(this.additionalParameters);
 
         if (url.indexOf('?') < 0) {

Modified: branches/fusion-mg30/widgets/widgetinfo/measure.xml
===================================================================
--- branches/fusion-mg30/widgets/widgetinfo/measure.xml	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/widgetinfo/measure.xml	2016-05-04 17:53:31 UTC (rev 2944)
@@ -27,6 +27,34 @@
       <Name>Degrees</Name>
       <Label>Degrees</Label>
     </AllowedValue>
+    <AllowedValue>
+      <Name>Kilometers</Name>
+      <Label>Kilometers</Label>
+    </AllowedValue>
+    <AllowedValue>
+      <Name>Feet</Name>
+      <Label>Feet</Label>
+    </AllowedValue>
+    <AllowedValue>
+      <Name>Inches</Name>
+      <Label>Inches</Label>
+    </AllowedValue>
+    <AllowedValue>
+      <Name>Nautical Miles</Name>
+      <Label>Nautical Miles</Label>
+    </AllowedValue>
+    <AllowedValue>
+      <Name>Millimeters</Name>
+      <Label>Millimeters</Label>
+    </AllowedValue>
+    <AllowedValue>
+      <Name>Centimeters</Name>
+      <Label>Centimeters</Label>
+    </AllowedValue>
+    <AllowedValue>
+      <Name>Pixels</Name>
+      <Label>Pixels</Label>
+    </AllowedValue>
     <DefaultValue>none</DefaultValue>
     <IsMandatory>false</IsMandatory>
   </Parameter>

Modified: branches/fusion-mg30/widgets/widgetinfo/search.xml
===================================================================
--- branches/fusion-mg30/widgets/widgetinfo/search.xml	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/widgetinfo/search.xml	2016-05-04 17:53:31 UTC (rev 2944)
@@ -35,7 +35,7 @@
   </Parameter>
   <Parameter>
     <Name>Filter</Name>
-    <Description>The search expression template to return features</Description>
+    <Description>The search expression template to return features. The filter must include a $USER_VARIABLE placeholder (that will contain the search term)</Description>
     <Type>String</Type>
     <Label>Filter</Label>
     <DefaultValue>String</DefaultValue>
@@ -66,4 +66,12 @@
     <DefaultValue></DefaultValue>
     <IsMandatory>false</IsMandatory>
   </Parameter>
+  <Parameter>
+    <Name>PointZoomLevel</Name>
+    <Label>Point zoom level</Label>
+    <Type>double</Type>
+    <Description>The zoom level to use when clicking on a point feature search result. Note that when basemaps are active, it will zoom to the discrete zoom level closest to the specified value</Description>
+    <DefaultValue>500.0</DefaultValue>
+    <IsMandatory>false</IsMandatory>
+  </Parameter>
 </WidgetInfo>

Modified: branches/fusion-mg30/widgets/widgetinfo/selectwithin.xml
===================================================================
--- branches/fusion-mg30/widgets/widgetinfo/selectwithin.xml	2016-05-04 17:47:42 UTC (rev 2943)
+++ branches/fusion-mg30/widgets/widgetinfo/selectwithin.xml	2016-05-04 17:53:31 UTC (rev 2944)
@@ -26,4 +26,12 @@
     <DefaultValue>true</DefaultValue>
     <IsMandatory>false</IsMandatory>
   </Parameter>
+  <Parameter>
+    <Name>OmitInvisibleLayers</Name>
+    <Description>A flag to indicate if invisible layers that are in the current selection should be omitted from the list of layers to restrict</Description>
+    <Type>boolean</Type>
+    <Label>Omit invisible layers</Label>
+    <DefaultValue>false</DefaultValue>
+    <IsMandatory>false</IsMandatory>
+  </Parameter>
 </WidgetInfo>



More information about the fusion-commits mailing list