Skip to content

m-gis核心库 v0.4.4


m-gis核心库 / Box

类: Box

定义于: overlay/entity/Box.ts:58

用于三维中绘制盒要素

// 添加图层 const layer = new EntityLayer().addToViewer(this.$viewer); const box = new Box( new Position(118.78600228, 31.9135434, 1.66113721), { length: 10, width: 10, height: 10, } ).addToLayer(layer); box.setStyle({ material: Color.fromCssColorString("rgba(241,12,12,0.5)"), outline: true }); // 注册 box 鼠标移入事件 box.on(MouseEventType.CLICK, evt => { console.log(evt); });

继承

构造函数

构造函数

new Box(position, options): Box

定义于: overlay/entity/Box.ts:67

参数

position

Position

坐标

options

OPT

长度、宽度、高度等属性

返回

Box

重写了

Overlay.constructor

属性

_attr

_attr: any

定义于: overlay/Overlay.ts:26

继承自

Overlay._attr


_bid

_bid: any

定义于: overlay/Overlay.ts:17

继承自

Overlay._bid


_customData

_customData: any

定义于: overlay/Overlay.ts:29

继承自

Overlay._customData


_delegate

_delegate: any

定义于: overlay/Overlay.ts:21

继承自

Overlay._delegate


_dimensions

_dimensions: Cartesian3

定义于: overlay/entity/Box.ts:62


_height

_height: number

定义于: overlay/entity/Box.ts:61


_id

_id: string | number

定义于: overlay/Overlay.ts:16

继承自

Overlay._id


_layer

_layer: any

定义于: overlay/Overlay.ts:22

继承自

Overlay._layer


_length

_length: number

定义于: overlay/entity/Box.ts:59


_options

_options: any

定义于: overlay/Overlay.ts:18

继承自

Overlay._options


_overlayEvent

_overlayEvent: OverlayEvent

定义于: overlay/Overlay.ts:28

继承自

Overlay._overlayEvent


_position

_position: any

定义于: overlay/Overlay.ts:19

继承自

Overlay._position


_positions

_positions: any

定义于: overlay/Overlay.ts:20

继承自

Overlay._positions


_relaters

_relaters: any

定义于: overlay/Overlay.ts:30

继承自

Overlay._relaters


_show

_show: boolean

定义于: overlay/Overlay.ts:24

继承自

Overlay._show


_state

_state: any

定义于: overlay/Overlay.ts:23

继承自

Overlay._state


_style

_style: any

定义于: overlay/Overlay.ts:25

继承自

Overlay._style


_width

_width: number

定义于: overlay/entity/Box.ts:60


interactionEvents

interactionEvents: any[]

定义于: overlay/Overlay.ts:31

继承自

Overlay.interactionEvents


type

type: any

定义于: overlay/Overlay.ts:27

继承自

Overlay.type

访问器

attr

Getter 签名

get attr(): any

定义于: overlay/Overlay.ts:106

返回

any

Setter 签名

set attr(attr): void

定义于: overlay/Overlay.ts:102

覆盖物的额外属性设置

参数
attr

any

返回

void

继承自

Overlay.attr


center

Getter 签名

get center(): Position

定义于: overlay/Overlay.ts:137

返回

Position

继承自

Overlay.center


customData

Getter 签名

get customData(): any

定义于: overlay/Overlay.ts:141

返回

any

继承自

Overlay.customData


delegate

Getter 签名

get delegate(): any

定义于: overlay/Overlay.ts:124

覆盖物的代理对象

返回

any

继承自

Overlay.delegate


height

Getter 签名

get height(): number

定义于: overlay/entity/Box.ts:130

返回

number

Setter 签名

set height(height): void

定义于: overlay/entity/Box.ts:124

参数
height

number

返回

void


id

Getter 签名

get id(): any

定义于: overlay/Overlay.ts:78

返回

any

Setter 签名

set id(id): void

定义于: overlay/Overlay.ts:74

设置覆盖物的业务 id

参数
id

any

返回

void

继承自

Tileset.id


length

Getter 签名

get length(): number

定义于: overlay/entity/Box.ts:110

返回

number

Setter 签名

set length(length): void

定义于: overlay/entity/Box.ts:104

参数
length

number

返回

void


overlayEvent

Getter 签名

get overlayEvent(): OverlayEvent

定义于: overlay/Overlay.ts:115

覆盖物的事件对象

返回

OverlayEvent

继承自

Overlay.overlayEvent


overlayId

Getter 签名

get overlayId(): string | number

定义于: overlay/Overlay.ts:61

覆盖物唯一标识

返回

string | number

继承自

Wall.overlayId


position

