1、supermap-idesktopx-10.1.2-0330-5260-86195-win64-bin-zip-chs
代码操作 查询模型纹理信息 内存居高不下:
DatasetVector datasetVector = (DatasetVector) selectedDataset;
Recordset recordset = datasetVector.getRecordset(false, CursorType.STATIC);
recordset.moveFirst();
long l1 = System.currentTimeMillis();
ModelEntityManager modelEntityManager = new ModelEntityManager(datasetVector);
long l2 = System.currentTimeMillis();
System.out.println("ModelEntityManager构建耗时:" + (l2-l1) + "ms");
while (!recordset.isEOF()){
Geometry geometry = recordset.getGeometry();
GeoModel3D geoModel3D = (GeoModel3D) geometry;
Model model = geoModel3D.getModel();
// ModelEntityManager modelEntityManager = new ModelEntityManager();
// Model append = modelEntityManager.append(model);
ArrayList<String> materialNames = modelEntityManager.getMaterialNames();
System.out.println(materialNames.size());
for (String materialName : materialNames) {
Material3D material = model.getMaterial(materialName);
if (material==null){
continue;
}
TextureData texture = material.getTexture();
if (texture != null){
BufferedImage data = texture.getData();
int height = texture.getHeight();
int width = texture.getWidth();
data.flush();
data = null;
texture.dispose();
System.out.println(height + "===" + width);
}
material.dispose();
}
//append.dispose();
//modelEntityManager.dispose();
model.dispose();
geoModel3D.dispose();
geometry.dispose();
recordset.moveNext();
}
// modelEntityManager.reset();
modelEntityManager.dispose();
recordset.dispose();
recordset.close();
datasetVector.close();
selectedDataset.close();
2、然后我尝试用桌面打开 去查看模型信息--结果也是一样的内存逐渐升高,
桌面打开平面场景后,右键属性 查看模型信息 内存居高不下。 关掉场景窗口后仍然高的一匹
咋解决。。。。。。。。。。。。。。。。。。。。。。。。
或者有啥办法能够获取到模型的大小