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


JavaScript ArcGIS SceneView.center用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

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

ESM: import SceneView from "@arcgis/core/views/SceneView";

類: esri/views/SceneView

繼承: SceneView > View > Accessor

自從:用於 JavaScript 4.0 的 ArcGIS API

用法說明

SceneView.center函數(或屬性)的定義如下:

center Point autocast

來自 Number[]|Object

表示視圖的中心點;設置中心時,您可以傳遞 Point 實例或表示經度/緯度對([-100.4593, 36.9014])的數字數組。設置中心會立即更改當前視圖。要為視圖設置動畫,請參閱 goTo()

如果在構造函數中設置,並且在構造函數中也設置了視點、相機或範圍屬性,則該屬性將被忽略。

center 屬性包含一個內部引用,將來可能會被修改。要保留或修改中心,請使用 center.clone() 創建一個克隆。

在地理或公製坐標係中定義的Z-values 以米為單位。但是,在使用投影坐標係的局部場景中,假定垂直單位與服務指定的水平單位相同。

例子:

// Sets the initial center point of the view to long/lat coordinates
let view = new SceneView({
  center: [-112, 38]
});
// Updates the view's center point to a pre-determined Point object
view.center = new Point({
  x: 12804.24,
  y: -1894032.09,
  z: 12000,

  spatialReference: 2027
});
// view.center needs to be set (not modified in place) to have an effect.
// To modify only the center.x, first clone the current center, modify
// the .x property and then set it on the view.
let center = view.center.clone();

// Offset the center 1km to the east
center.x += 1000;

view.center = center;

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 SceneView.center。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。