[mapguide-commits] r5813 - trunk/Tools/Maestro/Maestro.Base/Editor
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 17 12:37:24 EDT 2011
Author: jng
Date: 2011-05-17 09:37:23 -0700 (Tue, 17 May 2011)
New Revision: 5813
Modified:
trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs
Log:
#1694: Add a KML output command to the generated preview web layout. These extra commands are now under a "Tools" flyout menu
Modified: trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs 2011-05-17 16:03:11 UTC (rev 5812)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs 2011-05-17 16:37:23 UTC (rev 5813)
@@ -90,7 +90,7 @@
var wl = ObjectFactory.CreateWebLayout(_edSvc.GetEditedResource().CurrentConnection, new Version(1, 0, 0), mdfId);
//Add a custom zoom command (to assist previews of layers that aren't [0, infinity] scale)
- AttachZoomToScaleCommand(wl);
+ AttachPreviewCommands(wl);
var resId = "Session:" + sessionId + "//" + Guid.NewGuid() + ".WebLayout";
@@ -112,7 +112,7 @@
return url;
}
- private static void AttachZoomToScaleCommand(IWebLayout wl)
+ private static void AttachPreviewCommands(IWebLayout wl)
{
var cmd = wl.CreateInvokeScriptCommand();
cmd.Name = "ZoomScale";
@@ -130,8 +130,29 @@
wl.CommandSet.AddCommand(cmd);
- var item = wl.CreateCommandItem(cmd.Name);
- wl.ToolBar.AddItem(item);
+ var cmd2 = wl.CreateInvokeScriptCommand();
+ cmd2.Name = "GetMapKml";
+ cmd2.Label = "Get KML";
+ cmd2.Description = "Gets the current map as a KML document";
+ cmd2.Tooltip = "Gets the current map as a KML document";
+
+ cmd2.Script = @"
+ var map = parent.parent.GetMapFrame();
+ var url = ""../mapagent/mapagent.fcgi?OPERATION=GETMAPKML&VERSION=1.0.0&FORMAT=KML&DISPLAYDPI=96&MAPDEFINITION=" + wl.Map.ResourceId + @""";
+ url += ""&SESSION="" + map.GetSessionId();
+ window.open(url);";
+
+ cmd2.TargetViewer = TargetViewerType.Ajax;
+ cmd2.ImageURL = "../stdicons/icon_invokescript.gif";
+
+ wl.CommandSet.AddCommand(cmd2);
+
+ var zoomScale = wl.CreateCommandItem(cmd.Name);
+ var menu = wl.CreateFlyout("Tools", "Tools", "Extra tools", "", "",
+ wl.CreateCommandItem("ZoomScale"),
+ wl.CreateCommandItem("GetMapKml")
+ );
+ wl.ToolBar.AddItem(menu);
}
private string GenerateMapPreviewUrl(IResource res)
@@ -153,7 +174,7 @@
var wl = ObjectFactory.CreateWebLayout(_edSvc.GetEditedResource().CurrentConnection, new Version(1, 0, 0), mdfId);
//Add a custom zoom command (to assist previews of layers that aren't [0, infinity] scale)
- AttachZoomToScaleCommand(wl);
+ AttachPreviewCommands(wl);
var resId = "Session:" + sessionId + "//" + Guid.NewGuid() + ".WebLayout";
More information about the mapguide-commits
mailing list