Пример #1
0
        public override void Run(object sender, EventArgs e)
        {
            bool _isAuth = Authority3DService.Instance.IsAuthorized;

            if (!_isAuth)
            {
                XtraMessageBox.Show("此功能需要USB Key。", "提示");
                return;
            }
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null || app.Workbench == null)
            {
                return;
            }
            Map3DCommandManager.Push(this);
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            System.DateTime birthDay = System.DateTime.Now;
            if (CommonUtils.Instance().EnableTemproalEdit)
            {
                using (DateSettingDialog dateSettingDialog = new DateSettingDialog(true))
                {
                    if (dateSettingDialog.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    birthDay = dateSettingDialog.Time;
                }
            }
            app.Workbench.SetMenuEnable(false);
            dlg = new FrmAddPipeBuild();
            dlg.SetBirthDay(birthDay);
            dlg.Show();
            dlg.FormClosed += new FormClosedEventHandler(dlg_FormClosed);
        }
Пример #2
0
        public override void Run(object sender, System.EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            try
            {
                RenderControlEditServices.Instance().StopGeometryEdit(true);
                app.Current3DMapControl.PauseRendering(false);
                using (new UndoRedoOperator(1))
                {
                    CommandManagerServices.Instance().Redo();
                    app.Workbench.UpdateMenu();
                }
            }
            catch (System.Exception)
            {
            }
            finally
            {
                app.Current3DMapControl.ResumeRendering();
            }
        }
Пример #3
0
        private void ExecuteUndoRedo(IUndoRedoResultCollection Coll)
        {
            if (Coll != null)
            {
                int count = Coll.Count;
                if (count == 0)
                {
                    return;
                }
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                app.Current3DMapControl.PauseRendering(false);
                for (int i = 0; i < count; i++)
                {
                    IUndoRedoResult undoRedoResult = Coll[i];
                    if (undoRedoResult != null)
                    {
                        IObjectClass         objectClass      = undoRedoResult.ObjectClass;
                        IRowBufferCollection rowBuffers       = undoRedoResult.RowBuffers;
                        DF3DFeatureClass     featureClassInfo = DF3DFeatureClassManager.Instance.GetFeatureClassByID(objectClass.GuidString);
                        switch (undoRedoResult.Type)
                        {
                        case gviCommandType.gviCommandInsert:
                        {
                            CommonUtils.Instance().Insert(featureClassInfo, rowBuffers, false, true);
                            app.Current3DMapControl.FeatureManager.CreateFeatures(objectClass as IFeatureClass, rowBuffers);
                            break;
                        }

                        case gviCommandType.gviCommandDelete:
                        {
                            int[] fidArray = undoRedoResult.FidArray;
                            app.Current3DMapControl.FeatureManager.DeleteFeatures(objectClass as IFeatureClass, fidArray);
                            CommonUtils.Instance().Delete(featureClassInfo, fidArray);
                            break;
                        }

                        case gviCommandType.gviCommandUpdate:
                        {
                            CommonUtils.Instance().Update(featureClassInfo, rowBuffers);
                            app.Current3DMapControl.FeatureManager.EditFeatures(objectClass as IFeatureClass, rowBuffers);
                            break;
                        }
                        }
                        if (rowBuffers != null)
                        {
                            rowBuffers.Clear();
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(rowBuffers);
                        }
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(objectClass);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(undoRedoResult);
                    }
                }
                System.Runtime.InteropServices.Marshal.ReleaseComObject(Coll);
                RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
                app.Current3DMapControl.ResumeRendering();
            }
        }
Пример #4
0
 public UCGeometryEdit()
 {
     this.InitializeComponent();
     this._connInfo = CommonUtils.Instance().CurEditLayer;
     RenderControlEditServices.Instance().GeometryEditorCreateGeometryEvent += new GeometryEditorCreateGeometryHandle(this.GeometryEditorCreateGeometryEvent);
     RenderControlEditServices.Instance().GeometryEditorStopEvent           += new GeometryEditorStopHandle(this.GeometryEditorStopEvent);
     RenderControlEditServices.Instance().RenderEditorTypeChangedEvent      += new RenderEditorTypeChangedHandle(this.RenderEditorTypeChanged);
     RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType;
     SelectCollection.Instance().SelectionChangedEvent    += new SelectionChangedEventHandler(this.SelectionChanged);
 }
Пример #5
0
        public CmdRollAll()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            app.Current3DMapControl.RcTransformHelperBegin    += new System.EventHandler(this.AxRenderControl_RcTransformHelperBegin);
            app.Current3DMapControl.RcTransformHelperEnd      += new System.EventHandler(this.AxRenderControl_RcTransformHelperEnd);
            app.Current3DMapControl.RcTransformHelperRotating += new Gvitech.CityMaker.Controls._IRenderControlEvents_RcTransformHelperRotatingEventHandler(this.AxRenderControl_RcTransformHelperRotating);
            RenderControlEditServices.Instance().RenderEditorChangedEvent += new RenderEditorChangedHandle(this.RenderEditorChangedEvent);
        }
