BoxClipping

new Cesium.GeoClipping.BoxClipping(options)

Box裁剪
Name Type Description
options Object 参数选项:
Name Type Default Description
viewer Viewer 当前viewer
polygon Array 点集,用来确定裁剪Box
targets Array 目标集
enabled Boolean true optional 是否激活
showPlanePrimitive Boolean true optional 是否显示裁剪Box的示意对象
planeColor Color 裁剪Box的颜色
height Number 裁剪Box的高度
Example:
var boxClipping = new Cesium.GeoClipping.BoxClipping({
     viewer : viewer,
     polygon : [new Cesium.Cartesian3(...), new Cesium.Cartesian3(...), new Cesium.Cartesian3(...)],
     targets : [tileset, model]
 });
Demo:

Members

center : Cartesian3

裁剪Box的中心

readonlychangedFrameNumber : Number

最后被更改时的对应帧数

readonlydestroyEvents : Event

销毁事件

enabled : Boolean

是否激活
Default Value: [true]

height : Number

裁剪Box的高度

minActionStride : Number

交互时的最小响应间隙

readonlyname : String

唯一名称标识

planeColor : Color

裁剪Box的示意Box图元的颜色

readonlyready : Boolean

是否就绪

showPlanePrimitive : Boolean

是否在场景中显示裁剪Box的示意Box图元
Default Value: [true]

readonlysource : Object

对应的BOX裁剪源数据

readonlytargets : Array

目标集

Methods

staticCesium.GeoClipping.BoxClipping.getPositions(viewer, callback)

通过交互方式,获取创建裁剪Box的点集,当交互完成时,将点集传送给回调函数
Name Type Description
viewer Viewer 当前viewer
callback function 交互完成时的回调函数
Example:
Cesium.GeoClipping.BoxClipping.getPositions(viewer, function(positions){
     if (positions && positions.length >= 3){
         clippingBox = new Cesium.GeoClipping.BoxClipping({
             viewer : viewer,
             polygon : positions,
             targets : [...]
         });

         viewer.scene.clippingCollection.push(clippingBox);
     }
 });

staticCesium.GeoClipping.BoxClipping.initialize(scene)

初始化Box裁剪环境, 这个接口必须在使用前调用,否则裁剪无效果
Name Type Description
scene Scene 当前场景
Example:
Cesium.GeoClipping.BoxClipping.initialize(viewer.scene);

expand(value)

缩放BOX
Name Type Description
value Number 缩放参数,单位米

matchPrimitive(primitive)

判断对象是否匹配
Name Type Description
primitive Model | Cesium3DTileset

matchPrimitiveByNumber(primitive, number)

判断对象是否在指定帧数之后被更改
Name Type Description
primitive Model | Cesium3DTileset
number Number

moveWithDistance(distance)

将裁剪Box的中心沿法线移动一定距离
Name Type Description
distance Number 要移动的距离,单位为米;当距离为负值时,反向移动
Example:
clippingBox.moveWithDistance(5);