[mapguide-commits] r7872 - in branches/2.4/MgDev/Desktop: MapViewer MapViewer/Redlining MapViewer/Resources MgAppLayout

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Sep 27 01:42:50 PDT 2013


Author: jng
Date: 2013-09-27 01:42:50 -0700 (Fri, 27 Sep 2013)
New Revision: 7872

Added:
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.Designer.cs
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.cs
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.resx
Modified:
   branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs
   branches/2.4/MgDev/Desktop/MapViewer/MapViewer.csproj
   branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgRedlineComponent.cs
   branches/2.4/MgDev/Desktop/MapViewer/MgRedlineControlImpl.cs
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.Designer.cs
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.cs
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.resx
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditor.cs
   branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineManager.cs
   branches/2.4/MgDev/Desktop/MapViewer/Resources/markuplayerdefinition_advanced.xml
   branches/2.4/MgDev/Desktop/MapViewer/Strings.Designer.cs
   branches/2.4/MgDev/Desktop/MapViewer/Strings.resx
   branches/2.4/MgDev/Desktop/MapViewer/Util.cs
   branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout
Log:
#2313: This submission enhances the Redline component in mg-desktop with the following:
 - Configurable component properties:
   - Default redline data store
   - Default geometry storage types
   - Stylization type
   - A boolean flag to indicate if the user should be prompted for new redline layer options when adding a new redline layer. Otherwise, the default component settings are used.
 - Workaround a SQLite FDO provider issue where the key value for an inserted redline cannot be retrieved. In such cases, the refresh button is highlighted to indicate a manual refresh is required.
 - Use polygon approximation for all operations involving digitized circles.
 - Remove default label from Advanced Stylization layer definition.

Modified: branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/BaseInteractionComponents.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -340,7 +340,7 @@
                 if (_wktRw == null)
                     _wktRw = new MgWktReaderWriter();
 
-                MgGeometry geom = _wktRw.Read(Util.MakeWktCircle(x, y, r));
+                MgGeometry geom = _wktRw.Read(Util.MakeWktCircle(x, y, r, true));
                 viewer.SelectByGeometry(geom);
             });
         }

Modified: branches/2.4/MgDev/Desktop/MapViewer/MapViewer.csproj
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MapViewer.csproj	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/MapViewer.csproj	2013-09-27 08:42:50 UTC (rev 7872)
@@ -221,6 +221,12 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>Resources.resx</DependentUpon>
     </Compile>
+    <Compile Include="Redlining\NewRedlineLayerDialog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Redlining\NewRedlineLayerDialog.Designer.cs">
+      <DependentUpon>NewRedlineLayerDialog.cs</DependentUpon>
+    </Compile>
     <Compile Include="Redlining\RedlineEditingCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -320,6 +326,9 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EmbeddedResource Include="Redlining\NewRedlineLayerDialog.resx">
+      <DependentUpon>NewRedlineLayerDialog.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Redlining\RedlineEditingCtrl.resx">
       <DependentUpon>RedlineEditingCtrl.cs</DependentUpon>
     </EmbeddedResource>

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgDefaultToolbar.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -258,7 +258,7 @@
 
             _viewer.DigitizeCircle((x, y, r) =>
             {
-                MgGeometry geom = _wktRw.Read(Util.MakeWktCircle(x, y, r));
+                MgGeometry geom = _wktRw.Read(Util.MakeWktCircle(x, y, r, true));
                 _viewer.SelectByGeometry(geom);
             });
         }

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgRedlineComponent.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgRedlineComponent.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgRedlineComponent.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -23,10 +23,56 @@
         {
             this.Icon = Properties.Resources.redline;
             this.Label = this.ToolTipText = Strings.TitleRedline;
+
+            this.StylizationType = OSGeo.MapGuide.Viewer.Redlining.RedlineStylizationType.Advanced;
+            this.UseDefaultSettings = false;
+            this.DefaultDataStoreFormat = OSGeo.MapGuide.Viewer.Redlining.RedlineDataStoreFormat.SDF;
+            this.DefaultGeometryTypes = MgFeatureGeometricType.Point | MgFeatureGeometricType.Curve | MgFeatureGeometricType.Surface;
         }
+
+        [Category("MapGuide Component Properties")] //NOXLATE
+        [Description("The type of stylization to use for redline features")] //NOXLATE
+        [DefaultValue(Redlining.RedlineStylizationType.Advanced)]
+        [MgComponentProperty]
+        public Redlining.RedlineStylizationType StylizationType
+        {
+            get;
+            set;
+        }
+
+        [Category("MapGuide Component Properties")] //NOXLATE
+        [Description("Indicates whether to use the default settings provided by this component. Setting this to true will bypass any prompts for such information when creating a new redline layer")] //NOXLATE
+        [DefaultValue(false)]
+        [MgComponentProperty]
+        public bool UseDefaultSettings
+        {
+            get;
+            set;
+        }
+
+        [Category("MapGuide Component Properties")] //NOXLATE
+        [Description("The default data store format to use to store redline features. Only takes effect if UseDefaultSettings is true")] //NOXLATE
+        [DefaultValue(Redlining.RedlineDataStoreFormat.SDF)]
+        [MgComponentProperty]
+        public Redlining.RedlineDataStoreFormat DefaultDataStoreFormat
+        {
+            get;
+            set;
+        }
+
+        [Category("MapGuide Component Properties")] //NOXLATE
+        [Description("Indicates the default geometry storage types allowed for a redline data store")] //NOXLATE
+        [DefaultValue(MgFeatureGeometricType.Curve | MgFeatureGeometricType.Point | MgFeatureGeometricType.Surface)]
+        [MgComponentProperty]
+        public int DefaultGeometryTypes
+        {
+            get;
+            set;
+        }
+
         protected override MgControlView CreateControlView()
         {
-            return new MgRedlineControlImpl(this.Viewer);
+            return new MgRedlineControlImpl(this);
         }
     }
 }

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgRedlineControlImpl.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgRedlineControlImpl.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgRedlineControlImpl.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -16,12 +16,12 @@
             InitializeComponent();
         }
 
