Ejemplo n.º 1
0
        public override bool BeginEdit()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return(false);
            }
            System.Windows.Forms.DialogResult dialogResult = XtraMessageBox.Show(StringParser.Parse("${res:feature_alert_batch_edit}"), StringParser.Parse("${res:feature_alert_tooltip}"), System.Windows.Forms.MessageBoxButtons.YesNo);
            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                this._clearSelection  = new ClearSelectionHandle(SelectCollection.Instance().Clear);
                this._deleteSelection = new DeleteSelectionHandle(CommonUtils.Instance().Delete);
                this._updateSelection = new UpdateSelectionHandel(SelectCollection.Instance().UpdateSelection);
                this._InsertSelection = new InsertSelectionHandel(CommonUtils.Instance().Insert);
                //this._NextPage = new NextPageHandel(SelectCollection.Instance().NextResultSize);
                this.bNeedOperator = true;
                app.Current3DMapControl.PauseRendering(false);
            }
            else
            {
                this.bNeedOperator = false;
            }
            return(this.bNeedOperator);
        }
Ejemplo n.º 2
0
        private void Clear()
        {
            if (this._drawTool != null)
            {
                this._drawTool.Close();
            }
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            foreach (Guid guid in this._listRGuid)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(guid);
            }
            this._listRGuid.Clear();
            if (_rPoint != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(_rPoint.Guid);
                _rPoint = null;
            }
            if (_particleEffect != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(_particleEffect.Guid);
                _particleEffect = null;
            }
        }
Ejemplo n.º 3
0
 public override void Run(object sender, System.EventArgs e)
 {
     try
     {
         DF3DApplication app = (DF3DApplication)this.Hook;
         if (app == null || app.Workbench == null)
         {
             return;
         }
         app.Workbench.BarPerformClick("CancelSelection");
         ComboBoxEdit cbEdit = sender as ComboBoxEdit;
         CboItem      item   = cbEdit.SelectedItem as CboItem;
         CommonUtils.Instance().SetCurEditLayer(item == null ? null : item.Value);
         app.Workbench.UpdateMenu();
         if (item != null && item.Value != null)
         {
             IBaseLayer layer = item.Value.GetTreeLayer();
             if (layer != null)
             {
                 layer.Visible = true;
             }
             else
             {
                 IFeatureLayer fl = item.Value.GetFeatureLayer();
                 if (fl != null)
                 {
                     fl.VisibleMask = gviViewportMask.gviViewAllNormalView;
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 4
0
        public void Clear()
        {
            if (this._drawTool != null)
            {
                this._drawTool.Close();
            }
            this._dt.Rows.Clear();

            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (this._renderBox != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(this._renderBox.Guid);
                this._renderBox = null;
            }
            foreach (Guid g in this._listRender)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(g);
            }
            this._listRender.Clear();

            app.Current3DMapControl.HighlightHelper.VisibleMask = 0;
            app.Current3DMapControl.HighlightHelper.SetRegion(null);
        }
Ejemplo n.º 5
0
        private void InsertFeatures(EditParameters parameter)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (parameter == null)
            {
                return;
            }
            System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> geometryMap = parameter.geometryMap;
            if (geometryMap != null)
            {
                CommandManagerServices.Instance().StartCommand();
                FDECommand fDECommand = new FDECommand(true, true);
                SelectCollection.Instance().Clear();
                foreach (DF3DFeatureClass current in geometryMap.Keys)
                {
                    IFeatureClass        featureClass        = current.GetFeatureClass();
                    IRowBufferCollection rowBufferCollection = geometryMap[current];
                    CommonUtils.Instance().FdeUndoRedoManager.InsertFeatures(featureClass, rowBufferCollection);
                    CommonUtils.Instance().Insert(current, rowBufferCollection, true, false);
                    app.Current3DMapControl.FeatureManager.CreateFeatures(featureClass, rowBufferCollection);
                }
                fDECommand.SetSelectionMap();
                CommandManagerServices.Instance().CallCommand(fDECommand);
                app.Workbench.UpdateMenu();
            }
        }
Ejemplo n.º 6
0
        private void StartEditFeatures()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (this.beforeRowBufferMap == null)
            {
                return;
            }
            if (app.Current3DMapControl.ObjectEditor.IsEditing)
            {
                app.Current3DMapControl.ObjectEditor.FinishEdit();
            }
            foreach (DF3DFeatureClass featureClassInfo in this.beforeRowBufferMap.Keys)
            {
                IRowBufferCollection rowBufferCollection = this.beforeRowBufferMap[featureClassInfo] as IRowBufferCollection;
                if (rowBufferCollection != null && rowBufferCollection.Count >= 1)
                {
                    IFeatureLayer featureLayer = featureClassInfo.GetFeatureLayer();
                    app.Current3DMapControl.ObjectEditor.AddMovingFeatures(featureLayer, rowBufferCollection);
                }
            }
            app.Current3DMapControl.ObjectEditor.StartMoveFeatures(CommonUtils.Instance().CurEditDatasetWkt);
        }
Ejemplo n.º 7
0
        public override void RestoreEnv()
        {
            //RenderControlEditServices.Instance().StopGeometryEdit(true);
            //FDECommand fDECommand = new FDECommand(true, false);
            //SelectCollection.Instance().Clear();
            //SelectCollection.Instance().ClearRowBuffers();
            //RenderControlEditServices.Instance().SetEditorPosition(null);
            //fDECommand.SetSelectionMap();

            IMap3DView map3DView = UCService.GetContent(typeof(Map3DView)) as Map3DView;

            if (map3DView == null)
            {
                return;
            }
            map3DView.UnBind(this);
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            app.Current3DMapControl.InteractMode          = gviInteractMode.gviInteractNormal;
            app.Current3DMapControl.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectNone;
            app.Current3DMapControl.MouseSelectMode       = gviMouseSelectMode.gviMouseSelectHover;
        }
Ejemplo n.º 8
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(this.btnEditBrowse.EditValue.ToString()))
            {
                XtraMessageBox.Show("输入路径不能为空", "提示");
                return;
            }
            if (this.seWidth.Value < 4 || this.seHeight.Value < 4 || this.seWidth.Value > 65536 || this.seHeight.Value > 65536)
            {
                XtraMessageBox.Show("输入的尺寸不符合要求,请重新输入", "提示");
                return;
            }
            bool bRes = app.Current3DMapControl.ExportManager.ExportImage(this.btnEditBrowse.EditValue.ToString(), Convert.ToUInt32(this.seWidth.Value.ToString()), Convert.ToUInt32(this.seHeight.Value.ToString()), true);

            if (bRes)
            {
                XtraMessageBox.Show("出图成功", "提示");
            }
            else
            {
                XtraMessageBox.Show("出图失败", "提示");
            }
        }
