[mapguide-commits] r6940 - in branches/2.4/MgDev/Desktop: MapViewer MgAppLayout SampleExtension

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Aug 20 04:43:34 PDT 2012


Author: jng
Date: 2012-08-20 04:43:34 -0700 (Mon, 20 Aug 2012)
New Revision: 6940

Added:
   branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.Designer.cs
   branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.cs
   branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.resx
Modified:
   branches/2.4/MgDev/Desktop/MapViewer/IMapViewer.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
   branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout
   branches/2.4/MgDev/Desktop/SampleExtension/SampleComponents.cs
   branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.csproj
   branches/2.4/MgDev/Desktop/SampleExtension/SamplesTaskPane.Designer.cs
Log:
mg-desktop: Expose Pre and Post map rendering events, allowing you to add custom rendering logic before and after the map image is rendered onto the control. This allows for things like backdrops and (non-MapGuide) watermarks to be rendered onto the viewer control, below or above the map image depending on which event you hooked onto. A basic sample has been added to the SampleExtension project to demonstrate this.

Modified: branches/2.4/MgDev/Desktop/MapViewer/IMapViewer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/IMapViewer.cs	2012-08-20 08:32:45 UTC (rev 6939)
+++ branches/2.4/MgDev/Desktop/MapViewer/IMapViewer.cs	2012-08-20 11:43:34 UTC (rev 6940)
@@ -5,6 +5,7 @@
 using System.Drawing;
 using System.ComponentModel;
 using System.Collections.ObjectModel;
+using System.Windows.Forms;
 
 namespace OSGeo.MapGuide.Viewer
 {
@@ -280,6 +281,10 @@
         /// Updates the rendered selection. Call this method if you have manipulated the selection
         /// set outside of the viewer
         /// </summary>
+        /// <remarks>
+        /// If you have modified the selection as a result of calling <see cref="SelectByGeometry"/>, calling
+        /// this method is not necessary as it will have automatically do this.
+        /// </remarks>
         void UpdateSelection();
 
         /// <summary>
@@ -287,12 +292,20 @@
         /// set outside of the viewer
         /// </summary>
         /// <param name="raise">Indicates if the <see cref="SelectionChanged"/> event should be raised as well</param>
+        /// <remarks>
+        /// If you have modified the selection as a result of calling <see cref="SelectByGeometry"/>, calling
+        /// this method is not necessary as it will have automatically do this.
+        /// </remarks>
         void UpdateSelection(bool raise);
 
         /// <summary>
         /// Selects features from all selectable layers that intersects the given geometry
         /// </summary>
         /// <param name="geom"></param>
+        /// <remarks>
+        /// This method will automatically trigger selection updates. Calling <see cref="UpdateSelection"/> is not necessary if
+        /// you are calling this method
+        /// </remarks>
         void SelectByGeometry(MgGeometry geom);
 
         /// <summary>
@@ -300,6 +313,10 @@
         /// </summary>
         /// <param name="geom"></param>
         /// <param name="maxFeatures">The maximum number of features to select. Specify -1 for all features</param>
+        /// <remarks>
+        /// This method will automatically trigger selection updates. Calling <see cref="UpdateSelection"/> is not necessary if
+        /// you are calling this method
+        /// </remarks>
         void SelectByGeometry(MgGeometry geom, int maxFeatures);
 
         /// <summary>
@@ -392,6 +409,55 @@
         /// Cancels the active digitization process. Does nothing if <see cref="DigitizingType"/> is MapDigitizationType.None
         /// </summary>
         void CancelDigitization();
+
+        /// <summary>
+        /// Raised before map rendering begins in the control's Paint method. This allows you to do custom rendering before the
+        /// map image is rendered. Depending on whatever map/layer transparency settings, content rendered by your handler may
+        /// be obscured by the map image that is rendered afterwards. If you need to do custom rendering on top of a rendered map
+        /// image, consider doing the rendering on the <see cref="E:OSGeo.MapGuide.Viewer.IMapViewer.PostMapRender"/> event
+        /// instead.
+        /// </summary>
+        /// <remarks>
+        /// The <see cref="T:System.Drawing.Graphics"/> object attached to the <see cref="T:System.Windows.Forms.PaintEventArgs"/>
+        /// that is passed to your handler will already have any scale/translate transforms applied as a result of user panning or
+        /// transitional zooming.
+        /// 
+        /// Also note that any such custom rendrered content will not appear in any custom rendering or plotting output through
+        /// MapGuide's APIs as it has no knowledge of the your custom rendered content here.
+        /// </remarks>
+        event PaintEventHandler PreMapRender;
+
+        /// <summary>
+        /// Raised after map render has completed in the control's Paint method. This allows you to do custom rendering after the
+        /// map image is rendered
+        /// </summary>
+        /// <remarks>
+        /// The <see cref="T:System.Drawing.Graphics"/> object attached to the <see cref="T:System.Windows.Forms.PaintEventArgs"/>
+        /// that is passed to your handler will already have any scale/translate transforms applied as a result of user panning or
+        /// transitional zooming.
+        /// 
+        /// Also note that any such custom rendrered content will not appear in any custom rendering or plotting output through
+        /// MapGuide's APIs as it has no knowledge of the your custom rendered content here.
+        /// </remarks>
+        event PaintEventHandler PostMapRender;
+
+        /// <summary>
+        /// Gets the width of this control
+        /// </summary>
+        int ControlWidth { get; }
+
+        /// <summary>
+        /// Gets the height of this control
+        /// </summary>
+        int ControlHeight { get; }
+
+        /// <summary>
+        /// Converts the given coordinate in screen units to map units
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <returns></returns>
+        PointF ScreenToMapUnits(double x, double y);
     }
 
     public class MgMapViewHistoryEntry

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-08-20 08:32:45 UTC (rev 6939)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgMapViewer.cs	2012-08-20 11:43:34 UTC (rev 6940)
@@ -514,8 +514,8 @@
         protected override void OnPaint(PaintEventArgs e)
         {
             base.OnPaint(e);
+
             Trace.TraceInformation("OnPaint(e)");
-
             ApplyPaintTranslateTransform(e);
 
             if (mouseWheelSx.HasValue && mouseWheelSy.HasValue && mouseWheelSx.Value != 0.0 && mouseWheelSy.Value != 0.0)
@@ -523,6 +523,10 @@
                 e.Graphics.ScaleTransform(mouseWheelSx.Value, mouseWheelSy.Value);
             }
 