Пример #6
0
        public override void Run(object sender, System.EventArgs e)
        {
            bool _isAuth = Authority3DService.Instance.IsAuthorized;

            if (!_isAuth)
            {
                XtraMessageBox.Show("此功能需要USB Key。", "提示");
                return;
            }
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            int count = SelectCollection.Instance().GetCount(false);

            if (count > 10000)
            {
                XtraMessageBox.Show("批量编辑超过上限,请重新选择");
                base.HighLight = false;
                return;
            }
            if (CommonUtils.Instance().EnableTemproalEdit)
            {
                using (DateSettingDialog dateSettingDialog = new DateSettingDialog())
                {
                    if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        base.HighLight = false;
                        return;
                    }
                    this.time = dateSettingDialog.Time;
                }
            }

            //Map3DCommandManager.Push(this);
            this._uPanel               = new UIDockPanel("风格编辑", "风格编辑", this.Location, this._width, this._height);
            this._dockPanel            = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right);
            this._dockPanel.Visibility = DockVisibility.Visible;
            this._dockPanel.FloatSize  = new System.Drawing.Size(this._width, this._height);
            this._dockPanel.Width      = this._width;
            this._dockPanel.Height     = this._height;
            this._uc      = new UCEditFacilityStyle();
            this._uc.Dock = System.Windows.Forms.DockStyle.Fill;
            this._uPanel.RegisterEvent(new PanelClose(this.Close));
            this._dockPanel.Controls.Add(this._uc);

            SelectCollection.Instance().FacStyleClassChangedEvent += new Delegate.FacStyleClassChangedHandle(CmdEditFacilityStyle_FacStyleClassChangedEvent);
        }
Пример #7
0
        private void GeometryEditorStopEvent(bool bSave)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType;
            if (app.Current3DMapControl.ObjectEditor.IsEditing)
            {
                GeometryEdit.Instance().StopEdit(bSave);
            }
        }
        public override void Run(object sender, System.EventArgs e)
        {
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            System.DateTime temproalTime = System.DateTime.Now;
            if (CommonUtils.Instance().EnableTemproalEdit)
            {
                using (DateSettingDialog dateSettingDialog = new DateSettingDialog())
                {
                    if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        return;
                    }
                    temproalTime = dateSettingDialog.Time;
                }
            }
            DF3DFeatureClass featureClassInfo = null;

            System.Collections.IEnumerator enumerator = SelectCollection.Instance().FeatureClassInfoMap.Keys.GetEnumerator();
            try
            {
                if (enumerator.MoveNext())
                {
                    DF3DFeatureClass featureClassInfo2 = (DF3DFeatureClass)enumerator.Current;
                    featureClassInfo = featureClassInfo2;
                }
            }
            finally
            {
                System.IDisposable disposable = enumerator as System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (featureClassInfo == null)
            {
                return;
            }
            int            count          = SelectCollection.Instance().GetCount(false);
            EditParameters editParameters = new EditParameters(featureClassInfo.GetFeatureClass().Guid.ToString());

            editParameters.connectionInfo = CommonUtils.Instance().GetCurrentFeatureDataset().DataSource.ConnectionInfo.ToConnectionString();
            editParameters.datasetName    = CommonUtils.Instance().GetCurrentFeatureDataset().Name;
            editParameters.TemproalTime   = temproalTime;
            IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count);

            batcheEdit.BeginEdit();
            batcheEdit.DoWork(EditType.ET_DELETE_SELCTION, editParameters);
            batcheEdit.EndEdit();
        }
Пример #9
0
 public override void Run(object sender, System.EventArgs e)
 {
     if (CommonUtils.Instance().CheckCurrentFeatureDatasetEncrypted())
     {
         XtraMessageBox.Show("数据集已加密!", "提示信息");
     }
     else
     {
         Map3DCommandManager.Push(this);
         RenderControlEditServices.Instance().StopGeometryEdit(true);
         //WorkSpaceServices.Instance().PropertyCanEdit = true;
         SplitDlg splitDlg = new SplitDlg();
         splitDlg.Show(DF3DApplication.Application.Workbench);
     }
 }
Пример #10
0
 public override bool Redo()
 {
     if (this._bSelectionChanged)
     {
         SelectCollection.Instance().Clear();
         SelectCollection.Instance().UpdateSelection(base.RedoSelectionMap);
         RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
     }
     if (this._bFeatureModify)
     {
         CommonUtils.Instance().FdeUndoRedoManager.Redo();
     }
     this.SetRedoCamera();
     return(true);
 }
