首页 / 浏览问题 / 组件GIS / 问题详情
layer3DDataset.toDatasetVector 无效果
2EXP 2021年04月27日

使用产品: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);

1个回答

您好,请问一下您那边具体需求是什么样呢?您那边如果要贴图可以先设置图层layer3DDatasetVector的底部高程和拉伸高度,再贴图转成模型数据集
9,197EXP 2021年04月27日

1.不需要强转为GeoModel3D,这个方法是将Geometry通过线性拉伸为一个GeoModel3D对象
2.设置贴图的步骤:
1.先进行拉伸获取到GoeModel3D对象,然后通过GeoModel.getModel()拿到Model对象
2.通过Model去拿该模型的骨架Skeleton
3.再通过骨架去设置材质:Skeleton.setMaterial(Material3D value)

到Model  又无后续了

9.1.2里linearExtrude是弃用且会报UnsatisfiedLinkError

9.0 getLODCount 为0

都找不到与Skeleton相关的东西

建议您那边在官网下载10.1.2的最新包,下载地址:http://support.supermap.com.cn/DownloadCenter/ProductPlatform.aspx

有结果了么 研发完了么
产品包地址已经私发你了哈
...