ui.Map.setControlVisibility
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Đặt chế độ hiển thị của các nút điều khiển trên bản đồ.
Trả về ui.Map này.
Cách sử dụng | Giá trị trả về |
---|
Map.setControlVisibility(all, layerList, zoomControl, scaleControl, mapTypeControl, fullscreenControl, drawingToolsControl) | ui.Map |
Đối số | Loại | Thông tin chi tiết |
---|
this: ui.map | ui.Map | Đối tượng ui.Map. |
all | Boolean, không bắt buộc | Có hiện tất cả chế độ điều khiển hay không. False sẽ ẩn tất cả chế độ điều khiển; true sẽ hiện tất cả chế độ điều khiển. Bị các thông số được đặt riêng lẻ ghi đè. Xin lưu ý rằng việc đặt chế độ này một cách rõ ràng sẽ ảnh hưởng đến mọi chế độ kiểm soát bổ sung được thêm trong tương lai. |
layerList | Boolean, không bắt buộc | Khi là false, sẽ ẩn bảng điều khiển danh sách lớp hoặc khi là true, sẽ cho phép xác định khả năng hiển thị của bảng điều khiển danh sách lớp dựa trên sự hiện diện của các lớp trong danh sách. Theo mặc định, danh sách sẽ xuất hiện. |
zoomControl | Boolean, không bắt buộc | Liệu chế độ thu phóng có hiển thị hay không. Giá trị mặc định là đúng. |
scaleControl | Boolean, không bắt buộc | Có hiển thị chế độ kiểm soát cho biết tỷ lệ ở mức thu phóng hiện tại của bản đồ hay không. Giá trị mặc định là đúng. |
mapTypeControl | Boolean, không bắt buộc | Có hiển thị chế độ kiểm soát cho phép người dùng thay đổi bản đồ cơ sở hay không. Giá trị mặc định là đúng. |
fullscreenControl | Boolean, không bắt buộc | Có hiển thị chế độ điều khiển cho phép người dùng chuyển bản đồ sang chế độ toàn màn hình hay không. Giá trị mặc định là đúng. |
drawingToolsControl | Boolean, không bắt buộc | Có hiển thị chế độ kiểm soát cho phép người dùng thêm hoặc chỉnh sửa các công cụ vẽ hình học hay không. Mặc định là true nếu các công cụ vẽ đã được thêm vào bản đồ trước đó. Bị bỏ qua nếu trước đó bạn chưa thêm các công cụ vẽ vào bản đồ. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\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. |"]]