-        private IMapViewer _viewer;
+        private MgRedlineComponent _component;
 
-        public MgRedlineControlImpl(IMapViewer viewer)
+        public MgRedlineControlImpl(MgRedlineComponent component)
             : this()
         {
-            _viewer = viewer;
+            _component = component;
             this.Title = Strings.TitleRedline;
             SetBodyControl(new RedlineMainCtrl());
         }
@@ -64,7 +64,7 @@
                     lstRedlineLayers.Items.Remove(item);
 
                     AddRedlineLayerOnMap(layer);
-                    _viewer.RefreshMap();
+                    _component.Viewer.RefreshMap();
                 }
             }
         }
@@ -83,7 +83,7 @@
                     lstLayersOnMap.Items.Remove(item);
 
                     AddAvailableRedlineLayer(layer);
-                    _viewer.RefreshMap();
+                    _component.Viewer.RefreshMap();
                     SetBodyControl(new RedlineMainCtrl());
                 }
             }
@@ -103,7 +103,7 @@
                         if (diag.ShowDialog() == DialogResult.OK)
                         {
                             _manager.UpdateLayerStyle(layer, diag.GetUpdatedStyle());
-                            _viewer.RefreshMap();
+                            _component.Viewer.RefreshMap();
                         }
                     }
                 }
@@ -118,7 +118,7 @@
                 var layer = item.Tag as RedlineLayer;
                 if (layer != null)
                 {
-                    var control = new RedlineEditingCtrl(_viewer, layer);
+                    var control = new RedlineEditingCtrl(_component.Viewer, layer);
                     SetBodyControl(control);
                 }
             }
@@ -164,7 +164,7 @@
         {
             if (_manager == null)
             {
-                _manager = new RedlineManager(_viewer);
+                _manager = new RedlineManager(_component.Viewer);
             }
             return _manager;
         }
