如何将GeoStyle3D保存到数据集,在场景中加载该数据集时自动设置

0 投票
                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呢?

7月 3 分类:  26次浏览 | 用户: zuoxinkai (7 分)
重新分类 7月 6 用户:三次鱼疯啦

1个回答

0 投票
在supermap中数据集不存储风格,风格是存储在图层中,如果需要保存风格的话,将当前这个场景保存到工作空间,然后下次打开的时候直接打卡工作空间即可。
7月 6 用户: 程逸诗 名扬四海 (2,412 分)
...