使用产品:SuperMap iDesktop .NET 9D 操作系统win10 x64
软件名称:supermap-idesktop.net-9.1.1-36767-win64-zip-chs
组件:supermap-iobjectsdotnet-9.1.1-16828-70590-win64-all-Bin
问题详细描述:超图用C#加载场景没有及时刷新
问题重述步骤:1、用C#来遍历每个文件夹下的文件来导入到场景中
2、想要每次遍历一个就画一个图,同时延时一段时间
问题是过程没有出来,只显示最后面遍历的那个文件的图形
主要代码如下:
System.Threading.Thread.Sleep(300);
foreach (FileInfo file in newfiles)
{
System.Threading.Thread.Sleep(300);
string filepath = file.FullName;
//删除场景图层和数据集
Layer3Ds layer3Ds2 = m_sceneControl.Scene.Layers;
if (layer3Ds2.Count > 2)
{
layer3Ds2.Remove(3);
layer3Ds2.Remove(2);
}
if (m_workspace.Datasources[0].Datasets.Count > 5)
{
m_workspace.Datasources[0].Datasets.Delete(6);
m_workspace.Datasources[0].Datasets.Delete(5);
}
//导入CAD
ImportSettingDWG importsettingdwg = new ImportSettingDWG();
importsettingdwg.SourceFilePath = filepath;
importsettingdwg.ImportMode = ImportMode.Overwrite;
importsettingdwg.ImportingAsCAD = false;
importsettingdwg.IsImportAs3D = true;
//设置投影
PrjCoordSys prjcoordsys = new PrjCoordSys();
GeoCoordSys geocoordsys = new GeoCoordSys();
geocoordsys.Type = GeoCoordSysType.Wgs1984;
prjcoordsys.GeoCoordSys = geocoordsys;
importsettingdwg.TargetPrjCoordSys = prjcoordsys;
importsettingdwg.TargetDatasource = m_workspace.Datasources[0];
//导入到数据源中
DataImport m_DataImport = new DataImport();
m_DataImport.ImportSettings.Clear();
m_DataImport.ImportSettings.Add(importsettingdwg);
m_DataImport.Run();
//导入到场景中
Dataset dataset0 = m_workspace.Datasources[0].Datasets[5];
Dataset dataset1 = m_workspace.Datasources[0].Datasets[6];
Layer3Ds layer3Ds = m_sceneControl.Scene.Layers;
Layer3DSettingVector layer3DSettingVector = new Layer3DSettingVector();
GeoStyle3D style = new GeoStyle3D();
style.AltitudeMode = AltitudeMode.Absolute; //高度模式
style.LineColor = System.Drawing.Color.Red;
style.LineWidth = 2.5;
style.MarkerColor = System.Drawing.Color.Red;
layer3DSettingVector.Style = style;
Layer3DDataset layer3DDataset0 = layer3Ds.Insert(2, dataset0, layer3DSettingVector);
layer3DDataset0.UpdateData();
Layer3DDataset layer3DDataset1 = layer3Ds.Insert(3, dataset1, layer3DSettingVector);
layer3DDataset1.UpdateData();
camera = new Camera()
{
AltitudeMode = AltitudeMode.RelativeToGround,
Altitude = 5779.44118825533,
Heading = 244.353707497597,
Latitude = 26.4163171297286,
Longitude = 119.952620267425,
Tilt = 68.3336350574725
};
m_sceneControl.Scene.Fly(camera, 100);
m_sceneControl.Scene.Refresh();
}