new FdText(viewer, id, option)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
viewer |
Viewer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id |
GUID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
option |
Object | 配置参数,可能包含以下值: Properties
|
Example
var viewer = Freedo.FdApp.createDefaultViewer('freedoContainer'); // 1.非贴地模式: var ent = mm.add('Text', { clamp: false, text: '北京飞渡科技有限公司', font: 'sans-serif', fontSize: 12, fillStyle: 'rgba(255, 255, 0, 1)', backgroundColor: 'rgba(0, 0, 0, 0.2)' heading: -45, // 只在非贴地模式下有效 pitch: 0, // 只在非贴地模式下有效 roll: 90, // 只在非贴地模式下有效 offsetHeight: 10, // 只在非贴地模式下有效 lineDistance: 6, // 多行文字有效 textAlign: 'center' // 多行文字有效 }); // 2.贴地模式 var ent = mm.add('Text', { clamp: true, text: '北京飞渡科技有限公司', font: 'sans-serif', fontSize: 12, fillStyle: 'rgba(255, 255, 0, 1)', backgroundColor: 'rgba(0, 0, 0, 0.2)', rotation: 60 // 只在贴地模式下有效 }); // 注意:参数中可以传position或modelMatrix属性,其中position为包含经纬度信息的数组 // 当这两个属性都不存在时,激活手动选点功能 // 当有modelMatrix属性时,position属性将会被忽略,同时heading、pitch、roll和rotation属性也将被忽略
Members
-
<readonly> option :Object
-
获取实体的属性数据
Type:
- Object
Methods
-
destroy()
-
销毁
-
endEdit()
-
结束编辑
-
getData()
-
获取实体的属性数据
Returns:
返回值格式:
{ id: GUID, type: "Text", option: { show: true, modelMatrix: Matrix4 } }
- Type
- Object
-
hide()
-
隐藏
-
on(listener [, scope])
-
注册事件捕捉
Parameters:
Name Type Argument Description listener
FdModel.FdText~FdTextCallback 当有事件触发时被执行的函数。
scope
Object <optional>
listener函数执行时的绑定的对象。
Returns:
返回一个函数,调用该函数可以取消监听。
- Type
- Freedo.Event~RemoveCallback
-
remove()
-
销毁
-
show()
-
显示
-
startEdit(type)
-
开始进行编辑
Parameters:
Name Type Default Description type
Strong MOVE|ROTATE|SCALE 编辑类型,可能是 'MOVE|ROTATE|SCALE'
Type Definitions
-
FdTextCallback(eventType, eventArg)
-
Parameters:
Name Type Description eventType
String 事件类型有:DataChanged
eventArg
Object DataChanged事件对应的参数