@@ -185,6 +185,9 @@
         {
             var mgr = GetRedlineManager();
             var p = GetCreateParams();
+            if (p == null)
+                return;
+
             bool bAddedToMap = false;
             var layerInfo = mgr.CreateRedlineLayer(p, out bAddedToMap);
             if (bAddedToMap)
@@ -195,22 +198,48 @@
 
         private CreateRedlineLayerParams GetCreateParams()
         {
-            //TODO: Popup UI dialog for user to enter this information if desired
-            return new CreateRedlineLayerParams()
+            if (_component.UseDefaultSettings)
             {
-                AddToMap = true,
-                Format = RedlineDataStoreFormat.SDF,
-                GeometryTypes = MgFeatureGeometricType.Point | MgFeatureGeometricType.Curve | MgFeatureGeometricType.Surface,
-                Name = GetName(),
-                Style = RedlineStyle.CreateDefault()
-            };
+                //TODO: Popup UI dialog for user to enter this information if desired
+                return new CreateRedlineLayerParams()
+                {
+                    AddToMap = true,
+                    Format = _component.DefaultDataStoreFormat,
+                    GeometryTypes = _component.DefaultGeometryTypes,
+                    Name = GetName(),
+                    Style = RedlineStyle.CreateDefault(),
+                    StyleType = _component.StylizationType
+                };
+            }
+            else
+            {
+                using (var diag = new NewRedlineLayerDialog(RedlineStyle.CreateDefault(),
+                                                            _component.DefaultDataStoreFormat,
+                                                            _component.DefaultGeometryTypes,
+                                                            GetName()))
+                {
+                    if (diag.ShowDialog() == DialogResult.OK)
+                    {
+                        return new CreateRedlineLayerParams()
+                        {
+                            AddToMap = true,
+                            Format = diag.Format,
+                            GeometryTypes = diag.GeometryTypes,
+                            Name = diag.LayerName,
+                            Style = diag.Style,
+                            StyleType = _component.StylizationType
+                        };
+                    }
+                }
+            }
+            return null;
         }
 
         private void btnRefreshAvailableLayers_Click(object sender, EventArgs e)
         {
             lstRedlineLayers.Clear();
             var mgr = GetRedlineManager();
-            MgMapBase map = _viewer.GetMap();
+            MgMapBase map = _component.Viewer.GetMap();
             MgLayerCollection layers = map.GetLayers();
             foreach (var layer in mgr.GetAvailableLayers())
             {
@@ -226,7 +255,7 @@
         {
             lstLayersOnMap.Clear();
             var mgr = GetRedlineManager();
-            MgMapBase map = _viewer.GetMap();
+            MgMapBase map = _component.Viewer.GetMap();
             MgLayerCollection layers = map.GetLayers();
             foreach (var layer in mgr.GetAvailableLayers())
             {

Added: branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.Designer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.Designer.cs	                        (rev 0)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.Designer.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -0,0 +1,164 @@
+namespace OSGeo.MapGuide.Viewer.Redlining
+{
+    partial class NewRedlineLayerDialog
+    {
+        /// <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 Windows Form 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()
+        {
+            this.components = new System.ComponentModel.Container();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewRedlineLayerDialog));
+            this.label1 = new System.Windows.Forms.Label();
+            this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+            this.label2 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.txtName = new System.Windows.Forms.TextBox();
+            this.cmbDataStoreFormat = new System.Windows.Forms.ComboBox();
+            this.chkPoints = new System.Windows.Forms.CheckBox();
+            this.chkLines = new System.Windows.Forms.CheckBox();
+            this.chkPolygons = new System.Windows.Forms.CheckBox();
+            this.btnOK = new System.Windows.Forms.Button();
+            this.btnCancel = new System.Windows.Forms.Button();
+            this.btnEditLayerStyle = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // label1
+            // 
+            resources.ApplyResources(this.label1, "label1");
+            this.label1.Name = "label1";
+            // 
+            // errorProvider
+            // 
+            this.errorProvider.ContainerControl = this;
+            // 
+            // label2
+            // 
+            resources.ApplyResources(this.label2, "label2");
+            this.label2.Name = "label2";
+            // 
+            // label3
+            // 
+            resources.ApplyResources(this.label3, "label3");
+            this.label3.Name = "label3";
+            // 
+            // txtName
+            // 
+            resources.ApplyResources(this.txtName, "txtName");
+            this.txtName.Name = "txtName";
+            // 
+            // cmbDataStoreFormat
+            // 
+            this.cmbDataStoreFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.cmbDataStoreFormat.FormattingEnabled = true;
+            resources.ApplyResources(this.cmbDataStoreFormat, "cmbDataStoreFormat");
+            this.cmbDataStoreFormat.Name = "cmbDataStoreFormat";
+            this.cmbDataStoreFormat.SelectedIndexChanged += new System.EventHandler(this.cmbDataStoreFormat_SelectedIndexChanged);
+            // 
+            // chkPoints
+            // 
+            resources.ApplyResources(this.chkPoints, "chkPoints");
+            this.chkPoints.Name = "chkPoints";
+            this.chkPoints.UseVisualStyleBackColor = true;
+            this.chkPoints.CheckedChanged += new System.EventHandler(this.chkPoints_CheckedChanged);
+            // 
+            // chkLines
+            // 
+            resources.ApplyResources(this.chkLines, "chkLines");
+            this.chkLines.Name = "chkLines";
+            this.chkLines.UseVisualStyleBackColor = true;
+            this.chkLines.CheckedChanged += new System.EventHandler(this.chkLines_CheckedChanged);
+            // 
+            // chkPolygons
+            // 
+            resources.ApplyResources(this.chkPolygons, "chkPolygons");
+            this.chkPolygons.Name = "chkPolygons";
+            this.chkPolygons.UseVisualStyleBackColor = true;
+            this.chkPolygons.CheckedChanged += new System.EventHandler(this.chkPolygons_CheckedChanged);
+            // 
+            // btnOK
+            // 
+            resources.ApplyResources(this.btnOK, "btnOK");
+            this.btnOK.Name = "btnOK";
+            this.btnOK.UseVisualStyleBackColor = true;
+            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+            // 
+            // btnCancel
+            // 
+            resources.ApplyResources(this.btnCancel, "btnCancel");
+            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.btnCancel.Name = "btnCancel";
+            this.btnCancel.UseVisualStyleBackColor = true;
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+            // 
+            // btnEditLayerStyle
+            // 
+            resources.ApplyResources(this.btnEditLayerStyle, "btnEditLayerStyle");
+            this.btnEditLayerStyle.Name = "btnEditLayerStyle";
+            this.btnEditLayerStyle.UseVisualStyleBackColor = true;
+            this.btnEditLayerStyle.Click += new System.EventHandler(this.btnEditLayerStyle_Click);
+            // 
+            // NewRedlineLayerDialog
+            // 
+            this.AcceptButton = this.btnOK;
+            resources.ApplyResources(this, "$this");
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.CancelButton = this.btnCancel;
+            this.ControlBox = false;
+            this.Controls.Add(this.btnEditLayerStyle);
+            this.Controls.Add(this.btnCancel);
+            this.Controls.Add(this.btnOK);
+            this.Controls.Add(this.chkPolygons);
+            this.Controls.Add(this.chkLines);
+            this.Controls.Add(this.chkPoints);
+            this.Controls.Add(this.cmbDataStoreFormat);
+            this.Controls.Add(this.txtName);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+            this.Name = "NewRedlineLayerDialog";
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.ErrorProvider errorProvider;
+        private System.Windows.Forms.TextBox txtName;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Button btnCancel;
+        private System.Windows.Forms.Button btnOK;
+        private System.Windows.Forms.CheckBox chkPolygons;
+        private System.Windows.Forms.CheckBox chkLines;
+        private System.Windows.Forms.CheckBox chkPoints;
+        private System.Windows.Forms.ComboBox cmbDataStoreFormat;
+        private System.Windows.Forms.Button btnEditLayerStyle;
+    }
+}
\ No newline at end of file

Added: branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.cs	                        (rev 0)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace OSGeo.MapGuide.Viewer.Redlining
+{
+    internal partial class NewRedlineLayerDialog : Form
+    {
+        private NewRedlineLayerDialog()
+        {
+            InitializeComponent();
+        }
+
+        private RedlineStyle _style;
+
+        public NewRedlineLayerDialog(RedlineStyle style, RedlineDataStoreFormat defaultDataStore, int defaultGeometryTypes, string defaultName)
+            : this()
+        {
+            _style = style;
+            cmbDataStoreFormat.DataSource = Enum.GetValues(typeof(RedlineDataStoreFormat));
+            
+            txtName.Text = defaultName;
+            cmbDataStoreFormat.SelectedItem = defaultDataStore;
+            if ((defaultGeometryTypes & MgFeatureGeometricType.Point) == MgFeatureGeometricType.Point)
+                chkPoints.Checked = true;
+            if ((defaultGeometryTypes & MgFeatureGeometricType.Curve) == MgFeatureGeometricType.Curve)
+                chkLines.Checked = true;
+            if ((defaultGeometryTypes & MgFeatureGeometricType.Surface) == MgFeatureGeometricType.Surface)
+                chkPolygons.Checked = true;
+        }
+
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.OK;
+        }
+
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+        }
+
+        private void btnEditLayerStyle_Click(object sender, EventArgs e)
+        {
+            using (var diag = new RedlineStyleDialog(_style))
+            {
+                if (diag.ShowDialog() == DialogResult.OK)
+                {
+                    _style = diag.GetUpdatedStyle();
+                }
+            }
+        }
+
+        private void chkPoints_CheckedChanged(object sender, EventArgs e)
+        {
+            if (chkPoints.Checked && this.Format == RedlineDataStoreFormat.SHP)
+            {
+                chkLines.Checked = false;
+                chkPolygons.Checked = false;
+            }
+        }
+
+        private void chkLines_CheckedChanged(object sender, EventArgs e)
+        {
+            if (chkLines.Checked && this.Format == RedlineDataStoreFormat.SHP)
+            {
+                chkPoints.Checked = false;
+                chkPolygons.Checked = false;
+            }
+        }
+
+        private void chkPolygons_CheckedChanged(object sender, EventArgs e)
+        {
+            if (chkPolygons.Checked && this.Format == RedlineDataStoreFormat.SHP)
+            {
+                chkPoints.Checked = false;
+                chkLines.Checked = false;
+            }
+        }
+
+        public RedlineStyle Style { get { return _style; } }
+
+        public RedlineDataStoreFormat Format { get { return (RedlineDataStoreFormat)cmbDataStoreFormat.SelectedItem; } }
+
+        public int GeometryTypes
+        {
+            get
+            {
+                int result = 0;
+                if (chkPoints.Checked)
+                    result |= MgFeatureGeometricType.Point;
+                if (chkLines.Checked)
+                    result |= MgFeatureGeometricType.Curve;
+                if (chkPolygons.Checked)
+                    result |= MgFeatureGeometricType.Surface;
+                return result;
+            }
+        }
+
+        public string LayerName { get { return txtName.Text; } }
+
+        private void cmbDataStoreFormat_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            errorProvider.Clear();
+            if (this.Format == RedlineDataStoreFormat.SHP)
+            {
+                int gt = this.GeometryTypes;
+                if (gt != MgFeatureGeometricType.Point &&
+                    gt != MgFeatureGeometricType.Curve &&
+                    gt != MgFeatureGeometricType.Surface)
+                {
+                    errorProvider.SetError(chkPoints, Strings.SHPGeometryLimitation);
+                    errorProvider.SetError(chkLines, Strings.SHPGeometryLimitation);
+                    errorProvider.SetError(chkPolygons, Strings.SHPGeometryLimitation);
+                }
+            }
+        }
+    }
+}

