DatasetVector dataset2;
Datasource datasource = workspace1.Datasources[0];
Layer3Ds layers = sceneControl1.Scene.Layers;
List<one_signals_source> data = dlg.data;
int size = data.Count;
for (int i = 0; i < size; i++)
{
one_signals_source tmp = data[i];
string name = tmp.name;
double x = tmp.x, y = tmp.y, z = tmp.z, r = tmp.r;
dataset2 = datasource.Datasets[0] as DatasetVector;
dataset2.PrjCoordSys = PrjCoordSys.FromEPSG(4326); ;
Recordset recordset = dataset2.GetRecordset(false, CursorType.Dynamic);
// landmark
GeoStyle3D geostyle3d2;
geostyle3d2 = new GeoStyle3D();
geostyle3d2.AltitudeMode = AltitudeMode.Absolute;
geostyle3d2.FillForeColor = Color.FromArgb(255, 0, 255, 255);
GeoCone geocone = new GeoCone();
geocone.Position = new Point3D(x, y, z);
geocone.BottomRadius = 5;
geocone.Height = 20;
geocone.Style3D = geostyle3d2;
GeoModel3D geomodel2 = geocone.ConvertToGeoModel3D(true);
geomodel2.Style3D = geostyle3d2;
// 这里往数据集里天剑了这个GeoModel3D, 但不知道如何保存它的Style3D
recordset2.AddNew(geomodel2);
recordset2.Update();
geostyle3d2 = new GeoStyle3D();
geostyle3d2.AltitudeMode = AltitudeMode.Absolute;
geostyle3d2.FillForeColor = Color.FromArgb(255, 0, 255, 255);
Layer3DSettingVector setting2 = new Layer3DSettingVector();
setting2.Style = geostyle3d2;
Layer3DDataset layer2 = layers.Add(dataset2, setting2, true);
layer2.IsEditable = true;
layer2.IsSelectable = true;
layer2.IsVisible = true;
layer2.MaxObjectVisibleDistance = double.MaxValue;
layer2.MaxVisibleAltitude = double.MaxValue;
layer2.UpdateData();
}
iobject .NET 桌面二次开发
生成一个GeoCone,添加到数据集中,并在场景中显示。
下一次打开这个数据集,GeoCone模型的Style3D就失效了,如何保存这个Style3D呢?