Wikitude SDK APIリファレンス

バージョン: 8.1.0
表示:

ActionRangeクラス

継承元: ActionArea
モジュール: AR

ActionRangeは、特定のロケーションを中心とする円を定義します。ユーザーがこの円に入るか円から出ると、イベントが発生します。

例:
var location1 = new AR.GeoLocation(47.77317, 13.069929);
var actionRange = new AR.ActionRange(location1, 500);
var location2 = new AR.GeoLocation(48.77317, 13.069929);
var inArea1 = actionRange.isInArea(location1); //inArea1 = true
var inArea2 = actionRange.isInArea(location2); //inArea2 = false

インスタンス生成時にパラメーターを渡して、ActionRangeのプロパティをカスタマイズできます。

var actionRange2 = new AR.ActionRange(location1, 500, {
    onEnter : function() {
        actionRange2.enabled = false; //an ActionArea which can only be entered once
    }
});

コンストラクター

ActionRange

(
  • location
  • radius
  • options
)

パラメーター:

  • location Location

    円の中心を定義する単一のLocation。

  • radius Number

    ActionRangeの半径(m単位)。

  • options Object オプション

    追加のオブジェクトプロパティをカスタマイズするためのパラメーター。

    設定可能なプロパティは以下のとおりです。

    • enabled(デフォルト値: trueBoolean オプション
    • onEnter Boolean オプション
    • onExit Boolean オプション

項目索引

メソッド

プロパティ

イベント

メソッド

destroy

()

継承元: ARchitectObject

オブジェクトを破棄します。

isInArea

(
  • geoLocation
)
Boolean

継承元: ActionArea

特定のロケーションがこのActionArea内にあるかどうかをチェックします。

パラメーター:

  • geoLocation GeoLocation

    チェックするGeoLocation。

戻り値:

Boolean:

メソッドに渡されたgeoLocationがこのActionArea内にある場合はtrue。このActionArea内にない場合はfalse。

プロパティ

destroyed

Boolean

継承元: ARchitectObject

オブジェクトがすでに破棄されているかどうかを示します。

enabled

Boolean

継承元: ActionArea

ActionAreaを有効または無効にするフラグ。無効なActionAreaではトリガーは発生しません。有効な場合は状況に応じてトリガーが発生します。

location

Location

ActionRangeの中心を定義するLocationオブジェクト。

radius

Number

ActionRangeの半径(SDU単位)。

イベント

onEnter

継承元: ActionArea

このトリガーは、ユーザーがActionAreaに入ったときに実行されます。

このトリガーのデフォルト値はnullであり、トリガーが発生したときに何もアクションは実行されません。開発者はonEnterトリガーにカスタム関数を指定することで、カスタム機能を追加できます。

onExit

継承元: ActionArea

このトリガーは、ユーザーがActionAreaから出たときに実行されます。

このトリガーのデフォルト値はnullであり、トリガーが発生したときに何もアクションは実行されません。開発者はonExitトリガーにカスタム関数を指定することで、カスタム機能を追加できます。