BuildingDrawer

new Cesium.BuildingDrawer(options)

绘制并拉升一个建筑物 绘制底面:单击加点,右键结束加点;鼠标移动,拉高,单击结束。完成后构建了一个{BuildingPrimitive}对象。 绘制过程中选择底面顶点中的最低点高程作为建筑物水平面基准底高, 拉升高度为相机鼠标射线与点过建筑底面最后一点点大地法线且朝向相机的虚拟面的交点,使用该交点计算建筑物实时拉升顶面. 当前对象为渲染对象,移除操作应当参考Scene移除Primitive的方式移除。 绑定了鼠标事件。建议使用单例模式。
Name Type Description
options Object 如下
Name Type Default Description
scene Scene Scene.
show Boolean true optional 是否实时显示绘制效果
floorHeight Number 3.0 optional 建筑层高
wallImage String | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement 'buildModuleUrl('Assets/Images/cityplan/outer_wall.jpg')' optional 墙面材质
wallUseColor Boolean false optional true,墙面使用颜色填充,false墙面使用图片材质填充
wallColor Color Color.GRAY optional 墙面颜色
wallRepeat Cartesian2 new Cartesian(1,1) optional 墙面的材质排列
roofImage String | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement 'buildModuleUrl('Assets/Images/cityplan/roof.jpg')' optional 房顶材质
roofUseColor Boolean false optional true,房顶面使用颜色填充,false房顶面使用图片材质填充
roofColor Color Color.GRAY optional 房顶面颜色
roofRepeat Cartesian2 new Cartesian(1,1) optional 房顶面的材质排列
pointColor Color Color.RED optional 点的颜色
pointSize Number 5 optional 点的像素大小
lineColor Color Color.YELLOW optional 轮廓线颜色

Members

绘制取消事件,可添加监听函数,取消时触发.无返回值
绘制结束事件,可添加监听函数.添加和移除监听函数参考Event. 绘制完成后触发该事件,返回BuildingPrimitive对象。即执行回调函数,回调函数形参为BuildingPrimitive对象
Example:
function callbackWhenDrawEnded(buildingPrimitive) {
  alert("绘制结束");
  console.dir(buildingPrimitive);
}
buildingDrawer.endDrawEvent.addEventListener(callbackWhenDrawEnded);

buildingDrawer.endDrawEvent.removeEventListener(callbackWhenDrawEnded);
层高
轮廓线或者折线的颜色
点的颜色
点的像素大小
房顶面颜色

roofImage : String|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement

房顶面材质
房顶面的材质排列

roofUseColor : Boolean

true,房顶面使用颜色填充,false房顶面使用图片材质填充
是否实时显示绘制效果
墙面颜色

wallImage : String|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement

墙面材质
墙面的材质排列

wallUseColor : Boolean

true,墙面使用颜色填充,false墙面使用图片材质填充

Methods

激活绘制状态,进行绘制建筑物的操作

removeAllEventListener()

移除绘制过程所有回调函数
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.