osgEarth js脚本绘制柱状图 10.feature_population_cylinders.earth

osgEarth js脚本绘制柱状图 

10.feature_population_cylinders.earth


1) 案例概述

使用JavaScript脚本绘制柱状图案例。

 

2) 软件环境

osgEarth:官方代码库2017.11.09最新代码地址:www.github.com/gwaldron/osgearth

osgEarth编辑器:SXEarth2.8及以上,下载地址:www.sxsim.com

 

3) 硬件环境

本文编写和案例测试使用的硬件环境:CPU: i5四核,显卡:GTX660,内存:8GB。

(推荐使用英伟达显卡,intel显卡,会出现三维场景中文字显示不全的问题,笔记本双显卡,需要切换到独显。)

 

4) 编辑柱状图高度

在左侧“场景面板”,选中“City Population”项,在右侧“属性面板”,右键单击“代码段”,在弹出的菜单中选择“编辑”菜单,打开代码“编辑窗口”,其中表示柱状图高度的代码:feature.properties.height = radius*1.5; 修改为:feature.properties.height = radius*5.5; 关闭窗口,柱状图刷新,高度增加。

 

5) 编辑文字显示高度

在左侧“场景面板”,选中“City Labels”项,在右侧“属性面板”,右键单击“样式”项,在弹出的菜单中选择“编辑样式”,弹出“编辑样式”对话框,展开“高度符号”的“属性表”组,选中“高度-位移”,并设置“高度-位移”为(3.0-feature.properties.scalerank) * 75000*6.0,点“提交”按钮,场景文字提高到柱状图上部显示。


osgEarth js脚本绘制柱状图 10.feature_population_cylinders.earth