[mapguide-commits] r7836 - in trunk/Tools/Maestro: Maestro.Editors/MapDefinition OSGeo.MapGuide.MaestroAPI/ObjectModels
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Sep 3 00:40:04 PDT 2013
Author: jng
Date: 2013-09-03 00:40:04 -0700 (Tue, 03 Sep 2013)
New Revision: 7836
Modified:
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
Log:
#2350: Detach the BaseMapDefinition element if removing the last tiled layer group or finite display scale and there's nothing left.
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs 2013-09-03 05:18:02 UTC (rev 7835)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/FiniteScaleListCtrl.cs 2013-09-03 07:40:04 UTC (rev 7836)
@@ -88,22 +88,21 @@
private void ClearScales()
{
_map.InitBaseMap();
- _map.BaseMap.RemoveAllScales();
+ _map.RemoveAllFiniteDisplayScales(true);
_edSvc.MarkDirty();
}
private void RemoveScaleFromMap(double scale)
{
_scales.Remove(scale);
- _map.InitBaseMap();
- _map.BaseMap.RemoveFiniteDisplayScale(scale);
+ _map.RemoveFiniteDisplayScale(scale, true);
_edSvc.MarkDirty();
}
private void AddScaleToMap(double scale)
{
_map.InitBaseMap();
- _map.BaseMap.AddFiniteDisplayScale(scale);
+ _map.AddFiniteDisplayScale(scale);
_edSvc.MarkDirty();
}
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2013-09-03 05:18:02 UTC (rev 7835)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2013-09-03 07:40:04 UTC (rev 7836)
@@ -413,7 +413,7 @@
layerCount++;
}
//Detach the base layer group
- _map.BaseMap.RemoveBaseLayerGroup(group.Tag);
+ _map.RemoveBaseLayerGroup(group.Tag, true);
MessageBox.Show(string.Format(Strings.BaseLayerGroupConvertedToLayerGroup, group.Tag.Name, groupName));
this.RefreshModels();
tabControl1.SelectedIndex = 0; //Switch to Layer Groups
@@ -705,7 +705,7 @@
private void RemoveSelectedTiledLayerItem(BaseLayerGroupItem group)
{
- _map.BaseMap.RemoveBaseLayerGroup(group.Tag);
+ _map.RemoveBaseLayerGroup(group.Tag, true);
propertiesPanel.Controls.Clear();
_tiledLayerModel.Invalidate();
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs 2013-09-03 05:18:02 UTC (rev 7835)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs 2013-09-03 07:40:04 UTC (rev 7836)
@@ -463,6 +463,92 @@
public static class MapDefinitionExtensions
{
/// <summary>
+ /// Adds the specified finite display scale to the Map Definition
+ /// </summary>
+ /// <param name="map"></param>
+ /// <param name="scale"></param>
+ public static void AddFiniteDisplayScale(this IMapDefinition map, double scale)
+ {
+ Check.NotNull(map, "map"); //NOXLATE
+
+ if (map.BaseMap != null)
+ map.InitBaseMap();
+
+ map.BaseMap.AddFiniteDisplayScale(scale);
+ }
+
+ /// <summary>
+ /// Removes the specified finite display scale from the Map Definition
+ /// </summary>
+ /// <param name="map"></param>
+ /// <param name="scale"></param>
+ /// <param name="bDetachIfEmpty"></param>
+ public static void RemoveFiniteDisplayScale(this IMapDefinition map, double scale, bool bDetachIfEmpty)
+ {
+ Check.NotNull(map, "map"); //NOXLATE
+
+ if (map.BaseMap == null)
+ return;
+
+ map.BaseMap.RemoveFiniteDisplayScale(scale);
+ if (map.BaseMap.GroupCount == 0 && map.BaseMap.ScaleCount == 0 && bDetachIfEmpty)
+ map.RemoveBaseMap();
+ }
+
+ /// <summary>
+ /// Removes all finite display scales from the Map Definition
+ /// </summary>
+ /// <param name="map"></param>
+ /// <param name="bDetachIfEmpty"></param>
+ public static void RemoveAllFiniteDisplayScales(this IMapDefinition map, bool bDetachIfEmpty)
+ {
+ Check.NotNull(map, "map"); //NOXLATE
+
+ if (map.BaseMap == null)
+ return;
+
+ map.BaseMap.RemoveAllScales();
+ if (map.BaseMap.GroupCount == 0 && map.BaseMap.ScaleCount == 0 && bDetachIfEmpty)
+ map.RemoveBaseMap();
+ }
+
+ /// <summary>
+ /// Adds the specified base layer group to the map definition
+ /// </summary>
+ /// <param name="map"></param>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ public static IBaseMapGroup AddBaseLayerGroup(this IMapDefinition map, string name)
+ {
+ Check.NotNull(map, "map"); //NOXLATE
+ Check.NotEmpty(name, "name"); //NOXLATE
+
+ if (map.BaseMap == null)
+ map.InitBaseMap();
+
+ return map.BaseMap.AddBaseLayerGroup(name);
+ }
+
+ /// <summary>
+ /// Removes the given base layer group from the Map Definition
+ /// </summary>
+ /// <param name="map"></param>
+ /// <param name="group"></param>
+ public static void RemoveBaseLayerGroup(this IMapDefinition map, IBaseMapGroup group, bool bDetachIfEmpty)
+ {
+ Check.NotNull(map, "map"); //NOXLATE
+ if (null == group)
+ return;
+
+ if (map.BaseMap == null)
+ return;
+
+ map.BaseMap.RemoveBaseLayerGroup(group);
+ if (map.BaseMap.GroupCount == 0 && map.BaseMap.GroupCount == 0 && bDetachIfEmpty)
+ map.RemoveBaseMap();
+ }
+
+ /// <summary>
/// Updates the group name references of all layers belonging to a particular group
/// </summary>
/// <param name="map">The map.</param>
More information about the mapguide-commits
mailing list