Skip to content

PolygonCollection 面集合类

判定

isPolygonCollection()

typescript
const isPolygonCollection: (tar: any) => tar is PolygonCollection

属性

redonlay id: string 唯一标识

size: number 子元素数量

show: boolean 是否显示

label: HtmlLabel

方法

add 添加面

typescript
add(options: PolygonCollectionOptions['add'] | PolygonCollectionOptions['add'][]): void

 type PolygonCollectionOptions = {
  add: {
    id?: string;
    positions: Positions[] | Positions | Hierarchy;
    show?: boolean;
    fillColor?: MapColor;
    /** 是否封闭上面 */
    closeTop?: boolean;
    /** 是否封闭下面  */
    closeBottom?: boolean;
    /** 开洞类型 */
    holes?: 'level' | 'deep';
    /** 相对于地面的高度 */
    height?: number;
    perPositionHeight?: boolean;
    /** 几何体本身的高度 */
    extrudedHeight?: number;
    shadows?: boolean;
    outline?: boolean;
    outlineColor?: MapColor;
    outlineWidth?: number;
    labelOffset?: [number, number];
    far?: number;
    near?: number;
    arcType?: 'GEODESIC' | 'RHUMB';
    property?: Record<string | symbol, any>;
  };
};

get 获取

  • id 子元素id
typescript
get(id: string): Polygon | undefined

setPolygon 设置改变子元素样式

typescript
setPolygon(id: string, options: {
    show?: boolean;
    labelOffset?: [number, number];
}): void

getProperty 获取属性

  • id 子元素id
typescript
getProperty(id: string): Record<string | symbol, any> | undefined

remove 移除点

  • id 子元素id
  • isRender 移除后是否进行渲染 默认true
typescript
remove(id: string, isRender: boolean): boolean

removeAll 移除所有点

  • isRender 移除后是否进行渲染 默认true
typescript
removeAll(isRender: boolean): void

on 事件注册

  • 两个函数重载
typescript
 on(
    type: 'mouseMove',
    listener: (tar: [PolygonCollection, Polygon | undefined], mark: 'in' | 'out', Even: MouseMoveEvent) => void
  ): PolygonCollection;
  on(type: PickType, listener: (tar: [PolygonCollection, Polygon | undefined], mark: 'in' | 'out', Even: PickEvent) => void): PolygonCollection;

off 事件移除

typescript
off(type: PickType | 'mouseMove'): PolygonCollection

isDestroyed 是否已经销毁

typescript
isDestroyed(): boolean

focus 聚焦

  • id 子元素id
  • duration 过渡时间(秒)
typescript
focus(id: string, duration): void

destroy 销毁

typescript
destroy(): boolean