Class: Viewer

mapray~ Viewer

mapray の表示を管理するクラスである。


new Viewer(container [, options])

表示管理

Parameters:
Name Type Argument Description
container string | Element

コンテナ (ID または要素)

options object <optional>

生成オプション

Properties
Name Type Argument Default Description
dem_provider mapray.DemProvider <optional>

DEM プロバイダ

image_provider mapray.ImageProvider <optional>

画像プロバイダ

layers array <optional>

地図レイヤー情報の配列

ground_visibility boolean <optional>
true

地表の可視性

entity_visibility boolean <optional>
true

エンティティの可視性

render_callback mapray.RenderCallback <optional>

レンダリングコールバック

render_mode mapray.Viewer.RenderMode <optional>

レンダリングモード

debug_stats mapray.DebugStats <optional>

デバッグ統計オブジェクト

logo_controller mapray.LogoController <optional>

ロゴ表示制御オブジェクト

attribution_controller mapray.AttributionController <optional>

著作権表示制御オブジェクト

Source:

Members


<static, constant> Category :object

表示対象の列挙型

mapray.Viewer#setVisibilitymapray.Viewer#getVisibility メソッドの target 引数に指定する値の型である。

Type:
  • object
Properties:
Name Type Default Description
GROUND object {"id":"GROUND"}

地表 (レイヤーも含む)

ENTITY object {"id":"ENTITY"}

エンティティ

Source:

<static, constant> RenderMode :object

レンダリングモードの列挙型

mapray.Viewer の構築子の options.render_mode パラメータ、または mapray.Viewer#render_mode プロパティに指定する値の型である。

Type:
  • object
Properties:
Name Type Default Description
SURFACE object {"id":"SURFACE"}

ポリゴン面 (既定値)

WIREFRAME object {"id":"WIREFRAME"}

ワイヤーフレーム

Source:

<readonly> animation :mapray.animation.BindingBlock

アニメーションパラメータ設定

Type:
Source:

<readonly> camera :mapray.Camera

カメラ

Type:
Source:

<readonly> canvas_element :Element

キャンバス要素

Type:
  • Element
Source:

<readonly> container_element :Element

コンテナ要素 (キャンバス要素を保有する)

Type:
  • Element
Source:

<readonly, nullable> debug_stats :mapray.DebugStats

デバッグ統計オブジェクト

Type:
Source:

<readonly> dem_provider :mapray.DemProvider

DEM データプロバイダ

Type:
Source:

<readonly> image_provider :mapray.ImageProvider

画像プロバイダ

Type:
Source:

<readonly> layers :mapray.LayerCollection

地図レイヤー管理

Type:
Source:

<readonly> point_cloud_collection :mapray.PointCloudCollection

点群管理

Type:
Source:

<readonly> render_callback :mapray.RenderCallback

レンダリングコールバック

Type:
Source:

<readonly> render_mode :mapray.RenderMode

レンダリングモード

Type:
  • mapray.RenderMode
Source:

render_mode :mapray.RenderMode

レンダリングモードを設定

Type:
  • mapray.RenderMode
Source:

<readonly> scene :mapray.Scene

モデルシーン

Type:
Source:

Methods


destroy()

インスタンスを破棄

次の順番で処理を行い、インスタンスを破棄する。

  1. アニメーションフレームを止める。(this.render_callbackonUpdateFrame() が呼び出されなくなる)
  2. this.render_callbackonStop() を呼び出す。(onStart() がすでに呼び出されている場合)
  3. mapray.RenderCallback インスタンスを this から切り離す。(mapray.RenderCallback#viewer プロパティは null を返すようになる)
  4. this.canvas_element を this.container_element から取り外す。(キャンバスは表示されなくなる)
  5. データプロバイダのリクエスト、シーンデータのロードの取り消しを試みる。

このメソッドを呼び出した後は this に直接的または間接的にアクセスすることはできない。ただし destroy() の呼び出しは除く。

このメソッドは mapray.RenderCallback のメソッドから呼び出してはならない。

Source:

getElevation(lat, lon)

指定位置の標高を取得

緯度 lat, 経度 lon が示す場所の標高を返す。

現在メモリに存在する DEM データの中で最も正確度が高いデータから標高を計算する。

さらに正確度が高い DEM データがサーバーに存在すれば、それを非同期に読み込む。そのため時間を置いてこのメソッドを呼び出すと、さらに正確な値が取得できることがある。

Parameters:
Name Type Description
lat number

緯度 (Degrees)

lon number

経度 (Degrees)

Source:
Returns:

標高 (Meters)

Type
number

getExistingElevation(position)

現行の標高を取得

現在メモリーにある最高精度の標高値を取得する。

まだ DEM データが存在しない、または経度, 緯度が範囲外の場所は標高を 0 とする。

このメソッドは DEM のリクエストは発生しない。また DEM のキャッシュには影響を与えない。

一般的に画面に表示されていない場所は標高の精度が低い。

Parameters:
Name Type Description
position mapray.GeoPoint

位置 (高度は無視される)

Source:
See:
Returns:

標高

Type
number

getExistingElevations(num_points, src_array, src_offset, src_stride, dst_array, dst_offset, dst_stride)

現行の標高 (複数) を取得

現在メモリーにある最高精度の標高値を一括で取得する。

まだ DEM データが存在しない、または経度, 緯度が範囲外の場所は標高を 0 とする。

このメソッドは DEM のリクエストは発生しない。また DEM のキャッシュには影響を与えない。

一般的に画面に表示されていない場所は標高の精度が低い。

Parameters:
Name Type Description
num_points number

入出力データ数

src_array Array.<number>

入力配列 (経度, 緯度, ...)

src_offset number

入力データの先頭インデックス

src_stride number

入力データのストライド

dst_array Array.<number>

出力配列 (標高, ...)

dst_offset number

出力データの先頭インデックス

dst_stride number

出力データのストライド

Source:
See:
Returns:

dst_array

Type
Array.<number>

getRayIntersection(ray)

レイと地表の交点を取得

ray と地表の最も近い交点を取得する。ただし交点が存在しない場合は null を返す。

Parameters:
Name Type Description
ray mapray.Ray

レイ (GOCS)

Source:
Returns:

交点または null

Type
mapray.Vector3

getVisibility(target)

可視性を取得

target に属するオブジェクトを表示するかどうかを取得する。

Parameters:
Name Type Description
target mapray.Viewer.Category

表示対象

Source:
See:
Returns:

表示するとき true, 表示しないとき false

Type
boolean

pick(screen_position)

現在のビューにおいて指定されたスクリーン位置の情報を取得します

Parameters:
Name Type Description
screen_position Vector2

スクリーン位置(キャンバス左上を原点としたピクセル座標)

Source:
Returns:

ピック結果

Type
mapray.Viewer.PickResult

setVisibility(target, visibility)

可視性を設定

target に属するオブジェクトを表示するかどうかを指定する。

可視性は Viewer の構築子の ground_visibility と entity_visibility オプションでも指定することができる。

Parameters:
Name Type Description
target mapray.Viewer.Category

表示対象

visibility boolean

表示するとき true, 表示しないとき false

Source:
See:

Type Definitions


PickResult

ピック結果

関数型 mapray.Viewer.pick の戻り値のオブジェクト構造である。

Type:
  • object
Properties:
Name Type Argument Description
point mapray.Vector3 <optional>

ピックした3次元位置

entity|undefined mapray.Entity <optional>

ピックしたエンティティ(ピック位置にエンティティがない場合はundefined)

Source: