English中文

ScreenSpaceCameraController

new Cesium.ScreenSpaceCameraController(scene)

根据画布上的鼠标输入修改相机位置和方向。 Modifies the camera position and orientation based on mouse input to a canvas.
名称 Name 类型 Type 说明 Description
scene Scene 现场。 The scene.

成员 Members

设置 2D 和哥伦布视图中反弹动画的持续时间(以秒为单位)。 Sets the duration, in seconds, of the bounce back animations in 2D and Columbus view.
默认值: Default Value: 3.0

enableCollisionDetection : boolean

禁用时,值 When disabled, the values of maximumZoomDistance and minimumZoomDistance 被忽略。也可与 are ignored. Also used in conjunction with Cesium3DTileset#enableCollision 以防止相机移动穿过或低于 3D Tileset 表面。这也可能会影响使用时的夹紧行为 to prevent the camera from moving through or below a 3D Tileset surface. This may also affect clamping behavior when using HeightReference.CLAMP_TO_GROUND 在 3D Tiles上。 on 3D Tiles.
默认值: Default Value: true
如果为 true,则有条件地允许使用标志enableTranslate、enableZoom、enableRotate、enableTilt 和enableLook 进行输入。如果为 false,则禁用所有输入。注意:此设置适用于临时用例,例如相机飞行和区域拖动选择(请参阅拾取演示)。它通常在此类事件开始时设置为 false,并在完成时设置为 true。要在摄像机飞行结束后保持输入禁用,您必须使用其他布尔值(enableTranslate、enableZoom、enableRotate、enableTilt 和 enableLook)。 If true, inputs are allowed conditionally with the flags enableTranslate, enableZoom, enableRotate, enableTilt, and enableLook. If false, all inputs are disabled. NOTE: This setting is for temporary use cases, such as camera flights and drag-selection of regions (see Picking demo). It is typically set to false at the start of such events, and set true on completion. To keep inputs disabled past the end of camera flights, you must use the other booleans (enableTranslate, enableZoom, enableRotate, enableTilt, and enableLook).
默认值: Default Value: true
如果为 true,则允许用户使用自由查看。如果为 false,则只能通过平移或旋转来更改相机视图方向。该标志仅适用于 3D 和 Columbus 视图模式。 If true, allows the user to use free-look. If false, the camera view direction can only be changed through translating or rotating. This flag only applies in 3D and Columbus view modes.
默认值: Default Value: true
如果为 true,则允许用户旋转世界,从而平移用户的位置。该标志仅适用于 2D 和 3D。 If true, allows the user to rotate the world which translates the user's position. This flag only applies in 2D and 3D.
默认值: Default Value: true
如果为 true,则允许用户倾斜相机。如果为 false,则相机将锁定到当前航向。该标志仅适用于 3D 和哥伦布视图。 If true, allows the user to tilt the camera. If false, the camera is locked to the current heading. This flag only applies in 3D and Columbus view.
默认值: Default Value: true
如果为 true,则允许用户在地图上平移。如果为 false,则相机保持锁定在当前位置。该标志仅适用于 2D 和 Columbus 视图模式。 If true, allows the user to pan around the map. If false, the camera stays locked at the current position. This flag only applies in 2D and Columbus view modes.
默认值: Default Value: true
如果为 true,则允许用户放大和缩小。如果为 false,相机将锁定到距椭球体的当前距离。 If true, allows the user to zoom in and out. If false, the camera is locked to the current distance from the ellipsoid.
默认值: Default Value: true
范围内的参数 A parameter in the range [0, 1) 用于确定相机由于惯性将继续旋转多长时间。当值为零时,相机将没有惯性。 used to determine how long the camera will continue to spin because of inertia. With value of zero, the camera will have no inertia.
默认值: Default Value: 0.9
范围内的参数 A parameter in the range [0, 1) 用于确定相机由于惯性将继续平移多长时间。当值为零时,相机将没有惯性。 used to determine how long the camera will continue to translate because of inertia. With value of zero, the camera will have no inertia.
默认值: Default Value: 0.9
范围内的参数 A parameter in the range [0, 1) 用于确定相机由于惯性而继续变焦多长时间。当值为零时,相机将没有惯性。 used to determine how long the camera will continue to zoom because of inertia. With value of zero, the camera will have no inertia.
默认值: Default Value: 0.8
允许用户更改相机观看方向的输入。这仅适用于 3D 和哥伦布视图模式。 The input that allows the user to change the direction the camera is viewing. This only applies in 3D and Columbus view modes.

类型可以是 The type can be a CameraEventType, undefined,一个物体 , an object with eventType and modifier 具有类型的属性 properties with types CameraEventType and KeyboardEventModifier,或任何前述的数组。 , or an array of any of the preceding.

默认值: Default Value: { eventType : CameraEventType.LEFT_DRAG, modifier : KeyboardEventModifier.SHIFT }
范围内的参数 A parameter in the range [0, 1) 用于将各种用户输入的范围限制为每个动画帧的窗口宽度/高度的百分比。这有助于在低帧速率情况下保持相机的控制。 used to limit the range of various user inputs to a percentage of the window width/height per animation frame. This helps keep the camera under control in low-frame-rate situations.
默认值: Default Value: 0.1

maximumTiltAngle : number|undefined

