公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ui.Map.setControlVisibility
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
設定地圖上控制項的顯示設定。
傳回這個 ui.Map。
用量 | 傳回 |
---|
Map.setControlVisibility(all, layerList, zoomControl, scaleControl, mapTypeControl, fullscreenControl, drawingToolsControl) | ui.Map |
引數 | 類型 | 詳細資料 |
---|
這個:ui.map | ui.Map | ui.Map 執行個體。 |
all | 布林值 (選填) | 是否顯示所有控制選項。如果設為 False,系統會隱藏所有控制項;如果設為 True,系統會顯示所有控制項。由個別設定的參數覆寫。請注意,明確設定這項屬性會影響日後新增的任何其他控制項。 |
layerList | 布林值 (選填) | 如果設為 false,系統會隱藏圖層清單面板;如果設為 true,系統會根據清單中是否有圖層,決定是否顯示圖層清單面板。預設為顯示清單。 |
zoomControl | 布林值 (選填) | 縮放控制項是否顯示在畫面上。預設為 true。 |
scaleControl | 布林值 (選填) | 是否顯示控制項,指出地圖目前縮放等級的比例。預設為 true。 |
mapTypeControl | 布林值 (選填) | 是否顯示可讓使用者變更基本地圖的控制項。預設為 true。 |
fullscreenControl | 布林值 (選填) | 是否顯示可讓使用者將地圖設為全螢幕的控制項。預設為 true。 |
drawingToolsControl | 布林值 (選填) | 是否顯示可供使用者新增或編輯幾何圖形繪圖工具的控制項。如果先前已將繪圖工具新增至地圖,預設值為 true。如果先前未將繪圖工具新增至地圖,系統會忽略這項要求。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eControls the visibility of map elements like zoom, scale, layer list, and map type selection.\u003c/p\u003e\n"],["\u003cp\u003eAllows for customization by showing or hiding individual controls or all at once.\u003c/p\u003e\n"],["\u003cp\u003eUses Boolean values (true/false) to set the visibility of each control element.\u003c/p\u003e\n"],["\u003cp\u003eProvides control over the fullscreen and drawing tools visibility, if enabled on the map.\u003c/p\u003e\n"],["\u003cp\u003eAffects the display of the layer list panel based on the presence of layers and user preference.\u003c/p\u003e\n"]]],["The `Map.setControlVisibility` function modifies the visibility of map controls. It accepts boolean arguments to show or hide controls: `all`, `layerList`, `zoomControl`, `scaleControl`, `mapTypeControl`, `fullscreenControl`, and `drawingToolsControl`. Setting `all` to true/false shows/hides all controls unless overridden. `layerList` determines the visibility of the layer list panel. The function returns the modified `ui.Map` instance, and each control defaults to visible (true), except `drawingToolsControl` that needs the drawing tools to have been added before.\n"],null,["# ui.Map.setControlVisibility\n\n\u003cbr /\u003e\n\nSets the visibility of the controls on the map.\n\n\u003cbr /\u003e\n\nReturns this ui.Map.\n\n| Usage | Returns |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| Map.setControlVisibility`(`*all* `, `*layerList* `, `*zoomControl* `, `*scaleControl* `, `*mapTypeControl* `, `*fullscreenControl* `, `*drawingToolsControl*`)` | ui.Map |\n\n| Argument | Type | Details |\n|-----------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.map` | ui.Map | The ui.Map instance. |\n| `all` | Boolean, optional | Whether to show all controls. False hides all controls; true shows all controls. Overridden by individually set parameters. Note that setting this explicitly will affect any additional controls added in the future. |\n| `layerList` | Boolean, optional | When false, hides the layer list panel or, when true, allows the layer list panel's visibility to be determined by the presence of layers in the list. The default is to show the list. |\n| `zoomControl` | Boolean, optional | Whether the zoom control is visible. Defaults to true. |\n| `scaleControl` | Boolean, optional | Whether to show the control which indicates the scale at the map's current zoom level. Defaults to true. |\n| `mapTypeControl` | Boolean, optional | Whether to show the control that allows the user to change the base map. Defaults to true. |\n| `fullscreenControl` | Boolean, optional | Whether to show the control that allows the user to make the map full-screen. Defaults to true. |\n| `drawingToolsControl` | Boolean, optional | Whether to show the control that allows the user to add or edit the geometry drawing tools. Defaults to true if the drawing tools were previously added to the map. Ignored if the drawing tools were not previously added to the map. |"]]