[mapguide-commits] r5991 - in trunk/Tools/Maestro: Maestro.Base/Editor OSGeo.MapGuide.MaestroAPI/ObjectModels

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jul 21 07:59:31 EDT 2011


Author: jng
Date: 2011-07-21 04:59:31 -0700 (Thu, 21 Jul 2011)
New Revision: 5991

Modified:
   trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
Log:
Enable watermark previews. This is possible because a blank Map Definition with a watermark attached will still render said watermark in the AJAX viewer.


Modified: trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs	2011-07-21 11:33:16 UTC (rev 5990)
+++ trunk/Tools/Maestro/Maestro.Base/Editor/ResourcePreviewEngine.cs	2011-07-21 11:59:31 UTC (rev 5991)
@@ -30,6 +30,7 @@
 using OSGeo.MapGuide.ObjectModels.WebLayout;
 using OSGeo.MapGuide.MaestroAPI;
 using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
+using OSGeo.MapGuide.ObjectModels.WatermarkDefinition;
 
 namespace Maestro.Base.Editor
 {
@@ -173,6 +174,16 @@
             wl.ToolBar.AddItem(menu);
         }
 
+        private string GenerateWatermarkPreviewUrl(IWatermarkDefinition wmd)
+        {
+            //We demand a 2.3.0 Map Definition
+            IMapDefinition2 map = (IMapDefinition2)ObjectFactory.CreateMapDefinition(wmd.CurrentConnection, new Version(2, 3, 0), "Watermark Definition Preview");
+            map.CoordinateSystem = @"LOCAL_CS[""*XY-M*"", LOCAL_DATUM[""*X-Y*"", 10000], UNIT[""Meter"", 1], AXIS[""X"", EAST], AXIS[""Y"", NORTH]]";
+            map.Extents = ObjectFactory.CreateEnvelope(-1000000, -1000000, 1000000, 1000000);
+            map.AddWatermark(wmd.CreateInstance());
+            return GenerateMapPreviewUrl(map);
+        }
+
         private string GenerateMapPreviewUrl(IResource res)
         {
             string url = _rootUrl;
@@ -262,6 +273,8 @@
                     return GenerateMapPreviewUrl(res);
                 case ResourceTypes.WebLayout:
                     return GenerateWebLayoutPreviewUrl(res);
+                case ResourceTypes.WatermarkDefinition:
+                    return GenerateWatermarkPreviewUrl((IWatermarkDefinition)res);
                 default:
                     throw new InvalidOperationException(Properties.Resources.UnpreviewableResourceType);
             }
@@ -273,7 +286,8 @@
             ResourceTypes.ApplicationDefinition,
             ResourceTypes.LayerDefinition,
             ResourceTypes.MapDefinition,
-            ResourceTypes.WebLayout
+            ResourceTypes.WebLayout,
+            ResourceTypes.WatermarkDefinition
         };
 
         internal static bool IsPreviewableType(OSGeo.MapGuide.MaestroAPI.ResourceTypes rt)

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs	2011-07-21 11:33:16 UTC (rev 5990)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs	2011-07-21 11:59:31 UTC (rev 5991)
@@ -83,6 +83,9 @@
                 BackgroundColor = Color.White,
                 MapLayer = new System.ComponentModel.BindingList<MapLayerType>(),
                 MapLayerGroup = new System.ComponentModel.BindingList<MapLayerGroupType>(),
+#if MDF_230
+                Watermarks = new BindingList<OSGeo.MapGuide.ObjectModels.WatermarkDefinition_2_3_0.WatermarkType>()
+#endif
             };
         }
 



More information about the mapguide-commits mailing list