Ejemplo n.º 9
0
        private void StartEditFeatures()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (this.beforeRowBufferMap == null)
            {
                return;
            }
            if (app.Current3DMapControl.ObjectEditor.IsEditing)
            {
                app.Current3DMapControl.ObjectEditor.FinishEdit();
            }
            foreach (DF3DFeatureClass featureClassInfo in this.beforeRowBufferMap.Keys)
            {
                IRowBufferCollection rowBufferCollection = this.beforeRowBufferMap[featureClassInfo] as IRowBufferCollection;
                if (rowBufferCollection != null && rowBufferCollection.Count == 1)
                {
                    IFeatureLayer featureLayer = featureClassInfo.GetFeatureLayer();
                    app.Current3DMapControl.ObjectEditor.StartEditFeatureGeometry(rowBufferCollection.Get(0), featureLayer, gviGeoEditType.gviGeoEditVertex);
                }
            }
        }
Ejemplo n.º 10
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();
            }
        }
Ejemplo n.º 11
0
        private void _2DLink3D()
        {
            if (b3To2 || b2To3)
            {
                b3To2 = false;
                b2To3 = false;
                return;
            }
            b2To3 = true;

            DF2DApplication app2D = DF2DApplication.Application;
            DF3DApplication app3D = DF3DApplication.Application;

            if (app2D == null || app3D == null || app2D.Current2DMapControl == null || app3D.Current3DMapControl == null)
            {
                return;
            }
            ESRI.ArcGIS.Geometry.IEnvelope env = app2D.Current2DMapControl.Extent;
            ICamera camera3D = app3D.Current3DMapControl.Camera;

            Gvitech.CityMaker.Math.IEulerAngle angle = new Gvitech.CityMaker.Math.EulerAngle();
            Gvitech.CityMaker.Math.IVector3    pos   = new Gvitech.CityMaker.Math.Vector3();
            camera3D.GetCamera(out pos, out angle);

            double ox, oy, oz;

            Link2DAnd3D._2DLink3D(env.XMin, env.XMax, env.YMin, env.YMax, Math.Abs(angle.Tilt * Math.PI / 180), camera3D.VerticalFieldOfView * Math.PI / 180, out ox, out oy, out oz);
            pos.Set(ox, oy, oz);
            camera3D.SetCamera(pos, angle, gviSetCameraFlags.gviSetCameraNoFlags);
        }
