|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkk.fdkkmeta.config.MetaConfig;
|
|
|
import com.fdkk.fdkkmeta.domain.dto.RouteDto;
|
|
|
import com.fdkk.fdkkmeta.domain.entity.mysql.BreakpointsEntity;
|
|
@@ -24,7 +25,6 @@ import com.googlecode.protobuf.format.JsonFormat;
|
|
|
import io.grpc.stub.StreamObserver;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import net.devh.boot.grpc.server.service.GrpcService;
|
|
|
-import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.io.File;
|
|
@@ -248,6 +248,8 @@ public class sceneGrpcServer extends SceneGrpcServiceGrpc.SceneGrpcServiceImplBa
|
|
|
Point start = null; //从user表里取
|
|
|
//计算路径
|
|
|
|
|
|
+
|
|
|
+
|
|
|
String appId = user.getAppId();
|
|
|
RouteDto po=new RouteDto();
|
|
|
PointPO s=new PointPO();
|
|
@@ -263,13 +265,16 @@ public class sceneGrpcServer extends SceneGrpcServiceGrpc.SceneGrpcServiceImplBa
|
|
|
po.setSceneCode(appId);
|
|
|
JSONArray maps = GetRoute.getRoute(metaConfig.getFreespacePath()+ File.separator +appId+"_target_freespace.json", po);
|
|
|
//处理路径数组,处理完成后放入缓存
|
|
|
+ //获得下一个要走的breakPointId
|
|
|
+ Long nextbreakPointId = 0L;
|
|
|
+ if (maps.size()>=2){
|
|
|
+ nextbreakPointId = JSON.parseObject(JSONObject.toJSON(maps.get(1)).toString()).getLong("id");
|
|
|
+ maps.remove(0);
|
|
|
+ redisCache.setCacheObject("route:"+trace_id,maps);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- redisCache.setCacheObject(trace_id,maps);
|
|
|
- // 从缓存里面取 JSONArray cacheObject = redisCache.getCacheObject(trace_id);
|
|
|
|
|
|
- //获得下一个要走的breakPointId
|
|
|
- int nextbreakPointId = 0;
|
|
|
|
|
|
//开始返回结果,一段一段的返回(每段是两个邻居点的过渡),第一段之前还要有角度的矫正
|
|
|
//矫正的结果:
|
|
@@ -366,8 +371,18 @@ public class sceneGrpcServer extends SceneGrpcServiceGrpc.SceneGrpcServiceImplBa
|
|
|
else {
|
|
|
offAngle = -1*offAngle;
|
|
|
}
|
|
|
+ Long nextbreakPointId = 0L;
|
|
|
+ // 从缓存里面取 JSONArray cacheObject = redisCache.getCacheObject(trace_id);
|
|
|
+ if (redisCache.hasKey(trace_id)){
|
|
|
+ JSONArray cacheObject = redisCache.getCacheObject(trace_id);
|
|
|
+ if (cacheObject.size()>=2){
|
|
|
+ nextbreakPointId = JSON.parseObject(JSONObject.toJSON(cacheObject.get(1)).toString()).getLong("id");
|
|
|
+ cacheObject.remove(0);
|
|
|
+ redisCache.setCacheObject("route:"+trace_id,cacheObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //循环
|
|
|
+ //循环
|
|
|
//for()
|
|
|
|
|
|
PointPO cameraPoint = rotateFrameEntity.getCameraPosition();
|