当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


JavaScript ArcGIS Camera.heading用法及代码示例


基本信息

以下是所在类或对象的基本信息。

AMD: require(["esri/Camera"], (Camera) => { /* code goes here */ });

ESM: import Camera from "@arcgis/core/Camera";

类: esri/Camera

继承: Camera > Accessor

自从:用于 JavaScript 4.0 的 ArcGIS API

用法说明

Camera.heading函数(或属性)的定义如下:

heading Number


以度为单位的相机指南针航向。当北为屏幕顶部时,航向为零。它随着视图顺时针旋转而增加。角度始终在 0 到 360 度之间进行归一化。

默认值:0

例子:

// Initialize the view with a specific camera
const cam = new Camera({
  heading: 90, // face due east
  tilt: 45, // looking from a bird's eye view
  position: [ -122, 38, 20000 ]  // creates a point instance (x,y,z)
});
// Initialize the view with a specific camera
const cam = new Camera({
  heading: 90, // face due east
  tilt: 45, // looking from a bird's eye view
  position: {
    latitude: 38,
    longitude: -122,
    z: 20000,
    spatialReference: { wkid: 3857 }
  }
});

view.camera = cam;
// Set the heading of the view's camera to 180 degrees
const newCam = view.camera.clone();
newCam.heading = 180;
view.camera = newCam;
// go to the pt geometry facing due south
view.goTo({ target: pt, heading: 180 });

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 Camera.heading。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。