Added: branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.resx
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.resx	                        (rev 0)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/NewRedlineLayerDialog.resx	2013-09-27 08:42:50 UTC (rev 7872)
@@ -0,0 +1,441 @@
+<?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>
+  <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="label1.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+    <value>13, 13</value>
+  </data>
+  <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+    <value>35, 13</value>
+  </data>
+  <data name="label1.TabIndex" type="System.Int32, mscorlib">
+    <value>0</value>
+  </data>
+  <data name="label1.Text" xml:space="preserve">
+    <value>Name</value>
+  </data>
+  <data name=">>label1.Name" xml:space="preserve">
+    <value>label1</value>
+  </data>
+  <data name=">>label1.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>label1.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>label1.ZOrder" xml:space="preserve">
+    <value>10</value>
+  </data>
+  <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="btnOK.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Bottom, Right</value>
+  </data>
+  <data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
+    <value>271, 150</value>
+  </data>
+  <data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
+    <value>75, 23</value>
+  </data>
+  <data name="btnOK.TabIndex" type="System.Int32, mscorlib">
+    <value>8</value>
+  </data>
+  <data name="btnOK.Text" xml:space="preserve">
+    <value>OK</value>
+  </data>
+  <data name=">>btnOK.Name" xml:space="preserve">
+    <value>btnOK</value>
+  </data>
+  <data name=">>btnOK.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnOK.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>btnOK.ZOrder" xml:space="preserve">
+    <value>2</value>
+  </data>
+  <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
+    <value>6, 13</value>
+  </data>
+  <data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Bottom, Right</value>
+  </data>
+  <data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
+    <value>352, 150</value>
+  </data>
+  <data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
+    <value>75, 23</value>
+  </data>
+  <data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
+    <value>9</value>
+  </data>
+  <data name="btnCancel.Text" xml:space="preserve">
+    <value>Cancel</value>
+  </data>
+  <data name=">>btnCancel.Name" xml:space="preserve">
+    <value>btnCancel</value>
+  </data>
+  <data name=">>btnCancel.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnCancel.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>btnCancel.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+    <value>444, 185</value>
+  </data>
+  <data name="btnEditLayerStyle.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Bottom, Left</value>
+  </data>
+  <data name="btnEditLayerStyle.Location" type="System.Drawing.Point, System.Drawing">
+    <value>12, 150</value>
+  </data>
+  <data name="btnEditLayerStyle.Size" type="System.Drawing.Size, System.Drawing">
+    <value>75, 23</value>
+  </data>
+  <data name="btnEditLayerStyle.TabIndex" type="System.Int32, mscorlib">
+    <value>10</value>
+  </data>
+  <data name="btnEditLayerStyle.Text" xml:space="preserve">
+    <value>Layer Style</value>
+  </data>
+  <data name=">>btnEditLayerStyle.Name" xml:space="preserve">
+    <value>btnEditLayerStyle</value>
+  </data>
+  <data name=">>btnEditLayerStyle.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnEditLayerStyle.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>btnEditLayerStyle.ZOrder" xml:space="preserve">
+    <value>0</value>
+  </data>
+  <data name="chkPolygons.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="chkPolygons.Location" type="System.Drawing.Point, System.Drawing">
+    <value>153, 118</value>
+  </data>
+  <data name="chkPolygons.Size" type="System.Drawing.Size, System.Drawing">
+    <value>69, 17</value>
+  </data>
+  <data name="chkPolygons.TabIndex" type="System.Int32, mscorlib">
+    <value>7</value>
+  </data>
+  <data name="chkPolygons.Text" xml:space="preserve">
+    <value>Polygons</value>
+  </data>
+  <data name=">>chkPolygons.Name" xml:space="preserve">
+    <value>chkPolygons</value>
+  </data>
+  <data name=">>chkPolygons.Type" xml:space="preserve">
+    <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>chkPolygons.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>chkPolygons.ZOrder" xml:space="preserve">
+    <value>3</value>
+  </data>
+  <data name="chkLines.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="chkLines.Location" type="System.Drawing.Point, System.Drawing">
+    <value>153, 95</value>
+  </data>
+  <data name="chkLines.Size" type="System.Drawing.Size, System.Drawing">
+    <value>51, 17</value>
+  </data>
+  <data name="chkLines.TabIndex" type="System.Int32, mscorlib">
+    <value>6</value>
+  </data>
+  <data name="chkLines.Text" xml:space="preserve">
+    <value>Lines</value>
+  </data>
+  <data name=">>chkLines.Name" xml:space="preserve">
+    <value>chkLines</value>
+  </data>
+  <data name=">>chkLines.Type" xml:space="preserve">
+    <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>chkLines.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>chkLines.ZOrder" xml:space="preserve">
+    <value>4</value>
+  </data>
+  <data name="chkPoints.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="chkPoints.Location" type="System.Drawing.Point, System.Drawing">
+    <value>153, 72</value>
+  </data>
+  <data name="chkPoints.Size" type="System.Drawing.Size, System.Drawing">
+    <value>55, 17</value>
+  </data>
+  <data name="chkPoints.TabIndex" type="System.Int32, mscorlib">
+    <value>5</value>
+  </data>
+  <data name="chkPoints.Text" xml:space="preserve">
+    <value>Points</value>
+  </data>
+  <data name=">>chkPoints.Name" xml:space="preserve">
+    <value>chkPoints</value>
+  </data>
+  <data name=">>chkPoints.Type" xml:space="preserve">
+    <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>chkPoints.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>chkPoints.ZOrder" xml:space="preserve">
+    <value>5</value>
+  </data>
+  <data name="cmbDataStoreFormat.Location" type="System.Drawing.Point, System.Drawing">
+    <value>153, 40</value>
+  </data>
+  <data name="cmbDataStoreFormat.Size" type="System.Drawing.Size, System.Drawing">
+    <value>150, 21</value>
+  </data>
+  <data name="cmbDataStoreFormat.TabIndex" type="System.Int32, mscorlib">
+    <value>4</value>
+  </data>
+  <data name=">>cmbDataStoreFormat.Name" xml:space="preserve">
+    <value>cmbDataStoreFormat</value>
+  </data>
+  <data name=">>cmbDataStoreFormat.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>cmbDataStoreFormat.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>cmbDataStoreFormat.ZOrder" xml:space="preserve">
+    <value>6</value>
+  </data>
+  <data name="txtName.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Top, Left, Right</value>
+  </data>
+  <data name="txtName.Location" type="System.Drawing.Point, System.Drawing">
+    <value>153, 10</value>
+  </data>
+  <data name="txtName.Size" type="System.Drawing.Size, System.Drawing">
+    <value>274, 20</value>
+  </data>
+  <data name="txtName.TabIndex" type="System.Int32, mscorlib">
+    <value>3</value>
+  </data>
+  <data name=">>txtName.Name" xml:space="preserve">
+    <value>txtName</value>
+  </data>
+  <data name=">>txtName.Type" xml:space="preserve">
+    <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>txtName.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>txtName.ZOrder" xml:space="preserve">
+    <value>7</value>
+  </data>
+  <data name="label3.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="label3.Location" type="System.Drawing.Point, System.Drawing">
+    <value>13, 73</value>
+  </data>
+  <data name="label3.Size" type="System.Drawing.Size, System.Drawing">
+    <value>124, 13</value>
+  </data>
+  <data name="label3.TabIndex" type="System.Int32, mscorlib">
+    <value>2</value>
+  </data>
+  <data name="label3.Text" xml:space="preserve">
+    <value>Allowed Geometry Types</value>
+  </data>
+  <data name=">>label3.Name" xml:space="preserve">
+    <value>label3</value>
+  </data>
+  <data name=">>label3.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>label3.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>label3.ZOrder" xml:space="preserve">
+    <value>8</value>
+  </data>
+  <data name="label2.AutoSize" type="System.Boolean, mscorlib">
+    <value>True</value>
+  </data>
+  <data name="label2.Location" type="System.Drawing.Point, System.Drawing">
+    <value>13, 43</value>
+  </data>
+  <data name="label2.Size" type="System.Drawing.Size, System.Drawing">
+    <value>93, 13</value>
+  </data>
+  <data name="label2.TabIndex" type="System.Int32, mscorlib">
+    <value>1</value>
+  </data>
+  <data name="label2.Text" xml:space="preserve">
+    <value>Data Store Format</value>
+  </data>
+  <data name=">>label2.Name" xml:space="preserve">
+    <value>label2</value>
+  </data>
+  <data name=">>label2.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>label2.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name=">>label2.ZOrder" xml:space="preserve">
+    <value>9</value>
+  </data>
+  <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
+    <value>CenterParent</value>
+  </data>
+  <data name="$this.Text" xml:space="preserve">
+    <value>New Redline Layer</value>
+  </data>
+  <data name=">>errorProvider.Name" xml:space="preserve">
+    <value>errorProvider</value>
+  </data>
+  <data name=">>errorProvider.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ErrorProvider, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>$this.Name" xml:space="preserve">
+    <value>NewRedlineLayerDialog</value>
+  </data>
+  <data name=">>$this.Type" xml:space="preserve">
+    <value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+</root>
\ No newline at end of file

