[mapguide-commits] r5645 - in trunk/Tools/Maestro:
Maestro.Base/Editor Maestro.Base/Properties
Maestro.Editors/MapDefinition OSGeo.MapGuide.MaestroAPI/Properties
OSGeo.MapGuide.MaestroAPI/Resource/Validation
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 21 07:07:41 EDT 2011
Author: jng
Date: 2011-03-21 04:07:41 -0700 (Mon, 21 Mar 2011)
New Revision: 5645
Modified:
trunk/Tools/Maestro/Maestro.Base/Editor/MapDefinitionEditor.cs
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.resx
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapTreeModels.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs
Log:
#1631: Fix the following defects in the Map Definition editor:
- Deleting layers does not clear the layer editor
- Deleting folders does not clear the folder editor
- Dropping a Layer Definition into a Base Layer Group will not add it to the group, but rather creates a new base layer group instead.
- It is possible for System.NullReferenceException? to occur when adding the first layer to a Map Definition due to the fact that it naively assumes that obtaining the extents for the layer will always succeed.
- Manual Scale List editor textbox does not allow the return keypress
- Add a new validation rule: A map definition with 1 or more base layer groups, must have 1 or more finite scale ranges defined.
- Editing the legend label incorrectly updates the layer display. This should be happening to the name component instead.
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/MapDefinitionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/MapDefinitionEditor.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/MapDefinitionEditor.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -50,13 +50,27 @@
protected override void OnBeforeSave(object sender, CancelEventArgs e)
{
+ var mdf = (IMapDefinition)_edsvc.GetEditedResource();
+ //Unfortunately we can't hook in the standard validation as the act of
+ //committing the xml content back, will trigger the invalid XML content error
+ //before the standard validation is performed. So check this one particular
+ //validation rule here before we go ahead
+ if (mdf.BaseMap != null && mdf.BaseMap.HasLayers())
+ {
+ if (mdf.BaseMap.ScaleCount == 0)
+ {
+ MessageService.ShowMessage(Properties.Resources.NoFiniteDisplayScalesSpecified);
+ e.Cancel = true;
+ return;
+ }
+ }
+
if (_edsvc.IsNew)
{
base.OnBeforeSave(sender, e);
return;
}
- var mdf = (IMapDefinition)_edsvc.GetEditedResource();
if (mdf.BaseMap != null)
{
if (mdf.BaseMap.HasLayers())
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.Designer.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -1158,6 +1158,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to This Map Definition has tiled layers but has no finite display scales defined. Define some display scales..
+ /// </summary>
+ internal static string NoFiniteDisplayScalesSpecified {
+ get {
+ return ResourceManager.GetString("NoFiniteDisplayScalesSpecified", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The following resources were not copied or moved because they would be overwriting resources currently open: {0}The following resources were not moved because they are currently open: {1}.
/// </summary>
internal static string NotCopiedOrMovedDueToOpenEditors {
Modified: trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Base/Properties/Resources.resx 2011-03-21 11:07:41 UTC (rev 5645)
@@ -874,4 +874,7 @@
<data name="ItemsNotMovedDueToBeingOpen" xml:space="preserve">
<value>The following items were not moved due to being already open in an editor: {0}</value>
</data>
+ <data name="NoFiniteDisplayScalesSpecified" xml:space="preserve">
+ <value>This Map Definition has tiled layers but has no finite display scales defined. Define some display scales.</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.Designer.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.Designer.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -36,6 +36,7 @@
//
// txtScales
//
+ this.txtScales.AcceptsReturn = true;
resources.ApplyResources(this.txtScales, "txtScales");
this.txtScales.Name = "txtScales";
//
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.resx 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/ManualScaleEditor.resx 2011-03-21 11:07:41 UTC (rev 5645)
@@ -129,6 +129,9 @@
<data name="txtScales.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
+ <data name="txtScales.ScrollBars" type="System.Windows.Forms.ScrollBars, System.Windows.Forms">
+ <value>Vertical</value>
+ </data>
<data name="txtScales.Size" type="System.Drawing.Size, System.Drawing">
<value>267, 219</value>
</data>
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -159,6 +159,7 @@
{
var group = GetSelectedLayerGroupItem() as GroupItem;
_map.RemoveGroup(group.Tag);
+ propertiesPanel.Controls.Clear();
_grpLayerModel.Invalidate();
}
@@ -183,6 +184,7 @@
if (layer != null)
{
_map.RemoveLayer(layer.Tag);
+ propertiesPanel.Controls.Clear();
this.RefreshModels();
}
}
@@ -217,6 +219,7 @@
if (layer != null)
{
_map.RemoveLayer(layer.Tag);
+ propertiesPanel.Controls.Clear();
this.RefreshModels();
}
}
@@ -377,6 +380,7 @@
if (group != null)
{
_map.BaseMap.RemoveBaseLayerGroup(group.Tag);
+ propertiesPanel.Controls.Clear();
_tiledLayerModel.Invalidate();
}
}
@@ -476,6 +480,7 @@
{
var grp = layer.Parent;
grp.RemoveBaseMapLayer(layer.Tag);
+ propertiesPanel.Controls.Clear();
_tiledLayerModel.Invalidate();
}
}
@@ -770,7 +775,7 @@
var rids = e.Data.GetData(typeof(ResourceIdentifier[])) as ResourceIdentifier[];
if (rids != null && rids.Length > 0)
{
- var node = trvLayersGroup.GetNodeAt(trvLayersGroup.PointToClient(new Point(e.X, e.Y)));
+ var node = trvBaseLayers.GetNodeAt(trvBaseLayers.PointToClient(new Point(e.X, e.Y)));
IBaseMapGroup group = null;
if (node != null && node.Tag is BaseLayerGroupItem)
@@ -783,14 +788,14 @@
{
_map.InitBaseMap();
group = _map.BaseMap.AddBaseLayerGroup(GenerateBaseGroupName(_map));
+ }
- foreach (var rid in rids)
+ foreach (var rid in rids)
+ {
+ if (rid.ResourceType == ResourceTypes.LayerDefinition)
{
- if (rid.ResourceType == ResourceTypes.LayerDefinition)
- {
- group.AddLayer(GenerateBaseLayerName(rid.ToString(), _map.BaseMap), rid.ToString());
- added++;
- }
+ group.AddLayer(GenerateBaseLayerName(rid.ToString(), _map.BaseMap), rid.ToString());
+ added++;
}
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapTreeModels.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapTreeModels.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapTreeModels.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -61,9 +61,9 @@
void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == "LegendLabel")
+ if (e.PropertyName == "Name")
{
- this.Text = this.Tag.LegendLabel;
+ this.Text = this.Tag.Name;
}
}
}
@@ -78,9 +78,9 @@
void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == "LegendLabel")
+ if (e.PropertyName == "Name")
{
- this.Text = this.Tag.LegendLabel;
+ this.Text = this.Tag.Name;
}
}
}
@@ -102,9 +102,9 @@
void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == "LegendLabel")
+ if (e.PropertyName == "Name")
{
- this.Text = this.Tag.LegendLabel;
+ this.Text = this.Tag.Name;
}
}
}
@@ -119,9 +119,9 @@
void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (e.PropertyName == "LegendLabel")
+ if (e.PropertyName == "Name")
{
- this.Text = this.Tag.LegendLabel;
+ this.Text = this.Tag.Name;
}
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -809,6 +809,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to The Map Definition contains tiled layers but has no finite display scales defined.
+ /// </summary>
+ internal static string MDF_NoFiniteDisplayScalesSpecified {
+ get {
+ return ResourceManager.GetString("MDF_NoFiniteDisplayScalesSpecified", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to {0} is a raster layer, and in another coordinate system than the map. No data will be displayed by the layer.
/// </summary>
internal static string MDF_RasterReprojectionError {
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2011-03-21 11:07:41 UTC (rev 5645)
@@ -485,4 +485,7 @@
<data name="UnknownSymbolDefVersion" xml:space="preserve">
<value>Unknown Symbol Definition version: </value>
</data>
+ <data name="MDF_NoFiniteDisplayScalesSpecified" xml:space="preserve">
+ <value>The Map Definition contains tiled layers but has no finite display scales defined</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs 2011-03-21 10:08:22 UTC (rev 5644)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs 2011-03-21 11:07:41 UTC (rev 5645)
@@ -69,10 +69,16 @@
layers.Add(l);
if (mdef.BaseMap != null && mdef.BaseMap.HasGroups())
+ {
+ if (mdef.BaseMap.ScaleCount == 0)
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, Properties.Resources.MDF_NoFiniteDisplayScalesSpecified));
+
foreach (IBaseMapGroup g in mdef.BaseMap.BaseMapLayerGroup)
+ {
foreach (IBaseMapLayer l in g.BaseMapLayer)
layers.Add(l);
-
+ }
+ }
Dictionary<string, IBaseMapLayer> nameCounter = new Dictionary<string, IBaseMapLayer>();
foreach (IBaseMapLayer l in layers)
More information about the mapguide-commits
mailing list