Occluder

new SuperMap3D.Occluder(occluderBoundingSphere, cameraPosition)

根据物体的位置、半径和相机位置创建一个遮挡物。遮挡物可用于确定其他物体是可见还是隐藏在由遮挡器和相机位置定义的可见水平线之后。
Name Type Description
occluderBoundingSphere BoundingSphere 包围遮挡器的包围球。
cameraPosition Cartesian3 观察者/相机的坐标。
Example:
// Construct an occluder one unit away from the origin with a radius of one.
var cameraPosition = SuperMap3D.Cartesian3.ZERO;
var occluderBoundingSphere = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -1), 1);
var occluder = new SuperMap3D.Occluder(occluderBoundingSphere, cameraPosition);

Members

cameraPosition : Cartesian3

相机的位置。

position : Cartesian3

遮挡物的位置。

radius : Number

遮挡物的半径。

Methods

staticSuperMap3D.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions)Object

计算一个点,该点可用作可见性函数的被遮挡位置。 通常情况下,用户会计算一个物体周围的包围球,用于显示可见性;但也可以计算一个点,如果看到/看不到,这个点也会显示物体是否可见/不可见。 对于相对于遮挡器不会移动且体积较大的物体(如一大块地形),最好调用该函数。 对于卫星或地面车辆等物体,最好不要调用此函数,而是使用物体的包围球来显示。 如卫星或地面车辆。
Name Type Description
occluderBoundingSphere BoundingSphere 遮挡物周围的包围球。
occludeePosition Cartesian3 遮挡物(半径为0的包围球)所在的点。
positions Array.<Cartesian3> 遮挡物表面附近地平线上的高度点列表。
Returns:
包含两个属性的对象:occludeePoint 和 valid是一个boolean。
Throws:
  • DeveloperError : 位置必须至少包含一个要素。
  • DeveloperError : occludeePosition 的值必须是 occluderBoundingSphere.center 以外的值。
Example:
var cameraPosition = new SuperMap3D.Cartesian3(0, 0, 0);
var occluderBoundingSphere = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -8), 2);
var occluder = new SuperMap3D.Occluder(occluderBoundingSphere, cameraPosition);
var positions = [new SuperMap3D.Cartesian3(-0.25, 0, -5.3), new SuperMap3D.Cartesian3(0.25, 0, -5.3)];
var tileOccluderSphere = SuperMap3D.BoundingSphere.fromPoints(positions);
var occludeePosition = tileOccluderSphere.center;
var occludeePt = SuperMap3D.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions);

staticSuperMap3D.Occluder.computeOccludeePointFromRectangle(rectangle, ellipsoid)Object

根据矩形计算一个可用作可见度函数的遮挡位置的点。
Name Type Default Description
rectangle Rectangle 用来创建包围球的矩形。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 用于确定矩形位置的椭球体。
Returns:
包含两个属性的对象:occludeePoint 和 valid是一个boolean。

staticSuperMap3D.Occluder.fromBoundingSphere(occluderBoundingSphere, cameraPosition, result)Occluder

根据包围球和相机位置创建遮挡器。
Name Type Description
occluderBoundingSphere BoundingSphere 遮挡物周围的包围球。
cameraPosition Cartesian3 T观察者/相机的坐标。
result Occluder optional 存储结果的对象。
Returns:
根据物体的位置和半径以及相机位置得出的遮挡物。

computeVisibility(occludeeBS)Number

确定遮挡物的可见程度(不可见、部分可见或完全可见)。
Name Type Description
occludeeBS BoundingSphere 被遮挡者的包围球。
Returns:
如果被遮挡物不可见,则显示 Visibility.NONE;如果被遮挡物部分可见,则显示 Visibility.PARTIAL;如果被遮挡物完全可见,则显示 Visibility.FULL。
Example:
var sphere1 = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -1.5), 0.5);
var sphere2 = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -2.5), 0.5);
var cameraPosition = new SuperMap3D.Cartesian3(0, 0, 0);
var occluder = new SuperMap3D.Occluder(sphere1, cameraPosition);
occluder.computeVisibility(sphere2); //returns Visibility.NONE
See:
  • Occluder#isVisible

isBoundingSphereVisible(occludee)Boolean

确定一个球体(即被遮挡者)是否被遮挡物遮挡。
Name Type Description
occludee BoundingSphere 被遮挡物体周围的包围球。
Returns:
如果遮挡物可见,则为 true;否则为 false。
Example:
var cameraPosition = new SuperMap3D.Cartesian3(0, 0, 0);
var littleSphere = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -1), 0.25);
var occluder = new SuperMap3D.Occluder(littleSphere, cameraPosition);
var bigSphere = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -3), 1);
occluder.isBoundingSphereVisible(bigSphere); //returns true
See:

isPointVisible(occludee)Boolean

确定一个点,即 occludee 是否被遮挡物从视图中隐藏。
Name Type Description
occludee Cartesian3 被遮挡物体周围的点。
Returns:
如果遮挡物可见,则为 true;否则为 false。
Example:
var cameraPosition = new SuperMap3D.Cartesian3(0, 0, 0);
var littleSphere = new SuperMap3D.BoundingSphere(new SuperMap3D.Cartesian3(0, 0, -1), 0.25);
var occluder = new SuperMap3D.Occluder(littleSphere, cameraPosition);
var point = new SuperMap3D.Cartesian3(0, 0, -3);
occluder.isPointVisible(point); //returns true
See: