|
@@ -20,81 +20,5 @@ import java.util.List;
|
|
*/
|
|
*/
|
|
public class test {
|
|
public class test {
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- String path="H:\\workfile\\100-150点json数据\\100-150点json数据\\outputjson\\";
|
|
|
|
-
|
|
|
|
- if (FileUtil.exist(path.replaceAll("outputjson",""))){
|
|
|
|
- String s = FileUtil.readString(path.replaceAll("outputjson","") + "points.json", "utf8");
|
|
|
|
- JSONArray points= JSON.parseArray(s);
|
|
|
|
- for (Object point : points) {
|
|
|
|
- JSONObject a = JSON.parseObject(JSONObject.toJSON(point).toString());
|
|
|
|
- BreakpointsEntity breakpointsEntity=new BreakpointsEntity();
|
|
|
|
- breakpointsEntity.setAppId("0000000001");
|
|
|
|
- PointPO po=new PointPO();
|
|
|
|
- po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
- po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
- po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
- breakpointsEntity.setPosition(po);
|
|
|
|
- breakpointsEntity.setBreakPointId(a.getString("id"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- File[] ls = FileUtil.ls(path);
|
|
|
|
- for (File l : ls) {
|
|
|
|
- List<File> files = FileUtil.loopFiles(l);
|
|
|
|
- for (File file : files) {
|
|
|
|
- if (!file.getName().contains("_")){
|
|
|
|
- String s = FileUtil.readString(file, "utf8");
|
|
|
|
- JSONArray rotate= JSON.parseArray(s);
|
|
|
|
- for (Object o : rotate) {
|
|
|
|
- JSONObject a = JSON.parseObject(JSONObject.toJSON(o).toString());
|
|
|
|
- RotateFrameEntity rotateFrameEntity=new RotateFrameEntity();
|
|
|
|
- rotateFrameEntity.setFrameIndex(a.getInteger("frame"));
|
|
|
|
- rotateFrameEntity.setFileName(l.getName()+".h64");
|
|
|
|
- rotateFrameEntity.setDirectory(l.getName());
|
|
|
|
- AnglePO anglePO=new AnglePO();
|
|
|
|
- anglePO.setPitch(a.getJSONObject("angle").getDoubleValue("pitch"));
|
|
|
|
- anglePO.setRoll(a.getJSONObject("angle").getDoubleValue("roll"));
|
|
|
|
- anglePO.setYaw(a.getJSONObject("angle").getDoubleValue("yaw"));
|
|
|
|
- rotateFrameEntity.setCameraAngle(anglePO);
|
|
|
|
- PointPO po=new PointPO();
|
|
|
|
- po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
- po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
- po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
- rotateFrameEntity.setCameraPosition(po);
|
|
|
|
- rotateFrameEntity.setBreakPointId(l.getName());
|
|
|
|
- System.out.println(JSON.toJSONString(rotateFrameEntity));
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }else {
|
|
|
|
- String s = FileUtil.readString(file, "utf8");
|
|
|
|
- JSONArray moveFrame= JSON.parseArray(s);
|
|
|
|
- for (Object o : moveFrame) {
|
|
|
|
- JSONObject a = JSON.parseObject(JSONObject.toJSON(o).toString());
|
|
|
|
- MoveFrameEntity moveFrameEntity=new MoveFrameEntity();
|
|
|
|
- AnglePO anglePO=new AnglePO();
|
|
|
|
- anglePO.setPitch(a.getJSONObject("angle").getDoubleValue("pitch"));
|
|
|
|
- anglePO.setRoll(a.getJSONObject("angle").getDoubleValue("roll"));
|
|
|
|
- anglePO.setYaw(a.getJSONObject("angle").getDoubleValue("yaw"));
|
|
|
|
- moveFrameEntity.setCameraAngle(anglePO);
|
|
|
|
- PointPO po=new PointPO();
|
|
|
|
- po.setX(a.getJSONObject("position").getDoubleValue("x"));
|
|
|
|
- po.setY(a.getJSONObject("position").getDoubleValue("y"));
|
|
|
|
- po.setZ(a.getJSONObject("position").getDoubleValue("z"));
|
|
|
|
- moveFrameEntity.setCameraPosition(po);
|
|
|
|
- String name = file.getName().replace(".json", "");
|
|
|
|
- String[] s1 = name.split("_");
|
|
|
|
- moveFrameEntity.setStartBreakPointId(Integer.parseInt(s1[0]));
|
|
|
|
- moveFrameEntity.setEndBreakPointId(Integer.parseInt(s1[1]));
|
|
|
|
- moveFrameEntity.setAngle(Integer.parseInt(s1[2]));
|
|
|
|
- moveFrameEntity.setFrameIndex(a.getInteger("frame"));
|
|
|
|
- moveFrameEntity.setDirectory(l.getName());
|
|
|
|
- System.out.println(JSON.toJSONString(moveFrameEntity));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- System.out.println(FileUtil.isFile(l));
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|