Ejemplo n.º 12
0
        private void FrmAddPolygon_Load(object sender, EventArgs e)
        {
            app = DF3DApplication.Application;
            if (app == null || app.Current3DMapControl == null || app.Workbench == null)
            {
                this.Enabled = false;
                return;
            }
            this._geoFact = new GeometryFactory();

            this._dt = new DataTable();
            this._dt.Columns.Add(new DataColumn("FN", Type.GetType("System.String")));
            this._dt.Columns.Add(new DataColumn("FV", Type.GetType("System.Object")));
            this._dt.Columns.Add(new DataColumn("F", Type.GetType("System.Object")));
            this.gridControl1.DataSource = this._dt;

            LoadProperty();
            this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polygon);
            if (this._drawTool != null)
            {
                this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                this._drawTool.Start();
            }
        }
Ejemplo n.º 13
0
        public bool IsValid(object caller, ICSharpCode.Core.Condition condition)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return(false);
            }
            if (CommonUtils.Instance().CurEditLayer != null)
            {
                DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer;
                if (dffc != null)
                {
                    string facType = dffc.GetFacilityClassName();
                    if (facType != "PipeLine" && facType != "PipeNode" && facType != "PipeBuild" && facType != "PipeBuild1")
                    {
                        IFeatureLayer fl = dffc.GetFeatureLayer();
                        if (fl != null)
                        {
                            if (fl.GeometryType == gviGeometryColumnType.gviGeometryColumnPoint)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 14
0
 public static void AddAndVisualizeTerrainData(string str3DTerrainConn, string str3DTerrainPwd, TreeList parentTree, bool bNeedFly = true)
 {
     try
     {
         DF3DApplication app = DF3DApplication.Application;
         if (app == null || app.Current3DMapControl == null)
         {
             return;
         }
         AxRenderControl d3 = app.Current3DMapControl;
         d3.Terrain.RegisterTerrain(str3DTerrainConn, str3DTerrainPwd);
         if (d3.Terrain.IsRegistered)
         {
             TreeNodeTerrain tnTerrain = new TreeNodeTerrain()
             {
                 Name        = "基础地形",
                 CustomValue = d3.Terrain,
             };
             tnTerrain.OwnNode = parentTree.AppendNode(new object[] { tnTerrain.Name }, (TreeListNode)null);
             tnTerrain.Visible = true;
             if (bNeedFly)
             {
                 d3.Terrain.FlyTo(gviTerrainActionCode.gviFlyToTerrain);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 15
0
        public static void AddAndVisualize3DTileData(string str3DTileConn, string str3DTilePwd, TreeList parentTree, string treeNodeName, bool bNeedFly = false, bool bTempData = true)
        {
            try
            {
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                AxRenderControl d3    = app.Current3DMapControl;
                I3DTileLayer    layer = d3.ObjectManager.Create3DTileLayer(str3DTileConn, str3DTilePwd, d3.ProjectTree.RootID);
                if (layer != null)
                {
                    TreeNode3DTile node = new TreeNode3DTile(layer.Guid.ToString())
                    {
                        Name        = treeNodeName,
                        CustomValue = layer,
                        Temp        = bTempData
                    };
                    node.OwnNode = parentTree.AppendNode(new object[] { node.Name }, (TreeListNode)null);
                    node.Visible = true;

                    if (bNeedFly)
                    {
                        d3.Camera.FlyToObject(layer.Guid, gviActionCode.gviActionFlyTo);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 16
0
        public override void Run(object sender, System.EventArgs e)
        {
            Map3DCommandManager.Push(this);
            IMap3DView map3DView = UCService.GetContent(typeof(Map3DView)) as Map3DView;

            if (map3DView == null)
            {
                return;
            }
            bool b3DBind = map3DView.Bind(this);

            if (!b3DBind)
            {
                return;
            }
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            app.Current3DMapControl.InteractMode          = gviInteractMode.gviInteractSelect;
            app.Current3DMapControl.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectFeatureLayer;
            app.Current3DMapControl.MouseSelectMode       = gviMouseSelectMode.gviMouseSelectClick;
        }
Ejemplo n.º 17
0
 public UndoRedoOperator(int nType)
 {
     this.app   = DF3DApplication.Application;
     this._Type = nType;
     if (CommonUtils.Instance().FdeUndoRedoManager != null)
     {
         if (nType == 0)
         {
             CommonUtils.Instance().FdeUndoRedoManager.UndoStart += new _ICommandManagerEvents_UndoStartEventHandler(this.fdeUndoRedoManager_UndoStart);
         }
         else
         {
             if (nType == 1)
             {
                 CommonUtils.Instance().FdeUndoRedoManager.RedoStart += new _ICommandManagerEvents_RedoStartEventHandler(this.fdeUndoRedoManager_RedoStart);
             }
         }
         this._nTotalCount = (this._nCurIndex = 0);
         this._bgWorker    = new System.ComponentModel.BackgroundWorker();
         this._bgWorker.WorkerReportsProgress = true;
         this._bgWorker.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.BGWorker_DoWork);
         this._bgWorker.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.BGWorker_ProgressChanged);
         this._bgWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.BGWorker_RunWorkerCompleted);
         string text = "初始化,请稍后...";
         this._wfDlg = new WaitDialogForm("", text);
         this._wfDlg.Show();
         this._progressDlg = new ProgressDialog();
     }
 }
Ejemplo n.º 18
0
        public bool IsValid(object caller, ICSharpCode.Core.Condition condition)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return(false);
            }
            DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer;

            if (dffc == null)
            {
                return(false);
            }
            IFeatureClass fc = dffc.GetFeatureClass();

            if (fc == null)
            {
                return(false);
            }
            IFeatureLayer fl = dffc.GetFeatureLayer();
            bool          b1 = false;

            if (fl != null && (fl.GeometryType == gviGeometryColumnType.gviGeometryColumnPolygon || fl.GeometryType == gviGeometryColumnType.gviGeometryColumnPolyline))
            {
                b1 = true;
            }
            int count = SelectCollection.Instance().GetCount(false);

            if (count != 1)
            {
                b1 &= false;
            }
            return(b1);
        }
Ejemplo n.º 19
0
        private void _3DLink2D(double x, double y, double z)
        {
            if (b3To2 || b2To3)
            {
                b3To2 = false;
                b2To3 = false;
                return;
            }
            b3To2 = true;

            DF2DApplication app2D = DF2DApplication.Application;
            DF3DApplication app3D = DF3DApplication.Application;

            if (app2D == null || app3D == null || app2D.Current2DMapControl == null || app3D.Current3DMapControl == null)
            {
                return;
            }
            ICamera camera3D = app3D.Current3DMapControl.Camera;

            Gvitech.CityMaker.Math.IEulerAngle angle = new Gvitech.CityMaker.Math.EulerAngle();
            Gvitech.CityMaker.Math.IVector3    pos   = new Gvitech.CityMaker.Math.Vector3();
            camera3D.GetCamera(out pos, out angle);

            ESRI.ArcGIS.Geometry.IEnvelope env = app2D.Current2DMapControl.Extent;
            double width  = env.XMax - env.XMin;
            double height = env.YMax - env.YMin;
            double rate   = width / height;

            double xmin, ymin, xmax, ymax;

            Link2DAnd3D._3DLink2D(x, y, z, Math.Abs(angle.Tilt * Math.PI / 180), camera3D.VerticalFieldOfView * Math.PI / 180, rate, out xmin, out ymin, out xmax, out ymax);
            ESRI.ArcGIS.Geometry.IEnvelope env1 = new ESRI.ArcGIS.Geometry.EnvelopeClass();
            env1.PutCoords(xmin, ymin, xmax, ymax);
            app2D.Current2DMapControl.Extent = env1;
        }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
0
        public override void Run(object sender, System.EventArgs e)
        {
            DF3DApplication app = (DF3DApplication)this.Hook;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (!app.IsInit3DControl)
            {
                XtraMessageBox.Show("三维空间初始化失败!", "提示");
                return;
            }
            try
            {
                Layer3DPlanTreePad pad = UCService.GetContent(typeof(Layer3DPlanTreePad)) as Layer3DPlanTreePad;
                if (pad == null)
                {
                    return;
                }
                app.Workbench.SetStatusInfo("规划数据加载中…");

                SplashScreenManager.Default.SendCommand(null, "开始加载三维规划数据......");
                string str3DPlanDataConn = Config.GetConfigValue("3DPlanDataConnStr");
                if (!string.IsNullOrEmpty(str3DPlanDataConn))
                {
                    IConnectionInfo ci = new ConnectionInfo();
                    ci.FromConnectionString(str3DPlanDataConn);
                    DataUtils.Add3DPlanData(ci, pad, pad.TreeList);
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 22
0
        public override void  Run(object sender, EventArgs e)
        {
            DF3DApplication app = (DF3DApplication)this.Hook;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            try
            {
                //初始化
                SplashScreenManager.Default.SendCommand(null, "开始初始化三维控件......");

                AxRenderControl d3 = app.Current3DMapControl;
                IPropertySet    ps = new PropertySet();
                ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
                if (!d3.Initialize(true, ps))
                {
                    app.IsInit3DControl = false;
                    return;
                }
                app.IsInit3DControl = true;
                double flyTime = 2.0;
                bool   bRes    = double.TryParse(Config.GetConfigValue("FlyTime"), out flyTime);
                if (bRes)
                {
                    d3.Camera.FlyTime = flyTime;
                }
                else
                {
                    d3.Camera.FlyTime = 2.0;
                }
                //d3.Camera.AutoClipPlane = false;
                d3.Camera.NearClipPlane            = 0.01f;
                d3.Camera.FarClipPlane             = 999999.0f;
                d3.CacheManager.FileCacheEnabled   = true;
                d3.CacheManager.FileCachePath      = "D:\\3DCache";
                d3.CacheManager.MemoryCacheEnabled = true;
                //d3.Viewport.LogoVisible = false;

                // 设置天空盒
                string tmpSkyboxPath = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, @"..\Resource\Skybox");
                for (int i = 0; i < 4; i++)
                {
                    ISkyBox skybox = d3.ObjectManager.GetSkyBox(i);
                    skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBack, tmpSkyboxPath + "\\13_BK.jpg");
                    skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBottom, tmpSkyboxPath + "\\13_DN.jpg");
                    skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageFront, tmpSkyboxPath + "\\13_FR.jpg");
                    skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageLeft, tmpSkyboxPath + "\\13_LF.jpg");
                    skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageRight, tmpSkyboxPath + "\\13_RT.jpg");
                    skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageTop, tmpSkyboxPath + "\\13_UP.jpg");
                }
            }
            catch (Exception ex)
            {
                LoggingService.Error("3D Control Init Failed!" + ex.Message);
            }
        }
Ejemplo n.º 23
0
        public override void  Run(object sender, EventArgs e)
        {
            DF3DApplication app = (DF3DApplication)this.Hook;

            if (app == null || app.Workbench == null)
            {
                return;
            }
        }
Ejemplo n.º 24
0
        private void RoateGeometry()
        {
            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;
            if (this._connInfo == null || this._oid == -1)
            {
                return;
            }
            Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = null;
            try
            {
                featureClass = this._connInfo.GetFeatureClass();
                IFeatureLayer featureLayer = this._connInfo.GetFeatureLayer();
                Gvitech.CityMaker.FdeCore.IRowBuffer row = featureClass.GetRow(this._oid);
                int num4 = row.FieldIndex(featureLayer.GeometryFieldName);
                if (num4 != -1)
                {
                    IGeometry geometry = row.GetValue(num4) as IGeometry;
                    if (geometry != null)
                    {
                        IVector3 vector = new Vector3Class();
                        vector.Set(1.0, 0.0, 0.0);
                        app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num);
                        vector.Set(0.0, 1.0, 0.0);
                        app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num2);
                        vector.Set(0.0, 0.0, 1.0);
                        app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num3);
                    }
                }
            }
            catch (System.Exception)
            {
            }
            finally
            {
                //if (featureClass != null)
                //{
                //    System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
                //    featureClass = null;
                //}
            }
        }
