相机由位置,方向,和视图的frustum来定义.
The orientation forms an orthonormal basis with a view, up and right = view x up unit vectors.
观景浮雕由6架飞机定义. Each plane is represented by a
The orientation forms an orthonormal basis with a view, up and right = view x up unit vectors.
观景浮雕由6架飞机定义. Each plane is represented by a
Cartesian4 object, where the x, y, and z components
定义平面正常的单位矢量, w 组件是
飞机从原产地/相机位置起飞.
| Name | Type | Description |
|---|---|---|
scene |
Scene | The scene. |
Example:
// Create a camera looking down the negative z-axis, positioned at the origin,
// with a field of view of 60 degrees, and 1:1 aspect ratio.
const camera = new Cesium.Camera(scene);
camera.position = new Cesium.Cartesian3();
camera.direction = Cesium.Cartesian3.negate(Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3());
camera.up = Cesium.Cartesian3.clone(Cesium.Cartesian3.UNIT_Y);
camera.frustum.fov = Cesium.Math.PI_OVER_THREE;
camera.frustum.near = 1.0;
camera.frustum.far = 2.0;
Demo:
Members
static Cesium.Camera.DEFAULT_OFFSET : HeadingPitchRange
默认的标题/pitch/range,用于摄影机飞行到包含一个边框的位置时.
用于放大到相机位置的Scalar,在设置相机后再添加回以查看矩形.
A value of zero means the camera will view the entire
Camera#DEFAULT_VIEW_RECTANGLE, a value greater than zero
值小于零将移动到接近程度.
static Cesium.Camera.DEFAULT_VIEW_RECTANGLE : Rectangle
默认的矩形相机将在创建时查看 .
readonly changed : Event
获取相机更改时将提起的事件 .
constrainedAxis : Cartesian3|undefined
如果设定, 相机将无法通过此轴向两个方向旋转 .
-
Default Value:
undefined
当一个参数不是旋转相机时默认值
提供外观方法.
-
Default Value:
Math.PI / 60.0
参数不时移动相机的默认值
用于移动方法.
-
Default Value:
100000.0;
当一个参数不是旋转相机时默认值
提供轮换方法.
-
Default Value:
Math.PI / 3600.0
参数不时移动相机的默认值
为缩放方法提供.
-
Default Value:
100000.0;
direction : Cartesian3
镜头的视野方向.
readonly directionWC : Cartesian3
获得世界坐标中相机的视图方向.
视空间区域.
-
Default Value:
PerspectiveFrustum()
See:
把摄像头用弧度拍下来.
readonly inverseTransform : Matrix4
得到反相机转换.
-
Default Value:
Matrix4.IDENTITY
readonly inverseViewMatrix : Matrix4
获得反视图矩阵.
See:
乘以用于确定照相机位置的地图大小
当从表面放大。 默认值为1.5. 只对2D有效,且地图可旋转 .
-
Default Value:
1.5
readonly moveEnd : Event
获取相机停止移动时将提起的事件 .
readonly moveStart : Event
获取相机开始移动时要提起的事件 .
摄像头在 NT 0 更改 NT 1 事件提出前必须更改的金额. 该值为[0, 1]范围内的一个百分比.
-
Default Value:
0.5
得到摄像头的弧度.
position : Cartesian3
摄像头的位置.
readonly positionCartographic : Cartographic
Gets the
Cartographic position of the camera, with longitude and latitude
以弧度表示,高度以米计。 在2D和哥伦布景区,这是可能的
使返回的经度和纬度超出有效的经度范围
并显示相机在地图外的纬度.
readonly positionWC : Cartesian3
获得相机在世界坐标中的位置.
right : Cartesian3
摄影机的正确方向.
readonly rightWC : Cartesian3
获得世界坐标中摄影机的正确方向.
摄像头卷在弧度.
readonly transform : Matrix4
获得相机的参考框架. 这种转变的反向性附在视图矩阵上.
-
Default Value:
Matrix4.IDENTITY
up : Cartesian3
摄影机的方向.
readonly upWC : Cartesian3
获得世界坐标中镜头的上升方向.
readonly viewMatrix : Matrix4
获取视图矩阵.
Methods
cameraToWorldCoordinates(cartesian, result) → Cartesian4
将一个矢量或点从相机的参考框转换成世界坐标.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 矢量或指变. |
result |
Cartesian4 | optional 存储结果的对象 . |
Returns:
变向量或点.
cameraToWorldCoordinatesPoint(cartesian, result) → Cartesian3
将一个点从镜头的参考框转换成世界坐标.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 变之点. |
result |
Cartesian3 | optional 存储结果的对象 . |
Returns:
变形点.
cameraToWorldCoordinatesVector(cartesian, result) → Cartesian3
将相机参考框中的矢量转换为世界坐标.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 向量变化. |
result |
Cartesian3 | optional 存储结果的对象 . |
Returns:
变形向量.
取消当前相机飞行,将相机留在当前位置.
如果没有飞行进行中,此功能将毫无作用.
完成当前相机飞行,将相机立即移动至最终目的地.
如果没有飞行进行中,此功能将毫无作用.
computeViewRectangle(ellipsoid, result) → Rectangle|undefined
计算椭圆上大约可见矩形.
| Name | Type | Default | Description |
|---|---|---|---|
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid that you want to know the visible region. |
result |
Rectangle | optional 存储结果的矩形 |
Returns:
如果椭圆完全不可见,则可见的矩形或未定义.
将相机的距离还原到边缘球体的前方.
| Name | Type | Description |
|---|---|---|
boundingSphere |
BoundingSphere | 地球的界域坐标. |
Returns:
与界域的距离.
Fly the camera to the home view. Use
Camera#.DEFAULT_VIEW_RECTANGLE to set
3D场景的默认视图。 2D和Columbus视图的主视图显示
entire map.
| Name | Type | Description |
|---|---|---|
duration |
number |
optional
The duration of the flight in seconds. If omitted, Cesium attempts to calculate an ideal duration based on the distance to be traveled by the flight. See Camera#flyTo |
把相机从现在的位置飞到一个新的位置.
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
下列属性的对象 :
|
Throws:
-
DeveloperError : If either direction or up is given, then both are required.
Example:
// 1. Fly to a position with a top-down view
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
});
// 2. Fly to a Rectangle with a top-down view
viewer.camera.flyTo({
destination : Cesium.Rectangle.fromDegrees(west, south, east, north)
});
// 3. Fly to a position with an orientation using unit vectors.
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
orientation : {
direction : new Cesium.Cartesian3(-0.04231243104240401, -0.20123236049443421, -0.97862924300734),
up : new Cesium.Cartesian3(-0.47934589305293746, -0.8553216253114552, 0.1966022179118339)
}
});
// 4. Fly to a position with an orientation using heading, pitch and roll.
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
orientation : {
heading : Cesium.Math.toRadians(175.0),
pitch : Cesium.Math.toRadians(-35.0),
roll : 0.0
}
});
将相机飞到当前视图包含所提供约束球体的位置.
-NT=0=- 翻译: 页:1.
标题和投球角度在局部的东-北上参考框中定义.
标题是Y轴的角度,向x轴增加。 皮奇是Xy飞机的旋转 正投篮
角度在飞机下方。 负投角位于飞机上方. 范围是中心距离. 如果范围是
0, 将计算一个范围, 使整个边框为 NT% 1
在2D和哥伦布景区,必须有一个上下视图. 摄像头会放在目标上方 上面的高处
target will be the range. The heading will be aligned to local north.
| Name | Type | Description | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
boundingSphere |
BoundingSphere | 在世界坐标中,有界域可视. | |||||||||||||||||||||||||||||||||
options |
object |
optional
下列属性的对象 :
|
获取相机位置的大小 。 在3D中,这是矢量级. 在二维和
哥伦布风景,这是距离地图.
Returns:
方位之广.
getPickRay(windowPosition, result) → Ray|undefined
从相机位置通过像素在 NT 0 窗口Postition NT % 1 创建射线
世界坐标.
| Name | Type | Description |
|---|---|---|
windowPosition |
Cartesian2 | 一个像素的x和y坐标. |
result |
Ray | optional 存储结果的对象 . |
Returns:
Returns the
Cartesian3 position and direction of the ray, or undefined if the pick ray cannot be determined.
以米计返回像素大小.
| Name | Type | Description |
|---|---|---|
boundingSphere |
BoundingSphere | 地球的界域坐标. |
drawingBufferWidth |
number | 绘图缓冲宽度 . |
drawingBufferHeight |
number | 绘画缓冲高度. |
Returns:
以米计的像素大小.
getRectangleCameraCoordinates(rectangle, result) → Cartesian3
获取在椭圆形或地图上查看矩形所需的相机位置
| Name | Type | Description |
|---|---|---|
rectangle |
Rectangle | 长方形取景. |
result |
Cartesian3 | optional 查看矩形所需的相机位置 |
Returns:
查看矩形所需的相机位置
由 NT 2 angle NT 3 左右旋转相机的每个方向向量
| Name | Type | Description |
|---|---|---|
axis |
Cartesian3 | 旋转的轴. |
angle |
number | optional 角度,用弧度来旋转 默认为 NT 0 defaultLookAmount NT 1 . |
使用目标设置相机位置和方向,并进行偏移。 目标必须在
世界坐标。 偏移可以是以目标为中心的当地东-北参照框中的笛卡尔或标题/pitch/距离.
If the offset is a cartesian, then it is an offset from the center of the reference frame defined by the transformation matrix. If the offset
是标题/pitch/range,然后在变换矩阵定义的参考框中定义标题和投球角度.
标题是Y轴的角度,向x轴增加。 皮奇是Xy飞机的旋转 正投篮
角度在飞机下方。 负投角位于飞机上方. 范围是中心距离.
在2D中,必须有一个上下视图. 摄像头会放在目标上方 上面的高处
目标将是抵消的幅度。 该标题将由抵消部分确定。 如果标题不能是
由乘数决定,航向为北.
| Name | Type | Description |
|---|---|---|
target |
Cartesian3 | 世界坐标中的目标位置. |
offset |
Cartesian3 | HeadingPitchRange | 与以目标为中心的地方东北参照框架内的目标相抵. |
Throws:
-
DeveloperError : lookAt is not supported while morphing.
Example:
// 1. Using a cartesian offset
const center = Cesium.Cartesian3.fromDegrees(-98.0, 40.0);
viewer.camera.lookAt(center, new Cesium.Cartesian3(0.0, -4790000.0, 3930000.0));
// 2. Using a HeadingPitchRange offset
const center = Cesium.Cartesian3.fromDegrees(-72.0, 40.0);
const heading = Cesium.Math.toRadians(50.0);
const pitch = Cesium.Math.toRadians(-20.0);
const range = 5000.0;
viewer.camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));
使用目标和变换矩阵设定相机位置和方向。 偏移可以是笛卡尔或标题/pitch/距离.
If the offset is a cartesian, then it is an offset from the center of the reference frame defined by the transformation matrix. If the offset
是标题/pitch/range,然后在变换矩阵定义的参考框中定义标题和投球角度.
标题是Y轴的角度,向x轴增加。 皮奇是Xy飞机的旋转 正投篮
角度在飞机下方。 负投角位于飞机上方. 范围是中心距离.
在2D中,必须有一个上下视图. 相机将放置在参考框架中心之上. 上面的高处
目标将是抵消的幅度。 该标题将由抵消部分确定。 如果标题不能是
由乘数决定,航向为北.
| Name | Type | Description |
|---|---|---|
transform |
Matrix4 | 定义参考框架的变换矩阵. |
offset |
Cartesian3 | HeadingPitchRange | optional 与以目标为中心的参考框架内的目标相抵. |
Throws:
-
DeveloperError : lookAtTransform is not supported while morphing.
Example:
// 1. Using a cartesian offset
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-98.0, 40.0));
viewer.camera.lookAtTransform(transform, new Cesium.Cartesian3(0.0, -4790000.0, 3930000.0));
// 2. Using a HeadingPitchRange offset
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-72.0, 40.0));
const heading = Cesium.Math.toRadians(50.0);
const pitch = Cesium.Math.toRadians(-20.0);
const range = 5000.0;
viewer.camera.lookAtTransform(transform, new Cesium.HeadingPitchRange(heading, pitch, range));
将相机绕其右向量旋转,以弧度表示,方向相反
,如果不是2D模式的话.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 以弧度表示的数值,可以旋转. 默认为 NT 0 defaultLookAmount NT 1 . |
See:
按数值旋转相机, 以弧度表示, 方向相反
,如果不是2D模式.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 以弧度表示的数值,可以旋转. 默认为 NT 0 defaultLookAmount NT 1 . |
See:
以弧度为单位,将相机绕向向量旋转
,如果不是2D模式.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 以弧度表示的数值,可以旋转. 默认为 NT 0 defaultLookAmount NT 1 . |
See:
将相机绕其右向量旋转,以弧度表示,方向
,如果不是2D模式的话.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 以弧度表示的数值,可以旋转. 默认为 NT 0 defaultLookAmount NT 1 . |
See:
将相机位置由 NT 0 amount NT 1 沿 NT 2 方向 NT 3 翻译.
| Name | Type | Description |
|---|---|---|
direction |
Cartesian3 | 前进方向. |
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
将相机位置由 NT 0 amount NT 1 按相反方向翻译
显示相机的视图矢量.
在2D模式下,这将会放大镜头,而不是翻译镜头的位置.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
See:
将相机位置由 NT 0 amount NT 1 按相反方向翻译
摄像机的上升向量.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
See:
将相机的位置由 NT 0 amount NT 1 沿相机的视野向量翻译.
当在2D模式下,这个会放大相机,而不是翻译相机的位置.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
See:
将相机位置由 NT 0 amount NT 1 按相反方向翻译
摄影机右向量.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
See:
按摄像头的右向量翻译摄像头位置 .
| Name | Type | Description |
|---|---|---|
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
See:
将相机位置由 NT 0 amount NT 1 沿相机的上升向量翻译.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 数量,以米计,移动。 默认为 NT 0 defaultMoveAmont NT 1 . |
See:
pickEllipsoid(windowPosition, ellipsoid, result) → Cartesian3|undefined
选择椭圆形或地图.
| Name | Type | Default | Description |
|---|---|---|---|
windowPosition |
Cartesian2 | 一个像素的x和y坐标. | |
ellipsoid |
Ellipsoid |
Ellipsoid.default
|
optional The ellipsoid to pick. |
result |
Cartesian3 | optional 存储结果的对象 . |
Returns:
如果选中椭圆形或地图,
返回世界椭圆形或地图表面的点
坐标。 如果未选中椭圆形或地图, 则返回未定义 .
Example:
const canvas = viewer.scene.canvas;
const center = new Cesium.Cartesian2(canvas.clientWidth / 2.0, canvas.clientHeight / 2.0);
const ellipsoid = viewer.scene.ellipsoid;
const result = viewer.camera.pickEllipsoid(center, ellipsoid);
由 NT 2 angle NT 3 左右旋转相机。 距离
镜头在镜头参考框中央的位置保持不变.
| Name | Type | Description |
|---|---|---|
axis |
Cartesian3 | 环绕世界坐标旋转的轴. |
angle |
number | optional 角度,用弧度来旋转 默认为 NT 0 defaultRotateAmont NT 1 . |
以角度向下旋转相机在相机参考框架中心周围.
| Name | Type | Description |
|---|---|---|
angle |
number | optional 角度,用弧度来旋转 默认为 NT 0 defaultRotateAmont NT 1 . |
将相机绕相机参考框中心以角度向左旋转.
| Name | Type | Description |
|---|---|---|
angle |
number | optional 角度,用弧度来旋转 默认为 NT 0 defaultRotateAmont NT 1 . |
按角度向右旋转相机在相机参考框中心周围.
| Name | Type | Description |
|---|---|---|
angle |
number | optional 角度,用弧度来旋转 默认为 NT 0 defaultRotateAmont NT 1 . |
以角度向上旋转相机在相机参考框架中心周围.
| Name | Type | Description |
|---|---|---|
angle |
number | optional 角度,用弧度来旋转 默认为 NT 0 defaultRotateAmont NT 1 . |
设置相机位置,方向和变换.
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
下列属性的对象 :
|
Example:
// 1. Set position with a top-down view
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
});
// 2 Set view with heading, pitch and roll
viewer.camera.setView({
destination : cartesianPosition,
orientation: {
heading : Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
pitch : Cesium.Math.toRadians(-90), // default value (looking down)
roll : 0.0 // default value
}
});
// 3. Change heading, pitch and roll with the camera position remaining the same.
viewer.camera.setView({
orientation: {
heading : Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
pitch : Cesium.Math.toRadians(-90), // default value (looking down)
roll : 0.0 // default value
}
});
// 4. View rectangle with a top-down view
viewer.camera.setView({
destination : Cesium.Rectangle.fromDegrees(west, south, east, north)
});
// 5. Set position with an orientation using unit vectors.
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
orientation : {
direction : new Cesium.Cartesian3(-0.04231243104240401, -0.20123236049443421, -0.97862924300734),
up : new Cesium.Cartesian3(-0.47934589305293746, -0.8553216253114552, 0.1966022179118339)
}
});
将frustum/投影切换为正图.
此函数在 2D 中为禁用, 它将永远为正图 .
将frustum/预测切换为视角.
此函数在 2D 中为禁用, 它必须始终为正图 .
相机逆时针绕方向向量旋转,以弧度表示.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 以弧度表示的数值,可以旋转. 默认为 NT 0 defaultLookAmount NT 1 . |
See:
按数值顺时针旋转相机方向矢量,以弧度表示.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 以弧度表示的数值,可以旋转. 默认为 NT 0 defaultLookAmount NT 1 . |
See:
设置相机,使当前视图包含提供的边框.
-NT=0=- 翻译: 页:1.
标题和投球角度在局部的东-北上参考框中定义.
标题是Y轴的角度,向x轴增加。 皮奇是Xy飞机的旋转 正投篮
角度在飞机下方。 负投角位于飞机上方. 范围是中心距离. 如果范围是
0, 将计算一个范围, 使整个边框为 NT% 1
NT 0 在2D中,必须有一个上下视图. 摄像头会放在目标上方 上面的高处
目标将是范围。 该标题将由抵消部分确定。 如果标题不能是
由冲抵确定,标题为 NT
| Name | Type | Description |
|---|---|---|
boundingSphere |
BoundingSphere | 在世界坐标中,有界域可视. |
offset |
HeadingPitchRange | optional 与以目标为中心的地方东北参照框架内的目标相抵. |
Throws:
-
DeveloperError : viewBoundingSphere is not supported while morphing.
worldToCameraCoordinates(cartesian, result) → Cartesian4
从世界坐标转换一个矢量或点到镜头的参考框架.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian4 | 矢量或指变. |
result |
Cartesian4 | optional 存储结果的对象 . |
Returns:
变向量或点.
worldToCameraCoordinatesPoint(cartesian, result) → Cartesian3
将一个点从世界坐标转换成镜头的参考框架.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 变之点. |
result |
Cartesian3 | optional 存储结果的对象 . |
Returns:
变形点.
worldToCameraCoordinatesVector(cartesian, result) → Cartesian3
从世界坐标转换一个矢量到相机的参考框架.
| Name | Type | Description |
|---|---|---|
cartesian |
Cartesian3 | 向量变化. |
result |
Cartesian3 | optional 存储结果的对象 . |
Returns:
变形向量.
缩放 NT 0 amount NT 1 沿着摄像机的视野向量.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 移动的金额。 默认为 NT 0 defaultZoomAmont NT 1 . |
See:
按相反方向缩放 NT 0 amount NT 1
相机的视图矢量.
| Name | Type | Description |
|---|---|---|
amount |
number | optional 移动的金额。 默认为 NT 0 defaultZoomAmont NT 1 . |