new FluidSourceCollection(fluid){Object}
engineExtensions/simulation/fluid/FluidSourceCollection.js, line 4
流体源集合对象(该对象会在Fluid内部进行实例化,不需要额外手动实例化)
| Name | Type | Description |
|---|---|---|
fluid |
Fluid |
流体源集合所属的流体对象 |
Returns:
| Type | Description |
|---|---|
| Object | 返回根据参数实例化的流体源集合对象 |
Members
-
lengthNumber
-
集合中流体源的数量
Methods
-
add(fluidSource){PointFluidSource|VolumeFluidSource}
engineExtensions/simulation/fluid/FluidSourceCollection.js, line 45 -
添加流体源对象,创建点流体源对象(PointFluidSource)或全域流体源对象(VolumeFluidSource),创建方法可以查看上述文档 在创建Fluid对象时,FluidSourceCollection对象会在其内部自动实例化,可以通过fluid.fluidSources获取
Name Type Description fluidSourcePointFluidSource | VolumeFluidSource 需要添加的流体源对象
Returns:
Type Description PointFluidSource | VolumeFluidSource 添加成功的流体源对象 Example
// 以添加一个点流体源为例,首先实例化一个点流体源对象 const pointFluidSource = new PointFluidSource({ position: Cesium.Cartesian3.fromDegrees(113, 30), radius: 50, flow: 20, }) // 将点流体源添加到流体模拟对象的流体源集合中 fluid.fluidSources.add(pointFluidSource) -
contains(fluidSource){Boolean}
engineExtensions/simulation/fluid/FluidSourceCollection.js, line 102 -
返回流体源集合中是否包含指定的流体源对象
Name Type Description fluidSourcePointFluidSource | VolumeFluidSource 需要查找的流体源对象
Returns:
Type Description Boolean 当流体源集合中包含fluidSource时返回true,否则返回false -
get(index){PointFluidSource|VolumeFluidSource}
engineExtensions/simulation/fluid/FluidSourceCollection.js, line 89 -
返回流体源集合中指定下标的流体源对象
Name Type Description indexNumber 需要查找的流体源对象在集合中的下标
Returns:
Type Description PointFluidSource | VolumeFluidSource 在流体源集合中下标index所对应的流体源对象 -
remove(fluidSource){Boolean}
engineExtensions/simulation/fluid/FluidSourceCollection.js, line 58 -
删除流体源对象(目前支持PointFluidSource和VolumeFluidSource)
Name Type Description fluidSourcePointFluidSource | VolumeFluidSource 需要删除的流体源对象
Returns:
Type Description Boolean 如果删除成功返回true,如果要删除的流体源对象未定义或不在集合中则返回false -
removeAll()
engineExtensions/simulation/fluid/FluidSourceCollection.js, line 73 -
删除集合中的所有流体源对象