[mapguide-commits] r8488 - in trunk/Tools/Maestro: Maestro.AddIn.ExtendedObjectModels Maestro.Editors/MapDefinition
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Dec 29 10:10:49 PST 2014
Author: jng
Date: 2014-12-29 10:10:49 -0800 (Mon, 29 Dec 2014)
New Revision: 8488
Modified:
trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Manifest.addin
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs
Log:
#2515: Add editor support for v3.0.0 Map Definition resources.
- Add Map Definition v3.0.0 item template
- Fix first layer added extent calculation functionality that was lost when we did the ObjectModel separation.
- When a Tile Set Definition is specified, update the Map Definition's coordinate system to match. Though this has no real effect (internally the Tile Set CS will always take precedence), at least it will signify to the user as to which coordinate system will be taking precedence.
- Default to external tile source if none specified when loading a Map Definition.
Modified: trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Manifest.addin
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Manifest.addin 2014-12-29 17:47:28 UTC (rev 8487)
+++ trunk/Tools/Maestro/Maestro.AddIn.ExtendedObjectModels/Manifest.addin 2014-12-29 18:10:49 UTC (rev 8488)
@@ -43,6 +43,7 @@
<Class id="VectorLayerDefinition240" class="Maestro.AddIn.ExtendedObjectModels.Templates.VectorLayer240ItemTemplate" />
<Class id="MapDefinition230" class="Maestro.AddIn.ExtendedObjectModels.Templates.MapDefinition230ItemTemplate" />
<Class id="MapDefinition240" class="Maestro.AddIn.ExtendedObjectModels.Templates.MapDefinition240ItemTemplate" />
+ <Class id="MapDefinition300" class="Maestro.AddIn.ExtendedObjectModels.Templates.MapDefinition300ItemTemplate" />
<Class id="WatermarkDefinitionSimple230" class="Maestro.AddIn.ExtendedObjectModels.Templates.WatermarkDefinitionSimple230ItemTemplate" />
<Class id="WatermarkDefinitionSimple240" class="Maestro.AddIn.ExtendedObjectModels.Templates.WatermarkDefinitionSimple240ItemTemplate" />
<Class id="SimpleSymbolDefinition110" class="Maestro.AddIn.ExtendedObjectModels.Templates.SimpleSymbolDefinitionItem110Template" />
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs 2014-12-29 17:47:28 UTC (rev 8487)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapDefinitionEditorCtrl.cs 2014-12-29 18:10:49 UTC (rev 8488)
@@ -21,6 +21,8 @@
#endregion Disclaimer / License
using Maestro.Editors.WatermarkDefinition;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.ObjectModels.LayerDefinition;
using OSGeo.MapGuide.ObjectModels.MapDefinition;
using System.Windows.Forms;
@@ -42,6 +44,35 @@
private IMapDefinition _map;
private IEditorService _edSvc;
+ class LayerExtentCalculator : ILayerExtentCalculator
+ {
+ private IServerConnection _conn;
+
+ public LayerExtentCalculator(IServerConnection conn)
+ {
+ _conn = conn;
+ }
+
+ public LayerExtent GetLayerExtent(string resourceID, string mapCoordSys)
+ {
+ var ldf = (ILayerDefinition)_conn.ResourceService.GetResource(resourceID);
+ string csWkt;
+ var env = ldf.GetSpatialExtent(_conn, true, out csWkt);
+ if (env != null)
+ {
+ if (!string.IsNullOrEmpty(mapCoordSys) && csWkt != mapCoordSys)
+ env = Utility.TransformEnvelope(env, csWkt, mapCoordSys);
+
+ return new LayerExtent()
+ {
+ LayerCoordinateSystem = csWkt,
+ Extent = env
+ };
+ }
+ return null;
+ }
+ }
+
/// <summary>
/// Sets the initial state of this editor and sets up any databinding
/// within such that user interface changes will propagate back to the
@@ -57,6 +88,8 @@
mapSettingsCtrl.Bind(service);
mapLayersCtrl.Bind(service);
+ _map.ExtentCalculator = new LayerExtentCalculator(_edSvc.CurrentConnection);
+
var mp2 = _map as IMapDefinition2;
if (mp2 != null)
{
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2014-12-29 17:47:28 UTC (rev 8487)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2014-12-29 18:10:49 UTC (rev 8488)
@@ -28,6 +28,7 @@
using OSGeo.MapGuide.MaestroAPI.Tile;
using OSGeo.MapGuide.ObjectModels;
using OSGeo.MapGuide.ObjectModels.MapDefinition;
+using OSGeo.MapGuide.ObjectModels.TileSetDefinition;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -172,6 +173,11 @@
tabs.TabPages.Add(TAB_TILE_SET);
InitExternalModel();
}
+ else //Default to external
+ {
+ tabs.TabPages.Add(TAB_TILE_SET);
+ InitExternalModel();
+ }
}
_map.PropertyChanged += WeakEventHandler.Wrap<PropertyChangedEventHandler>(OnMapPropertyChanged, (eh) => _map.PropertyChanged -= eh);
@@ -2115,6 +2121,11 @@
if (picker.ShowDialog() == DialogResult.OK )
{
txtTileSet.Text = picker.ResourceID;
+
+ var tsd = (ITileSetDefinition)_edSvc.CurrentConnection.ResourceService.GetResource(picker.ResourceID);
+ string coordSys = tsd.GetDefaultCoordinateSystem();
+ if (!string.IsNullOrEmpty(coordSys))
+ _map.CoordinateSystem = coordSys;
}
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs 2014-12-29 17:47:28 UTC (rev 8487)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapSettingsSectionCtrl.cs 2014-12-29 18:10:49 UTC (rev 8488)
@@ -71,6 +71,9 @@
case TileSourceType.Inline:
rdInline.Checked = true;
break;
+ default: //Default to external
+ rdExternal.Checked = true;
+ break;
}
}
More information about the mapguide-commits
mailing list