Ejemplo n.º 25
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.Controls.EditorButton btn = e.Button;
            switch (btn.Caption)
            {
            case "定位":
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                int focusedRowHandle = this.gridView1.FocusedRowHandle;
                if (focusedRowHandle == -1)
                {
                    return;
                }
                DataRow dr = this.gridView1.GetDataRow(focusedRowHandle);
                if (dr["geo"] != null && dr["Name"] != null && dr["fcName"] != null && dr["fc"] != null)
                {
                    ISurfaceSymbol ss = new SurfaceSymbolClass();
                    ss.Color = 0xcc00ff00;
                    ICurveSymbol cs = new CurveSymbolClass();
                    cs.Color          = 0xff00ff00;
                    cs.Width          = -5;
                    ss.BoundarySymbol = cs;
                    ISimplePointSymbol ps = new SimplePointSymbol();
                    ps.Size      = SystemInfo.Instance.SymbolSize;
                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                    IGeometry objGeo = dr["geo"] as IGeometry;
                    if (objGeo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                    {
                        IModelPoint       mp  = objGeo as IModelPoint;
                        IModelPointSymbol mps = new ModelPointSymbol();
                        mps.SetResourceDataSet((dr["fc"] as IFeatureClass).FeatureDataSet);
                        mps.Color = 0xffffff00;
                        IRenderModelPoint rMP = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                        rMP.Glow(8000);
                        app.Current3DMapControl.ObjectManager.DelayDelete(rMP.Guid, 8000);

                        IGeometryFactory geoFact = new GeometryFactory();
                        IPoint           pt      = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = mp.X; pt.Y = mp.Y; pt.Z = mp.Z;

                        ITableLabel tl = DrawTool.CreateTableLabel1(1);
                        tl.TitleText = dr["fcName"].ToString();
                        tl.SetRecord(0, 0, dr["Name"].ToString());
                        tl.Position = pt;

                        this._listRender.Add(tl.Guid);

                        app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                    }
                }
                break;
            }
        }
