new TextLayer()
- Source:
- View2D/Visuals/Three/TextLayer.js
Example
//构造地图对象 var map = new GeoGlobe.Map({ style: Cfg.style, container: 'map', zoom: 18, bearing: -47, pitch: 45, units: "degrees", center: [114.26734490525155, 30.594607628267966] }); //构造THREE可视化图层 var threebox = new GeoGlobe.Visuals.Three(); //绑定鼠标点击事件 threebox.on('overlayerclick', function(e){ var xyz = threebox.unprojectFromWorld(e.param.pickedInfos[0].point); alert(e.param.info.userData.attributes.OriginalData.properties.name + '\n经纬度及高程:' + xyz); }); //绑定鼠标移动事件 threebox.on('overlayerhover', function(e){ console.info(e); }); //添加到地图中 threebox.addTo(map); //构造文本图层 var textLayer = new GeoGlobe.Visuals.Three.TextLayer({ id: 'text in 3D', data: [ {"type":"Feature","properties":{"name": "一号文本","height": 40, "text": "我是文本Q1", color: "rgb(255, 120, 0)"},"geometry":{"type":"Point","coordinates":[114.267589714434,30.593727684842285]}}, ], visible: true, opacity: 1, scale: 1, size: 10, thickness: 3, curveSegments: 4, fontURL: '../../fonts/SimHei_Regular.json', //简体 getGeometry: function(geometry, data){ geometry.rotateX((90/360)*2*Math.PI); geometry.rotateZ((180/360)*2*Math.PI); return geometry; }, }); //添加到THREE图层 textLayer.addTo(threebox); //绘制 threebox.render();
Members
-
curveSegments :Int
-
字体曲面光滑度
Type:
- Int
- Default Value:
-
- 12
- Source:
- View2D/Visuals/Three/TextLayer.js
-
data :Array
-
数据
Type:
- Array
- Source:
- View2D/Visuals/Three/TextLayer.js
Example
[{ "type":"Feature", "properties":{ "id": 100001, "name":"1号视频", "text":"我是文本1", "height":30, "color": "rgb(255, 120, 0)" }, "geometry":{ "type":"Point", "coordinates": [114.20257245367856, 30.773372078561778] } }]
-
fontURL :String
-
字体资源路径
Type:
- String
- Default Value:
-
- ''
- Source:
- View2D/Visuals/Three/TextLayer.js
-
id :String
-
图层id
Type:
- String
- Default Value:
-
- '1'
- Source:
- View2D/Visuals/Three/TextLayer.js
-
opacity :Float
-
透明度 0-1
Type:
- Float
- Default Value:
-
- 1.0
- Source:
- View2D/Visuals/Three/TextLayer.js
-
size :Int
-
字体大小
Type:
- Int
- Default Value:
-
- 100
- Source:
- View2D/Visuals/Three/TextLayer.js
-
thickness :Int
-
字体厚度
Type:
- Int
- Default Value:
-
- 50
- Source:
- View2D/Visuals/Three/TextLayer.js
-
visible :Boolean
-
可见性
Type:
- Boolean
- Default Value:
-
- true
- Source:
- View2D/Visuals/Three/TextLayer.js
Methods
-
addTo(three)
-
关联Three
Parameters:
Name Type Description three
GeoGlobe.Visuals.Three - Source:
- View2D/Visuals/Three/TextLayer.js
-
getColor(data)
-
颜色GET属性
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Source:
- View2D/Visuals/Three/TextLayer.js
Returns:
color - 颜色值- Type
- String
-
getGeometry(geometry, data)
-
几何对象GET属性
Parameters:
Name Type Description geometry
Geometry THREE.Geometry data
Feature geojson中的一个Feature - Source:
- View2D/Visuals/Three/TextLayer.js
Returns:
geometry - 可对geometry平移旋转缩放后的- Type
- Geometry
-
getPosition(data)
-
地理位置GET属性
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Source:
- View2D/Visuals/Three/TextLayer.js
Returns:
point - [x,y,z]- Type
- Array
-
getText(data)
-
文本GET属性
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Source:
- View2D/Visuals/Three/TextLayer.js
Returns:
text - data.properties.text- Type
- String
-
remove()
-
从父对象中移除自己
- Source:
- View2D/Visuals/Three/TextLayer.js
-
render()
-
绘制
- Source:
- View2D/Visuals/Three/TextLayer.js