Map.setControlVisibility
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Définit la visibilité des commandes sur la carte.
Renvoie cette ui.Map.
Utilisation | Renvoie |
---|
Map.setControlVisibility(all, layerList, zoomControl, scaleControl, mapTypeControl, fullscreenControl, drawingToolsControl) | ui.Map |
Argument | Type | Détails |
---|
all | Booléen, facultatif | Indique s'il faut afficher toutes les commandes. "False" masque toutes les commandes, tandis que "true" les affiche toutes. Remplacé par les paramètres définis individuellement. Notez que si vous définissez explicitement ce paramètre, cela affectera tous les contrôles supplémentaires ajoutés à l'avenir. |
layerList | Booléen, facultatif | Si la valeur est "false", le panneau de la liste des calques est masqué. Si la valeur est "true", la visibilité du panneau de la liste des calques est déterminée par la présence de calques dans la liste. Par défaut, la liste est affichée. |
zoomControl | Booléen, facultatif | Indique si la commande de zoom est visible. La valeur par défaut est "true". |
scaleControl | Booléen, facultatif | Indique si la commande qui affiche l'échelle au niveau de zoom actuel de la carte doit être affichée. La valeur par défaut est "true". |
mapTypeControl | Booléen, facultatif | Indique s'il faut afficher le contrôle qui permet à l'utilisateur de modifier la carte de base. La valeur par défaut est "true". |
fullscreenControl | Booléen, facultatif | Indique s'il faut afficher le bouton qui permet à l'utilisateur de mettre la carte en plein écran. La valeur par défaut est "true". |
drawingToolsControl | Booléen, facultatif | Indique s'il faut afficher le contrôle qui permet à l'utilisateur d'ajouter ou de modifier les outils de dessin de géométrie. La valeur par défaut est "true". |
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eMap.setControlVisibility()\u003c/code\u003e allows customization of the visibility of map controls, such as zoom, scale, layer list, map type, fullscreen, and drawing tools.\u003c/p\u003e\n"],["\u003cp\u003eControl visibility can be set individually for each control or globally using the \u003ccode\u003eall\u003c/code\u003e parameter, with individual settings overriding the global setting.\u003c/p\u003e\n"],["\u003cp\u003eBy default, all map controls are visible; setting \u003ccode\u003eall\u003c/code\u003e to \u003ccode\u003efalse\u003c/code\u003e will hide all controls, while setting it to \u003ccode\u003etrue\u003c/code\u003e will show all.\u003c/p\u003e\n"],["\u003cp\u003eThe layer list's visibility is influenced by the presence of layers and can be further customized using the \u003ccode\u003elayerList\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],["The `Map.setControlVisibility` function sets the visibility of map controls. It accepts boolean arguments: `all`, `layerList`, `zoomControl`, `scaleControl`, `mapTypeControl`, `fullscreenControl`, and `drawingToolsControl`. `all` toggles all controls, while the others manage individual controls. Defaults for all controls except the layer list are set to show, the default for the layer list is to show if layers are present. The function returns the `ui.Map` object.\n"],null,["# 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| `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. |"]]