+            var pre = this.PreMapRender;
+            if (pre != null)
+                pre(this, e);
+
             if (_mapImage != null)
             {
                 Trace.TraceInformation("Render buffered map image");
@@ -591,6 +595,10 @@
                     }
                 }
             }
+
+            var post = this.PostMapRender;
+            if (post != null)
+                post(this, e);
         }
 
         private void ApplyPaintTranslateTransform(PaintEventArgs e)
@@ -1465,6 +1473,10 @@
         /// Updates the rendered selection. Call this method if you have manipulated the selection
         /// set outside of the viewer. This does not raise the <see cref="SelectionChanged"/> event
         /// </summary>
+        /// <remarks>
+        /// If you have modified the selection as a result of calling <see cref="SelectByGeometry"/>, calling
+        /// this method is not necessary as it will have automatically do this.
+        /// </remarks>
         public void UpdateSelection()
         {
             UpdateSelection(false);
@@ -1475,6 +1487,10 @@
         /// set outside of the viewer
         /// </summary>
         /// <param name="raise">Indicates if the <see cref="SelectionChanged"/> event should be raised as well</param>
+        /// <remarks>
+        /// If you have modified the selection as a result of calling <see cref="SelectByGeometry"/>, calling
+        /// this method is not necessary as it will have automatically do this.
+        /// </remarks>
         public void UpdateSelection(bool raise)
         {
             RenderSelection();
@@ -2875,5 +2891,13 @@
         }
 
         public bool HasLoadedMap { get { return _map != null; } }
+
+        int IMapViewer.ControlHeight { get { return this.Height; } }
+
+        int IMapViewer.ControlWidth { get { return this.Width; } }
+
+        public event PaintEventHandler PreMapRender;
+
+        public event PaintEventHandler PostMapRender;
     }
 }

