首页 / 浏览问题 / 组件GIS / 问题详情
设置了投影系但是球上不显示绑定的数据
80EXP 2021年01月14日
设置了投影系但是球上不显示绑定的数据 代码如下:

SceneControl sceneControl = new SceneControl();
            Workspace workspace = new SuperMap.Data.Workspace(this.components);
            sceneControl.Scene.Workspace = workspace;
            workspace.Description = "";
            workspace.DesktopInfo = "";
            sceneControl.Action = SuperMap.UI.Action3D.Pan;
            sceneControl.BackColor = System.Drawing.Color.White;
            //sceneControl.ControlMode = SuperMap.Realspace.ControlMode3D.Normal;
            //sceneControl.InteractionMode = SuperMap.UI.InteractionMode3D.Default;
            sceneControl.IsAlwaysActive = false;
            sceneControl.IsAlwaysUpdate = false;
            sceneControl.IsCursorCustomized = false;
            sceneControl.IsDynamicSelection = false;
            sceneControl.IsFPSVisible = false;
            sceneControl.IsKeyboardNavigationEnabled = false;
            sceneControl.IsMouseNavigationEnabled = true;
            sceneControl.IsStatusBarShowAltitude = false;
            sceneControl.IsStatusBarVisible = true;
            sceneControl.IsWaitCursorEnabled = false;
            sceneControl.LayerIDUnit = 8;
            sceneControl.Location = new System.Drawing.Point(0, 28);
            sceneControl.Name = "sceneControl";
            sceneControl.Size = new System.Drawing.Size(800, 424);
            sceneControl.SnapMode = SuperMap.Realspace.SnapMode3D.NONE;
            sceneControl.SnapTolerance = 10;
            sceneControl.TabIndex = 2;
            sceneControl.TrackMode = SuperMap.UI.TrackMode3D.Edit;
            sceneControl.Scene.LatLonGrid.IsVisible = false;
            sceneControl.Dock = DockStyle.Fill;
            this.Controls.Add(sceneControl);
          

            Point3Ds point3Ds = new Point3Ds();
            point3Ds.Add(new Point3D(103, 32, 0));
            point3Ds.Add(new Point3D(95, 24, 0));
            point3Ds.Add(new Point3D(96, 33, 0));
            point3Ds.Add(new Point3D(97, 50, 0));
            point3Ds.Add(new Point3D(103, 32, 0));
            GeoRegion3D geoRegion3D = new GeoRegion3D(point3Ds);
            GeoStyle3D geoStyle3D = new GeoStyle3D();
            geoStyle3D.FillBackColor = Color.Aqua;
            geoStyle3D.FillForeColor = Color.Aqua;
            geoStyle3D.AltitudeMode = AltitudeMode.ClampToGround;
            geoStyle3D.AltitudeMode = AltitudeMode.Absolute;
            geoStyle3D.ExtendedHeight = 10000000;

            geoRegion3D.Style3D = geoStyle3D;

            DatasourceConnectionInfo info = new DatasourceConnectionInfo();
            info.Server = ":memory:";
            info.EngineType = EngineType.UDB;
            workspace.Datasources.Create(info);

            Datasets datasets = workspace.Datasources[0].Datasets;
            DatasetVectorInfo vectorInfo = new DatasetVectorInfo();
            vectorInfo.Name = "Region3D";
            vectorInfo.Type = DatasetType.Region3D;
            DatasetVector datasetVector = datasets.Create(vectorInfo);
            Dataset dataset = datasets["Region3D"];

            Recordset recordset = null;

            try
            {
                recordset = datasetVector.GetRecordset(false, CursorType.Dynamic);
                Dictionary<string, object> dic = new Dictionary<string, object>();
                dic.Add("0", "test1");
               
                recordset.AddNew(geoRegion3D, dic);
                recordset.Update();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                // recordset 使用完毕后必须 Dispose
                // The recordset must be disposed after using
                if (recordset != null)
                {
                    recordset.Dispose();
                }
            }

            Layer3DSettingVector settingPoint = new Layer3DSettingVector();
           
            PrjCoordSys prjCoordSys =  new PrjCoordSys();
            prjCoordSys.Type = PrjCoordSysType.China20003DegreeGk25;
            workspace.Datasources[0].Datasets["Region3D"].PrjCoordSys = prjCoordSys;
            sceneControl.Scene.Layers.Add(workspace.Datasources[0].Datasets["Region3D"], settingPoint,true);
关闭重复的问题: 添加图层时报错
...