|
@@ -1,41 +1,37 @@
|
|
|
-//package com.fdkk.fdkkmeta.test;
|
|
|
-//
|
|
|
-//import cn.hutool.core.date.DateUtil;
|
|
|
-//import cn.hutool.core.io.BufferUtil;
|
|
|
-//import cn.hutool.core.io.FileUtil;
|
|
|
-//import cn.hutool.core.io.IORuntimeException;
|
|
|
-//import cn.hutool.core.io.IoUtil;
|
|
|
-//import cn.hutool.core.io.file.FileWriter;
|
|
|
-//import cn.hutool.core.lang.Console;
|
|
|
-//import cn.hutool.core.util.StrUtil;
|
|
|
-//import cn.hutool.core.util.URLUtil;
|
|
|
-//import cn.hutool.log.StaticLog;
|
|
|
-//import cn.hutool.socket.aio.AioServer;
|
|
|
-//import cn.hutool.socket.aio.AioSession;
|
|
|
-//import cn.hutool.socket.aio.SimpleIoAction;
|
|
|
-//import cn.hutool.socket.nio.NioServer;
|
|
|
-//import com.alibaba.fastjson.JSON;
|
|
|
-//import com.alibaba.fastjson.JSONArray;
|
|
|
-//import com.alibaba.fastjson.JSONObject;
|
|
|
-//import com.fdkk.fdkkmeta.po.RoutePO;
|
|
|
-//import com.fdkk.fdkkmeta.util.FileUtils;
|
|
|
-//import org.bytedeco.ffmpeg.global.avcodec;
|
|
|
-//import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
|
-//import org.bytedeco.javacv.FFmpegFrameRecorder;
|
|
|
-//import org.bytedeco.javacv.Frame;
|
|
|
-//
|
|
|
-//import java.io.*;
|
|
|
-//import java.nio.ByteBuffer;
|
|
|
-//import java.nio.charset.Charset;
|
|
|
-//import java.text.SimpleDateFormat;
|
|
|
-//import java.util.*;
|
|
|
-//import java.util.stream.Collectors;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @author Xiewj
|
|
|
-// * @date 2022/3/29
|
|
|
-// */
|
|
|
-//public class test {
|
|
|
+package com.fdkk.fdkkmeta.test;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.io.BufferUtil;
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.io.IORuntimeException;
|
|
|
+import cn.hutool.core.io.IoUtil;
|
|
|
+import cn.hutool.core.io.file.FileWriter;
|
|
|
+import cn.hutool.core.lang.Console;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.core.util.URLUtil;
|
|
|
+import cn.hutool.log.StaticLog;
|
|
|
+import cn.hutool.socket.aio.AioServer;
|
|
|
+import cn.hutool.socket.aio.AioSession;
|
|
|
+import cn.hutool.socket.aio.SimpleIoAction;
|
|
|
+import cn.hutool.socket.nio.NioServer;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fdkk.fdkkmeta.entity.po.RoutePO;
|
|
|
+import com.fdkk.fdkkmeta.util.FileUtils;
|
|
|
+
|
|
|
+import java.io.*;
|
|
|
+import java.nio.ByteBuffer;
|
|
|
+import java.nio.charset.Charset;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Xiewj
|
|
|
+ * @date 2022/3/29
|
|
|
+ */
|
|
|
+public class test {
|
|
|
//// public static void main(String[] args) throws IOException {
|
|
|
//// int d=6;
|
|
|
//// int fps=2 % d;
|
|
@@ -120,60 +116,65 @@
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
-// private static void createdPointsJson(String path) {
|
|
|
-// List<String> list = FileUtils.readFileByLines2(path);
|
|
|
-// JSONArray array=new JSONArray();
|
|
|
-// FileWriter writer=new FileWriter("D:\\video\\points.json");
|
|
|
-// for (int i = 0; i < list.size(); i++) {
|
|
|
-// JSONObject jsonObject=new JSONObject();
|
|
|
-// String[] s = list.get(i).split(" ");
|
|
|
-// jsonObject.put("id",i );
|
|
|
-// JSONObject position=new JSONObject();
|
|
|
-// position.put("x",Double.valueOf(s[0]));
|
|
|
-// position.put("y",Double.valueOf(s[1]));
|
|
|
-// position.put("z",Double.valueOf(s[2]));
|
|
|
-// jsonObject.put("position",position);
|
|
|
-// JSONObject rotation=new JSONObject();
|
|
|
-// rotation.put("x",0.0);
|
|
|
-// rotation.put("y",0.0);
|
|
|
-// rotation.put("z",0.0);
|
|
|
-// rotation.put("w",1.0);
|
|
|
-// jsonObject.put("rotation",rotation);
|
|
|
-// List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
|
|
|
-// List<Integer> contact = strings.stream().filter(a -> !a.equals("-1")).map(a->{
|
|
|
-// return Integer.parseInt(a)-1;
|
|
|
-// }).collect(Collectors.toList());
|
|
|
-// jsonObject.put("contact",contact);
|
|
|
-// array.add(jsonObject);
|
|
|
-// }
|
|
|
-// writer.write(array.toJSONString());
|
|
|
-// }
|
|
|
-//
|
|
|
-// private static void creatTargetJson(String path) {
|
|
|
-// List<String> list = FileUtils.readFileByLines2(path);
|
|
|
-// List<String> collect = new ArrayList<>();
|
|
|
-// FileWriter writer=new FileWriter("D:\\video\\target_freespace.json");
|
|
|
-// for (int i = 0; i < list.size(); i++) {
|
|
|
-// RoutePO po = new RoutePO();
|
|
|
-// String[] s = list.get(i).split(" ");
|
|
|
-// po.setId(i );
|
|
|
-// if (s.length == 12) {
|
|
|
-// double[] oldPoint = {Double.valueOf(s[0]), Double.valueOf(s[1]), Double.valueOf(s[2])};
|
|
|
-// po.setX(oldPoint[0]);
|
|
|
-// po.setY(oldPoint[1]);
|
|
|
-// po.setZ(oldPoint[2]);
|
|
|
-// po.setWeight(Double.parseDouble(s[3]));
|
|
|
-// List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
|
|
|
-// List<Integer> contact = strings.stream().map(a->{
|
|
|
-// if (Integer.parseInt(a)!=-1){
|
|
|
-// return Integer.parseInt(a)-1;
|
|
|
-// }
|
|
|
-// return Integer.parseInt(a);
|
|
|
-// }).collect(Collectors.toList());
|
|
|
-// po.setIds(contact);
|
|
|
-// }
|
|
|
-// collect.add(JSON.toJSONString(po));
|
|
|
-// }
|
|
|
-// writer.writeLines(collect);
|
|
|
-// }
|
|
|
-//}
|
|
|
+ public static void main(String[] args) {
|
|
|
+ createdPointsJson("H:\\workfile\\final_freespace(3).csv");
|
|
|
+ creatTargetJson("H:\\workfile\\final_freespace(3).csv");
|
|
|
+
|
|
|
+ }
|
|
|
+ private static void createdPointsJson(String path) {
|
|
|
+ List<String> list = FileUtils.readFileByLines2(path);
|
|
|
+ JSONArray array=new JSONArray();
|
|
|
+ FileWriter writer=new FileWriter("H:\\workfile\\points.json");
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ JSONObject jsonObject=new JSONObject();
|
|
|
+ String[] s = list.get(i).split(" ");
|
|
|
+ jsonObject.put("id",i );
|
|
|
+ JSONObject position=new JSONObject();
|
|
|
+ position.put("x",Double.valueOf(s[0]));
|
|
|
+ position.put("y",Double.valueOf(s[1]));
|
|
|
+ position.put("z",Double.valueOf(s[2]));
|
|
|
+ jsonObject.put("position",position);
|
|
|
+ JSONObject rotation=new JSONObject();
|
|
|
+ rotation.put("x",0.0);
|
|
|
+ rotation.put("y",0.0);
|
|
|
+ rotation.put("z",0.0);
|
|
|
+ rotation.put("w",1.0);
|
|
|
+ jsonObject.put("rotation",rotation);
|
|
|
+ List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
|
|
|
+ List<Integer> contact = strings.stream().filter(a -> !a.equals("-1")).map(a->{
|
|
|
+ return Integer.parseInt(a)-1;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ jsonObject.put("contact",contact);
|
|
|
+ array.add(jsonObject);
|
|
|
+ }
|
|
|
+ writer.write(array.toJSONString());
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void creatTargetJson(String path) {
|
|
|
+ List<String> list = FileUtils.readFileByLines2(path);
|
|
|
+ List<String> collect = new ArrayList<>();
|
|
|
+ FileWriter writer=new FileWriter("H:\\workfile\\target_freespace.json");
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ RoutePO po = new RoutePO();
|
|
|
+ String[] s = list.get(i).split(" ");
|
|
|
+ po.setId(i );
|
|
|
+ if (s.length == 12) {
|
|
|
+ double[] oldPoint = {Double.valueOf(s[0]), Double.valueOf(s[1]), Double.valueOf(s[2])};
|
|
|
+ po.setX(oldPoint[0]);
|
|
|
+ po.setY(oldPoint[1]);
|
|
|
+ po.setZ(oldPoint[2]);
|
|
|
+ po.setWeight(Double.parseDouble(s[3]));
|
|
|
+ List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
|
|
|
+ List<Integer> contact = strings.stream().map(a->{
|
|
|
+ if (Integer.parseInt(a)!=-1){
|
|
|
+ return Integer.parseInt(a)-1;
|
|
|
+ }
|
|
|
+ return Integer.parseInt(a);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ po.setIds(contact);
|
|
|
+ }
|
|
|
+ collect.add(JSON.toJSONString(po));
|
|
|
+ }
|
|
|
+ writer.writeLines(collect);
|
|
|
+ }
|
|
|
+}
|