Skip to content

Mask 蒙版 ​


演练场

引入 ​

ts
import { Mask } from "@m-tech/gis-core";

参数 ​

参数类型必填默认值描述
positionsPosition[]是-蒙版位置
idstring否-蒙版 id
invertboolean否false是否反转
maskColorColor否-蒙版颜色

属性 ​

属性类型读/写描述
positionsPosition[]读/写蒙版位置
maskColorColor读/写蒙版颜色
invertboolean读/写是否反转

方法 ​

重新加载蒙版

示例 ​

ts
import { Mask, PrimitiveLayer, Color, Position } from "@m-tech/gis-core";

const layer = new PrimitiveLayer();

const mask = new Mask(
  [
    new Position(114.310782, 30.47049),
    new Position(114.321782, 30.47049),
    new Position(114.316282, 30.47649),
  ],
  {
    id: "mask",
    invert: true,
    maskColor: new Color(0, 0, 0, 0.5),
  },
);

// 添加到图层
layer.add(mask);

// 设置蒙版反转
mask.invert = false;

// 移除蒙版
layer.remove(mask);

MGis 地理三维库