Modified: branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout
===================================================================
--- branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout	2012-08-20 08:32:45 UTC (rev 6939)
+++ branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout	2012-08-20 11:43:34 UTC (rev 6940)
@@ -494,5 +494,10 @@
       <Assembly>SampleExtension.dll</Assembly>
       <ClassName>SampleExtension.MgCustomOutputComponent</ClassName>
     </ComponentDefinition>
+    <ComponentDefinition>
+      <ComponentID>PrePostRender</ComponentID>
+      <Assembly>SampleExtension.dll</Assembly>
+      <ClassName>SampleExtension.MgPrePostRenderingComponent</ClassName>
+    </ComponentDefinition>
   </Components>
 </AppLayout>
\ No newline at end of file

Added: branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.Designer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.Designer.cs	                        (rev 0)
+++ branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.Designer.cs	2012-08-20 11:43:34 UTC (rev 6940)
@@ -0,0 +1,103 @@
+namespace SampleExtension
+{
+    partial class PrePostRendering
+    {
+        /// <summary> 
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Component Designer generated code
+
+        /// <summary> 
+        /// Required method for Designer support - do not modify 
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PrePostRendering));
+            this.label1 = new System.Windows.Forms.Label();
+            this.chkEnablePreRender = new System.Windows.Forms.CheckBox();
+            this.chkEnablePostRender = new System.Windows.Forms.CheckBox();
+            this.txtMessages = new System.Windows.Forms.TextBox();
+            this.SuspendLayout();
+            // 
+            // label1
+            // 
+            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.label1.Location = new System.Drawing.Point(12, 12);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(227, 285);
+            this.label1.TabIndex = 1;
+            this.label1.Text = resources.GetString("label1.Text");
+            // 
+            // chkEnablePreRender
+            // 
+            this.chkEnablePreRender.AutoSize = true;
+            this.chkEnablePreRender.Location = new System.Drawing.Point(15, 314);
+            this.chkEnablePreRender.Name = "chkEnablePreRender";
+            this.chkEnablePreRender.Size = new System.Drawing.Size(110, 17);
+            this.chkEnablePreRender.TabIndex = 2;
+            this.chkEnablePreRender.Text = "Enable pre-render";
+            this.chkEnablePreRender.UseVisualStyleBackColor = true;
+            this.chkEnablePreRender.CheckedChanged += new System.EventHandler(this.chkEnablePreRender_CheckedChanged);
+            // 
+            // chkEnablePostRender
+            // 
+            this.chkEnablePostRender.AutoSize = true;
+            this.chkEnablePostRender.Location = new System.Drawing.Point(131, 314);
+            this.chkEnablePostRender.Name = "chkEnablePostRender";
+            this.chkEnablePostRender.Size = new System.Drawing.Size(115, 17);
+            this.chkEnablePostRender.TabIndex = 3;
+            this.chkEnablePostRender.Text = "Enable post-render";
+            this.chkEnablePostRender.UseVisualStyleBackColor = true;
+            this.chkEnablePostRender.CheckedChanged += new System.EventHandler(this.chkEnablePostRender_CheckedChanged);
+            // 
+            // txtMessages
+            // 
+            this.txtMessages.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+                        | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtMessages.Location = new System.Drawing.Point(15, 348);
+            this.txtMessages.Multiline = true;
+            this.txtMessages.Name = "txtMessages";
+            this.txtMessages.ReadOnly = true;
+            this.txtMessages.Size = new System.Drawing.Size(224, 68);
+            this.txtMessages.TabIndex = 4;
+            // 
+            // PrePostRendering
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.txtMessages);
+            this.Controls.Add(this.chkEnablePostRender);
+            this.Controls.Add(this.chkEnablePreRender);
+            this.Controls.Add(this.label1);
+            this.Name = "PrePostRendering";
+            this.Size = new System.Drawing.Size(255, 442);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.CheckBox chkEnablePreRender;
+        private System.Windows.Forms.CheckBox chkEnablePostRender;
+        private System.Windows.Forms.TextBox txtMessages;
+    }
+}

Added: branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.cs
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.cs	                        (rev 0)
+++ branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.cs	2012-08-20 11:43:34 UTC (rev 6940)
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using OSGeo.MapGuide.Viewer;
+
+namespace SampleExtension
+{
+    public partial class PrePostRendering : MgControlView
+    {
+        private IMapViewer _viewer;
+
+        private bool _bPreRender;
+        private bool _bPostRender;
+
+        public PrePostRendering(IMapViewer viewer)
+        {
+            InitializeComponent();
+            _viewer = viewer;
+            _viewer.PreMapRender += new PaintEventHandler(OnPreMapRender);
+            _viewer.PostMapRender += new PaintEventHandler(OnPostMapRender);
+            this.Title = "Pre/Post Rendering";
+        }
+
+        void OnPostMapRender(object sender, PaintEventArgs e)
+        {
+            if (_bPostRender)
+            {
+                string str = "Post-render text";
+                SizeF size = e.Graphics.MeasureString(str, SystemFonts.DialogFont);
+                e.Graphics.DrawString(str, SystemFonts.DialogFont, Brushes.Green, new PointF(0, _viewer.ControlHeight - size.Height));
+                txtMessages.AppendText("Invoked post-map render handler" + Environment.NewLine);
+            }
+        }
+
+        void OnPreMapRender(object sender, PaintEventArgs e)
+        {
+            txtMessages.Clear();
+            if (_bPreRender)
+            {
+                e.Graphics.DrawString("Pre-render text", SystemFonts.DialogFont, Brushes.Red, new PointF(0, 0));
+                txtMessages.AppendText("Invoked pre-map render handler" + Environment.NewLine);
+            }
+        }
+
+        protected override void SubCleanup()
+        {
+            base.SubCleanup();
+        }
+
+        private void chkEnablePreRender_CheckedChanged(object sender, EventArgs e)
+        {
+            _bPreRender = chkEnablePreRender.Checked;
+            _viewer.RefreshMap(); //IMapViewer currently does not expose a control invalidation mechanism, so a RefreshMap() needs to be done
+        }
+
+        private void chkEnablePostRender_CheckedChanged(object sender, EventArgs e)
+        {
+            _bPostRender = chkEnablePostRender.Checked;
+            _viewer.RefreshMap(); //IMapViewer currently does not expose a control invalidation mechanism, so a RefreshMap() needs to be done
+        }
+    }
+}

Added: branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.resx
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.resx	                        (rev 0)
+++ branches/2.4/MgDev/Desktop/SampleExtension/PrePostRendering.resx	2012-08-20 11:43:34 UTC (rev 6940)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="label1.Text" xml:space="preserve">
+    <value>This sample demonstrates hooking on to the map rendering pipeline. The viewer exposes a PreMapRender and PostMapRender events allowing you to do your own custom painting before and after the map is rendered.
+
+Note that when the map viewer's paint method is invoked, it is not calling MapGuide's Rendering Service APIs. Instead it is rendering a buffered result of a previous call to the APIs. Refreshing a map calls the Rendering Service APIs and buffers the result for future control
+ paint calls, allowing for client-side transformations when panning, zooming, etc
+
+These events allow you to render custom backdrops or overlays for your map. Notice how the pre-render text can be obscured by the map, whereas the post-render text will always display
+</value>
+  </data>
+</root>
\ No newline at end of file

Modified: branches/2.4/MgDev/Desktop/SampleExtension/SampleComponents.cs
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/SampleComponents.cs	2012-08-20 08:32:45 UTC (rev 6939)
+++ branches/2.4/MgDev/Desktop/SampleExtension/SampleComponents.cs	2012-08-20 11:43:34 UTC (rev 6940)
@@ -115,4 +115,17 @@
             return new CustomOutput(this.Viewer);
         }
     }