Modified: branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.Designer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.Designer.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.Designer.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -31,6 +31,7 @@
             this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RedlineEditingCtrl));
             this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.chkPromptForLabel = new System.Windows.Forms.CheckBox();
             this.lblRedlineLayerName = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.lblDrawingStatus = new System.Windows.Forms.Label();
@@ -54,7 +55,6 @@
             this.btnDrawRect = new System.Windows.Forms.Button();
             this.btnDrawLineString = new System.Windows.Forms.Button();
             this.drawTooltip = new System.Windows.Forms.ToolTip(this.components);
-            this.chkPromptForLabel = new System.Windows.Forms.CheckBox();
             this.groupBox1.SuspendLayout();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.grdActiveRedlines)).BeginInit();
@@ -81,6 +81,12 @@
             this.groupBox1.Name = "groupBox1";
             this.groupBox1.TabStop = false;
             // 
+            // chkPromptForLabel
+            // 
+            resources.ApplyResources(this.chkPromptForLabel, "chkPromptForLabel");
+            this.chkPromptForLabel.Name = "chkPromptForLabel";
+            this.chkPromptForLabel.UseVisualStyleBackColor = true;
+            // 
             // lblRedlineLayerName
             // 
             resources.ApplyResources(this.lblRedlineLayerName, "lblRedlineLayerName");
