[mapguide-commits] r4345 - in trunk/Tools/Maestro/MaestroAPI: .
RuntimeClasses
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Nov 15 18:34:39 EST 2009
Author: ksgeograf
Date: 2009-11-15 18:34:39 -0500 (Sun, 15 Nov 2009)
New Revision: 4345
Modified:
trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs
trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs
trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs
trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
trunk/Tools/Maestro/MaestroAPI/ServerConnectionI.cs
Log:
Maestro:
Fixed issue #674, additional map rendering options
Modified: trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs 2009-11-15 23:10:34 UTC (rev 4344)
+++ trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs 2009-11-15 23:34:39 UTC (rev 4345)
@@ -805,17 +805,17 @@
- public override System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format)
+ public override System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
{
ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
string mapname = resourceId.Substring(resourceId.IndexOf("//") + 2);
mapname = mapname.Substring(0, mapname.LastIndexOf("."));
#if DEBUG
- string s = m_reqBuilder.GetMapImageUrl(mapname, format, null, x, y, scale, dpi, width, height, null, null, null, null);
+ string s = m_reqBuilder.GetMapImageUrl(mapname, format, null, x, y, scale, dpi, width, height, clip, null, null, null, null);
return new System.IO.MemoryStream(this.DownloadData(s));
#else
System.IO.MemoryStream ms = new System.IO.MemoryStream();
- System.Net.WebRequest req = m_reqBuilder.GetMapImage(mapname, format, null, x, y, scale, dpi, width, height, null, null, null, null, ms);
+ System.Net.WebRequest req = m_reqBuilder.GetMapImage(mapname, format, null, x, y, scale, dpi, width, height, clip, null, null, null, null, ms);
//Maksim reported that the rendering times out frequently, so now we wait 5 minutes
req.Timeout = 5 * 60 * 1000;
@@ -830,17 +830,17 @@
#endif
}
- public override System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format)
+ public override System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
{
ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
string mapname = resourceId.Substring(resourceId.IndexOf("//") + 2);
mapname = mapname.Substring(0, mapname.LastIndexOf("."));
#if DEBUG
- string s = m_reqBuilder.GetMapImageUrl(mapname, format, null, x1, y1, x2, y2, dpi, width, height, null, null, null, null);
+ string s = m_reqBuilder.GetMapImageUrl(mapname, format, null, x1, y1, x2, y2, dpi, width, height, clip, null, null, null, null);
return new System.IO.MemoryStream(this.DownloadData(s));
#else
System.IO.MemoryStream ms = new System.IO.MemoryStream();
- System.Net.WebRequest req = m_reqBuilder.GetMapImage(mapname, format, null, x1, y1, x2, y2, dpi, width, height, null, null, null, null, ms);
+ System.Net.WebRequest req = m_reqBuilder.GetMapImage(mapname, format, null, x1, y1, x2, y2, dpi, width, height, clip, null, null, null, null, ms);
//Maksim reported that the rendering times out frequently, so now we wait 5 minutes
req.Timeout = 5 * 60 * 1000;
Modified: trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs 2009-11-15 23:10:34 UTC (rev 4344)
+++ trunk/Tools/Maestro/MaestroAPI/LocalNativeConnection.cs 2009-11-15 23:34:39 UTC (rev 4345)
@@ -485,7 +485,7 @@
res.MoveResource(new MgResourceIdentifier(oldpath), new MgResourceIdentifier(newpath), overwrite);
}
- public override System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format)
+ public override System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
{
MgRenderingService rnd = this.Con.CreateService(MgServiceType.RenderingService) as MgRenderingService;
MgResourceService res = this.Con.CreateService(MgServiceType.ResourceService) as MgResourceService;
@@ -498,13 +498,14 @@
MgSelection sel = new MgSelection(map);
//The color accepted by MgColor has alpha as the last value, but the returned has alpha first
MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
-
- object[] args = new object[] { map, sel, gf.CreateCoordinateXY(x, y), scale, width, height, color, format, true };
+
+ //TODO: The render method is missing the overload for the Clip parameter
+ object[] args = new object[] { map, sel, gf.CreateCoordinateXY(x, y), scale, width, height, color, format, true };
Type[] types = new Type[] { args[0].GetType(), args[1].GetType(), args[2].GetType(), args[3].GetType(), args[4].GetType(), args[5].GetType(), args[6].GetType(), args[7].GetType(), args[8].GetType() };
return Utility.MgStreamToNetStream(rnd, rnd.GetType().GetMethod("RenderMap", types), args);
}
- public override System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format)
+ public override System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
{
MgRenderingService rnd = this.Con.CreateService(MgServiceType.RenderingService) as MgRenderingService;
MgResourceService res = this.Con.CreateService(MgServiceType.ResourceService) as MgResourceService;
@@ -519,6 +520,8 @@
MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
MgEnvelope env = new MgEnvelope(gf.CreateCoordinateXY(x1, y1), gf.CreateCoordinateXY(x2, y2));
+ //TODO: The render is missing the clip param for the extent override method
+
object[] args = new object[] { map, sel, env, width, height, color, format };
Type[] types = new Type[] { args[0].GetType(), args[1].GetType(), args[2].GetType(), args[3].GetType(), args[4].GetType(), args[5].GetType(), args[6].GetType() };
return Utility.MgStreamToNetStream(rnd, rnd.GetType().GetMethod("RenderMap", types), args);
Modified: trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs 2009-11-15 23:10:34 UTC (rev 4344)
+++ trunk/Tools/Maestro/MaestroAPI/RequestBuilder.cs 2009-11-15 23:34:39 UTC (rev 4345)
@@ -769,7 +769,7 @@
return m_hosturi + "?" + EncodeParameters(param);
}
- public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
+ public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
{
NameValueCollection param = new NameValueCollection();
param.Add("OPERATION", "GETMAPIMAGE");
@@ -800,6 +800,7 @@
if (hidegroups != null && hidegroups.Length > 0)
param.Add("HIDEGROUPS", string.Join(",", hidegroups));
+ param.Add("CLIP", clip ? "1" : "0");
//TODO: Find out if this actually works...
//param.Add("REFRESHLAYERS", ...)
@@ -811,7 +812,7 @@
return req;
}
- public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double x1, double y1, double x2, double y2, int dpi, int width, int height, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
+ public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double x1, double y1, double x2, double y2, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
{
NameValueCollection param = new NameValueCollection();
param.Add("OPERATION", "GETMAPIMAGE");
@@ -840,6 +841,7 @@
if (hidegroups != null && hidegroups.Length > 0)
param.Add("HIDEGROUPS", string.Join(",", hidegroups));
+ param.Add("CLIP", clip ? "1" : "0");
//TODO: Find out if this actually works...
//param.Add("REFRESHLAYERS", ...)
@@ -856,7 +858,7 @@
return m_hosturi + "?" + EncodeParameters(param);
}
- public string GetMapImageUrl(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
+ public string GetMapImageUrl(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
{
NameValueCollection param = new NameValueCollection();
param.Add("OPERATION", "GETMAPIMAGE");
@@ -890,10 +892,12 @@
//TODO: Find out if this actually works...
//param.Add("REFRESHLAYERS", ...)
+ param.Add("CLIP", clip ? "1" : "0");
+
return m_hosturi + "?" + EncodeParameters(param);
}
- public string GetMapImageUrl(string mapname, string format, string selectionXml, double x1, double y1, double x2, double y2, int dpi, int width, int height, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
+ public string GetMapImageUrl(string mapname, string format, string selectionXml, double x1, double y1, double x2, double y2, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
{
NameValueCollection param = new NameValueCollection();
param.Add("OPERATION", "GETMAPIMAGE");
@@ -922,6 +926,8 @@
if (hidegroups != null && hidegroups.Length > 0)
param.Add("HIDEGROUPS", string.Join(",", hidegroups));
+ param.Add("CLIP", clip ? "1" : "0");
+
//TODO: Find out if this actually works...
//param.Add("REFRESHLAYERS", ...)
Modified: trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs 2009-11-15 23:10:34 UTC (rev 4344)
+++ trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs 2009-11-15 23:34:39 UTC (rev 4345)
@@ -478,7 +478,29 @@
}
}
+ public System.IO.Stream RenderToStream(double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
+ {
+ return m_serverConnection.RenderRuntimeMap(m_resourceID, x, y, scale, width, height, dpi, format, clip);
+ }
+ public System.IO.Stream RenderToStream(double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
+ {
+ return m_serverConnection.RenderRuntimeMap(m_resourceID, x1, y1, x2, y2, width, height, dpi, format, clip);
+ }
+
+ public System.Drawing.Bitmap Render(double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
+ {
+ using (System.IO.Stream s = m_serverConnection.RenderRuntimeMap(m_resourceID, x, y, scale, width, height, dpi, format, clip))
+ return new System.Drawing.Bitmap(s);
+ }
+
+ public System.Drawing.Bitmap Render(double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
+ {
+ using (System.IO.Stream s = m_serverConnection.RenderRuntimeMap(m_resourceID, x1, y1, x2, y2, width, height, dpi, format, clip))
+ return new System.Drawing.Bitmap(s);
+ }
+
+
}
public class RuntimeMapGroup
@@ -1307,6 +1329,7 @@
{
base.InnerList.Insert(index, layer);
}
- }
+ }
+
}
Modified: trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs 2009-11-15 23:10:34 UTC (rev 4344)
+++ trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs 2009-11-15 23:34:39 UTC (rev 4345)
@@ -1930,17 +1930,27 @@
public virtual System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi)
{
- return this.RenderRuntimeMap(resourceId, x, y, scale, width, height, dpi, "PNG");
+ return this.RenderRuntimeMap(resourceId, x, y, scale, width, height, dpi, "PNG", false);
}
public virtual System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi)
{
- return this.RenderRuntimeMap(resourceId, x1, y1, x2, y2, width, height, dpi, "PNG");
+ return this.RenderRuntimeMap(resourceId, x1, y1, x2, y2, width, height, dpi, "PNG", false);
}
- public abstract System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format);
- public abstract System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format);
+ public virtual System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format)
+ {
+ return this.RenderRuntimeMap(resourceId, x, y, scale, width, height, dpi, format, false);
+ }
+ public virtual System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format)
+ {
+ return this.RenderRuntimeMap(resourceId, x1, y1, x2, y2, width, height, dpi, format, false);
+ }
+
+ public abstract System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format, bool clip);
+ public abstract System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip);
+
public abstract System.IO.Stream GetTile(string mapdefinition, string baselayergroup, int col, int row, int scaleindex, string format);
Modified: trunk/Tools/Maestro/MaestroAPI/ServerConnectionI.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ServerConnectionI.cs 2009-11-15 23:10:34 UTC (rev 4344)
+++ trunk/Tools/Maestro/MaestroAPI/ServerConnectionI.cs 2009-11-15 23:34:39 UTC (rev 4345)
@@ -181,6 +181,9 @@
System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format);
System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format);
+ System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format, bool clip);
+ System.IO.Stream RenderRuntimeMap(string resourceId, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip);
+
/// <summary>
/// Saves a WebLayout, using its originating resourceId
/// </summary>
More information about the mapguide-commits
mailing list