Skip to content

m-gis核心库 v0.4.4


m-gis核心库 / Rectangle

类: Rectangle ​

定义于: overlay/entity/Rectangle.ts:40

用于三维中绘制矩形要素

// 添加图层 const layer = new EntityLayer().addToViewer(this.$viewer); const rectangle = new Rectangle([ new Position(118.78530347, 31.91314423, 1.02735847), new Position(118.78701917, 31.91406876, -0.00150279) ]).addToLayer(layer); rectangle.setStyle({ material: Color.fromCssColor("rgba(241,12,12,0.5)"), outline: true, extrudedHeight: 30 }); // 注册 rectangle 鼠标移入事件 rectangle.on(MouseEventType.CLICK, evt => { console.log(evt); });

继承 ​

构造函数 ​

构造函数 ​

new Rectangle(positions, options?): Rectangle

定义于: overlay/entity/Rectangle.ts:44

参数 ​

positions ​

Position[]

矩形的两个对角点,左下右上, 格式 [new Position(xMin,yMin,...),new Position(xMax,yMax,...)]

options? ​

OPT = DEF_OPT

返回 ​

Rectangle

重写了 ​

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


_id ​

_id: string | number

定义于: overlay/Overlay.ts:16

继承自 ​

Overlay._id


_layer ​

_layer: any

定义于: overlay/Overlay.ts:22

继承自 ​

Overlay._layer


_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


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


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


overlayEvent ​

Getter 签名 ​

get overlayEvent(): OverlayEvent

定义于: overlay/Overlay.ts:115

覆盖物的事件对象

返回 ​

OverlayEvent

继承自 ​

Overlay.overlayEvent


overlayId ​

Getter 签名 ​

get overlayId(): string | number

定义于: overlay/Overlay.ts:61

覆盖物唯一标识

返回 ​

string | number

继承自 ​

Overlay.overlayId


positions ​

Getter 签名 ​

get positions(): any

定义于: overlay/entity/Rectangle.ts:63

返回 ​

any

Setter 签名 ​

set positions(positions): void

定义于: overlay/entity/Rectangle.ts:56

参数 ​
positions ​

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

方法 ​

addCustomData() ​

addCustomData(key, value): void

定义于: overlay/Overlay.ts:267

参数 ​

key ​

any

value ​

any

返回 ​

void

继承自 ​

Overlay.addCustomData


addToLayer() ​

addToLayer(layer): Rectangle

定义于: overlay/Overlay.ts:260

添加到指定图层

参数 ​

layer ​

any

指定图层

返回 ​

Rectangle

继承自 ​

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): Rectangle

定义于: overlay/Overlay.ts:339

触发事件

参数 ​

type ​

string | number

params ​

any

返回 ​

Rectangle

继承自 ​

Overlay.fire


getCustomData() ​

getCustomData(key): any

定义于: overlay/Overlay.ts:271

参数 ​

key ​

any

返回 ​

any

继承自 ​

Overlay.getCustomData


off() ​

off(type, callback, context?): Rectangle

定义于: overlay/Overlay.ts:324

注销事件

参数 ​

type ​

string | number

事件类型

callback ​

any

监听回调

context? ​

any

返回 ​

Rectangle

继承自 ​

Overlay.off


on() ​

on(type, callback, context?): Rectangle

定义于: overlay/Overlay.ts:304

注册事件

参数 ​

type ​

string | number

事件类型

callback ​

any

监听回调

context? ​

any

返回 ​

Rectangle

继承自 ​

Overlay.on


relate() ​

relate(overlay): void

定义于: overlay/Overlay.ts:279

参数 ​

overlay ​

Overlay

返回 ​

void

继承自 ​

Overlay.relate


remove() ​

remove(): Rectangle

定义于: overlay/Overlay.ts:243

从图层上移出

返回 ​

Rectangle

继承自 ​

Overlay.remove


setLabel() ​

setLabel(): Rectangle

定义于: overlay/entity/Rectangle.ts:79

返回 ​

Rectangle

重写了 ​

Overlay.setLabel


setStyle() ​

setStyle(style): Rectangle

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

设置矩形要素的样式

参数 ​

style ​

OPT

样式可选属性

// 样式参数(可选) { "height": 1, //高度 "heightReference": 0, //高度参照,0:位置无参照,位置是绝对的,1:位置固定在地形上 2:位置高度是指地形上方的高度。 "extrudedHeight": 0, //拉升高度 "rotation": 0, //顺时针旋转角度 "stRotation": 0, //纹理旋转角度 "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 //最远距离 }, //根据距离设置可见 "classificationType": 2, //分类 是否影响地形,3D切片或同时影响这两者。0:地形、1:3D切片、2:两者 "zIndex": 0 //层级 }

返回 ​

Rectangle


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 地理三维库