类名 MapGISTextSymbol

# 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

文字颜色

extendOptions Object

符号的额外构造参数,该构造参数是地图引擎的额外构造参数,在此设置了之后,会覆盖该符号转换好地图引擎的构造参数

font String

文字字体

haloColor Color

光晕颜色

haloSize Number

光晕大小

horizontalAlignment HorizontalAlignment

水平方向

kerning Boolean

是否调整文本字符串中字符之间的间距

letterSpacing Number

文字间距

lineHeight Number

行高

lineMaxNum Number

文字最大行数

lineWidth Number

行宽

rotated Boolean

是否旋转

text String

显示的内容

textDecorationThroughlineColor Color

文字删除线颜色,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

textDecorationThroughlineWidth Number

文字删除线宽度,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

textDecorationUnderlineColor Color

文字下划线颜色,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

textDecorationUnderlineWidth Number

文字下划线宽度,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

textExtraIcon Image

注记额外符号

textExtraIconAnchor String

图标方位 "left" "right" "top" "bottom"

textExtraIconSize Number

图标大小

textShadowBlur Number

文字阴影模糊度

textShadowColor Color

文字阴影颜色

textShadowOffsetX Number

文字阴影横轴偏移

textShadowOffsetY Number

文字阴影纵轴偏移

textWraps Boolean

是否换行

type String

符号类型

verticalAlignment VerticalAlignment

垂直对齐

xoffset Number

x偏移

yoffset Number

y偏移

成员变量详情

Number

# angle

文字角度

Inherited From:
Color

# backgroundColor

文字背景颜色

Inherited From:
function | Image

# backgroundImage

文字背景颜色

Array.<Number>

# backgroundPadding

文字背景内边距

Color

# borderLineColor

文字外边框颜色

Inherited From:
Number

# borderLineSize

文字外边框线宽

Inherited From:
Color

# color

文字颜色

Inherited From:
Object

# extendOptions

符号的额外构造参数,该构造参数是地图引擎的额外构造参数,在此设置了之后,会覆盖该符号转换好地图引擎的构造参数

Inherited From:
String

# font

文字字体

Inherited From:
Color

# haloColor

光晕颜色

Inherited From:
Number

# haloSize

光晕大小

Inherited From:
HorizontalAlignment

# horizontalAlignment

水平方向

Inherited From:
Boolean

# kerning

是否调整文本字符串中字符之间的间距

Inherited From:
Number

# letterSpacing

文字间距

Number

# lineHeight

行高

Inherited From:
Number

# lineMaxNum

文字最大行数

Number

# lineWidth

行宽

Inherited From:
Boolean

# rotated

是否旋转

Inherited From:
String

# text

显示的内容

Inherited From:
Color

# textDecorationThroughlineColor

文字删除线颜色,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

Number

# textDecorationThroughlineWidth

文字删除线宽度,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

Color

# textDecorationUnderlineColor

文字下划线颜色,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

Number

# textDecorationUnderlineWidth

文字下划线宽度,待废弃接口,推荐使用font属性中文字装饰元素属性decoration

Image

# textExtraIcon

注记额外符号

String

# textExtraIconAnchor

图标方位 "left" "right" "top" "bottom"

Number

# textExtraIconSize

图标大小

Number

# textShadowBlur

文字阴影模糊度

Color

# textShadowColor

文字阴影颜色

Number

# textShadowOffsetX

文字阴影横轴偏移

Number

# textShadowOffsetY

文字阴影纵轴偏移

Boolean

# textWraps

是否换行

String

# type

符号类型

Overrides:
VerticalAlignment

# verticalAlignment

垂直对齐

Inherited From:
Number

# xoffset

x偏移

Inherited From:
Number

# yoffset

y偏移

Inherited From:

方法

方法概述

方法详情

# static fromJSON(json)

参数

名称 类型 描述
json Object

新的TextSymbol对象

新的TextSymbol对象

MapGISTextSymbol

# clone()

Overrides:

克隆后的新符号对象

MapGISTextSymbol

# toJSON()

Overrides:

JSON对像

Object