Пример #11
0
        private void BGWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            IUndoRedoResultCollection undoRedoResultCollection = e.Argument as IUndoRedoResultCollection;

            if (undoRedoResultCollection != null)
            {
                this._GetRowbufferMap         = (() => SelectCollection.Instance().GetSelectGeometrys());
                this._setEditorPositionHandel = delegate(HashMap rowMap)
                {
                    RenderControlEditServices.Instance().SetEditorPosition(rowMap);
                }
                ;
                this.AsyncExecuteUndoRedo(undoRedoResultCollection);
            }
        }
Пример #12
0
        public override void EndEdit()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            app.Current3DMapControl.FeatureManager.RefreshAll();
            if (!this.bNeedOperator)
            {
                RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().GetSelectGeometrys());
                return;
            }
            app.Current3DMapControl.ResumeRendering();
        }
Пример #13
0
        public override void RestoreEnv()
        {
            if (!this.bFinished)
            {
                this.EndRote();
            }
            RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType;
            SelectCollection.Instance().ClearRowBuffers();

            if (this._uPanel != null)
            {
                this._uPanel.GetControlContainer().Controls.Clear();
                this._uPanel.Close();
                this._uPanel = null;
            }
        }
Пример #14
0
        public override void Run(object sender, System.EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            int count = SelectCollection.Instance().GetCount(false);

            if (count > 10000)
            {
                XtraMessageBox.Show("批量编辑超过上限,请重新选择");
                base.HighLight = false;
                return;
            }
            if (CommonUtils.Instance().EnableTemproalEdit)
            {
                using (DateSettingDialog dateSettingDialog = new DateSettingDialog())
                {
                    if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        base.HighLight = false;
                        return;
                    }
                    this.time = dateSettingDialog.Time;
                }
            }
            Map3DCommandManager.Push(this);
            this._uPanel               = new UIDockPanel("对象编辑", "对象编辑", this.Location, this._width, this._height);
            this._dockPanel            = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right);
            this._dockPanel.Visibility = DockVisibility.Visible;
            this._dockPanel.FloatSize  = new System.Drawing.Size(this._width, this._height);
            this._dockPanel.Width      = this._width;
            this._dockPanel.Height     = this._height;
            this._uc      = new UCGeometryEdit();
            this._uc.Dock = System.Windows.Forms.DockStyle.Fill;
            this._uPanel.RegisterEvent(new PanelClose(this.Close));
            this._dockPanel.Controls.Add(this._uc);

            this._InteractaMode = app.Current3DMapControl.InteractMode;
            this.SetMoveProperty(SelectCollection.Instance().GetSelectGeometrys());
            SelectCollection.Instance().SelectionMovingEvent += new System.Action <IVector3>(this.SelectionMovingEvent);
            app.Current3DMapControl.RcFeaturesMoving += new Gvitech.CityMaker.Controls._IRenderControlEvents_RcFeaturesMovingEventHandler(this.AxRenderControl_RcFeaturesMoving);
        }
Пример #15
0
        public override void Run(object sender, System.EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            Map3DCommandManager.Push(this);
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            //FDECommand fDECommand = new FDECommand(true, false);
            SelectCollection.Instance().Clear();
            SelectCollection.Instance().ClearRowBuffers();
            RenderControlEditServices.Instance().SetEditorPosition(null);
            //fDECommand.SetSelectionMap();
            //CommandManagerServices.Instance().CallCommand(fDECommand);
            app.Workbench.UpdateMenu();
        }
Пример #16
0
        private void SetMoveProperty(HashMap rowbufferMap)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.MoveType;
            app.Current3DMapControl.InteractMode = gviInteractMode.gviInteractEdit;
            if (app.Current3DMapControl.ObjectEditor.IsEditing)
            {
                app.Current3DMapControl.ObjectEditor.FinishEdit();
            }
            if (rowbufferMap == null || rowbufferMap.Count == 0)
            {
                return;
            }
            this.beforeRowBufferMap = rowbufferMap;
            this.StartEditFeatures();
        }