Ejemplo n.º 26
0
        public bool IsValid(object caller, ICSharpCode.Core.Condition condition)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null || app.Current3DMapControl.Terrain == null)
            {
                return(true);
            }
            return(!(app.Current3DMapControl.Terrain.IsRegistered && (app.Current3DMapControl.Terrain.VisibleMask != gviViewportMask.gviViewNone) && app.Current3DMapControl.Terrain.DemAvailable));
        }
Ejemplo n.º 27
0
 private FrmSunSimulation()
 {
     InitializeComponent();
     app = DF3DApplication.Application;
     if (app == null || app.Current3DMapControl == null)
     {
         this.Enabled = false;
         return;
     }
 }
Ejemplo n.º 28
0
 private GeometryEdit()
 {
     this._app = DF3DApplication.Application;
     if (this._app != null && this._app.Current3DMapControl != null)
     {
         this._geoEditor = this._app.Current3DMapControl.ObjectEditor;
         this._app.Current3DMapControl.RcObjectEditFinish += new System.EventHandler(this.AxRenderControl_RcObjectEditFinish);
         this._app.Current3DMapControl.RcObjectEditing    += new Gvitech.CityMaker.Controls._IRenderControlEvents_RcObjectEditingEventHandler(this.AxRenderControl_RcObjectEditing);
     }
 }
Ejemplo n.º 29
0
        public override void RestoreEnv()
        {
            DF3DApplication app = (DF3DApplication)this.Hook;

            if (app == null || app.Workbench == null)
            {
                return;
            }
            app.Workbench.BarPerformClick("Wander3D");
        }
Ejemplo n.º 30
0
        public bool IsValid(object caller, ICSharpCode.Core.Condition condition)
        {
            DF3DApplication app = DF3DApplication.Application;

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