Cruising Area

この章ではCruising Areaの表示方法、制御方法について紹介します。

Cruising Areaとは

電力/燃料の消費量を推定し、推定した電力燃料消費率で到達可能なエリアを表示する機能です。

Cruising Area設定方法

大まかに以下の流れで設定します。

  1. EnergyInfoの各パラメータを設定します。
  2. EnergyInfo.ExtendCruisingAreaで表示したい燃料または電力消費率を設定します。
  3. CruisingAreaRequestEnergyInfoを設定し、Navi.getCruisingArea()を呼び出します。

日産リーフの後続可能領域を作成するサンプルは以下の通りです。

EnergyInfo energyInfo = new EnergyInfo();
energyInfo.setModel("ZAA-ZE1");
energyInfo.setEnergyType(EnergyInfo.EnergyType.ELECTRIC);

EnergyInfo.TypeElectric typeElectric = new EnergyInfo.TypeElectric();
typeElectric.setBattery(40F); // バッテリ容量[kWh]
energyInfo.setTypeElectric(typeElectric);

energyInfo.setEnergyInfoExtension(EnergyInfo.EnergyInfoExtension.CRUISINGAREA);
EnergyInfo.ExtendCruisingArea extendCruisingArea = new EnergyInfo.ExtendCruisingArea();
extendCruisingArea.setCruisingAreaRateList(new ArrayList<>(Arrays.asList(100, 50)));  // 電力消費率100%, 50%で到達可能な領域
energyInfo.setExtendCruisingArea(extendCruisingArea);

CruisingAreaRequest request = new CruisingAreaRequest();
request.setEnergyInfo(energyInfo);

Navi.getInstance().getCruisingArea(request, new CruisingAreaListener() {
	@Override
	public void onCompleted(ErrorCode errorCode, CruisingAreaResult result) {

		if (errorCode == ErrorCode.NONE) {
			// 地図全体が画面に収まるように拡大率を調整
			List<GeoCoordinate> pathPointList = new ArrayList<>();
			pathPointList.add(result.getRange().getLeftBottom());
			pathPointList.add(result.getRange().getRightTop());
			GeoBoundingBox geoBoundingBox = GeoBoundingBox.getBoundingBoxContainingGeoCoordinates(pathPointList);
			map.zoomTo(geoBoundingBox, 0, false);
		}
		else {
			// 失敗
		}
	}
});

Cruising Area

Note:

cruisingAreaRateに指定された値ごとに透過率が設定された領域が描画されます。
そのため、近くの領域は濃く、遠くの領域は薄くなります。

注意:
  • 交差点拡大図(InterSectionMap)には描画しません。
  • 時間規制は考慮されません。
  • フェリー航路は考慮されません。
  • 住宅地図では利用できません。

Cruising Areaの条件調整

CruisingAreaRequest.Optionsによって、

  • 探索基準
  • 有料道路利用有無
  • スマートIC利用有無

を切り替えられます。

距離優先
距離優先

CruisingAreaRequest request = new CruisingAreaRequest();
CruisingAreaRequest.Options options = new CruisingAreaRequest.Options();
options.setPriority(CruisingAreaRequest.Options.Priority.DISTANCE);
request.setOptions(options);

幹線優先
幹線優先

CruisingAreaRequest request = new CruisingAreaRequest();
CruisingAreaRequest.Options options = new CruisingAreaRequest.Options();
options.setPriority(CruisingAreaRequest.Options.Priority.MAIN_ROAD);
request.setOptions(options);

推奨・有料道なし
推奨・有料道なし・スマートICなし

CruisingAreaRequest request = new CruisingAreaRequest();
CruisingAreaRequest.Options options = new CruisingAreaRequest.Options();
options.setPriority(CruisingAreaRequest.Options.Priority.MAIN_ROAD);
options.setUseToll(false);
options.setUseSmartIC(false);
request.setOptions(options);

Cruising Areaのデザイン変更

CruisingAreaDesignを設定して表示方法をカスタマイズできます。

CruisingAreaDesign.Contour contour = new CruisingAreaDesign.Contour();
contour.setFillColor(Color.RED); // 塗りつぶし色
contour.setFillOpacity(0.2f); // 不透明率
contour.setOutLine(true); // 境界線描画有無
contour.setOutLineColor(Color.BLACK); // 境界線色
contour.setOutLineWidth(2.00F); // 境界線幅(pixel)

List<CruisingAreaDesign.Contour> contourList = new ArrayList<>();
contourList.add(contour);

CruisingAreaDesign design = new CruisingAreaDesign();
design.setContourList(contourList);
Navi.getInstance().setCruisingAreaDesign(design);

Cruising Area Design

Cruising Areaの表示制御について

全ての地図に対する制御

Cruising Areaを削除したい場合、Navi.eraseCruisingArea()を呼び出してください。

個別の地図に対する制御

Cruising Areaの表示、非表示を切り替えるには該当MapのMap.cruisingAreaVisibleをtrue(表示する)、またはfalse(非表示にする)に設定します。

個別の地図に対してデザインを変更したい場合、該当MapのMap.setCruisingAreaDesignを設定します。

個別の地図に対してCruising Areaを表示したい場合、該当MapのMap.setCruisingAreaを設定します。 引数にはNavi.getCruisingAreaResult()で取得したresultを渡してください。

個別の地図に対してCruising Areaを削除したい場合、該当MapのMap.eraseCruisingArea()を呼び出してください。