當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。