@@ -184,6 +190,7 @@
             this.btnRefresh.Image = global::OSGeo.MapGuide.Viewer.Properties.Resources.view_refresh;
             resources.ApplyResources(this.btnRefresh, "btnRefresh");
             this.btnRefresh.Name = "btnRefresh";
+            this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
             // 
             // label2
             // 
@@ -249,12 +256,6 @@
             this.btnDrawLineString.UseVisualStyleBackColor = true;
             this.btnDrawLineString.Click += new System.EventHandler(this.btnDrawLineString_Click);
             // 
-            // chkPromptForLabel
-            // 
-            resources.ApplyResources(this.chkPromptForLabel, "chkPromptForLabel");
-            this.chkPromptForLabel.Name = "chkPromptForLabel";
-            this.chkPromptForLabel.UseVisualStyleBackColor = true;
-            // 
             // RedlineEditingCtrl
             // 
             resources.ApplyResources(this, "$this");

Modified: branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -17,6 +17,8 @@
             grdActiveRedlines.DataSource = _activeRedlines;
         }
 
+        private Color _origToolbarColor;
+
         private IMapViewer _viewer;
         private RedlineLayer _layer;
         private RedlineEditor _ed;
@@ -30,11 +32,28 @@
             _ed = new RedlineEditor(_viewer, _layer);
             this.Disposed += OnDisposed;
             lblRedlineLayerName.Text = _layer.Name;
+            _origToolbarColor = btnRefresh.BackColor;
         }
 
+        private bool _allowPoints;
+        private bool _allowLines;
+        private bool _allowPoly;
+
         protected override void OnLoad(EventArgs e)
         {
             base.OnLoad(e);
+
+            _allowPoints = ((_layer.GeometryTypes & MgFeatureGeometricType.Point) == MgFeatureGeometricType.Point);
+            _allowLines = ((_layer.GeometryTypes & MgFeatureGeometricType.Curve) == MgFeatureGeometricType.Curve);
+            _allowPoly = ((_layer.GeometryTypes & MgFeatureGeometricType.Surface) == MgFeatureGeometricType.Surface);
+
+            btnDrawPoint.Enabled = _allowPoints;
+            btnDrawLine.Enabled = _allowLines;
+            btnDrawLineString.Enabled = _allowLines;
+            btnDrawRect.Enabled = _allowPoly;
+            btnDrawPolygon.Enabled = _allowPoly;
+            btnDrawCircle.Enabled = _allowPoly;
+
             RefreshActiveRedlineList(false);
         }
 
@@ -60,12 +79,12 @@
             if (e.PropertyName == "DigitizingType")
             {
                 bool bNotDrawing = (_viewer.DigitizingType == MapDigitizationType.None);
-                btnDrawCircle.Enabled =
-                btnDrawLine.Enabled =
-                btnDrawLineString.Enabled =
-                btnDrawPoint.Enabled =
-                btnDrawPolygon.Enabled =
-                btnDrawRect.Enabled = bNotDrawing;
+                btnDrawCircle.Enabled = (_allowPoly && bNotDrawing);
+                btnDrawLine.Enabled = (_allowLines && bNotDrawing);
+                btnDrawLineString.Enabled = (_allowLines && bNotDrawing);
+                btnDrawPoint.Enabled = (_allowPoints && bNotDrawing);
+                btnDrawPolygon.Enabled = (_allowPoly && bNotDrawing);
+                btnDrawRect.Enabled = (_allowPoly && bNotDrawing);
 
                 lblDrawingStatus.Visible = !bNotDrawing;
             }
@@ -81,9 +100,13 @@
 
         private BindingList<RedlineObject> _activeRedlines;
 
-        private void OnRedlineAdded(int key, string text)
+        private void OnRedlineAdded(int? key, string text)
         {
-            _activeRedlines.Add(new RedlineObject(key, text));
+            if (key.HasValue)
+                _activeRedlines.Add(new RedlineObject(key.Value, text));
+            else
+                btnRefresh.BackColor = Color.Orange;
+                //RefreshActiveRedlineList(false);
         }
 
         private void btnDrawPoint_Click(object sender, EventArgs e)
@@ -173,5 +196,11 @@
                 _viewer.UpdateSelection();
             }
         }
+
+        private void btnRefresh_Click(object sender, EventArgs e)
+        {
+            btnRefresh.BackColor = _origToolbarColor;
+            RefreshActiveRedlineList(false);
+        }
     }
 }

Modified: branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.resx
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.resx	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditingCtrl.resx	2013-09-27 08:42:50 UTC (rev 7872)
@@ -126,13 +126,13 @@
     <value>27, 109</value>
   </data>
   <data name="chkPromptForLabel.Size" type="System.Drawing.Size, System.Drawing">
-    <value>169, 17</value>
+    <value>155, 17</value>
   </data>
   <data name="chkPromptForLabel.TabIndex" type="System.Int32, mscorlib">
     <value>13</value>
   </data>
   <data name="chkPromptForLabel.Text" xml:space="preserve">
-    <value>Prompt for text when complete</value>
+    <value>Prompt for text when drawn</value>
   </data>
   <data name=">>chkPromptForLabel.Name" xml:space="preserve">
     <value>chkPromptForLabel</value>

Modified: branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditor.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditor.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineEditor.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -4,7 +4,17 @@
 
 namespace OSGeo.MapGuide.Viewer.Redlining
 {
-    public delegate void RedlineAction(int key, string text);
+    /// <summary>
+    /// A callback that's invoked when a new redline object is added
+    /// </summary>
+    /// <param name="key">The key of the inserted feature. Some providers may not be able to return the key of the inserted feature and will pass null into this callback</param>
+    /// <param name="text">The text of the redline</param>
+    public delegate void RedlineAction(int? key, string text);
+
+    /// <summary>
+    /// A callback that retrieves the redline text
+    /// </summary>
+    /// <returns></returns>
     public delegate string RedlineTextFunction();
 
     internal class RedlineEditor
@@ -151,7 +161,11 @@
 
             MgPropertyCollection result = redlineLayer.UpdateFeatures(commands);
             MgInt32Property updateResult = result.GetItem(0) as MgInt32Property;
-
+            MgStringProperty errorResult = result.GetItem(0) as MgStringProperty;
+            if (errorResult != null)
+            {
+                throw new Exception(errorResult.GetValue());
+            }
             _viewer.RefreshMap();
         }
 
@@ -183,23 +197,38 @@
             MgPropertyCollection result = redlineLayer.UpdateFeatures(commands);
             //Insert result is a MgFeatureProperty containing an MgFeatureReader
             MgFeatureProperty insertResult = result.GetItem(0) as MgFeatureProperty;
+            MgStringProperty errorResult = result.GetItem(0) as MgStringProperty;
             if (insertResult != null)
             {
                 var reader = insertResult.GetValue();
                 int inserted = 0;
-                int id = -1;
-                if (reader.ReadNext())
+                int? id = null;
+                try
                 {
-                    id = reader.GetInt32(idProp.Name);
-                    inserted++;
+                    if (reader.ReadNext())
+                    {
+                        inserted++;
+                        id = reader.GetInt32(idProp.Name);
+                    }
                 }
-                reader.Close();
+                catch (MgException ex)
+                {
+                    ex.Dispose();
+                }
+                finally
+                {
+                    reader.Close();
+                }
                 if (inserted > 0)
                 {
                     _viewer.RefreshMap();
                     onRedlineAdded(id, text);
                 }
             }
+            else if (errorResult != null)
+            {
+                throw new Exception(errorResult.GetValue());
+            }
         }
 
         private void AddRectangle(RedlineTextFunction retrieveTextMethod, RedlineAction onRedlineAdded)
@@ -285,7 +314,7 @@
                 string text = string.Empty;
                 if (retrieveTextMethod != null)
                     text = retrieveTextMethod();
-                MgGeometry geom = _wktRW.Read(Util.MakeWktCircle(x, y, r));
+                MgGeometry geom = _wktRW.Read(Util.MakeWktCircle(x, y, r, true));
                 InsertRedlineGeometry(text, geom, onRedlineAdded);
             });
         }

Modified: branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineManager.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineManager.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Redlining/RedlineManager.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -42,9 +42,6 @@
         public RedlineLayer CreateRedlineLayer(CreateRedlineLayerParams param, out bool bAddedToMap)
         {
             bAddedToMap = false;
-
-            //HACK: SQLite leaky abstraction (hard-coded schema name), SHP probably has some leaks of its own, so we can't assume MarkupSchema:Markup
-            //as the class name interrogate our schema to figure it out
             MgResourceIdentifier fsId = GenerateRedlineFeatureSourceId(param);
 
             string className = null;
@@ -60,9 +57,6 @@
             else
             {
                 MgFeatureSchema schema = RedlineSchemaFactory.CreateSchema(param.GeometryTypes);
-                MgClassDefinitionCollection classes = schema.GetClasses();
-                MgClassDefinition cls = classes.GetItem(0);
-                className = schema.Name + ":" + cls.Name;
 
                 providerName = "OSGeo.SDF";
                 if (param.Format == RedlineDataStoreFormat.SHP)
@@ -72,6 +66,14 @@
 
                 MgFileFeatureSourceParams createParams = new MgFileFeatureSourceParams(providerName, RedlineSchemaFactory.SPATIAL_CONTEXT, _map.GetMapSRS(), schema);
                 _featSvc.CreateFeatureSource(fsId, createParams);
+
+                //HACK: SQLite leaky abstraction (hard-coded schema name), SHP probably has some leaks of its own, so we can't assume MarkupSchema:Markup
+                //as the class name so re-interrogate our schema to figure it out
+                MgFeatureSchemaCollection schemas = _featSvc.DescribeSchema(fsId, string.Empty, null);
+                schema = schemas.GetItem(0);
+                MgClassDefinitionCollection classes = schema.GetClasses();
+                MgClassDefinition cls = classes.GetItem(0);
+                className = schema.Name + ":" + cls.Name;
             }
 
             MgResourceIdentifier ldfId = GenerateRedlineLayerDefinitionId(param);
@@ -624,7 +626,7 @@
         }
     }
 
-    internal enum RedlineStylizationType : int
+    public enum RedlineStylizationType : int
     {
         Basic = 1,
         Advanced = 2
@@ -650,7 +652,7 @@
         Rectangle
     }
 
