Skip to content

m-gis核心库 v0.4.4


m-gis核心库 / Polyline

类: Polyline ​

定义于: overlay/entity/Polyline.ts:54

用于三维中绘制线要素

// 添加图层 const layer = new EntityLayer().addToViewer(this.$viewer); const polyline = new Polyline([ new Position(118.78653636, 31.91315607, -0.14395184), new Position(118.78717476, 31.91365014, 0.9309363), new Position(118.78773082, 31.91401772, 0.65392468), new Position(118.78792258, 31.91435828, 4.09293584) ]).addToLayer(layer); polyline.setStyle({ material: Color.fromCssColorString("rgba(241,12,12,0.5)"), clampToGround: true, width: 10 }); // 注册 polyline 鼠标移入事件 polyline.on(MouseEventType.CLICK, evt => { console.log(evt); });

继承 ​

构造函数 ​

构造函数 ​

new Polyline(positions?, options?): Polyline

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

参数 ​

positions? ​

Position[] = []

线要素坐标串

options? ​

OPT = DEF_OPT

返回 ​

Polyline

重写了 ​

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/entity/Polyline.ts:84

返回 ​

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


distance ​

Getter 签名 ​

get distance(): number

定义于: overlay/entity/Polyline.ts:88

返回 ​

number


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/Polyline.ts:80

返回 ​

any

Setter 签名 ​

set positions(positions): void

定义于: overlay/entity/Polyline.ts:73

参数 ​
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): Polyline

定义于: overlay/Overlay.ts:260

添加到指定图层

参数 ​

layer ​

any

指定图层

返回 ​

Polyline

继承自 ​

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

定义于: overlay/Overlay.ts:339

触发事件

参数 ​

type ​

string | number

params ​

any

返回 ​

Polyline

继承自 ​

Overlay.fire


getCustomData() ​

getCustomData(key): any

定义于: overlay/Overlay.ts:271

参数 ​

key ​

any

返回 ​

any

继承自 ​

Overlay.getCustomData


off() ​

off(type, callback, context?): Polyline

定义于: overlay/Overlay.ts:324

注销事件

参数 ​

type ​

string | number

事件类型

callback ​

any

监听回调

context? ​

any

返回 ​

Polyline

继承自 ​

Overlay.off


on() ​

on(type, callback, context?): Polyline

定义于: overlay/Overlay.ts:304

注册事件

参数 ​

type ​

string | number

事件类型

callback ​

any

监听回调

context? ​

any

返回 ​

Polyline

继承自 ​

Overlay.on


relate() ​

relate(overlay): void

定义于: overlay/Overlay.ts:279

参数 ​

overlay ​

Overlay

返回 ​

void

继承自 ​

Overlay.relate


remove() ​

remove(): Polyline

定义于: overlay/Overlay.ts:243

从图层上移出

返回 ​

Polyline

继承自 ​

Overlay.remove


setLabel() ​

setLabel(text, textStyle): Polyline

定义于: overlay/entity/Polyline.ts:142

设置文字标签

参数 ​

text ​

string

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

textStyle ​

any

text 样式

返回 ​

Polyline

重写了 ​

Overlay.setLabel


setMode() ​

setMode(mode): void

定义于: overlay/entity/Polyline.ts:95

初始化一些预设样式

参数 ​

mode ​

number

返回 ​

void


setStyle() ​

setStyle(style): Polyline

定义于: overlay/entity/Polyline.ts:172

设置 Polyline 的样式

参数 ​

style ​

any

样式可选属性

// 样式参数(可选) { "width": 1, //线宽 "material": Color.WHITE, //材质 "arcType": 1, // 线条类型。NONE: 0, GEODESIC: 1, RHUMB: 2 "clampToGround": false, //是否贴地 "shadows": 0, //阴影类型,0:禁用、1:启用 、2:投射、3:接受 "distanceDisplayCondition": { "near": 0, //最近距离 "far": Number.MAX_VALUE //最远距离 }, //根据距离设置可见 "classificationType": 2, //分类 是否影响地形,3D切片或同时影响这两者。0:地形、1:3D切片、2:两者 "zIndex": 0 //层级 }

返回 ​

Polyline


unRelate() ​

unRelate(overlay): void

定义于: overlay/Overlay.ts:283

参数 ​

overlay ​

Overlay

返回 ​

void

继承自 ​

Overlay.unRelate


fromEntity() ​

static fromEntity(entity): Polyline | undefined

定义于: overlay/entity/Polyline.ts:188

从 entity 中解析出 Polyline

参数 ​

entity ​

Entity

返回 ​

Polyline | undefined


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