모의주행 API 에 접근할 수 있는 클래스입니다.

Constructors

Methods

  • 길찾기 경로를 지도에서 제거합니다.

    Returns void

    Example

    map.routeSimulation.clear();
    
  • 현재 진행중인 모의주행을 멈추고 현재 상태를 반환합니다.

    Returns undefined | {
        currentIndex: number;
        distance: number;
        floorIndex: number;
        routeIndex?: number;
    }

    currentIndex, distance, floorIndex, và routeIndex (optional) hoặc undefined

    Example

    const pauseData = map.routeSimulation.pause();
    if (pauseData) {
    console.log('Current index:', pauseData.currentIndex);
    console.log('Distance traveled:', pauseData.distance);
    console.log('Floor index:', pauseData.floorIndex);
    console.log('Route index:', pauseData.routeIndex);

    // Lưu state để restore sau khi clear map
    localStorage.setItem('pausedRouteState', JSON.stringify(pauseData));
    }
  • 현재 멈춰있는 모의주행을 재개할 수 있습니다. (Tiếp tục từ vị trí pause, không clear map)

    Returns void

    Example

    map.routeSimulation.resume();
    
  • 길찾기 경로를 지도에 표현합니다.

    Parameters

    • naviResponse: undefined | Partial<INavigationResponse>

      mapData.getRoute() 를 호출하여 반환된 NavigationResponse 데이터

    • naviOption: Partial<INaviOptions> = {}

      길찾기 옵션. 출발지, 경유지, 도착지의 아이콘 및 주행선 옵션을 설정할 수 있습니다.

    • Optional pauseState: {
          currentIndex: number;
          distance: number;
          floorId?: string;
          floorIndex: number;
          position?: {
              x: number;
              y: number;
          };
          routeIndex?: number;
          url?: string;
      }

      Optional: Nếu có pause state (currentIndex, distance, floorIndex), icon sẽ được hiển thị tại vị trí đó Nếu có floorId trong pauseState, sẽ tự động changeFloor đến tầng đó

      • currentIndex: number
      • distance: number
      • Optional floorId?: string
      • floorIndex: number
      • Optional position?: {
            x: number;
            y: number;
        }
        • x: number
        • y: number
      • Optional routeIndex?: number
      • Optional url?: string

    Returns Promise<any>

    적용된 옵션값

    See

    mapData.getRoute()

    Example

    // Set route bình thường
    await map.routeSimulation.set(naviResponse.recommendation, naviOption);

    // Set route với pause state (hiển thị icon tại vị trí đã pause)
    await map.routeSimulation.set(naviResponse.recommendation, naviOption, {
    currentIndex: 1,
    distance: 311.59,
    floorIndex: 0
    });

    // Set route với floorId để tự động changeFloor đến tầng đó
    await map.routeSimulation.set(naviResponse.recommendation, naviOption, {
    currentIndex: 1,
    distance: 311.59,
    floorIndex: 0,
    floorId: 'FL-xxxxx' // Tự động changeFloor đến tầng này
    });
  • 길찾기 경로가 표시된 후 경로를 따라 모의주행을 그립니다. 경로를 따라가다가 층이 변경되는 경우 층 변경 전에 "floor-changed" event와 "floor-changing" event가 발생합니다. 옵션 없이 사용할 수도 있고 옵션을 주어 모의주행에 관련된 설정을 할 수도 있습니다. 반드시 비동기 처리를 해주셔야 합니다.

    Parameters

    Returns void

    void (반환해서는 안된다)

    Example

    const animOption = {
    zoom: number, // 애니메이션 동작 시 zoom Level
    enableTwoFloorsNavigation: boolean // 층변경 애니메이션 후 두개지도 표출 여부
    twoFloorsNavigationDuration : number // 층변경 애니메이션 후 두개지도 표출로 넘어가는 시간 ms, default 2000
    twoFloorsNavigationOriginCss : string
    twoFloorsNavigationDestCSs : string
    enableFloorMotionCSS: boolean // 층변경시 애니메이션으로 동작 여부
    floorMotionDuration: number // 층변경 애니메이션시 동작 시간 ms. ex 1000 default 3000
    changeFloorDelay: number, // 층 변경시 delay time
    speedRate: number, // 모의주행 속도 지정. 예를 들어 1.5로 지정한 경우 default대비 1.5배 속도
    removeIcon: boolean, // 모의주행 완료 또는 stop 시, 모의주행 icon 제거 옵션. 기본값은 true
    markerOptions: { // 모의주행의 icon 옵션
    iconUrl: string, // 모의주행의 icon의 url을 지정합니다.
    width: number, // 모의주행의 icon의 width값을 설정합니다.
    height: number, // 모의주행의 icon의 height값을 설정합니다.
    },
    };
    await map.routeSimulation.start(animOption);
  • Start route animation từ paused state (sau khi clear map và recreate)

    Parameters

    • pausedState: {
          currentIndex: number;
          distance: number;
          floorId?: string;
          floorIndex: number;
          routeIndex?: number;
      }

      State đã lưu từ pause() (bao gồm routeIndex nếu có)

      • currentIndex: number
      • distance: number
      • Optional floorId?: string
      • floorIndex: number
      • Optional routeIndex?: number
    • Optional animOption: INaviAnimOption

      Animation option

    Returns Promise<undefined | INaviAnimOption>

    Promise với animation option hoặc undefined

    Example

    // 1. Pause và lưu state
    const pauseData = map.routeSimulation.pause();
    if (pauseData) {
    localStorage.setItem('pausedState', JSON.stringify(pauseData));
    }

    // 2. Clear map
    map.cleanup();

    // 3. Recreate map
    const newMap = new DabeeoMaps({ ... });
    await newMap.control.showMap();

    // 4. Set route lại
    await newMap.routeSimulation.set(naviResponse, naviOptions);

    // 5. Resume từ vị trí đã pause (routeIndex sẽ được tự động sử dụng nếu có)
    const savedState = JSON.parse(localStorage.getItem('pausedState'));
    if (savedState) {
    await newMap.routeSimulation.startFromPausedState(savedState, animOption);
    }
  • 현재 진행중인 모의주행을 멈출 수 있습니다.

    Returns void

    Example

    map.routeSimulation.stop();