相对于椭球法线的角度,限制用户可以倾斜相机的最大量。如果 The angle, relative to the ellipsoid normal, restricting the maximum amount that the user can tilt the camera. If undefined,相机倾斜角度不受限制。 , the angle of the camera tilt is unrestricted.
默认值: Default Value: undefined
示例: Example:
// Prevent the camera from tilting below the ellipsoid surface
viewer.scene.screenSpaceCameraController.maximumTiltAngle = Math.PI / 2.0;
变焦时相机位置的最大幅度(以米为单位)。默认为正无穷大。 The maximum magnitude, in meters, of the camera position when zooming. Defaults to positive infinity.
默认值: Default Value: Number.POSITIVE_INFINITY

minimumCollisionTerrainHeight : number

在测试与地形碰撞之前相机必须达到的最小高度。当使用除 WGS84 之外的另一个椭球体时,默认为 scene.ellipsoid.minimumRadius * 0.0025。 The minimum height the camera must be before testing for collision with terrain. Default to scene.ellipsoid.minimumRadius * 0.0025 when another ellipsoid than WGS84 is used.
默认值: Default Value: 15000.0 or scene.ellipsoid.minimumRadius * 0.0025.

minimumPickingTerrainDistanceWithInertia : number

当惯性变焦时,在测试与地形碰撞之前相机必须保持的最小距离。当使用除 WGS84 之外的另一个椭球体时,默认为 scene.ellipsoid.minimumRadius * 0.00063。 The minimum distance the camera must be before testing for collision with terrain when zoom with inertia. Default to scene.ellipsoid.minimumRadius * 0.00063 when another ellipsoid than WGS84 is used.
默认值: Default Value: 4000.0 or scene.ellipsoid.minimumRadius * 0.00063

minimumPickingTerrainHeight : number

在拾取地形或场景内容而不是椭球体之前相机必须达到的最小高度。当使用除 WGS84 之外的其他椭球体时,默认为 scene.ellipsoid.minimumRadius * 0.025。 The minimum height the camera must be before picking the terrain or scene content instead of the ellipsoid. Defaults to scene.ellipsoid.minimumRadius * 0.025 when another ellipsoid than WGS84 is used.
默认值: Default Value: 150000.0 or scene.ellipsoid.minimumRadius * 0.025
当点击来自天空或太空时,从旋转轨迹球切换到自由观察之前相机必须达到的最小高度。当使用除 WGS84 之外的另一个椭球体时,默认为 ellipsoid.minimumRadius * 1.175。 The minimum height the camera must be before switching from rotating a track ball to free look when clicks originate on the sky or in space. Defaults to ellipsoid.minimumRadius * 1.175 when another ellipsoid than WGS84 is used.
默认值: Default Value: 7500000.0 or scene.ellipsoid.minimumRadius * 1.175
变焦时相机位置的最小幅度(以米为单位)。默认为 1.0。 The minimum magnitude, in meters, of the camera position when zooming. Defaults to 1.0.
默认值: Default Value: 1.0
允许用户围绕地球或其他对象旋转的输入。这仅适用于 3D 和哥伦布视图模式。 The input that allows the user to rotate around the globe or another object. This only applies in 3D and Columbus view modes.

类型可以是 The type can be a CameraEventType, undefined,一个物体 , an object with eventType and modifier 具有类型的属性 properties with types CameraEventType and KeyboardEventModifier,或任何前述的数组。 , or an array of any of the preceding.

默认值: Default Value: CameraEventType.LEFT_DRAG
允许用户在 3D 和哥伦布视图中倾斜或在 2D 中扭曲的输入。 The input that allows the user to tilt in 3D and Columbus view or twist in 2D.

类型可以是 The type can be a CameraEventType, undefined,一个物体 , an object with eventType and modifier 具有类型的属性 properties with types CameraEventType and KeyboardEventModifier,或任何前述的数组。 , or an array of any of the preceding.

默认值: Default Value: [CameraEventType.MIDDLE_DRAG, CameraEventType.PINCH, { eventType : CameraEventType.LEFT_DRAG, modifier : KeyboardEventModifier.CTRL }, { eventType : CameraEventType.RIGHT_DRAG, modifier : KeyboardEventModifier.CTRL }]
允许用户在地图上平移的输入。这仅适用于 2D 和 Columbus 视图模式。 The input that allows the user to pan around the map. This only applies in 2D and Columbus view modes.

类型可以是 The type can be a CameraEventType, undefined,一个物体 , an object with eventType and modifier 具有类型的属性 properties with types CameraEventType and KeyboardEventModifier,或任何前述的数组。 , or an array of any of the preceding.

默认值: Default Value: CameraEventType.LEFT_DRAG
允许用户放大/缩小的输入。 The input that allows the user to zoom in/out.

类型可以是 The type can be a CameraEventType, undefined,一个物体 , an object with eventType and modifier 具有类型的属性 properties with types CameraEventType and KeyboardEventModifier,或任何前述的数组。 , or an array of any of the preceding.

默认值: Default Value: [CameraEventType.RIGHT_DRAG, CameraEventType.WHEEL, CameraEventType.PINCH]
相机变焦速度的乘数。 A multiplier for the speed at which the camera will zoom.
默认值: Default Value: 5.0

方法 Methods

删除该对象持有的鼠标侦听器。 Removes mouse listeners held by this object.

一旦对象被销毁,就不应再使用;调用除 Once an object is destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.
抛出: Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
示例: Example:
controller = controller && controller.destroy();
另见: See:
如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.

如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError exception.
返回: Returns:
true 如果该物体被摧毁;否则, if this object was destroyed; otherwise, false.
另见: See:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.