コード例 #1
0
        private void MapControl_MouseUpEvent(object sender, AxManifold.Interop.IComponentControlEvents_MouseUpEvent e)
        {
            try
            {
                bool bPrepareEdit = false;

                if (this._MouseIsClickedDown == true &&
                  (Utility.isModeTypeEditEnabled(EditModeOperation) == true))
                {
                    //Need to set this here because it gets updated in the 'prepareEditObject()' methods
                    //and the GEOMChanged Event needs the original value before it was Edited.
                    //string sSelectedManifoldObjectOriginalGEOM = this._SelectedManifoldObjectOriginalGEOM;

                    switch (EditModeOperation)
                    {
                        case MODETYPE_OPERATION.EditDeleteCoordinate:
                            this._DrawingEdit.SelectNone();
                            break;
                        case MODETYPE_OPERATION.EditAddCoordinate:
                            this._DrawingEdit.SelectNone();
                            break;
                        case MODETYPE_OPERATION.EditModeEnabled:
                            if (this._SelectedEditManifoldID > 0 && this._UserMovedCoordinate == true)
                            {
                                Manifold.Interop.Point objPointScreen = e.pArgs.LocationScreen;
                                objPointScreen.Y += this._YCoordMapClickOffset;
                                objPointScreen = this._MapControl.ScreenToNative(objPointScreen);
                                moveOriginalPointCoordinate(objPointScreen.X, objPointScreen.Y);
                                bPrepareEdit = true;

                                //After MouseUp Event - remove selection for move so that it dosnt move anymore
                                this._SelectedEditManifoldID = -1;
                            }
                            break;
                        case MODETYPE_OPERATION.EditMoveGeom:
                            if (this._SelectedEditManifoldID > 0 && this._UserMovedGeom == true)
                            {
                                this._SelectedEditManifoldPointEnd = e.pArgs.LocationNative;
                                if (this._SelectedEditManifoldPointStart != null && this._SelectedEditManifoldPointEnd != null)
                                {
                                    //Move Geom the difference in meters Horizontally and Vertically
                                    moveGeomWithSQL();
                                    bPrepareEdit = true;
                                }
                                //After MouseUp Event - remove selection for move so that it dosnt move anymore
                                this._SelectedEditManifoldID = -1;
                            }
                            break;
                        default:
                            break;
                        //}
                    }
                    if (this._DrawingOriginalEditObject.Selection.Count < 1 || Convert.ToInt32(this._DrawingOriginalEditObject.Selection[0].Record.get_Data("ID").ToString()) != this._SelectedManifoldID)
                    {
                        Utility.setSelection(this._MapControl, this._DrawingOriginalEditObject, this._SelectedManifoldID);
                    }

                    if (bPrepareEdit == true)
                    {
                        prepareEditObject();
                    }
                }
            }
            catch (Exception objEx)
            {
                throw;
            }
            finally
            {
                this._UserMovedCoordinate = false;
                this._UserAddedCoordinate = false;
                this._UserDeletedCoordinate = false;
                this._UserMovedGeom = false;
                this._MouseIsClickedDown = false;
                this._SelectedEditManifoldPointEnd = null;
                this._SelectedEditManifoldPointStart = null;

                this._SelectedPointBranchIndex = -1;
                this._SelectedPointIndex = -1;
            }
        }
コード例 #2
0
        private void MapControl_MouseDownEvent(object sender, AxManifold.Interop.IComponentControlEvents_MouseDownEvent e)
        {
            try
            {
                if (Utility.isModeTypeEditEnabled(EditModeOperation) == true)
                {
                    this._DrawingEdit.SelectNone();
                    if (this._DrawingOriginalEditObject.Selection.Count < 1 || Convert.ToInt32(this._DrawingOriginalEditObject.Selection[0].Record.get_Data("ID").ToString()) != this._SelectedManifoldID)
                    {
                        Utility.setSelection(this._MapControl, this._DrawingOriginalEditObject, this._SelectedManifoldID);
                    }

                    if (this._DrawingEdit.Selection.Count < 1)
                    {
                        //Save the Edit object GEOM string before any EDITING is performed on it.
                        this._SelectedManifoldObjectOriginalGEOM = this._DrawingOriginalEditObject.Selection[0].get_Geom().ToTextWKT();

                        //SET SELECTION
                        Manifold.Interop.Point objPointScreen = e.pArgs.LocationScreen;
                        objPointScreen.Y += this._YCoordMapClickOffset;
                        objPointScreen = this._MapControl.ScreenToNative(objPointScreen);

                        switch (EditModeOperation)
                        {
                            case MODETYPE_OPERATION.EditDeleteCoordinate:
                                this._MouseIsClickedDown = true;
                                deleteCoordinate(objPointScreen);
                                break;
                            case MODETYPE_OPERATION.EditAddCoordinate:
                                this._MouseIsClickedDown = true;
                                if (this._AddingCoordinate == false)
                                {
                                    addCoordinate(objPointScreen);
                                }
                                break;
                            case MODETYPE_OPERATION.EditModeEnabled:
                                Utility.setNearestSelection(this._MapControl, this._DrawingEdit, objPointScreen, _SelectionTolerance);

                                if (this._DrawingEdit.Selection.Count > 0)
                                {
                                    //Record selected Point object
                                    this._MouseIsClickedDown = true;
                                    this._SelectedEditManifoldID = Convert.ToInt32(this._DrawingEdit.Selection[0].Record.get_Data("ID").ToString());

                                    this._SelectedPointBranchIndex = Convert.ToInt32(this._DrawingEdit.Selection[0].Record.get_Data("BranchIndex").ToString());
                                    this._SelectedPointIndex = Convert.ToInt32(this._DrawingEdit.Selection[0].Record.get_Data("PointIndex").ToString());
                                }
                                else
                                {
                                    this._SelectedEditManifoldID = -1;
                                }
                                break;
                            case MODETYPE_OPERATION.EditMoveGeom:
                                Utility.setNearestSelection(this._MapControl, this._DrawingEdit, objPointScreen, _SelectionTolerance);

                                if (this._DrawingEdit.Selection.Count > 0)
                                {
                                    this._GeomMovedDetails = new GeomMovedDetails();
                                    this._UserMovedGeom = false;
                                    //Record selected Point object
                                    this._MouseIsClickedDown = true;
                                    this._SelectedEditManifoldID = Convert.ToInt32(this._DrawingEdit.Selection[0].Record.get_Data("ID").ToString());
                                    this._SelectedEditManifoldPointStart = e.pArgs.LocationNative;
                                }
                                else
                                {
                                    this._SelectedEditManifoldID = -1;
                                }
                                break;
                            default:
                                this._MouseIsClickedDown = false;
                                break;
                        }
                    }
                }
            }
            catch (Exception objEx)
            {
                throw;
            }
        }