new ExtrudeSymbol3DLayer(options)
base/symbol/symbol3DLayer/ExtrudeSymbol3DLayer.js, line 6
三维拉伸区符号图层,用于在三维场景中将面(区)几何沿垂直方向拉伸为立体形状,仅支持三维场景视图,不支持二维地图视图。
示例如下:
[1、创建三维拉伸区符号图层]
| Name | Type | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
构造参数
|
Example
// ES5引入方式
const { Color, Feature } = zondy
const { GraphicsLayer } = zondy.layer
const { Polygon } = zondy.geometry
const { ExtrudeSymbol3DLayer, ColorMaterial, PolygonSymbol3D } = zondy.symbol
// ES6引入方式
import { ExtrudeSymbol3DLayer, ColorMaterial, Color, GraphicsLayer, Feature, PolygonSymbol3D } from "@mapgis/webclient-common"
// 创建三维拉伸区符号图层(棱柱形状,拉伸高度 1000 米,红色填充)
const extrudeSymbol3DLayer = new ExtrudeSymbol3DLayer({
// 拉伸体几何形状:棱柱
primitive: 'prism',
// 拉伸高度(单位:米)
size: 1000,
// 填充颜色材质
material: new ColorMaterial({
color: new Color(255, 0, 0, 1)
})
})
// 创建三维符号
const symbol = new PolygonSymbol3D({
symbolLayers: [extrudeSymbol3DLayer]
})
// 构造区几何对象
const polygon = new Polygon({
coordinates: [
[
[112.3, 29, 0],
[112.9, 29, 0],
[113.5, 29, 0],
[113.5, 28.4, 0],
[112.9, 28.4, 0],
[112.3, 28.4, 0],
[112.3, 29, 0],
],
],
});
// 构建要素对象
const feature = new Feature({
geometry: polygon,
symbol: symbol
});
// 创建几何图层
const layer = new GraphicsLayer({
graphics: [],
});
map.add(layer)
// 添加要素
layer.add(feature)
Extends
Members
-
castShadowsBoolean
-
是否投射阴影
- Default Value: true
edgesEdges3D
拉伸体棱线(轮廓线)的样式,支持设置颜色和线宽
idString
符号图层唯一标识
materialColorMaterial
拉伸体的填充材质,目前支持 ColorMaterial(纯色材质)
outlineFillSymbol3DOutline
拉伸体底面的外边线样式,支持设置颜色、宽度(1-10 之间)和线型。默认不显示外边线
- Default Value: null
primitiveString
拉伸体的几何形状类型。可选值:
thicknessPolygon:带厚度的平铺多边形(size 参数在此模式下无效)prism:棱柱(多边形截面垂直拉伸)pyramid:棱锥(顶部收缩为尖顶)
- Default Value: 'thicknessPolygon'
sizeNumber
拉伸高度(单位:米)。当 primitive 为 thicknessPolygon 时,该参数无效
- Default Value: 1
transformMatrixArray.<Number>
图层的变换矩阵,格式为16个元素的一维数组,表示一个4x4的齐次坐标变换矩阵
三维符号图层类型,固定为 Symbol3DLayerType.extrude
Methods
-
clone(){ExtrudeSymbol3DLayer}
base/symbol/symbol3DLayer/ExtrudeSymbol3DLayer.js, line 158 -
克隆并返回一个新的ExtrudeSymbol3DLayer对象
Returns:
Type Description ExtrudeSymbol3DLayer 新的ExtrudeSymbol3DLayer对象 -
toJSON(){Object}
base/symbol/symbol3DLayer/ExtrudeSymbol3DLayer.js, line 142 -
导出为json数据
Returns:
Type Description Object 导出的json数据 -
ExtrudeSymbol3DLayer.fromJSON(json){ExtrudeSymbol3DLayer}
base/symbol/symbol3DLayer/ExtrudeSymbol3DLayer.js, line 134 -
通过json数据构造一个ExtrudeSymbol3DLayer对象
Name Type Description jsonObject json数据
Returns:
Type Description ExtrudeSymbol3DLayer 新的ExtrudeSymbol3DLayer对象