使用产品:iobject java 9.0.1 操作系统:win7 x64
数据类型:文件形udb
layer3DDataset.toDatasetVector直接返回false无效果,无任何报错
Workspace workspace = new Workspace();
DatasourceConnectionInfo info = new DatasourceConnectionInfo();
info.setServer("E:/Amy分类/贴图/WDTEST1.udb");
info.setEngineType(EngineType.UDB);
Datasource datasource = workspace.getDatasources().open(info);
// Workspace workspace = new Workspace();
// WorkspaceConnectionInfo workspaceConnectionInfo = new
// WorkspaceConnectionInfo();
// workspaceConnectionInfo.setType(WorkspaceType.SMWU);
// String file = "E:/Amy分类/贴图/roadwork.smwu";
// workspaceConnectionInfo.setServer(file);
// workspace.open(workspaceConnectionInfo);
// Datasource datasource = workspace.getDatasources().get(0);
Dataset dataset = datasource.getDatasets().get("道路合并");
Scene scene = new Scene(workspace);
Layer3DSettingVector layer3DSettingVector = new Layer3DSettingVector();
GeoStyle3D geoStyle3D = new GeoStyle3D();
geoStyle3D.setAltitudeMode (AltitudeMode.RELATIVE_TO_GROUND);
geoStyle3D.setFillMode(FillMode3D.LINE_AND_FILL);
geoStyle3D.setLineColor (Color.WHITE);
geoStyle3D.setLineWidth(1);
//geoStyle3D.setMarkerSize(10);
layer3DSettingVector.setStyle(geoStyle3D);
//贴图设置
layer3DSettingVector.setTopTextureField("chartlet");
layer3DSettingVector.setTopTilingUField("crosswise");
layer3DSettingVector.setTopTilingVField("lengthways");
scene.getLayers().add(dataset, layer3DSettingVector,true);
String xml = scene.toXML();
workspace.getScenes().add("贴图场景", xml);
scene.fromXML(xml);
Layer3DDataset layer3DDataset=(Layer3DDataset)scene.getLayers().get(0);
boolean bb = layer3DDataset.toDatasetVector(datasource, "道路合并model");
System.out.println(bb);
//隐使用c#代码生成模型数据集存在线程问题故在此尝试java是否同样存在
// new Thread(){
// Layer3DDataset layer3DDataset;
// Datasource datasource;
// public synchronized void startset(Layer3DDataset layer3DDataset,Datasource datasource) {
// this.layer3DDataset=layer3DDataset;
// this.datasource=datasource;
// super.start();
// }
// @Override
// public void run() {
// boolean bb = layer3DDataset.toDatasetVector(null, "道路合并model");
// System.out.println(bb);
// }
// }.startset(layer3DDataset,datasource);
WorkspaceConnectionInfo workspaceConnectionInfo2 = new WorkspaceConnectionInfo();
workspaceConnectionInfo2.setName("world_save002");
workspaceConnectionInfo2.setType(WorkspaceType.SXWU);
workspaceConnectionInfo2.setServer("E:/Amy分类/贴图/world_save002");
workspace.saveAs(workspaceConnectionInfo2);