Пример #17
0
        public override void Run(object sender, System.EventArgs e)
        {
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            int count = SelectCollection.Instance().GetCount(false);

            if (count > 10000)
            {
                XtraMessageBox.Show("批量编辑超过上限,请重新选择");
                base.HighLight = false;
                return;
            }
            if (CommonUtils.Instance().EnableTemproalEdit)
            {
                using (DateSettingDialog dateSettingDialog = new DateSettingDialog())
                {
                    if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        base.HighLight = false;
                        return;
                    }
                    this.time = dateSettingDialog.Time;
                }
            }
            Map3DCommandManager.Push(this);
            this._uPanel               = new UIDockPanel("对象编辑", "对象编辑", this.Location, this._width, this._height);
            this._dockPanel            = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right);
            this._dockPanel.Visibility = DockVisibility.Visible;
            this._dockPanel.FloatSize  = new System.Drawing.Size(this._width, this._height);
            this._dockPanel.Width      = this._width;
            this._dockPanel.Height     = this._height;
            this._uc      = new UCGeometryEdit();
            this._uc.Dock = System.Windows.Forms.DockStyle.Fill;
            this._uPanel.RegisterEvent(new PanelClose(this.Close));
            this._dockPanel.Controls.Add(this._uc);

            RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.ScaleAllType;
            this.bInit = false;
            this.BeginScale(SelectCollection.Instance().GetSelectGeometrys());
            RenderControlEditServices.Instance().SetEditorPosition(this.beginRowbufferMap);
        }
Пример #18
0
        public override void RestoreEnv()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            app.Current3DMapControl.ObjectEditor.FinishEdit();
            RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType;
            app.Current3DMapControl.InteractMode      = this._InteractaMode;
            app.Current3DMapControl.RcFeaturesMoving -= new Gvitech.CityMaker.Controls._IRenderControlEvents_RcFeaturesMovingEventHandler(this.AxRenderControl_RcFeaturesMoving);
            SelectCollection.Instance().SelectionMovingEvent -= new System.Action <IVector3>(this.SelectionMovingEvent);
            SelectCollection.Instance().ClearRowBuffers();

            if (this._uPanel != null)
            {
                this._uPanel.GetControlContainer().Controls.Clear();
                this._uPanel.Close();
                this._uPanel = null;
            }
        }
Пример #19
0
        public override bool Undo()
        {
            if (this._bSelectionChanged)
            {
                SelectCollection.Instance().Clear();
                SelectCollection.Instance().UpdateSelection(base.UndoSelectionMap);
                RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
            }
            if (this._bFeatureModify)
            {
                CommonUtils.Instance().FdeUndoRedoManager.Undo();
            }
            IVector3    vector;
            IEulerAngle eulerAngle;

            DF3DApplication.Application.Current3DMapControl.Camera.GetCamera(out vector, out eulerAngle);
            CameraParamter redoCamera = new CameraParamter(vector.X, vector.Y, vector.Z, eulerAngle.Heading, eulerAngle.Tilt, eulerAngle.Roll);

            base.RedoCamera = redoCamera;
            this.SetUndoCamera();
            return(true);
        }
Пример #20
0
        public override void Run(object sender, EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            RenderControlEditServices.Instance().StopGeometryEdit(true);
            int count = SelectCollection.Instance().GetCount(false);

            if (count > 1)
            {
                XtraMessageBox.Show("批量编辑超过上限,请重新选择");
                base.HighLight = false;
                return;
            }
            if (CommonUtils.Instance().EnableTemproalEdit)
            {
                using (DateSettingDialog dateSettingDialog = new DateSettingDialog())
                {
                    if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        base.HighLight = false;
                        return;
                    }
                    this.time = dateSettingDialog.Time;
                }
            }
            Map3DCommandManager.Push(this);

            this._InteractaMode = app.Current3DMapControl.InteractMode;
            app.Current3DMapControl.InteractMode        = gviInteractMode.gviInteractEdit;
            app.Current3DMapControl.RcObjectEditing    += new Gvitech.CityMaker.Controls._IRenderControlEvents_RcObjectEditingEventHandler(Current3DMapControl_RcObjectEditing);
            app.Current3DMapControl.RcObjectEditFinish += new EventHandler(Current3DMapControl_RcObjectEditFinish);
            this.SetVertexProperty(SelectCollection.Instance().GetSelectGeometrys());
        }
