[mapguide-commits] r4460 - in trunk/MgDev/Web/src: mapviewerjava mapviewernet mapviewerphp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Dec 22 01:09:34 EST 2009


Author: leaf
Date: 2009-12-22 01:09:33 -0500 (Tue, 22 Dec 2009)
New Revision: 4460

Modified:
   trunk/MgDev/Web/src/mapviewerjava/measure.jsp
   trunk/MgDev/Web/src/mapviewernet/measure.aspx
   trunk/MgDev/Web/src/mapviewerphp/measure.php
Log:
Submit on behalf of Arthur Liu

Fixed ticket #1186 When the Measure clear and stopped but the layer still shows in the Layers box

[Analysis]
The measure layer is not removed from layer collection of current map after clear.

[Resolution]
Remove the measure layer while user click clear button. 
Create a new layer while user start a new measure.



Modified: trunk/MgDev/Web/src/mapviewerjava/measure.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/measure.jsp	2009-12-21 21:28:00 UTC (rev 4459)
+++ trunk/MgDev/Web/src/mapviewerjava/measure.jsp	2009-12-22 06:09:33 UTC (rev 4460)
@@ -105,6 +105,8 @@
         if(clear)
         {
             total = 0;
+            if(layer != null)
+                layers.Remove(layer);
             if(DataSourceExists(resourceSrvc, dataSourceId))
                 ClearDataSource(featureSrvc, dataSourceId, featureName);
         }
@@ -189,22 +191,22 @@
                     //Create the layer definition
                     MgByteReader layerDefContent = BuildLayerDefinitionContent(dataSource, featureName, tip);
                     resourceSrvc.SetResource(layerDefId, layerDefContent, null);
-
-                    //Add the layer to the map, if it's not already in it
-                    if(layer == null)
-                    {
-                        legendName = MgLocalizer.GetString("MEASURELAYER", locale);
-                        layer = new MgLayer(layerDefId, resourceSrvc);
-                        layer.SetDisplayInLegend(true);
-                        layer.SetLegendLabel(legendName);
-                        layers.Insert(0, layer);
-                    }
                 }
                 else
                 {
                     //data source already exist. clear its content
                     ClearDataSource(featureSrvc, dataSourceId, featureName);
                 }
+                
+                //Add the layer to the map, if it's not already in it
+                if(layer == null)
+                {
+                    legendName = MgLocalizer.GetString("MEASURELAYER", locale);
+                    layer = new MgLayer(layerDefId, resourceSrvc);
+                    layer.SetDisplayInLegend(true);
+                    layer.SetLegendLabel(legendName);
+                    layers.Insert(0, layer);
+                }
             }
             // create a feature representing this segment and insert it into the data source
             //

Modified: trunk/MgDev/Web/src/mapviewernet/measure.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/measure.aspx	2009-12-21 21:28:00 UTC (rev 4459)
+++ trunk/MgDev/Web/src/mapviewernet/measure.aspx	2009-12-22 06:09:33 UTC (rev 4460)
@@ -84,6 +84,8 @@
             if (clear)
             {
                 total = 0;
+                if (null != layer)
+                    layers.Remove(layer);
                 if (DataSourceExists(resourceSrvc, dataSourceId))
                     ClearDataSource(featureSrvc, dataSourceId, featureName);
             }
@@ -168,16 +170,6 @@
                         //Create the layer definition
                         MgByteReader layerDefContent = BuildLayerDefinitionContent(dataSource, featureName, tip);
                         resourceSrvc.SetResource(layerDefId, layerDefContent, null);
-
-                        //Add the layer to the map, if it's not already in it
-                        if (layer == null)
-                        {
-                            legendName = MgLocalizer.GetString("MEASURELAYER", locale);
-                            layer = new MgLayer(layerDefId, resourceSrvc);
-                            layer.SetDisplayInLegend(true);
-                            layer.SetLegendLabel(legendName);
-                            layers.Insert(0, layer);
-                        }
                     }
                     else
                     {
@@ -186,6 +178,16 @@
                     }
                 }
 
+                //Add the layer to the map, if it's not already in it
+                if (layer == null)
+                {
+                    legendName = MgLocalizer.GetString("MEASURELAYER", locale);
+                    layer = new MgLayer(layerDefId, resourceSrvc);
+                    layer.SetDisplayInLegend(true);
+                    layer.SetLegendLabel(legendName);
+                    layers.Insert(0,layer);
+                }
+                
                 // create a feature representing this segment and insert it into the data source
                 //
                 MgPropertyCollection measureProps = new MgPropertyCollection();

Modified: trunk/MgDev/Web/src/mapviewerphp/measure.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/measure.php	2009-12-21 21:28:00 UTC (rev 4459)
+++ trunk/MgDev/Web/src/mapviewerphp/measure.php	2009-12-22 06:09:33 UTC (rev 4460)
@@ -75,6 +75,8 @@
         if($clear)
         {
             $total = 0;
+            if($layer != null)
+                $layers->Remove($layer);
             if(DataSourceExists($resourceSrvc, $dataSourceId))
                 ClearDataSource($featureSrvc, $dataSourceId, $featureName);
         }
@@ -157,23 +159,23 @@
 
                     //Create the layer definition
                     $layerDefContent = BuildLayerDefinitionContent($dataSource, $featureName, $tip);
-                    $resourceSrvc->SetResource($layerDefId, $layerDefContent, null);
-
-                    //Add the layer to the map, if it's not already in it
-                    if($layer == null)
-                    {
-                        $legendName = GetLocalizedString("MEASURELAYER", $locale);
-                        $layer = new MgLayer($layerDefId, $resourceSrvc);
-                        $layer->SetDisplayInLegend(true);
-                        $layer->SetLegendLabel($legendName);
-                        $layers->Insert(0, $layer);
-                    }
+                    $resourceSrvc->SetResource($layerDefId, $layerDefContent, null); 
                 }
                 else
                 {
                     //data source already exist. clear its content
                     ClearDataSource($featureSrvc, $dataSourceId, $featureName);
                 }
+                
+                //Add the layer to the map, if it's not already in it
+                if($layer == null)
+                {
+                    $legendName = GetLocalizedString("MEASURELAYER", $locale);
+                    $layer = new MgLayer($layerDefId, $resourceSrvc);
+                    $layer->SetDisplayInLegend(true);
+                    $layer->SetLegendLabel($legendName);
+                    $layers->Insert(0, $layer);
+                }
             }
             // create a feature representing this segment and insert it into the data source
             //



More information about the mapguide-commits mailing list