@@ -66,7 +66,7 @@ public List<GetRouteRes> findRoute(LocationType startType, Long startId, Double
6666 if (conditions == null ) {
6767 conditions = new ArrayList <>();
6868 }
69- conditions .add (OPERATING );
69+ // conditions.add(OPERATING);
7070 Node startNode = getNodeByType (startType , startId , startLat , startLong );
7171 Node endNode = getNodeByType (endType , endId , endLat , endLong );
7272
@@ -273,7 +273,6 @@ private GetGraphRes getGraph(HashSet<Building> buildingList, Node startNode, Nod
273273 Map <Long , List <Edge >> graphEdge = new HashMap <>();
274274
275275 // 조건에 따른 노드 검색
276-
277276 for (Building building : buildingList ) {
278277 if (conditions .contains (OPERATING )) {
279278 if (!building .isOperating ()) continue ;
@@ -395,9 +394,10 @@ private DijkstraRes dijkstra(GetGraphRes graphRes, Node startNode, Node endNode)
395394 //path 생성
396395 List <Node > path = new ArrayList <>();
397396 Long finalDistance = distances .get (endNode .getId ());
398- for (Long at = endNode .getId (); at != null ; at = previousNodes . get ( at ) ) {
397+ for (Long at = endNode .getId (); at != null ;) {
399398 Node node = nodeRepository .findById (at ).orElseThrow (() -> new GlobalException (NOT_FOUND_ROUTE ));
400399 path .add (node );
400+ at = previousNodes .get (at );
401401 }
402402 Collections .reverse (path );
403403
@@ -500,8 +500,12 @@ private List<List<Node>> cutRoute(List<Node> route) {
500500 else if (!Objects .equals (thisNode .getFloor (), nextNode .getFloor ())) {
501501 partialRoute .add (thisNode );
502502
503+ // 층 생략 여부 확인
504+ boolean isFloorSkipped = false ;
505+
503506 // 계단/엘리베이터를 통한 연속적인 층 이동을 감지하여 중간 층을 생략
504- while (!Objects .equals (thisNode .getFloor (), nextNode .getFloor ()) && thisNode .getBuilding ().equals (nextNode .getBuilding ())) {
507+ while (!Objects .equals (thisNode .getFloor (), nextNode .getFloor ()) && thisNode .getBuilding ().equals (nextNode .getBuilding ()) && thisNode .getBuilding ().getId () != OUTDOOR_ID ) {
508+ isFloorSkipped = true ;
505509 count ++;
506510 thisNode = route .get (count );
507511 nextNode = route .get (count +1 );
@@ -510,7 +514,7 @@ else if (!Objects.equals(thisNode.getFloor(), nextNode.getFloor())) {
510514 partialRoute .clear ();
511515
512516 // 끝 층의 시작 노드를 새 경로로 추가
513- count --;
517+ if ( isFloorSkipped ) count --;
514518 } else {
515519 partialRoute .add (thisNode );
516520 }
0 commit comments