Пример #21
0
        private void SpatialQuery()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }

            try
            {
                HashMap        hashMap = new HashMap();
                IRowBuffer     buffer  = null;
                IFdeCursor     cursor  = null;
                ISpatialFilter filter  = null;
                IGeometry      geo2D   = this._drawTool.GetGeo();
                if (geo2D != null && geo2D.GeometryType == gviGeometryType.gviGeometryPolygon)
                {
                    IPolygon polygon = geo2D as IPolygon;
                    if (polygon != null)
                    {
                        DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer;
                        if (featureClassInfo != null)
                        {
                            IFeatureClass featureClass = featureClassInfo.GetFeatureClass();
                            if (featureClass != null)
                            {
                                string typeName = featureClassInfo.GetFacilityClassName();
                                if (typeName == "PipeLine" || typeName == "PipeNode" || typeName == "PipeBuild" || typeName == "PipeBuild1")
                                {
                                    filter = new SpatialFilterClass
                                    {
                                        GeometryField = "Shape",
                                        SpatialRel    = gviSpatialRel.gviSpatialRelIntersects,
                                        Geometry      = polygon.Clone2(gviVertexAttribute.gviVertexAttributeNone)
                                    };
                                }
                                else
                                {
                                    filter = new SpatialFilterClass
                                    {
                                        Geometry      = polygon,
                                        GeometryField = "Geometry",
                                        SpatialRel    = gviSpatialRel.gviSpatialRelEnvelope
                                    };
                                }
                                filter.SubFields = featureClass.FidFieldName;
                                cursor           = featureClass.Search(filter, true);
                                while ((buffer = cursor.NextRow()) != null)
                                {
                                    int featureId = int.Parse(buffer.GetValue(0).ToString());
                                    if (hashMap.Contains(featureClassInfo))
                                    {
                                        System.Collections.Generic.List <int> list = hashMap[featureClassInfo] as System.Collections.Generic.List <int>;
                                        if (!list.Contains(featureId))
                                        {
                                            list.Add(featureId);
                                        }
                                    }
                                    else
                                    {
                                        System.Collections.Generic.List <int> list2 = new System.Collections.Generic.List <int>();
                                        if (!list2.Contains(featureId))
                                        {
                                            list2.Add(featureId);
                                        }
                                        hashMap[featureClassInfo] = list2;
                                    }
                                }
                            }
                        }
                    }
                    SelectCollection.Instance().UpdateSelection(hashMap);
                    RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
                    this.Clear();
                }
                if (buffer != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(buffer);
                }
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                }
                if (filter != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(filter);
                }
            }
            catch (Exception ex)
            {
                LoggingService.Error(ex.Message);
            }
        }
Пример #22
0
        private void btnApply_Click(object sender, System.EventArgs e)
        {
            //if (this._connInfo != null && this._connInfo.GetFeatureClass().HasTemporal() && CommonUtils.Instance().EnableTemproalEdit)
            //{
            //    using (DateSettingDialog dateSettingDialog = new DateSettingDialog())
            //    {
            //        if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            //        {
            //            return;
            //        }
            //        this._time = dateSettingDialog.Time;
            //    }
            //}
            switch (this._editType)
            {
            case RenderEditorType.MoveType:
            {
                this.MoveSelection();
                goto IL_AC;
            }

            case RenderEditorType.RotateAllType:
            case RenderEditorType.RotateCenterType:
            {
                this.RoateSelection();
                goto IL_AC;
            }

            case RenderEditorType.ScaleAllType:
            case RenderEditorType.ScaleCenterType:
            {
                this.ScaleSelection();
                goto IL_AC;
            }

            case RenderEditorType.GeometryMove:
            {
                this.MoveGeometry();
                goto IL_AC;
            }

            case RenderEditorType.GeometryRoate:
            {
                this.RoateGeometry();
                goto IL_AC;
            }

            case RenderEditorType.GeometryScale:
            {
                this.ScaleGeometry();
                goto IL_AC;
            }

            default:
            {
                goto IL_AC;
            }
            }
            return;

IL_AC:
            RenderControlEditServices.Instance().RenderEditorType = this._editType;
        }
Пример #23
0
 private void GeometryEditorCreateGeometryEvent(DF3DFeatureClass fcInfo, IRenderGeometry renderGeo)
 {
     RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType;
     GeometryEdit.Instance().GeometryEditStart(fcInfo, renderGeo, gviGeoEditType.gviGeoEditCreator);
 }
