# new MapGISTextSymbol(options)
文本符号,支持点几何对象,参考示例:[创建文本样式]
[ES5引入方式]:
zondy.symbol.MapGISTextSymbol()
[ES6引入方式]:
import { MapGISTextSymbol } from "@mapgis/webclient-common"
参数
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
options |
Object | 构造参数 |
|
backgroundPadding |
Array.<Number> | [5,5] | 背景内边距 |
backgroundImage |
Image | function | 背景图片样式,设置时会覆盖backgroundColor |
|
textDecorationUnderlineColor |
String | 文字下划线颜色,待废弃接口,推荐使用font属性中文字装饰元素属性decoration |
|
textDecorationUnderlineWidth |
Number | 文字下划线宽度,待废弃接口,推荐使用font属性中文字装饰元素属性decoration |
|
textDecorationThroughlineColor |
String | 文字删除线颜色,待废弃接口,推荐使用font属性中文字装饰元素属性decoration |
|
textDecorationThroughlineWidth |
Number | 文字删除线宽度,待废弃接口,推荐使用font属性中文字装饰元素属性decoration |
|
textShadowOffsetX |
Number | 0 | 文字阴影横轴偏移 |
textShadowOffsetY |
Number | 0 | 文字阴影纵轴偏移 |
textShadowBlur |
Number | 1 | 文字阴影模糊度 |
textShadowColor |
String | 文字阴影颜色 |
|
letterSpacing |
Number | 0 | 文字间距 |
lineMaxNum |
Number | 3 | 文字最大行数 |
textWraps |
Boolean | false | 是否换行 |
textExtraIcon |
Image | 文字额外符号图标。测试接口,后续可能会改动。 |
|
textExtraIconAnchor |
String | 'left' | 文字额外图标方位,可选"left" "right" "top" "bottom"。测试接口,后续可能会改动。 |
textExtraIconSize |
Number | 14 | 文字额外图标大小,单位像素。测试接口,后续可能会改动。 |
支持如下方法:
[1、将JSON里的数据导入,并返回一个新的TextSymbol对象][2、导出为JSON对象]
[3、克隆并返回新的符号对象]
示例
// ES5引入方式
const { MapGISTextSymbol } = zondy.symbol
const { MapGISTextSymbol, Color } = zondy
// ES6引入方式
import { MapGISTextSymbol, Color } from "@mapgis/webclient-common"
const textSymbol = new MapGISTextSymbol({
// 字体颜色
color: new Color(252, 100, 22, 1),
// 字体内容,如果是服务端数据,可不填
text: "默认文字",
// 字体样式
font: {
// 字体
family: "微软雅黑",
// 文字大小,单位像素
size: 30,
// 文字是否为斜体,正常模式
style: "normal",
// 文字粗细
weight: "normal"
}
})
继承关系
成员变量
成员变量概述
名称 | 类型 | 描述 |
---|---|---|
angle |
Number
|
|
backgroundColor |
Color
|
|
backgroundImage |
function
|
Image
|
|
backgroundPadding |
Array.<Number>
|
|
borderLineColor |
Color
|
|
borderLineSize |
Number
|
|
color |
Color
|
|
extensionOptions |
Object
|
|
font |
String
|
|
haloColor |
Color
|
|
haloSize |
Number
|
|
horizontalAlignment |
HorizontalAlignment
|
|
id |
String
|
|
kerning |
Boolean
|
|
letterSpacing |
Number
|
|
lineHeight |
Number
|
|
lineMaxNum |
Number
|
|
lineWidth |
Number
|
|
rotated |
Boolean
|
|
text |
String
|
|
textDecorationThroughlineColor |
Color
|
|
textDecorationThroughlineWidth |
Number
|
|
textDecorationUnderlineColor |
Color
|
|
textDecorationUnderlineWidth |
Number
|
|
textExtraIcon |
Image
|
|
textExtraIconAnchor |
String
|
|
textExtraIconSize |
Number
|
|
textShadowBlur |
Number
|
|
textShadowColor |
Color
|
|
textShadowOffsetX |
Number
|
|
textShadowOffsetY |
Number
|
|
textWraps |
Boolean
|
|
type |
String
|
|
verticalAlignment |
VerticalAlignment
|
|
xoffset |
Number
|
|
yoffset |
Number
|
|
成员变量详情
# extensionOptions
符号的额外构造参数,该构造参数是地图引擎的额外构造参数,在此设置了之后,会覆盖该符号转换好地图引擎的构造参数
- Inherited From:
- Default Value:
- {}
方法
方法概述
名称 | 返回值类型 | 描述 |
---|---|---|
fromJSON |
MapGISTextSymbol
|
|
clone |
MapGISTextSymbol
|
|
toJSON |
Object
|
|