間接費( Scala のみ)

ロケーション ライブラリには Implicits 、ロケーション ライブラリタイプのクラスの使用を簡素化するオブジェクトがあります。 たとえば、型クラスの操作を拡張メソッドとして公開します。

これを行う最も簡単な方法は、ソースファイルの一番上に次の行を追加することです。

Scala
import com.here.platform.location.core.geospatial.Implicits._

次の例では、結果の単純化を確認できます。

Scala
def processLineString[LS: LineStringOperations](lineString: LS) = {
  // Using the type class without the `Implicits` object
  val points = implicitly[LineStringOperations[LS]].points(lineString)

  import com.here.platform.location.core.geospatial.Implicits._

  // Using the type class with the `Implicits` object
  val points2 = lineString.points

  assert(points == points2)
}

ロケーション ライブラリでは、対応 Implicits するオブジェクトの内容をインポートすることで、ロケーション ライブラリタイプクラスでの HERE Map Content タイプの使用もサポートされています。

Scala
val point0 = com.here.schema.geometry.v2.geometry.Point(0, 0)
val point1 = com.here.schema.geometry.v2.geometry.Point(1, 1)

import com.here.platform.location.integration.heremapcontent.geospatial.Implicits._

val distance = GeoCoordinates.greatCircleDistanceMeters(point0, point1)

」に一致する結果は 件です

    」に一致する結果はありません