|
@@ -1,11 +1,17 @@
|
|
|
package com.fdkankan.fusion.common.util;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.nio.file.StandardCopyOption;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
import static cn.hutool.core.util.ClassUtil.getClassLoader;
|
|
|
|
|
@@ -70,13 +76,37 @@ public class FileWriterUtil {
|
|
|
File[] files = objPathFile.listFiles();
|
|
|
for (File file1 : files) {
|
|
|
if(file1.isFile()){
|
|
|
- if(file1.getName().endsWith(".obj") || file1.getName().endsWith(".las") || file1.getName().endsWith(".ply")){
|
|
|
+ if(file1.getName().endsWith(".obj") || file1.getName().endsWith(".las") || file1.getName().endsWith(".ply")
|
|
|
+ || file1.getName().endsWith(".osgb") || file1.getName().endsWith("b3dm")){
|
|
|
fileList.add(file1);
|
|
|
}
|
|
|
+// if(file1.getName().equals("tileset.json")){
|
|
|
+// checkB3dmTileset(file1);
|
|
|
+// }
|
|
|
}else {
|
|
|
getCanRunList(fileList,file1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static Boolean checkB3dmTileset(File jsonFile) {
|
|
|
+ String fileObj = FileUtil.readUtf8String(jsonFile);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(fileObj);
|
|
|
+ JSONObject root = jsonObject.getJSONObject("root");
|
|
|
+ JSONArray children = root.getJSONArray("children");
|
|
|
+ for (Object child : children) {
|
|
|
+ JSONObject o = (JSONObject) child;
|
|
|
+ JSONObject content = o.getJSONObject("content");
|
|
|
+ String uri = content.getString("uri");
|
|
|
+ String uriPath = jsonFile.getPath().replace(jsonFile.getName(),"");
|
|
|
+ uriPath = uriPath + uri.replace("./","");
|
|
|
+ File file = new File(uriPath);
|
|
|
+ if(!file.exists()){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|