[mapguide-commits] r8481 - in trunk/Tools/Maestro: Maestro.Base/UI MaestroAPITests OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Mapping OSGeo.MapGuide.MaestroAPI/Serialization OSGeo.MapGuide.MaestroAPI.Http OSGeo.MapGuide.ObjectModels
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Dec 29 02:11:17 PST 2014
Author: jng
Date: 2014-12-29 02:11:17 -0800 (Mon, 29 Dec 2014)
New Revision: 8481
Modified:
trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs
trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs
trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceIdentifier.cs
trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceTypes.cs
Log:
#2514: Update RuntimeMap to support MGOS 3.0 MgMap state.
- Rename ResourceTypes.RuntimeMap to ResourceTypes.Map, this avoids the need for special-case processing when converting resource ids to strings when dealing with Runtime Map resources.
- Update RuntimeMap serialization logic to handle the new information in MGOS 3.0 (tile set ids)
- Update MgBinarySerializer to properly handle the case of null resource IDs.
Modified: trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -109,7 +109,7 @@
//AIMS 2012 demands this checks out. Can't flub it anymore
m.ResourceID = "Session:" + m_connection.SessionID + "//non-existing.MapDefinition"; //NOXLATE
var mpsvc = (IMappingService)m_connection.GetService((int)ServiceType.Mapping);
- var rid = new ResourceIdentifier(Guid.NewGuid().ToString(), ResourceTypes.RuntimeMap, m_connection.SessionID);
+ var rid = new ResourceIdentifier(Guid.NewGuid().ToString(), ResourceTypes.Map, m_connection.SessionID);
m_tempmap = mpsvc.CreateMap(m);
}
Modified: trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -1043,7 +1043,7 @@
ResourceIdentifier rtmX = new ResourceIdentifier(mapdefinition);
string rtmDef = "Library://UnitTests/Cache/" + rtmX.Fullpath.Replace(":", "_").Replace("/", "_");
string mapName = rtmX.Name;
- ResourceIdentifier mapid = new ResourceIdentifier(mapName, ResourceTypes.RuntimeMap, conn.SessionID);
+ ResourceIdentifier mapid = new ResourceIdentifier(mapName, ResourceTypes.Map, conn.SessionID);
IMapDefinition mdef = (IMapDefinition)conn.ResourceService.GetResource(mapdefinition);
RuntimeMap rtm = mapSvc.CreateMap(mdef); // Create new runtime map
Assert.IsFalse(rtm.IsDirty);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -485,6 +485,17 @@
}
/// <summary>
+ /// Gets or sets the tile set definition resource id. Only applicable
+ /// if the Map Definition used to create this map contains a reference
+ /// to a tile set
+ /// </summary>
+ public virtual string TileSetDefinition
+ {
+ get;
+ internal set;
+ }
+
+ /// <summary>
/// Gets or sets the map definition resource id
/// </summary>
/// <value>The map definition resource id.</value>
@@ -649,7 +660,7 @@
/// <value>The type of the resource.</value>
public ResourceTypes ResourceType
{
- get { return ResourceTypes.RuntimeMap; }
+ get { return ResourceTypes.Map; }
}
/// <summary>
@@ -736,6 +747,10 @@
{
s.Write(this.WatermarkUsage);
}
+ if (s.SiteVersion >= new Version(3, 0))
+ {
+ s.WriteResourceIdentifier(this.TileSetDefinition);
+ }
s.Write((int)0);
}
else
@@ -951,6 +966,10 @@
{
this.WatermarkUsage = d.ReadInt32();
}
+ if (d.SiteVersion >= new Version(3, 0))
+ {
+ this.TileSetDefinition = d.ReadResourceIdentifier();
+ }
int mapLayerCount = d.ReadInt32();
if (mapLayerCount != 0)
throw new Exception(Strings.ErrorShouldHaveNoLayerDataInMap);
@@ -1242,13 +1261,16 @@
private void Save(string resourceID)
{
+ Check.ArgumentNotNull(resourceID, "resourceID");
+ Check.ArgumentNotEmpty(resourceID, "resourceID");
+ Check.ThatPreconditionIsMet(resourceID.EndsWith(".Map"), "resourceID.EndsWith(\".Map\")");
var map = this;
string selectionID = resourceID.Substring(0, resourceID.LastIndexOf(".")) + ".Selection"; //NOXLATE
this.ResourceService.SetResourceXmlData(resourceID, new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(RUNTIMEMAP_XML)));
this.ResourceService.SetResourceXmlData(selectionID, new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(RUNTIMEMAP_SELECTION_XML)));
- ResourceIdentifier.Validate(resourceID, ResourceTypes.RuntimeMap);
+ ResourceIdentifier.Validate(resourceID, ResourceTypes.Map);
if (!resourceID.StartsWith("Session:" + this.SessionId + "//") || !resourceID.EndsWith(".Map")) //NOXLATE
throw new Exception(Strings.ErrorRuntimeMapNotInSessionRepo);
@@ -1304,7 +1326,7 @@
private void SaveSelectionXml(string resourceID)
{
- ResourceIdentifier.Validate(resourceID, ResourceTypes.RuntimeMap);
+ ResourceIdentifier.Validate(resourceID, ResourceTypes.Map);
string selectionID = resourceID.Substring(0, resourceID.LastIndexOf(".")) + ".Selection"; //NOXLATE
System.IO.MemoryStream ms = new System.IO.MemoryStream();
MgBinarySerializer serializer = new MgBinarySerializer(ms, this.SiteVersion);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -2205,7 +2205,7 @@
/// <returns></returns>
public RuntimeMap CreateMap(IMapDefinition mdf, bool suppressErrors)
{
- var rid = new ResourceIdentifier(ResourceIdentifier.GetName(mdf.ResourceID), ResourceTypes.RuntimeMap, this.SessionID);
+ var rid = new ResourceIdentifier(ResourceIdentifier.GetName(mdf.ResourceID), ResourceTypes.Map, this.SessionID);
return CreateMap(rid.ToString(), mdf, suppressErrors);
}
@@ -2231,7 +2231,7 @@
/// <returns></returns>
public RuntimeMap CreateMap(IMapDefinition mdf, double metersPerUnit, bool suppressErrors)
{
- var rid = new ResourceIdentifier(ResourceIdentifier.GetName(mdf.ResourceID), ResourceTypes.RuntimeMap, this.SessionID);
+ var rid = new ResourceIdentifier(ResourceIdentifier.GetName(mdf.ResourceID), ResourceTypes.Map, this.SessionID);
return CreateMap(rid.ToString(), mdf, metersPerUnit, suppressErrors);
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Serialization/MgBinarySerializer.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -113,14 +113,22 @@
/// <param name="resourceID">The resource ID.</param>
public void WriteResourceIdentifier(string resourceID)
{
- if (m_siteVersion <= SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP1_1))
- WriteClassId(12003);
+ if (resourceID == null)
+ {
+ //For null objects, we write a class ID of 0
+ WriteClassId(0);
+ }
else
- WriteClassId(11500);
- if (m_siteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
- WriteStringInternal(resourceID);
- else
- Write(resourceID);
+ {
+ if (m_siteVersion <= SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP1_1))
+ WriteClassId(12003);
+ else
+ WriteClassId(11500);
+ if (m_siteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
+ WriteStringInternal(resourceID);
+ else
+ Write(resourceID);
+ }
}
/// <summary>
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -1061,7 +1061,7 @@
public override System.IO.Stream RenderRuntimeMap(Mapping.RuntimeMap map, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
{
var resourceId = map.ResourceID;
- ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
+ ResourceIdentifier.Validate(resourceId, ResourceTypes.Map);
string mapname = resourceId.Substring(resourceId.IndexOf("//") + 2);
mapname = mapname.Substring(0, mapname.LastIndexOf("."));
#if DEBUG
@@ -1093,7 +1093,7 @@
public override System.IO.Stream RenderRuntimeMap(Mapping.RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
{
var resourceId = map.ResourceID;
- ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
+ ResourceIdentifier.Validate(resourceId, ResourceTypes.Map);
string mapname = resourceId.Substring(resourceId.IndexOf("//") + 2);
mapname = mapname.Substring(0, mapname.LastIndexOf("."));
#if DEBUG
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceIdentifier.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceIdentifier.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceIdentifier.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -418,7 +418,7 @@
{
var ext = GetExtension(identifier);
if (ext == "Map") //NOXLATE
- return ResourceTypes.RuntimeMap;
+ return ResourceTypes.Map;
else
return (ResourceTypes)Enum.Parse(typeof(ResourceTypes), ext);
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceTypes.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceTypes.cs 2014-12-29 08:03:30 UTC (rev 8480)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/ResourceTypes.cs 2014-12-29 10:11:17 UTC (rev 8481)
@@ -55,7 +55,7 @@
/// <summary>
/// Runtime Map
/// </summary>
- RuntimeMap,
+ Map,
/// <summary>
/// Folder
More information about the mapguide-commits
mailing list