| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.MapNode; |
| | |
| | | import com.zy.core.News; |
| | | import com.zy.core.enums.MapNodeType; |
| | | import com.zy.core.model.PythonSimilarityResult; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | private String pythonCalcSimilarity; |
| | | @Autowired |
| | | private NavigateMapData navigateMapData; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | public List<NavigateNode> calc(String startPoint, String endPoint, List<NavigationMapType> mapTypes, List<int[]> shuttlePoints, List<int[]> whites) { |
| | | return calcJava(startPoint, endPoint, mapTypes, shuttlePoints, whites); |
| | |
| | | //将最后一段数据添加进入 |
| | | list.add(data); |
| | | |
| | | //分段路径-处理超长直线段路径 |
| | | List<List<NavigateNode>> paths = getSectionPathToSplitOverLength(list); |
| | | return paths; |
| | | } |
| | | |
| | | //分段路径-处理超长直线段路径 |
| | | public List<List<NavigateNode>> getSectionPathToSplitOverLength(List<List<NavigateNode>> list) { |
| | | int overLength = 9;//默认9节 |
| | | Config shuttleMoveOverLengthConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "shuttleMoveOverLength")); |
| | | if (shuttleMoveOverLengthConfig != null) { |
| | | overLength = Integer.parseInt(shuttleMoveOverLengthConfig.getValue()); |
| | | } |
| | | |
| | | List<List<NavigateNode>> paths = new ArrayList<>(); |
| | | int overLength = 9; |
| | | for (List<NavigateNode> nodes : list) { |
| | | long nextId = snowflakeIdWorker.nextId(); |
| | | |
| | | if (nodes.size() > overLength) { |
| | | List<NavigateNode> copy = JSON.parseArray(JSON.toJSONString(nodes), NavigateNode.class); |
| | | List<NavigateNode> tmp = new ArrayList<>(); |
| | |
| | | if (lastNode == null) { |
| | | NavigateNode startNode = tmp.get(0); |
| | | startNode.setLinePartAllowGo(true);//直线段超长部分允许直接行走 |
| | | startNode.setLinePartFlag(nextId);//直线段数据标识 |
| | | tmp.set(0, startNode); |
| | | } |
| | | NavigateNode targetNode = tmp.get(tmp.size() - 1); |
| | | targetNode.setLinePartAllowGo(true);//直线段超长部分允许直接行走 |
| | | targetNode.setLinePartFlag(nextId);//直线段数据标识 |
| | | if (lastNode != null) { |
| | | tmp.add(0, lastNode); |
| | | } |
| | |
| | | paths.add(tmp); |
| | | } |
| | | }else { |
| | | NavigateNode startNode = nodes.get(0); |
| | | startNode.setLinePartAllowGo(true);//直线段超长部分允许直接行走 |
| | | startNode.setLinePartFlag(nextId);//直线段数据标识 |
| | | nodes.set(0, startNode); |
| | | paths.add(nodes); |
| | | } |
| | | } |