Getter 签名

get position(): any

定义于: overlay/entity/Box.ts:100

返回

any

Setter 签名

set position(position): void

定义于: overlay/entity/Box.ts:87

参数
position

any

返回

void


relaters

Getter 签名

get relaters(): any[]

定义于: overlay/Overlay.ts:145

返回

any[]

继承自

Overlay.relaters


show

Getter 签名

get show(): boolean

定义于: overlay/Overlay.ts:94

返回

boolean

Setter 签名

set show(show): void

定义于: overlay/Overlay.ts:86

覆盖物的可见性

参数
show

boolean

返回

void

继承自

Overlay.show


state

Getter 签名

get state(): any

定义于: overlay/Overlay.ts:133

覆盖物的状态

返回

any

继承自

Overlay.state


viewer

Getter 签名

get viewer(): any

定义于: overlay/Overlay.ts:52

返回

any

继承自

Overlay.viewer


width

Getter 签名

get width(): number

定义于: overlay/entity/Box.ts:120

返回

number

Setter 签名

set width(width): void

定义于: overlay/entity/Box.ts:114

参数
width

number

返回

void

方法

addCustomData()

addCustomData(key, value): void

定义于: overlay/Overlay.ts:267

参数

key

any

value

any

返回

void

继承自

Overlay.addCustomData


addToLayer()

addToLayer(layer): Box

定义于: overlay/Overlay.ts:260

添加到指定图层

参数

layer

any

指定图层

返回

Box

继承自

Overlay.addToLayer


clearCustomData()

clearCustomData(): void

定义于: overlay/Overlay.ts:275

返回

void

继承自

Overlay.clearCustomData


clearRelate()

clearRelate(): void

定义于: overlay/Overlay.ts:288

返回

void

继承自

Overlay.clearRelate


eachRelaters()

eachRelaters(callback): void

定义于: overlay/Overlay.ts:292

参数

callback

any

返回

void

继承自

Overlay.eachRelaters


fire()

fire(type, params): Box

定义于: overlay/Overlay.ts:339

触发事件

参数

type

string | number

params

any

返回

Box

继承自

Overlay.fire


getCustomData()

getCustomData(key): any

定义于: overlay/Overlay.ts:271

参数

key

any

返回

any

继承自

Overlay.getCustomData


off()

off(type, callback, context?): Box

定义于: overlay/Overlay.ts:324

注销事件

参数

type

string | number

事件类型

callback

any

监听回调

context?

any

返回

Box

继承自

Overlay.off


on()

on(type, callback, context?): Box

定义于: overlay/Overlay.ts:304

注册事件

参数

type

string | number

事件类型

callback

any

监听回调

context?

any

返回

Box

继承自

Overlay.on


relate()

relate(overlay): void

定义于: overlay/Overlay.ts:279

参数

overlay

Overlay

返回

void

继承自

Overlay.relate


remove()

remove(): Box

定义于: overlay/Overlay.ts:243

从图层上移出

返回

Box

继承自

Overlay.remove


setLabel()

setLabel(text, textStyle): Box

定义于: overlay/Overlay.ts:229

设置文字标签

参数

text

string

指定文本的属性。支持显式换行符'\ n'。

textStyle

any

text 样式

返回

Box

继承自

Overlay.setLabel


setStyle()

setStyle(style): Box

定义于: overlay/entity/Box.ts:162

设置 Box 的样式

参数

style

any

样式可选属性

// 样式参数(可选) { "heightReference": 0, //高度参照,0:位置无参照,位置是绝对的,1:位置固定在地形上 2:位置高度是指地形上方的高度。 "fill": true, //是否用提供的材料填充多边形。 "material": Color.WHITE, //材质 "outline": false, //是否显示边框 "outlineColor": Color.BLACK, //边框颜色 "outlineWidth": 0, //边框宽度 "shadows": 0, //阴影类型,0:禁用、1:启用 、2:投射、3:接受 "distanceDisplayCondition": { "near": 0, //最近距离 "far": Number.MAX_VALUE //最远距离 } //根据距离设置可见 }

返回

Box


unRelate()

unRelate(overlay): void

定义于: overlay/Overlay.ts:283

参数

overlay

Overlay

返回

void

继承自

Overlay.unRelate


getOverlayType()

static getOverlayType(type): string | number | undefined

定义于: overlay/Overlay.ts:361

获取 Overlay 类型

参数

type

string

返回

string | number | undefined

继承自

Overlay.getOverlayType


registerType()

static registerType(type): void

定义于: overlay/Overlay.ts:349

Overlay 类型注册

参数

type

string

返回

void

继承自

Overlay.registerType

MGis 地理三维库