在本地可以运行生成,在其他一台电脑上,构建缓存报错。这跟环境什么的有关系吗? 这是什么原因导致的?
private Boolean SceneCacheBuild(Scene scene,Path output,String workspaceName) {
Boolean flag = false;
SceneCacheBuilder builder = null;
try {
//1.三维数据集图层设置
Layer3Ds layer3Ds = scene.getLayers();
System.out.println("场景中图层数量:"+layer3Ds.getCount());
ArrayList<String> layerNames = new ArrayList<String>();
for(int i=0;i<layer3Ds.getCount();i++) {
Layer3D layer3D = layer3Ds.get(i);
if(layer3D.getType()==Layer3DType.DATASET)
{
Layer3DDataset layer3DDataset = (Layer3DDataset)layer3D;
layer3DDataset.setFileType(CacheFileType.S3M);//缓存文件类型
layer3DDataset.setTileWidth(2000);//瓦片宽度
layer3DDataset.setIsBuildOSGBCache(true);//三维切片缓存,不然会生成矢量缓存
layer3DDataset.setBuildOSGBPipeCache(true);//生成管线缓存
layer3DDataset.setFilterPixelSize(2);//像素过滤值,提升显示性能
layer3DDataset.setLODCount(0);//部分管点符号模型存在压缩变形,这个参数是超图给出的解决方式
layerNames.add(layer3D.getName());
}
}
System.out.println("场景中三维自定义专题图层数量:"+layerNames.size());
if(layerNames.size()==0)
{
return false;
}
//2.场景缓存生成参数
builder = new SceneCacheBuilder(scene, output.toString());
builder.setCompressedTextureType(CompressedTextureType.DDS);//压缩方式,PC
//builder.setProcessThreadsCount(8);//处理线程
builder.setStorageType(StorageType.Original);//存储方式,原始
builder.setIsCalNormal(false);
builder.setIsInstance(true);
//2.1 设置需要生成缓存的普通图层和地形图层
String[] layerNameArr = layerNames.toArray(new String[] {});
builder.setOutputLayerNames(layerNameArr);//三维自定义图层
builder.setOutputTerrainLayerNames(null);//地形图层不生成
//2.2 场景和工作空间输出参数
builder.setOutputSceneName("Scene");//设置新生成的场景名称
Path path = Paths.get(output.toString(),workspaceName+ ".smwu");//*工作空间路径
connectionInfo.setServer(path.toString());//工作空间路径
builder.setOutputWorkspaceConnectionInfo(connectionInfo);
//2.3 开始生成缓存
flag = builder.build();
} catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
finally {
builder.dispose();
builder = null;
}
return flag;
}
Stack: [0x000000004e9b0000,0x000000004eab0000], sp=0x000000004eaae858, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.supermap.data.processing.SceneCacheBuilderNative.jni_Build(JJLjava/lang/String;)Z+0
j com.supermap.data.processing.SceneCacheBuilder.build()Z+108
j z.s.cache.util.CacheSeverHelper.SceneCacheBuild(Lcom/supermap/realspace/Scene;Ljava/nio/file/Path;Ljava/lang/String;)Ljava/lang/Boolean;+344
j z.s.cache.util.CacheSeverHelper.BuildSceneCache(Lcom/supermap/data/Workspace;)Ljava/lang/Boolean;+181
j z.s.cache.util.CacheSeverHelper.BuildAndPubilshScene(Lcom/supermap/data/Workspace;)Ljava/lang/String;+44
j z.s.cache.util.CacheSeverHelper.PublishAll(Ljava/lang/String;Ljava/lang/String;)Lcom/alibaba/fastjson/JSONObject;+51
j z.s.cache.service.cacheSrv.publishServices(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V+475
j z.s.cache.thread.CacheThread.run()V+23
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub