iOS 開発者ガイド for SDK

Fleet Telematics カスタムルート

Fleet Telematics カスタムルート (FTCR) API には、 HERE Map Data および顧客のプライベートマップ データを使用して、ルートの計算、地図への表示、簡単なターン・バイ・ターンナビ (矢印ナビ)の実行を行う機能があります。 FTCR API は、一般的なルーティングおよびナビゲーションに似ていますが、それらと比較して限定的な機能を提供します。 FTCR でカバーされるユースケースの詳細について は、 Fleet Telematics カスタムルート API 開発者ガイドを参照してください。

FTCR クラス

クラス 説明
NMAFTCRRouter Fleet Telematics カスタムルートのルート計算実行者。
NMAFTCRRoutePlan ftcr ルートの計算に必要なすべての情報が含まれています。
NMAFTCRRouteOptions ftcr ルート計算のオプションが含まれています。
NMAFTCRRoute 2 つ以上の経由地を接続する個別の Fleet Telematics カスタムパスを表します。
NMAMapFTCRRoute NMAFTCRRoute に表示できるを表し Mapます。
NMAFTCRNavigationManager FTCR ルートに関するガイダンスアドバイスおよび情報を提供するナビゲーション管理者クラス。
NMAFTCRLaneInformation の車線情報に関する情報を表し NMAFTCRManeuverます。
NMAFTCRManeuver での操作に関する情報を表し NMAFTCRRouteます。
NMAFTCRRouteWarning の警告について説明します NMAFTCRRoute

FTCR ルートの計算

計算するステップ NMAFTCRRoute は、一般的なルーティングの場合と同じです。 ftcr ルート NMAFTCRRouterNMAFTCRRoutePlanNMAFTCRRouteOptions の計算には、 directory: 、およびのクラスを使用します。 ルート計算はオンラインモードでのみ機能することに注意してください。 以下の FTCR ルートの計算例を参照してください。

- (void)calculateRoute
{
  // waypoints setup
  NMAGeoCoordinates* startGeo = [[NMAGeoCoordinates alloc] initWithLatitude:52.514184 longitude:13.316419];
  NMAGeoCoordinates* destinationGeo = [[NMAGeoCoordinates alloc] initWithLatitude:52.512272 longitude:13.383096];
  NMAWaypoint* start = [[NMAWaypoint alloc] initWithGeoCoordinates: startGeo];
  NMAWaypoint* destination = [[NMAWaypoint alloc] initWithGeoCoordinates: destinationGeo];

  // fleet telematics options
  NMAFTCRRoutePlan *plan = [[NMAFTCRRoutePlan alloc] initWithWaypoints:@[start, destination]];
  // set overlay name if needed
  plan.overlay = @"OVERLAYNAME";
  plan.options = [[NMAFTCRRouteOptions alloc] init];
  // other transport modes such as Truck, Pedestrian, Scooter, Bike and Bus are also supported.
  plan.options.transportMode = NMAFTCRTransportModeCar;
  // see API reference to check all possible routing options
  plan.options.routingType = NMAFTCRRoutingTypeFastest;
  NMAGeoCoordinates* topLeft = [[NMAGeoCoordinates alloc] initWithLatitude:52.521842 longitude:13.375375];
  NMAGeoCoordinates* bottomRight = [[NMAGeoCoordinates alloc] initWithLatitude:52.518212 longitude:13.380335];
  [plan.options addAvoidArea:[[NMAGeoBoundingBox alloc] initWithTopLeft:topLeft
                                bottomRight:bottomRight]];

  _router = [[NMAFTCRRouter alloc] init];
  [_router calculateRouteWithPlan:plan
          completionBlock:^(NSArray<NMAFTCRRoute *> *routes, NSError *error) {
    if (!error && routes && routes.count > 0) {
      [self startNavigationWithRoute:[routes firstObject]];
    }
  }];
}

FTCR ターンバイターンガイダンス

NMAFTCRNavigationManager 開発者がルート沿いの簡単なターンバイターンガイダンスを実行できます。 LocationDataSource でカスタムを使用して、ルートのシミュレーションやルートのナビゲート PositioningManagerを行うことができます。 FTCR ナビゲーションの機能は以下と異なります NavigationManager。マップマッチャーはオンラインサーバーからのルートジオメトリにのみ基づいており、再ルーティングはオンラインモードでのみ利用でき、速度警告などの一部のナビゲーションイベントはサポートされていません。 以下の FTCR ナビゲーションを開始する例を参照してください。

- (void)startNavigationWithRoute:(NMAFTCRRoute *)route
{
  // add route to the map
  _ftcrCurrentRoute = [[NMAMapFTCRRoute alloc] initWithRoute:route];
  [_activeMapView addMapObject:_ftcrCurrentRoute];

  // set first route coordinate as map center
  [_activeMapView setGeoCenter:[route.geometry firstObject]];

  // show indicator on the map
  _activeMapView.positionIndicator.visible = YES;

  NMAFTCRNavigationManager *ftcrNavigationManager = [NMAFTCRNavigationManager sharedNavigationManager];
  ftcrNavigationManager.map = _activeMapView;
  ftcrNavigationManager.mapTrackingMode = NMAFTCRTrackingModeFollow;
  ftcrNavigationManager.mapTrackingTilt = NMAFTCRTrackingTilt3D;
  [ftcrNavigationManager addListener:self];

  // also supports simulation and navigation using PositionSimulator
  [ftcrNavigationManager startWithRoute:route];
}

- (void)navigationManager:(nonnull NMAFTCRNavigationManager *)navigationManager
    didRerouteWithRoute:(nullable NMAFTCRRoute *)reroute
          error:(NSError* _Nullable)error
{
  // We must remove old route from the map and add new one, SDK does not do that
  // automatically
  if (!error && reroute) {
    [_activeMapView removeMapObject:_ftcrCurrentRoute];
    _ftcrCurrentRoute = [[NMAMapFTCRRoute alloc] initWithRoute:reroute];
    [_activeMapView addMapObject:_ftcrCurrentRoute];
  }
}

- (void)navigationManager:(nonnull NMAFTCRNavigationManager *)navigationManager
     hasCurrentManeuver:(nullable NMAFTCRManeuver *)maneuver
       nextManeuver:(nullable NMAFTCRManeuver *)nextManeuver
{ }


- (void)navigationManagerDidReachDestination:(nonnull NMAFTCRNavigationManager *)navigationManager
{ }

- (void)navigationManager:(nonnull NMAFTCRNavigationManager *)navigationManager
     didReachStopover:(NSInteger)stopoverIndex
{ }


- (void)navigationManagerWillReroute:(nonnull NMAFTCRNavigationManager *)navigationManager
{ }

- (void)navigationManager:(nonnull NMAFTCRNavigationManager*)navigationManager
 didUpdateLaneInformation:(nonnull NSArray<NMAFTCRLaneInformation *> *)laneInformationList
{ }