//public void editModeChanged(MODETYPE_OPERATION p_EditMode)
        //{
        //    try
        //    {
        //        //Thread safe method for updating controls -  Thread is not the form thread we have to Invoke the method for thread safety.
        //        if (IsHandleCreated)
        //        {
        //            lblMode.Invoke((MethodInvoker)delegate
        //            {
        //                this.ModeTypeOperation = p_EditMode;
        //                switch (p_EditMode)
        //                {
        //                    case MODETYPE_OPERATION.EditAddCoordinate:
        //                        lblMode.Text = "Mode: Edit Add Coordinate";
        //                        break;
        //                    case MODETYPE_OPERATION.EditDeleteCoordinate:
        //                        lblMode.Text = "Mode: Edit Delete Coordinate";
        //                        break;
        //                    case MODETYPE_OPERATION.SnapModeEnabled:
        //                        lblMode.Text = "Mode: Edit Snap To Parcel";
        //                        break;
        //                    case MODETYPE_OPERATION.DrawArea:
        //                        lblMode.Text = "Mode: Draw Polygon";
        //                        break;
        //                    case MODETYPE_OPERATION.EditModeEnabled:
        //                        lblMode.Text = "Mode: Edit Move Coordinate";
        //                        break;
        //                    default:
        //                        lblMode.Text = "Mode: Select";
        //                        break;
        //                }
        //            });
        //        }
        //    }
        //    catch (Exception)
        //    {
        //    }
        //    finally
        //    {
        //    }
        //}
        //public void EventHandler_onModeTypeOperationChanged(object sender, ModeTypeEventArgs p_ModeType)
        //{
        //    try
        //    {
        //        if (inEventModeTypeOperationChanged == false)
        //        {
        //            inEventModeTypeOperationChanged = true;
        //            if (this.ModeTypeOperation != p_ModeType.MODETYPE_OPERATION)
        //            {
        //                this.ModeTypeOperation = p_ModeType.MODETYPE_OPERATION;
        //            }
        //            if (this._EditFactory != null)
        //            {
        //                if (this._EditFactory.EditModeOperation != p_ModeType.MODETYPE_OPERATION)
        //                {
        //                    this._EditFactory.OnMapModeTypeChanged(p_ModeType);
        //                }
        //            }
        //            //if (this._SnapFactory != null)
        //            //{
        //            //    if (this._SnapFactory.EditModeOperation != p_ModeType.MODETYPE_OPERATION)
        //            //    {
        //            //        this._SnapFactory.OnMapModeTypeChanged(p_ModeType);
        //            //    }
        //            //}
        //        }
        //    }
        //    catch (Exception objEx)
        //    {
        //        throw;
        //    }
        //    finally
        //    {
        //        inEventModeTypeOperationChanged = false;
        //    }
        //}
        public void EventHandler_onEditModeChanged(object sender, ModeTypeEventArgs changeArgs)
        {
            if (this.ModeTypeOperation != changeArgs.MODETYPE_OPERATION)
            {
                try
                {
                    if (IsHandleCreated)
                    {
                        axComponentControl1.MouseMode = Manifold.Interop.ControlMouseMode.ControlMouseModeNone;
                        this.ModeTypeOperation = changeArgs.MODETYPE_OPERATION;
                        gbEditMode.Text = "  Edit Mode - Disabled:  ";
                        gbDrawControls.Enabled = true;

                        if (this._EditFactory != null)
                        {
                            if (this._EditFactory.EditModeOperation != changeArgs.MODETYPE_OPERATION)
                            {
                                this._EditFactory.OnMapModeTypeChanged(changeArgs);
                            }
                        }

                        switch (changeArgs.MODETYPE_OPERATION)
                        {
                            case MODETYPE_OPERATION.SelectMode:
                                lblMode.Text = "Mode: Select";
                                Utility.unsetSelection(axComponentControl1, DrawingOriginal);
                                break;
                            case MODETYPE_OPERATION.EditModeEnabled:
                                gbDrawControls.Enabled = false;

                                gbEditMode.Text = "  Edit Mode - Enabled:  ";
                                lblMode.Text = "Mode: Edit-Move Coordinate";
                                btnEditAddCoordinate.Enabled = true;
                                btnEditDeleteCoordinate.Enabled = true;
                                btnEditMoveGeom.Enabled = true;
                                break;
                            case MODETYPE_OPERATION.EditMoveGeom:
                                gbDrawControls.Enabled = false;
                                gbEditMode.Text = "  Edit Mode - Move Geom:  ";
                                lblMode.Text = "Mode: Edit-Move Geom";
                                btnEditAddCoordinate.Enabled = true;
                                btnEditDeleteCoordinate.Enabled = true;
                                btnEditMoveGeom.Enabled = true;
                                break;
                            case MODETYPE_OPERATION.EditAddCoordinate:
                                gbDrawControls.Enabled = false;

                                gbEditMode.Text = "  Edit Mode - Add Coordinate:  ";
                                lblMode.Text = "Mode: Edit-Add Coordinate";
                                btnEditAddCoordinate.Enabled = true;
                                btnEditDeleteCoordinate.Enabled = true;
                                btnEditMoveGeom.Enabled = true;
                                break;
                            case MODETYPE_OPERATION.EditDeleteCoordinate:
                                gbDrawControls.Enabled = false;
                                gbEditMode.Text = "  Edit Mode - Delete Coordinate:  ";
                                lblMode.Text = "Mode: Edit-Delete Coordinate";
                                btnEditAddCoordinate.Enabled = true;
                                btnEditDeleteCoordinate.Enabled = true;
                                btnEditMoveGeom.Enabled = true;
                                break;
                            case MODETYPE_OPERATION.DrawArea:
                                axComponentControl1.MouseMode = Manifold.Interop.ControlMouseMode.ControlMouseModeGenericArea;
                                lblMode.Text = "Mode: Draw Area";
                                break;
                            case MODETYPE_OPERATION.DrawLine:
                                axComponentControl1.MouseMode = Manifold.Interop.ControlMouseMode.ControlMouseModeGenericLine;
                                lblMode.Text = "Mode: Draw Line";
                                break;
                            case MODETYPE_OPERATION.DrawPoint:
                                axComponentControl1.MouseMode = Manifold.Interop.ControlMouseMode.ControlMouseModeGenericPoint;
                                lblMode.Text = "Mode: Draw Point";
                                break;
                            default:
                                break;
                        }
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("ERROR:" + err.Message);
                }
                finally
                {
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="p_MapControl">Reference to the Manifold ActiveX control.</param>
        /// <param name="p_DrawingOriginalEditObject">The Drawing layer which contains the original Line\Area to edit.</param>
        /// <param name="p_DrawingEdit">A temporary Drawing layer - used only to display inflection Points of the Line\area to edit.</param>
        /// <param name="p_Draw">Internal class used to draw ojects on Drawings.</param>
        /// <param name="p_MODETYPE_OPERATION"></param>
        public EditDrawingFactorySQL(AxManifold.Interop.AxComponentControl p_MapControl, Manifold.Interop.Drawing p_DrawingOriginalEditObject, Manifold.Interop.Drawing p_DrawingEdit, MODETYPE_OPERATION p_MODETYPE_OPERATION)
        {
            try
            {
                //Map events
                this._MapControl = p_MapControl;

                this._MapControl.MouseDownEvent += new AxManifold.Interop.IComponentControlEvents_MouseDownEventHandler(this.MapControl_MouseDownEvent);
                this._MapControl.MouseUpEvent += new AxManifold.Interop.IComponentControlEvents_MouseUpEventHandler(this.MapControl_MouseUpEvent);
                this._MapControl.MouseMoveEvent += new AxManifold.Interop.IComponentControlEvents_MouseMoveEventHandler(this.MapControl_MouseMoveEvent);

                if (p_DrawingOriginalEditObject == null )
                {
                    throw new Exception("The Original Edit objects Drawing was null in the EditDrawingFactory constructor. Assign an initialised Manifold.Interop.Drawing to it before calling this class.");
                }
                else
                {
                    this._DrawingOriginalEditObject = p_DrawingOriginalEditObject;
                }

                if (p_DrawingEdit == null)
                {
                    throw new Exception("The Edit Drawing layer was null in the EditDrawingFactory constructor. Assign an initialised Manifold.Interop.Drawing to it before calling this class.");
                }
                else
                {
                    this._DrawingEdit = p_DrawingEdit;
                }
                this._EditModeOperation = p_MODETYPE_OPERATION;
                clearEditLayer();
            }
            catch (Exception objEx)
            {
                throw;
            }
        }
 public ModeTypeEventArgs(MODETYPE_OPERATION modeTypeOperation)
 {
     this.MODETYPE_OPERATION = modeTypeOperation;
 }
 public static bool isModeTypeEditEnabled(MODETYPE_OPERATION p_MODETYPE_OPERATION)
 {
     bool bReturn = false;
     try
     {
         if (p_MODETYPE_OPERATION == MODETYPE_OPERATION.EditModeEnabled
           || p_MODETYPE_OPERATION == MODETYPE_OPERATION.EditAddCoordinate
           || p_MODETYPE_OPERATION == MODETYPE_OPERATION.EditMoveGeom
           || p_MODETYPE_OPERATION == MODETYPE_OPERATION.EditDeleteCoordinate)
         {
             bReturn = true;
         }
     }
     catch (Exception objEx)
     {
         throw;
     }
     return bReturn;
 }