Esempio n. 1
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;
                //}
            }
        }
Esempio n. 2
0
        private void MoveSelection()
        {
            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;
            }
            IVector3 vector = new Vector3Class();

            vector.Set(num, num2, num3);
            SelectCollection.Instance().SelectionMoving(vector);
        }
Esempio n. 3
0
        private void MoveGeometry()
        {
            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;
            }
            IVector3 vector = new Vector3Class();

            vector.Set(num, num2, num3);
            app.Current3DMapControl.ObjectEditor.Move(vector);
        }
        public void SetCamera(double x, double y, double z, double heading, double tilt, double roll)
        {
            DF3DApplication app = DF3DApplication.Application;

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

            if (app.Current3DMapControl.Camera.FlyTime != 3.0)
            {
                app.Current3DMapControl.Camera.FlyTime = 3.0;
            }
            app.Current3DMapControl.Viewport.ActiveView = 0;
            IVector3 vector = new Vector3Class();

            vector.Set(x, y, z);
            IEulerAngle eulerAngle = new EulerAngleClass();

            eulerAngle.Heading = heading;
            eulerAngle.Tilt    = tilt;
            eulerAngle.Roll    = roll;
            app.Current3DMapControl.Camera.SetCamera(vector, eulerAngle, gviSetCameraFlags.gviSetCameraNoFlags);
        }
Esempio n. 5
0
        public override void Run(object sender, System.EventArgs e)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            string str   = Config.GetConfigValue("InitView3D");
            bool   bHave = true;

            if (string.IsNullOrEmpty(str))
            {
                bHave = false;
            }
            string[] arrstr = str.Split(';');
            if (arrstr == null || arrstr.Length != 6)
            {
                bHave = false;
            }
            else
            {
                double x, y, z, heading, tilt, roll;
                bool   bRes = double.TryParse(arrstr[0], out x);
                if (!bRes)
                {
                    bHave = false;
                }
                bRes = double.TryParse(arrstr[1], out y);
                if (!bRes)
                {
                    bHave &= false;
                }
                bRes = double.TryParse(arrstr[2], out z);
                if (!bRes)
                {
                    bHave &= false;
                }
                bRes = double.TryParse(arrstr[3], out heading);
                if (!bRes)
                {
                    bHave &= false;
                }
                bRes = double.TryParse(arrstr[4], out tilt);
                if (!bRes)
                {
                    bHave &= false;
                }
                bRes = double.TryParse(arrstr[5], out roll);
                if (!bRes)
                {
                    bHave &= false;
                }
                if (bHave)
                {
                    IVector3    v3  = new Vector3Class();
                    IEulerAngle ang = new EulerAngle();
                    v3.Set(x, y, z);
                    ang.Set(heading, tilt, roll);
                    app.Current3DMapControl.Camera.SetCamera(v3, ang, Gvitech.CityMaker.RenderControl.gviSetCameraFlags.gviSetCameraNoFlags);
                }
            }
            if (!bHave && app.Current3DMapControl.Terrain.IsRegistered)
            {
                app.Current3DMapControl.Terrain.FlyTo(Gvitech.CityMaker.RenderControl.gviTerrainActionCode.gviFlyToTerrain);
            }
        }
        public void SetEditorPosition(HashMap rowbufferMap)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            if (this.renderEditorChangedEvent != null)
            {
                this.renderEditorChangedEvent(rowbufferMap);
            }
            //if (!WorkSpaceServices.Instance().PropertyCanEdit)
            //{
            //    RenderControlServices.Instance().AxRenderControl.TransformHelper.Type = gviEditorType.gviEditorNone;
            //    return;
            //}
            IEnvelope selectEnvelope = SelectCollection.Instance().GetSelectEnvelope(rowbufferMap);

            if (selectEnvelope == null || !selectEnvelope.Valid())
            {
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
                return;
            }
            app.Current3DMapControl.TransformHelper.CrsWKT = CommonUtils.Instance().CurEditDatasetWkt;
            double   x      = (selectEnvelope.MinX + selectEnvelope.MaxX) / 2.0;
            double   y      = (selectEnvelope.MinY + selectEnvelope.MaxY) / 2.0;
            double   z      = (selectEnvelope.MinZ + selectEnvelope.MaxZ) / 2.0;
            IVector3 vector = new Vector3Class();

            vector.Set(x, y, z);
            switch (this.renderEditorType)
            {
            case RenderEditorType.MoveType:
            {
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
                return;
            }

            case RenderEditorType.RotateAllType:
            case RenderEditorType.RotateCenterType:
            {
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorRotate;
                app.Current3DMapControl.TransformHelper.SetPosition(vector);
                return;
            }

            case RenderEditorType.ScaleAllType:
            case RenderEditorType.ScaleCenterType:
            {
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorScale;
                app.Current3DMapControl.TransformHelper.SetPosition(vector);
                return;
            }

            case RenderEditorType.GeometryMove:
            case RenderEditorType.GeometryRoate:
            case RenderEditorType.GeometryScale:
            {
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
                return;
            }

            default:
            {
                app.Current3DMapControl.TransformHelper.Type = gviEditorType.gviEditorNone;
                return;
            }
            }
        }