Geometry3D geometry = e.Geometry;
Layer3DSettingVector setting = new Layer3DSettingVector();
setting.Style.AltitudeMode = AltitudeMode.ClampToGround;
setting.Style.LineColor = Color.Yellow;
setting.Style.LineWidth = 1.3;
Datasource ds = MapUtils.OpenDatasource(this.m_sceneControl.Scene.Workspace, "drawEdit");
DatasetVectorInfo datasetVectorInfo = new DatasetVectorInfo();
datasetVectorInfo.Type = DatasetType.Line3D;
datasetVectorInfo.IsFileCache = true;
datasetVectorInfo.Name = "line";
DatasetVector datasetVector = ds.Datasets.Create(datasetVectorInfo);
Recordset recordset = datasetVector.GetRecordset(true, CursorType.Dynamic);
bool f = recordset.AddNew(geometry);
recordset.Update();
datasetVector.PrjCoordSys = PrjCoordSys.FromEPSG(3857);
Layer3DDataset layerPipeLine = this.m_sceneControl.Scene.Layers.Add(datasetVector, setting, true, "pipeLine");
layerPipeLine.IsVisible = true;
layerPipeLine.IsEditable = true;
layerPipeLine.IsSelectable = true;
this.m_sceneControl.Scene.Refresh();
this.m_sceneControl.Refresh();
请看看是哪里有问题,界面不显示线段,这段代码是放在 m_sceneControl.Tracked 事件里的,MapUtils.OpenDatasource是自定义函数,生成并打开了一个datasource