本人代码如下:
DatasetVector datasetVector = (DatasetVector) dataset;
//坐标新转换
PrjCoordSys prjCoordSys = new PrjCoordSys();
prjCoordSys.fromEPSGCode(4490);
datasetVector.setPrjCoordSys(prjCoordSys);
String datasetVectorName = datasetVector.getName();
String cacheName = datasetVectorName + "@" + sourceName;
Rectangle2D bounds = datasetVector.getBounds();
OSGBCacheBuilder osgbCacheBuilder = new OSGBCacheBuilder(datasetVector, filePath, cacheName);
osgbCacheBuilder.setFileType(CacheFileType.S3MB);
osgbCacheBuilder.setBounds(bounds);
Point3D position = osgbCacheBuilder.getPosition();
Point3D point3D = new Point3D(position.x, position.y, position.z);
osgbCacheBuilder.setPosition(point3D);
osgbCacheBuilder.setMaterialType(MaterialType.NORMAL);
osgbCacheBuilder.setUserIDField("SmID");
boolean build = osgbCacheBuilder.build();
//添加场景
Scene scene = new Scene(workspace);
Layer3Ds layers = scene.getLayers();
// Layer3DSettingVector layer3DSettingVector = new Layer3DSettingVector();
// GeoStyle3D style = new GeoStyle3D();
// style.setFillForeColor(Color.BLACK);
// layer3DSettingVector.setStyle(style);
// Layer3D add = layers.add(datasetVector, layer3DSettingVector, true);
Layer3D add = layers.add(filePath + "/" + cacheName + "/" + cacheName + ".scp", Layer3DType.OSGB, true);
add.setEditable(true);
add.setVisible(true);
scene.ensureVisible(add);
Scenes scenes = workspace.getScenes();
scenes.add(datasetVectorName, scene.toXML());
工作空间中有一个模型数据集(model类型dataset),生成缓存之后,使用缓存文件方式添加场景图层,另存工作空间发布服务,进入scenes后用WebGL3D形式查看,看不到模型,如图:
但是以三维切片缓存方式发布服务(不用工作空间,用scp文件)就能看到模型,如图:
我想问一下是我缓存有问题还是场景图层有问题?谢谢