|
@@ -42,5 +42,36 @@ public class sceneGrpcServer extends SceneGrpcServiceGrpc.SceneGrpcServiceImplBa
|
|
|
log.info("回复{}",res);
|
|
|
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public void getRoute(RouteRequest request, StreamObserver<RouteReply> responseObserver) {
|
|
|
+ // grpc服务端获取调用端请求参数
|
|
|
+ String sceneCode = request.getSceneCode();
|
|
|
+ Point sLocation = request.getSLocation();
|
|
|
+ Point eLocation = request.getELocation();
|
|
|
+ RouteDto po=new RouteDto();
|
|
|
+ PointPO s=new PointPO();
|
|
|
+ s.setX(Double.parseDouble(sLocation.getX()));
|
|
|
+ s.setY(Double.parseDouble(sLocation.getY()));
|
|
|
+ s.setZ(Double.parseDouble(sLocation.getY()));
|
|
|
+ PointPO e=new PointPO();
|
|
|
+ e.setX(Double.parseDouble(eLocation.getX()));
|
|
|
+ e.setY(Double.parseDouble(eLocation.getY()));
|
|
|
+ e.setZ(Double.parseDouble(eLocation.getY()));
|
|
|
+ po.setE_location(e);
|
|
|
+ po.setS_location(s);
|
|
|
+ po.setSceneCode(sceneCode);
|
|
|
+ JSONArray maps = GetRoute.getRoute(metaConfig.getFreespacePath()+ File.separator +"target_freespace.json", po);
|
|
|
+ // 这里可以有自己的业务代码,只需要按照porto中的返回类型返回参数即可
|
|
|
+ RouteReply.Builder builder = RouteReply.newBuilder();
|
|
|
+ if (ArrayUtil.isNotEmpty(maps)) {
|
|
|
+ for (int i = 0; i < maps.size(); i++) {
|
|
|
+ RouteArray.Builder addInBuilder = builder.addInBuilder();
|
|
|
+ ProtoJsonUtils.toProtoBean(addInBuilder, maps.get(i).toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ responseObserver.onNext(builder.build());
|
|
|
+ responseObserver.onCompleted();
|
|
|
+ }
|
|
|
|
|
|
}
|