Class: FMCompositeMarker

FMCompositeMarker

FMCompositeMarker 文本标注对象, 属于fengmap.plugins-compositemarker.min.js

new fengmap.FMCompositeMarker(options)

Name Type Description
options json

参数

Name Type Description
layout json

视图中心的地图坐标

Name Type Description
style string

image:只显示图片,text:只显示文字
limage-rtext:左图右文
ltext-rimage:左文右图
timage-btext:上图下文
ttext-bimage:上文下图
overlay-text:文字覆盖图片

align string

当style为limage-rtext或者ltext-rimage时值可以为center,top,bottom
当style为timage-btext或者ttext-bimage时值可以为left,center,right
当style为overlay-text时值可以为图(位置包括:top,center,bottom)-文字(位置包括:left,center,right),例子:bottom-right代表文字在图的底部,文字与图右对齐

image json

图片信息

Name Type Description
url string

图片url地址

size Array

图片大小,数组第一个元素是宽,第二个元素为高,默认为[32, 32]

text json

文字信息

Name Type Description
padding array

文字内边距默认值为 [0,0,0,0]

plateColor string

底色,默认无

plateStrokeColor string

底色边框颜色,默认无

plateStrokeWidth number

文字背景边框宽度,注:只有描边颜色没有描边宽度时,默认描边宽度为 1

content json

文字内容信息

Name Type Description
textAlign string

fengmap.FMTextAlign 文字对齐方式。水平居中、左对齐、右对齐,默认为fengmap.FMTextAlign.Center

lineSpacing number

行间距默认为2,当小于2时也等于2

fontSize number

文本字号, 默认20px

fontWeight number | string

文字粗细

fontFamily string

字体样式,如果没有给定,使用默认字体样式

fillColor string

文本填充色,rgb类型字符串,默认 "255,0,0"

strokeColor string

文本边框填充色,rgb类型字符串。默认 '255,255,0'

strokeWidth number

描边线宽

text string | array

文字内容,必填

text[].text string

当为数组时的文字内容,必填

text[].textAlign string

fengmap.FMTextAlign 文字对齐方式。水平居中、左对齐、右对齐,默认为与上面的设置的textAlign一致

text[].lineSpacing number

行间距默认,默认与上面设置的lineSpacing一致,当小于2时也等于2

text[].fontSize number

文本字号, 默认与上面设置的fontSize一致

text[].fontWeight number | string

文字粗细, 默认与上面设置的fontWeight一致

text[].fontFamily string

字体样式,默认与上面设置的fontFamily一致

text[].fillColor string

文本填充色,默认与上面设置的fillColor一致

text[].strokeColor string

文本边框填充色,默认与上面设置的strokeColor一致

text[].strokeWidth number

描边线宽,默认与上面设置的strokeWidth一致

x number

图片地图位置x值,默认对应楼层中心点坐标,必填

y number

图片地图位置y值,默认对应楼层中心点坐标,必填

render string

渲染方式,billboard始终面向屏幕,flat平铺

anchor json

锚点信息

Name Type Description
baseon string

锚点基于图片还是文字还是全部(all:全部,image:图片,text:文字)

anchor fengmap.FMMarkerAnchor

锚点位置

zoomRange array

模型比例尺范围属性,默认[16,29]

opacity number

透明度,0到1之间,默认为1

collision bool

true:开启避让 false:关闭避让 默认 true,注:render为flat平铺时不支持避让

depth bool

文本渲染深度 【true】:开启深度;【false】:关闭深度

height number

离地高度, 默认 1

Members

height

离地高度

Properties:
Name Type Description
height number

离地高度

readonlylevel

Properties:
Name Type Description
level number

楼层等级,初始化完成后可以获取当前值

opacity

标注透明度

Properties:
Name Type Description
opacity number

标注透明度 修改需要调用update方法更新

plateColor

Properties:
Name Type Description
plateColor String

文字背景色 修改需要调用update方法更新

plateStrokeColor

Properties:
Name Type Description
plateStrokeColor String

文字背景色边框 修改需要调用update方法更新

readonlytype

Properties:
Name Type Description
type fengmap.FMType

节点类型

visible

Properties:
Name Type Description
visible Boolean

true 显示 false 隐藏

readonlyx

Properties:
Name Type Description
x number

坐标

readonlyy

Properties:
Name Type Description
y number

坐标

zoomRange

离地高度

Properties:
Name Type Description
zoomRange array

模型比例尺范围属性,默认[16,29]

Methods

addTo(floor)

添加到楼层

Name Type Description
floor Object

楼层等级

getImage(){string}

获取图片信息

Returns:
Type Description
string 获取图片信息

getText(){string|array}

获取文字信息

Returns:
Type Description
string | array 地图覆盖物组

moveTo(options){fengmap.FMAnimation}

动画移动marker到指定位置

Name Type Description
options json
Name Type Description
x number

图片地图位置x值,默认对应楼层中心点坐标

y number

图片地图位置y值,默认对应楼层中心点坐标

animate boolean

是否需要动画,默认false

duration number

移动到指定位置所用的时间(秒),默认0.5

finish function

移动到指定位置后的回调函数

Returns:
Type Description
fengmap.FMAnimation animation 动画类

remove()

从楼层中移除

rotateTo(options){fengmap.FMAnimation|undefined}

水平旋转至特定角度,带动画,只对render为flat(平铺)时有效

Name Type Description
options json
Name Type Description
heading number

{number} 角度

animate Boolean

是否启动动画 默认 false

duration number

动画持续时间

finish function

移动到指定位置后的回调函数

Returns:
Type Description
fengmap.FMAnimation | undefined animation 返回动画

setImage(url, size)

设置图片,设置后需要执行update()方法更新

Name Type Description
url string

图片的url地址

size array

图片大小,数组第一个元素是宽,第二个元素为高

setText(text)

设置文字信息,设置后需要执行update()方法更新

Name Type Description
text string | array

文字信息

update()

更新marker