import Entity from "./Entity"; import Scene from "./Scene"; import Primitive from "./Primitive"; import Texture from "./Texture"; import { Vector2, Vector3 } from "./GeoMath"; import GeoPoint from "./GeoPoint"; import RenderStage from "./RenderStage"; import AltitudeMode from "./AltitudeMode"; import EntityRegion from "./EntityRegion"; import { URLTemplateIconLoader, TextIconLoader, IconLoaderItem } from "./IconLoader"; import BindingBlock from "./animation/BindingBlock"; import AbstractPointEntity from "./AbstractPointEntity"; /** * ピンエンティティ * * @example * ```ts * var pin = new mapray.PinEntity(viewer.scene); * * * // Normal Pin * pin.addPin( new mapray.GeoPoint(139.766, 35.6361) ); * * * // Text Pin * pin.addTextPin( "32", new mapray.GeoPoint(139.768, 35.635) ); * * pin.addTextPin( "A", new mapray.GeoPoint(139.768, 35.636), * { fg_color: [0.0, 0.0, 1.0], bg_color: [1.0, 0.0, 0.0] } ); * * pin.addTextPin( "S", new mapray.GeoPoint(139.768, 35.637), * { size: 50 } ); * * pin.addTextPin( "E", new mapray.GeoPoint(139.768, 35.639), * { size: 50, font_family: "Georgia" } ); * * * // Maki Icon Pin * pin.addMakiIconPin( "ferry-15", new mapray.GeoPoint(139.764, 35.6361), * { size: 150, fg_color: [0.2, 0.2, 0.2], bg_color: [1.0, 1.0, 1.0] } ); * * pin.addMakiIconPin( "car-15", new mapray.GeoPoint(139.762, 35.6361), * { size: 60, fg_color: [1.0, 1.0, 1.0], bg_color: [0.2, 0.2, 0.2] } ); * * pin.addMakiIconPin( "bus-15", new mapray.GeoPoint(139.760, 35.6361), * { size: 40, fg_color: [1.0, 0.3, 0.1], bg_color: [0.1, 0.3, 1.0] } ); * * pin.addMakiIconPin( "bus-15", new mapray.GeoPoint(139.759, 35.6361) ); * * * viewer.scene.addEntity(pin); * ``` */ declare class PinEntity extends AbstractPointEntity { private _primitive_producer; private _parent_props; /** * @param scene 所属可能シーン * @param opts オプション集合 */ constructor(scene: Scene, opts?: PinEntity.Option); /** * @override */ getPrimitiveProducer(): PinEntity.PrimitiveProducer; /** * @override */ protected onChangeAltitudeMode(prev_mode: AltitudeMode): void; /** * EasyBindingBlock.DescendantUnbinder 処理 */ private _unbindDescendantAnimations; /** * アニメーションの BindingBlock を初期化 */ private _setupAnimationBindingBlock; /** * アイコンのピクセルサイズを指定 * @param size アイコンのピクセルサイズ */ setSize(size: Vector2): void; /** * アイコンの色を設定 * @param color アイコンの色 */ setFGColor(color: Vector3): void; /** * アイコン背景の色を設定 * @param color アイコン背景の色 */ setBGColor(color: Vector3): void; /** * テキストアイコンのフォントを設定 * @param font_family フォントファミリー */ setFontFamily(font_family: string): void; /** * Add Pin * @param position 位置 * @param props プロパティ * @return 追加したEntry */ addPin(position: GeoPoint, props?: PinEntity.AbstractPinEntryOption): PinEntity.TextPinEntry; /** * Add Maki Icon Pin * @param id ID of Maki Icon * @param position 位置 * @param props プロパティ * @return 追加したEntry */ addMakiIconPin(id: string, position: GeoPoint, props?: PinEntity.MakiIconPinEntryOption): PinEntity.MakiIconPinEntry; /** * Add Text Pin * @param text ピンに表示されるテキスト * @param position 位置 * @param props プロパティ * @return 追加したEntry */ addTextPin(text: string, position: GeoPoint, props?: PinEntity.TextPinEntryOption): PinEntity.TextPinEntry; /** * 専用マテリアルを取得 */ private _getMaterial; /** * プロパティを設定 */ private _setValueProperty; /** * Vector3プロパティを設定 */ private _setVector3Property; /** * Vector2プロパティを設定 */ private _setVector2Property; /** * @param json Json */ private _setupByJson; /** * IDでEntryを取得 * @param id ID * @return IDが一致するEntry(なければ `undefined` を返す)。 */ getEntry(id: string): PinEntity.TextPinEntry | PinEntity.MakiIconPinEntry | undefined; static readonly SAFETY_PIXEL_MARGIN = 1; static MAX_IMAGE_WIDTH: number; static CIRCLE_SEP_LENGTH: number; static DEFAULT_SIZE: Vector2; static DEFAULT_FONT_FAMILY: string; static DEFAULT_FG_COLOR: Vector3; static DEFAULT_BG_COLOR: Vector3; } declare namespace PinEntity { /** オプション */ interface Option extends Entity.Option { /** 生成情報 */ json: Json; } interface PinEntryJson { type: string; position: [x: number, y: number, z: number]; } interface Json extends Entity.Json { entries: (PinEntryJson & ParentPinEntryOption)[]; size?: Vector2; fg_color?: Vector3; bg_color?: Vector3; font_family?: string; } interface AbstractPinEntryOption { /** アイコンサイズ */ size?: number | Vector2; /** アイコン色 */ fg_color?: Vector3; /** アイコン背景色 */ bg_color?: Vector3; /** Entryを識別するID */ id?: string; } interface MakiIconPinEntryOption extends AbstractPinEntryOption { /** Maki Icon ID */ maki_id?: string; } interface TextPinEntryOption extends AbstractPinEntryOption { /** 表示文字列 */ text?: string; /** フォントファミリー */ font_family?: string; } type ParentPinEntryOption = MakiIconPinEntryOption & TextPinEntryOption; /** * @summary PrimitiveProducer * * TODO: relative で標高の変化のたびにテクスチャを生成する必要はないので * Layout でのテクスチャの生成とメッシュの生成を分離する * * @private */ class PrimitiveProducer extends Entity.PrimitiveProducer { private _glenv; private _dirty; private _transform; /** プリミティブの要素 */ private _properties; private _primitive; private _pickPrimitive; /** プリミティブ配列 */ private _primitives; /** プリミティブ配列 */ private _pickPrimitives; /** * @param entity */ constructor(entity: PinEntity); /** * @override */ createRegions(): EntityRegion[]; /** * @override */ onChangeElevation(regions: EntityRegion[]): void; /** * @override */ getPrimitives(stage: RenderStage): Primitive[]; /** * @summary 親プロパティが変更されたことを通知 */ onChangeParentProperty(): void; /** * @summary 子プロパティが変更されたことを通知 */ onChangeChildProperty(): void; /** * @summary 高度モードが変更されたことを通知 */ onChangeAltitudeMode(): void; /** * @summary エントリが追加されたことを通知 */ onAddEntry(): void; /** * @summary プリミティブの更新 * * @desc * 入力: * this.entity._entries * this._dirty * 出力: * this._transform * this._properties.image * this._primitive.mesh * this._primitives * this._dirty * * @return {array.} this._primitives * * @private */ _updatePrimitive(stage: RenderStage): void; /** * プリミティブの更新 * * @desc * 条件: * this.entity._entries.length > 0 * 入力: * this.entity._entries.length * 出力: * this._transform * * @param gocs_array GOCS 平坦化配列 */ private _updateTransform; /** * GOCS 平坦化配列を取得 * * 入力: this.entity._entries * * @return GOCS 平坦化配列 */ private _createFlatGocsArray; /** * @summary GeoPoint 平坦化配列を取得 (絶対高度) * * 入力: this.entity._entries * * @return {number[]} GeoPoint 平坦化配列 * @private */ _getFlatGeoPoints_with_Absolute(): Float64Array; } /** * @summary ピン要素 * @hideconstructor * @memberof mapray.PinEntity * @public * @abstract */ class AbstractPinEntry extends AbstractPointEntity.Entry { protected _owner: PinEntity; private _position; private _animation; protected _props: T; protected _icon?: IconLoaderItem; constructor(owner: PinEntity, position: GeoPoint, props: AbstractPinEntryOption); _loadIcon(): void; /** * 位置 */ get position(): GeoPoint; /** * ID */ get id(): string; /** * アイコンサイズ (Pixels) */ get size(): Vector2; /** * アイコン色 */ get fg_color(): Vector3; /** * アイコン背景色 */ get bg_color(): Vector3; /** */ get animation(): BindingBlock; /** * アニメーションの BindingBlock を初期化 */ private _setupAnimationBindingBlock; /** * モデル原点位置を設定 * * @param position モデル原点の位置 */ setPosition(position: GeoPoint): void; /** * アイコンのピクセルサイズを指定 * @param size アイコンのピクセルサイズ */ setSize(size: Vector2): void; /** * アイコンの色を設定 * @param アイコンの色 */ setFGColor(color: Vector3): void; /** * アイコン背景の色を設定 * @param color アイコン背景の色 */ setBGColor(color: Vector3): void; /** * Vector3fプロパティのコピー */ private _copyPropertyVector3f; /** * Vector2fプロパティのコピー */ private _copyPropertyVector2f; /** * Vector3プロパティの設定 */ private _setVector3Property; /** * Vector2プロパティの設定 */ private _setVector2Property; isLoaded(): boolean | undefined; get icon(): IconLoaderItem | undefined; draw(context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number): void; } /** * @summary MakiIcon要素 * @hideconstructor * @memberof mapray.PinEntity * @extends mapray.PinEntity.AbstractPinEntry * @public */ class MakiIconPinEntry extends AbstractPinEntry { private _maki_id?; /** * @param owner 所有者 * @param id MakiアイコンのID * @param position 位置 * @param props プロパティ */ constructor(owner: PinEntity, id: string, position: GeoPoint, props?: PinEntity.MakiIconPinEntryOption); /** * アニメーションの BindingBlock を初期化 */ private _setupMakiIconPinAnimationBindingBlock; /** * アイコンのIDを設定 * @param maki_id アイコンのID */ setId(maki_id: string): void; static makiIconLoader: URLTemplateIconLoader; } /** * @summary MakiIcon要素 * @hideconstructor * @memberof mapray.PinEntity * @extends mapray.PinEntity.AbstractPinEntry * @public */ class TextPinEntry extends AbstractPinEntry { private _text; /** * @param owner 所有者 * @param text テキスト * @param position 位置 * @param props プロパティ */ constructor(owner: PinEntity, text: string, position: GeoPoint, props?: PinEntity.TextPinEntryOption); /** * @summary フォントファミリー * @type {string} * @readonly * @package */ get font_family(): string; /** * アニメーションの BindingBlock を初期化 */ private _setupTextPinAnimationBindingBlock; /** * テキストを設定 * @param text テキスト */ setText(text: string): void; /** * アイコンを生成します */ private _renderIcon; static textIconLoader: TextIconLoader; } /** * @summary 要素を Canvas 上にレイアウト * * @memberof mapray.PinEntity * @private */ class Layout { private _owner; private _is_valid; private _vertices; private _items; private _indices; private _texture?; private _texture_mask?; /** * @desc * 入力: * owner._glenv * owner.entity._entries * owner._transform * * @param {PrimitiveProducer} owner 所有者 * @param {number[]} gocs_array GOCS 平坦化配列 */ constructor(owner: PrimitiveProducer, gocs_array: Float64Array); /** * 有効なオブジェクトか? * * 無効のとき、他のメソッドは呼び出せない。 * @return 有効のとき true, 無効のとき false */ isValid(): boolean; /** * テクスチャ */ get texture(): Texture | undefined; /** * テクスチャマスク */ get texture_mask(): Texture | undefined; /** * 頂点配列 * * 条件: * this._entries.length > 0 * 入力: * this._entries * this._transform */ get vertices(): number[]; /** * インデックス配列 */ get indices(): number[]; /** * @summary レイアウトアイテムのリストを生成 * @return {array.} * @private */ _createItemList(): any[]; /** * @summary RowLayout のリストを生成 * @return {array.} * @private */ _createRowLayouts(): RowLayout[]; /** * テクスチャを生成 * @param width 横幅 * @param height 高さ * @return テキストテクスチャ */ private _createTexture; private _createTextureMask; /** * 頂点配列を生成 * * @param width 横幅 * @param height 高さ * @param gocs_array GOCS 平坦化配列 * @return 頂点配列 [左下0, 右下0, 左上0, 右上0, ...] */ private _createVertices; /** * インデックス配列を生成 * @return インデックス配列 [] */ private _createIndices; /** * @summary アイテムの配置を設定 * @param {array.} row_layouts * @return {object} キャンバスサイズ * @private */ _setupLocation(row_layouts: RowLayout[]): { width: number; height: number; }; } /** * @summary レイアウト対象 * @memberof mapray.PinEntity * @private */ class LItem { entries: { index: number; entry: AbstractPinEntry; }[]; private _pos_x; private _pos_y; private _height; private _width; private _is_canceled; /** * @param {mapray.PinEntity.Layout} layout 所有者 * @param {mapray.PinEntity.Entry} entry PinEntityのエントリ */ constructor(layout: Layout); add(index: number, entry: AbstractPinEntry): void; /** * @type {number} * @readonly */ get pos_x(): number; /** * @type {number} * @readonly */ get pos_y(): number; /** * @type {number} * @readonly */ get width(): number; get height(): number; /** * キャンバス上でのテキストの横画素数 * @type {number} * @readonly */ get width_pixel(): number; /** * キャンバス上でのテキストの縦画素数 * @type {number} * @readonly */ get height_pixel(): number; /** * 取り消し状態か? * @type {boolean} * @readonly */ get is_canceled(): boolean; /** * @summary 取り消し状態に移行 */ cancel(): void; /** * 配置を決定 * @param x テキスト矩形左辺の X 座標 (キャンバス座標系) * @param y テキスト矩形上辺の Y 座標 (キャンバス座標系) */ locate(x: number, y: number): void; draw(context: CanvasRenderingContext2D): void; } /** * @summary 水平レイアウト * @memberof mapray.PinEntity * @private */ class RowLayout { private _items; private _width_assumed; private _height_pixel; /** * @desc *

レイアウトされた、またはレイアウトに失敗したアイテムは src_items から削除される。

*

レイアウトに失敗したアイテムは取り消し (is_canceled) になる。

* @param {array.} src_items アイテムリスト */ constructor(src_items: LItem[]); /** * @summary 有効なオブジェクトか? * @desc *

無効のとき、他のメソッドは呼び出せない。

* @return {boolean} 有効のとき true, 無効のとき false */ isValid(): boolean; /** * * @type {array.} * @readonly */ get items(): LItem[]; /** * キャンバス上での行の横占有画素数 * @type {number} * @readonly */ get width_assumed(): number; /** * キャンバス上での行の縦画素数 * @type {number} * @readonly */ get height_pixel(): number; /** * レイアウトの配置を決定 * @param y テキスト矩形上辺の Y 座標 (キャンバス座標系) */ locate(y: number): void; } } export default PinEntity; //# sourceMappingURL=PinEntity.d.ts.map