+
+    public class MgPrePostRenderingComponent : MgViewerComponent
+    {
+        public MgPrePostRenderingComponent()
+        {
+            this.Target = MgViewerTarget.TaskPane;
+        }
+
+        protected override MgControlView CreateControlView()
+        {
+            return new PrePostRendering(this.Viewer);
+        }
+    }
 }

Modified: branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.csproj
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.csproj	2012-08-20 08:32:45 UTC (rev 6939)
+++ branches/2.4/MgDev/Desktop/SampleExtension/SampleExtension.csproj	2012-08-20 11:43:34 UTC (rev 6940)
@@ -133,6 +133,12 @@
     <Compile Include="ModifyingMapsAndLayers.Designer.cs">
       <DependentUpon>ModifyingMapsAndLayers.cs</DependentUpon>
     </Compile>
+    <Compile Include="PrePostRendering.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="PrePostRendering.Designer.cs">
+      <DependentUpon>PrePostRendering.cs</DependentUpon>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ParcelQueryResultWindow.cs">
       <SubType>Form</SubType>
@@ -220,6 +226,9 @@
     <EmbeddedResource Include="ParcelQueryResultWindow.resx">
       <DependentUpon>ParcelQueryResultWindow.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="PrePostRendering.resx">
+      <DependentUpon>PrePostRendering.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="ResourceIdDialog.resx">
       <DependentUpon>ResourceIdDialog.cs</DependentUpon>
     </EmbeddedResource>

Modified: branches/2.4/MgDev/Desktop/SampleExtension/SamplesTaskPane.Designer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/SampleExtension/SamplesTaskPane.Designer.cs	2012-08-20 08:32:45 UTC (rev 6939)
+++ branches/2.4/MgDev/Desktop/SampleExtension/SamplesTaskPane.Designer.cs	2012-08-20 11:43:34 UTC (rev 6940)
@@ -39,6 +39,7 @@
             this.label2 = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.btnReload = new System.Windows.Forms.Button();
+            this.btnPrePostRender = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // btnHelloMap
@@ -142,7 +143,7 @@
             // 
             // label1
             // 
-            this.label1.Location = new System.Drawing.Point(23, 324);
+            this.label1.Location = new System.Drawing.Point(20, 357);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(200, 45);
             this.label1.TabIndex = 9;
@@ -151,7 +152,7 @@
             // 
             // btnReload
             // 
-            this.btnReload.Location = new System.Drawing.Point(23, 372);
+            this.btnReload.Location = new System.Drawing.Point(20, 405);
             this.btnReload.Name = "btnReload";
             this.btnReload.Size = new System.Drawing.Size(173, 23);
             this.btnReload.TabIndex = 10;
@@ -159,10 +160,22 @@
             this.btnReload.UseVisualStyleBackColor = true;
             this.btnReload.Click += new System.EventHandler(this.btnReload_Click);
             // 
+            // btnPrePostRender
+            // 
+            this.btnPrePostRender.Location = new System.Drawing.Point(23, 307);
+            this.btnPrePostRender.Name = "btnPrePostRender";
+            this.btnPrePostRender.Size = new System.Drawing.Size(173, 23);
+            this.btnPrePostRender.TabIndex = 11;
+            this.btnPrePostRender.Tag = "PrePostRender";
+            this.btnPrePostRender.Text = "Pre/Post Rendering";
+            this.btnPrePostRender.UseVisualStyleBackColor = true;
+            this.btnPrePostRender.Click += new System.EventHandler(this.OnActionClick);
+            // 
             // SamplesTaskPane
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.btnPrePostRender);
             this.Controls.Add(this.btnReload);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.label2);
@@ -175,7 +188,7 @@
             this.Controls.Add(this.btnHelloViewer);
             this.Controls.Add(this.btnHelloMap);
             this.Name = "SamplesTaskPane";
-            this.Size = new System.Drawing.Size(247, 413);
+            this.Size = new System.Drawing.Size(247, 446);
             this.ResumeLayout(false);
 
         }
@@ -193,5 +206,6 @@
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Button btnReload;
+        private System.Windows.Forms.Button btnPrePostRender;
     }
 }



More information about the mapguide-commits mailing list