Пример #24
0
        public override void Run(object sender, System.EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            try
            {
                Map3DCommandManager.Push(this);
                RenderControlEditServices.Instance().StopGeometryEdit(true);
                app.Current3DMapControl.PauseRendering(false);
                System.Collections.Generic.IList <System.Collections.Generic.KeyValuePair <int, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <int, string> >();
                HashMap          featureClassInfoMap              = SelectCollection.Instance().FeatureClassInfoMap;
                DF3DFeatureClass featureClassInfo                 = null;
                System.Collections.Generic.IList <int> list2      = new System.Collections.Generic.List <int>();
                System.Collections.IEnumerator         enumerator = featureClassInfoMap.Keys.GetEnumerator();
                try
                {
                    if (enumerator.MoveNext())
                    {
                        DF3DFeatureClass featureClassInfo2 = (DF3DFeatureClass)enumerator.Current;
                        featureClassInfo = featureClassInfo2;
                        ResultSetInfo resultSetInfo = featureClassInfoMap[featureClassInfo2] as ResultSetInfo;
                        foreach (DataRow dataRow in resultSetInfo.ResultSetTable.Rows)
                        {
                            int    num   = int.Parse(dataRow[featureClassInfo.GetFeatureClass().FidFieldName].ToString());
                            string value = num.ToString();
                            System.Collections.Generic.KeyValuePair <int, string> item = new System.Collections.Generic.KeyValuePair <int, string>(num, value);
                            list.Add(item);
                            list2.Add(num);
                        }
                    }
                }
                finally
                {
                    System.IDisposable disposable = enumerator as System.IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
                if (featureClassInfo != null)
                {
                    using (MergeDlg mergeDlg = new MergeDlg(list))
                    {
                        if (mergeDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            if (System.Windows.Forms.DialogResult.No != XtraMessageBox.Show("模型合并不支持撤销操作,是否继续?", "提示", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation))
                            {
                                int fid = mergeDlg.Fid;
                                using (new WaitDialogForm("", "正在进行模型合并,请稍后..."))
                                {
                                    IFeatureClass    featureClass      = featureClassInfo.GetFeatureClass();
                                    string           geometryFieldName = featureClassInfo.GetFeatureLayer().GeometryFieldName;
                                    IModelPoint      model             = this.GetModel(featureClass, geometryFieldName, fid);
                                    IResourceManager resourceManager   = CommonUtils.Instance().GetCurrentFeatureDataset() as IResourceManager;
                                    if (resourceManager != null)
                                    {
                                        if (!this.MergeModels(featureClass, geometryFieldName, list2.ToArray <int>(), resourceManager, ref model))
                                        {
                                            XtraMessageBox.Show("模型合并失败!");
                                        }
                                        else
                                        {
                                            if (list2.Remove(fid))
                                            {
                                                featureClass.Delete(new QueryFilterClass
                                                {
                                                    IdsFilter = list2.ToArray <int>()
                                                });
                                                CommonUtils.Instance().Delete(featureClassInfo, list2.ToArray <int>());
                                                app.Current3DMapControl.FeatureManager.DeleteFeatures(featureClass, list2.ToArray <int>());
                                            }
                                            app.Current3DMapControl.RefreshModel(CommonUtils.Instance().GetCurrentFeatureDataset(), model.ModelName);
                                            IFdeCursor fdeCursor = featureClass.Update(new QueryFilterClass
                                            {
                                                IdsFilter = new int[]
                                                {
                                                    fid
                                                }
                                            });
                                            IRowBuffer rowBuffer = fdeCursor.NextRow();
                                            if (rowBuffer != null)
                                            {
                                                int num2 = rowBuffer.FieldIndex(geometryFieldName);
                                                if (num2 != -1)
                                                {
                                                    rowBuffer.SetValue(num2, model);
                                                }
                                                fdeCursor.UpdateRow(rowBuffer);
                                                System.Runtime.InteropServices.Marshal.ReleaseComObject(fdeCursor);
                                                app.Current3DMapControl.FeatureManager.EditFeature(featureClass, rowBuffer);
                                            }
                                            //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
            catch (System.UnauthorizedAccessException var_23_389)
            {
                XtraMessageBox.Show("拒绝访问");
            }
            catch (System.Exception ex2)
            {
                XtraMessageBox.Show(ex2.Message);
            }
            finally
            {
                app.Current3DMapControl.ResumeRendering();
            }
        }
Пример #25
0
        private void SelectionChanged()
        {
            int count = SelectCollection.Instance().GetCount(false);

            if (count != 1)
            {
                RenderControlEditServices.Instance().StopGeometryEdit(false);
                //this._selectRow = null;
                //this._editCtrl.bar2.Visible = false;
                //this.memoEdit1.Visible = false;
                //SelectCollection.Instance().PickUpSingleRecord(null, -1);
                return;
            }
            //int oid = -1;
            //foreach (DF3DFeatureClass featureClassInfo in SelectCollection.Instance().FeatureClassInfoMap.Keys)
            //{
            //    this._selectFeatureClass = featureClassInfo;
            //    ResultSetInfo resultSetInfo = SelectCollection.Instance().FeatureClassInfoMap[featureClassInfo] as ResultSetInfo;
            //    if (resultSetInfo != null)
            //    {
            //        this.fidFieldName = this._selectFeatureClass.FidFieldName;
            //        this.curGeoField = this._selectFeatureClass.GeometryFieldName;
            //        System.Data.DataTable resultSetTable = resultSetInfo.ResultSetTable;
            //        if (resultSetTable != null && resultSetTable.Rows.Count != 0)
            //        {
            //            this._selectRow = resultSetTable.Rows[0];
            //            oid = int.Parse(this._selectRow[this.fidFieldName].ToString());
            //            System.Data.DataRow dataRow = this._recordTable.NewRow();
            //            KeyValuePairEx<string, string> keyValuePairEx = new KeyValuePairEx<string, string>(this.curGeoField, this.curGeoField);
            //            dataRow[0] = keyValuePairEx;
            //            dataRow[1] = this._selectRow[this.curGeoField];
            //            this._recordTable.Rows.Add(dataRow);
            //            if (this._selectFeatureClass.HasAttachment)
            //            {
            //                this.layoutControlItem3.Visibility = (LayoutVisibility)0;
            //            }
            //            else
            //            {
            //                this.layoutControlItem3.Visibility = (LayoutVisibility)1;
            //            }
            //            System.Collections.IEnumerator enumerator2 = resultSetTable.Columns.GetEnumerator();
            //            try
            //            {
            //                while (enumerator2.MoveNext())
            //                {
            //                    System.Data.DataColumn dataColumn = (System.Data.DataColumn)enumerator2.Current;
            //                    if (!(dataColumn.ColumnName == this.curGeoField))
            //                    {
            //                        dataRow = this._recordTable.NewRow();
            //                        KeyValuePairEx<string, string> keyValuePairEx2 = new KeyValuePairEx<string, string>(dataColumn.ColumnName, dataColumn.Caption);
            //                        dataRow[0] = keyValuePairEx2;
            //                        dataRow[1] = this._selectRow[dataColumn.ColumnName];
            //                        this._recordTable.Rows.Add(dataRow);
            //                    }
            //                }
            //                break;
            //            }
            //            finally
            //            {
            //                System.IDisposable disposable = enumerator2 as System.IDisposable;
            //                if (disposable != null)
            //                {
            //                    disposable.Dispose();
            //                }
            //            }
            //        }
            //    }
            //}
            //SelectCollection.Instance().PickUpSingleRecord(this._selectFeatureClass, oid);
        }
Пример #26
0
        private void MousePickup(IPickResult pr, gviModKeyMask mask)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if ((mask == gviModKeyMask.gviModKeyCtrl || mask == gviModKeyMask.gviModKeyShift) && pr == null)
            {
                return;
            }
            //FDECommand fDECommand = new FDECommand(true, false);
            if (mask != gviModKeyMask.gviModKeyCtrl && mask != gviModKeyMask.gviModKeyShift)
            {
                app.Current3DMapControl.FeatureManager.UnhighlightAll();
            }
            else
            {
                HashMap featureClassInfoMap = SelectCollection.Instance().FeatureClassInfoMap;
                if (featureClassInfoMap != null)
                {
                    bool flag = true;
                    System.Collections.IEnumerator enumerator = featureClassInfoMap.Keys.GetEnumerator();
                    try
                    {
                        if (enumerator.MoveNext())
                        {
                            DF3DFeatureClass featureClassInfo = (DF3DFeatureClass)enumerator.Current;
                            if (featureClassInfo.GetFeatureClass().Guid == CommonUtils.Instance().CurEditLayer.GetFeatureClass().Guid)
                            {
                                flag = true;
                            }
                        }
                    }
                    finally
                    {
                        System.IDisposable disposable = enumerator as System.IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    if (!flag)
                    {
                        SelectCollection.Instance().Clear();
                    }
                }
            }
            if (app.Current3DMapControl.ObjectEditor.IsEditing)
            {
                RenderControlEditServices.Instance().StopGeometryEdit(true);
            }
            if (pr == null)
            {
                SelectCollection.Instance().Clear();
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
            }
            else
            {
                if (pr.Type == gviObjectType.gviObjectTerrain || pr.Type == gviObjectType.gviObjectReferencePlane)
                {
                    SelectCollection.Instance().Clear();
                    app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
                }
                else
                {
                    if (pr.Type == gviObjectType.gviObjectFeatureLayer)
                    {
                        IFeatureLayerPickResult featureLayerPickResult = pr as IFeatureLayerPickResult;
                        int           featureId    = featureLayerPickResult.FeatureId;
                        IFeatureLayer featureLayer = featureLayerPickResult.FeatureLayer;
                        if (featureLayer.Guid == CommonUtils.Instance().CurEditLayer.GetFeatureLayer().Guid)
                        {
                            DF3DFeatureClass featureClassInfo = DF3DFeatureClassManager.Instance.GetFeatureClassByID(featureLayer.FeatureClassId.ToString());
                            if (featureClassInfo != null)
                            {
                                IFeatureClass featureClass = featureClassInfo.GetFeatureClass();
                                HashMap       hashMap      = new HashMap();
                                if (mask == (gviModKeyMask)0)
                                {
                                    hashMap[featureClassInfo] = new System.Collections.Generic.List <int>
                                    {
                                        featureId
                                    };
                                }
                                else
                                {
                                    foreach (DF3DFeatureClass key in SelectCollection.Instance().FeatureClassInfoMap.Keys)
                                    {
                                        ResultSetInfo resultSetInfo = SelectCollection.Instance().FeatureClassInfoMap[key] as ResultSetInfo;
                                        if (resultSetInfo != null && resultSetInfo.OidList != null)
                                        {
                                            hashMap[key] = resultSetInfo.OidList;
                                        }
                                    }
                                    System.Collections.Generic.List <int> list = hashMap[featureClassInfo] as System.Collections.Generic.List <int>;
                                    if (list != null)
                                    {
                                        if (list.Contains(featureId))
                                        {
                                            app.Current3DMapControl.FeatureManager.UnhighlightFeature(featureClass, featureId);
                                            list.Remove(featureId);
                                        }
                                        else
                                        {
                                            list.Add(featureId);
                                        }
                                    }
                                    else
                                    {
                                        hashMap[featureClassInfo] = new System.Collections.Generic.List <int>
                                        {
                                            featureId
                                        };
                                    }
                                }
                                SelectCollection.Instance().UpdateSelection(hashMap);
                            }
                            else
                            {
                                SelectCollection.Instance().Clear();
                                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
                            }
                        }
                    }
                }
            }
            RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
            //fDECommand.SetSelectionMap();
            //CommandManagerServices.Instance().CallCommand(fDECommand);
            app.Workbench.UpdateMenu();
        }
Пример #27
0
 private void AxRenderControl_RcObjectEditFinish(object sender, System.EventArgs e)
 {
     RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType;
     this.StopEdit(true);
 }
Пример #28
0
 public CmdMove()
 {
     RenderControlEditServices.Instance().RenderEditorChangedEvent += new RenderEditorChangedHandle(this.RenderEditorChange);
 }
Пример #29
0
        private void RoateSelection()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            double num  = double.Parse(this.spinEditX.EditValue.ToString());
            double num2 = double.Parse(this.spinEditY.EditValue.ToString());
            double num3 = double.Parse(this.spinEditZ.EditValue.ToString());

            if (num == 0.0 && num2 == 0.0 && num3 == 0.0)
            {
                return;
            }
            num  = 3.14 * num / 180.0;
            num2 = 3.14 * num2 / 180.0;
            num3 = 3.14 * num3 / 180.0;
            System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> rowBuffers = this.GetRowBuffers();
            if (rowBuffers.Count < 1)
            {
                return;
            }
            IEnvelope selectEnvelope = SelectCollection.Instance().GetSelectEnvelope(SelectCollection.Instance().FcRowBuffersMap);
            double    centerX        = 0.0;
            double    centerY        = 0.0;
            double    centerZ        = 0.0;

            if (selectEnvelope != null)
            {
                centerX = (selectEnvelope.MinX + selectEnvelope.MaxX) / 2.0;
                centerY = (selectEnvelope.MinY + selectEnvelope.MaxY) / 2.0;
                centerZ = (selectEnvelope.MinZ + selectEnvelope.MaxZ) / 2.0;
            }
            foreach (DF3DFeatureClass current in rowBuffers.Keys)
            {
                Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = current.GetFeatureClass();
                IFeatureLayer        featureLayer        = current.GetFeatureLayer();
                IRowBufferCollection rowBufferCollection = rowBuffers[current];
                for (int i = 0; i < rowBufferCollection.Count; i++)
                {
                    Gvitech.CityMaker.FdeCore.IRowBuffer rowBuffer = rowBufferCollection.Get(i);
                    int        position  = rowBuffer.FieldIndex(featureLayer.GeometryFieldName);
                    IGeometry  geometry  = rowBuffer.GetValue(position) as IGeometry;
                    ITransform transform = geometry as ITransform;
                    if (geometry != null && transform != null)
                    {
                        if (this._editType == RenderEditorType.RotateCenterType)
                        {
                            IEnvelope envelope = geometry.Envelope;
                            centerX = (envelope.MinX + envelope.MaxX) / 2.0;
                            centerY = (envelope.MinY + envelope.MaxY) / 2.0;
                            centerZ = (envelope.MinZ + envelope.MaxZ) / 2.0;
                        }
                        if (geometry.HasZ())
                        {
                            transform.Rotate3D(1.0, 0.0, 0.0, centerX, centerY, centerZ, num);
                            transform.Rotate3D(0.0, 1.0, 0.0, centerX, centerY, centerZ, num2);
                            transform.Rotate3D(0.0, 0.0, 1.0, centerX, centerY, centerZ, num3);
                        }
                        else
                        {
                            transform.Rotate2D(centerX, centerY, num3);
                        }
                        rowBuffer.SetValue(position, transform);
                    }
                }
                app.Current3DMapControl.FeatureManager.EditFeatures(featureClass, rowBufferCollection);
                //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
            }
            RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
            this.UpdateDatabase(rowBuffers);
        }