-
Notifications
You must be signed in to change notification settings - Fork 111
Widgets
Rodrigo E. Principe edited this page Mar 15, 2019
·
6 revisions
Custom widgets for the ui
To use it:
var widgets = require('users/fitoprincipe/geetools:widgets')
A Panel with an X
button for "closing" it. To make it work you must add it to another Panel
or Map
with its method addTo
or insertTo
, otherwise it will not be able to close it. Parameters are similar to ui.Panel
. The difference is that it has a parameter inner_style
to set the style for the inner Panel, like backgroundColor
or border
. To close the panel using another widget it has a close
method.
Options:
- widgets: a list of widgets to add to the panel
-
style:
- position: position of the panel
- backgroundColor: background color of the panel
- margin: margin of the panel
- shown: shown option of the panel
- border: border of the panel
-
inner_style:
- position: position of the inner panel
- backgroundColor: background color of the inner panel
- margin: margin of the inner panel
- shown: shown option of the inner panel
- layout: layout of the panel
Methods:
- addTo(widget): adds the panel to the parsed widget
- insertTo(widget, position): inserts the panel to the parsed widget in the parsed position
- close(): closes the panel
-
build(): builds the widget. If you need to add the widget without using
addTo
orinsertTo
, use this method to get the actual panel. For example:
var panel = new ClosePanel()
Map.add(panel.build())
example: https://code.earthengine.google.com/07d13af7a46f0c9ca8d908b3cbab068c
Sometimes you need to access new drawn geometries to do some process within an app, but you cannot access the geometries scope. Options are:
- width: panel width
- height: panel height
- border: panel border (example: '1px solid black')
- position: panel position (example: 'top-center')
- layout: panel layout (example: ui.Panel.Layout.flow('vertical'))
- drawings: the type of drawings to include in dropdown, currently only 'polygon' is available
-
map: the map instance. Defaults to
Map
- map_callback: if the map has already a callback for onClick, must be provided here to recover it
- map_callback_id: if the map has already a callback for onClick, must be provided its ID here to recover it
- title: a title for the panel
example: https://code.earthengine.google.com/eea12e7b2bdcc153ec6420d3cc893b98
- @author: Rodrigo E. Principe
- email: fitoprincipe82 at gmail
- Licence: MIT