-    internal enum RedlineDataStoreFormat
+    public enum RedlineDataStoreFormat
     {
         SDF,
         SHP,

Modified: branches/2.4/MgDev/Desktop/MapViewer/Resources/markuplayerdefinition_advanced.xml
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Resources/markuplayerdefinition_advanced.xml	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Resources/markuplayerdefinition_advanced.xml	2013-09-27 08:42:50 UTC (rev 7872)
@@ -187,7 +187,7 @@
                 <ParameterDefinition>
                   <Parameter>
                     <Identifier>CONTENT</Identifier>
-                    <DefaultValue>'text'</DefaultValue>
+                    <DefaultValue></DefaultValue>
                     <DisplayName>T&ext</DisplayName>
                     <Description>Text</Description>
                     <DataType>Content</DataType>
@@ -459,7 +459,7 @@
                 <ParameterDefinition>
                   <Parameter>
                     <Identifier>CONTENT</Identifier>
-                    <DefaultValue>'text'</DefaultValue>
+                    <DefaultValue></DefaultValue>
                     <DisplayName>T&ext</DisplayName>
                     <Description>Text</Description>
                     <DataType>Content</DataType>
@@ -842,7 +842,7 @@
                 <ParameterDefinition>
                   <Parameter>
                     <Identifier>CONTENT</Identifier>
-                    <DefaultValue>'text'</DefaultValue>
+                    <DefaultValue></DefaultValue>
                     <DisplayName>T&ext</DisplayName>
                     <Description>Text</Description>
                     <DataType>Content</DataType>

Modified: branches/2.4/MgDev/Desktop/MapViewer/Strings.Designer.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Strings.Designer.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Strings.Designer.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -948,6 +948,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to SHP only allows a single geometry type.
+        /// </summary>
+        internal static string SHPGeometryLimitation {
+            get {
+                return ResourceManager.GetString("SHPGeometryLimitation", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Specify the text for the selected redline(s).
         /// </summary>
         internal static string SpecifyRedlineText {

Modified: branches/2.4/MgDev/Desktop/MapViewer/Strings.resx
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Strings.resx	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Strings.resx	2013-09-27 08:42:50 UTC (rev 7872)
@@ -499,4 +499,7 @@
   <data name="TitleEditRedlineText" xml:space="preserve">
     <value>Edit Redline Text</value>
   </data>
+  <data name="SHPGeometryLimitation" xml:space="preserve">
+    <value>SHP only allows a single geometry type</value>
+  </data>
 </root>
\ No newline at end of file

Modified: branches/2.4/MgDev/Desktop/MapViewer/Util.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/Util.cs	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MapViewer/Util.cs	2013-09-27 08:42:50 UTC (rev 7872)
@@ -8,11 +8,43 @@
 {
     internal static class Util
     {
-        public static string MakeWktCircle(double x, double y, double r)
+        static List<double> simulateCirclePoints;
+        static int simulateCircleHalfPointNumber = 40;
+
+        static Util()
         {
-            return "CURVEPOLYGON ((" + (x - r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + " (CIRCULARARCSEGMENT (" + x.ToString(CultureInfo.InvariantCulture) + " " + (y - r).ToString(CultureInfo.InvariantCulture) + ", " + (x + r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + "), CIRCULARARCSEGMENT (" + x.ToString(CultureInfo.InvariantCulture) + " " + (y + r).ToString(CultureInfo.InvariantCulture) + ", " + (x - r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + "))))"; //NOXLATE
+            simulateCirclePoints = new List<double>();
+            for (var i = 0; i < 2 * simulateCircleHalfPointNumber + 1; i++)
+            {
+                simulateCirclePoints.Add(Math.Cos(Math.PI * i / simulateCircleHalfPointNumber));
+                simulateCirclePoints.Add(Math.Sin(Math.PI * i / simulateCircleHalfPointNumber));
+            }
         }
 
+        public static string MakeWktCircle(double x, double y, double r, bool bSimulate)
+        {
+            if (bSimulate)
+            {
+                StringBuilder fgfText = new StringBuilder("POLYGON ((");
+                for (var i = 0; i < 2 * simulateCircleHalfPointNumber + 1; i++)
+                {
+                    if (i != 0)
+                    {
+                        fgfText.Append(", ");
+                    }
+                    fgfText.Append((x + r * simulateCirclePoints[2 * i]).ToString(CultureInfo.InvariantCulture));
+                    fgfText.Append(" ");
+                    fgfText.Append((y + r * simulateCirclePoints[2 * i + 1]).ToString(CultureInfo.InvariantCulture));
+                }
+                fgfText.Append("))");
+                return fgfText.ToString();
+            }
+            else
+            {
+                return "CURVEPOLYGON ((" + (x - r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + " (CIRCULARARCSEGMENT (" + x.ToString(CultureInfo.InvariantCulture) + " " + (y - r).ToString(CultureInfo.InvariantCulture) + ", " + (x + r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + "), CIRCULARARCSEGMENT (" + x.ToString(CultureInfo.InvariantCulture) + " " + (y + r).ToString(CultureInfo.InvariantCulture) + ", " + (x - r).ToString(CultureInfo.InvariantCulture) + " " + y.ToString(CultureInfo.InvariantCulture) + "))))"; //NOXLATE
+            }
+        }
+
         public static string MakeWktPolygon(double x1, double y1, double x2, double y2)
         {
             string x1str = x1.ToString(CultureInfo.InvariantCulture);

Modified: branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout
===================================================================
--- branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout	2013-09-26 09:05:10 UTC (rev 7871)
+++ branches/2.4/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout	2013-09-27 08:42:50 UTC (rev 7872)
@@ -359,6 +359,22 @@
           <Name>Target</Name>
           <Value>enum:OSGeo.MapGuide.Viewer.MgViewerTarget:TaskPane</Value>
         </NameValue>
+        <NameValue>
+          <Name>StylizationType</Name>
+          <Value>enum:OSGeo.MapGuide.Viewer.Redlining.RedlineStylizationType:Advanced</Value>
+        </NameValue>
+        <NameValue>
+          <Name>UseDefaultSettings</Name>
+          <Value>true</Value>
+        </NameValue>
+        <NameValue>
+          <Name>DefaultDataStoreFormat</Name>
+          <Value>enum:OSGeo.MapGuide.Viewer.Redlining.RedlineDataStoreFormat:SDF</Value>
+        </NameValue>
+        <NameValue>
+          <Name>DefaultGeometryTypes</Name>
+          <Value>7</Value>
+        </NameValue>
       </Properties>
     </ComponentDefinition>
     <ComponentDefinition>



More information about the mapguide-commits mailing list