/
cesiumwidget.py
52 lines (43 loc) · 1.78 KB
/
cesiumwidget.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
from ipywidgets import DOMWidget
from traitlets import (
Bool,
CaselessStrEnum,
Float,
List,
Unicode,
Tuple,
)
class CesiumWidget(DOMWidget):
# the name of the Backbone.View subclass to be used
_view_name = Unicode('CesiumView', sync=True)
_view_module = Unicode('nbextensions/CesiumWidget/cesium_widget',
sync=True)
czml = Tuple(sync=True)
kml_url = Unicode(sync=True)
geojson = Unicode(sync=True)
_zoomto = List(sync=True, trait=Float, allow_none=True)
_flyto = List(sync=True, trait=Float, allow_none=True)
_zoomtoregion = List(sync=True, trait=Float, allow_none=True)
animation = Bool(True, sync=True)
base_layer_picker = Bool(True, sync=True)
geocoder = Bool(True, sync=True)
home_button = Bool(True, sync=True)
infobox = Bool(True, sync=True)
scene_mode_picker = Bool(True, sync=True)
selection_indicator = Bool(True, sync=True)
timeline = Bool(True, sync=True)
navigation_help_button = Bool(True, sync=True)
navigation_instructions_initially_visible = Bool(False, sync=True)
scene_3D_only = Bool(False, sync=True)
scene_mode = CaselessStrEnum(['COLUMBUS_VIEW', 'SCENE2D', 'SCENE3D'],
default_value='SCENE3D',
allow_none=False,
sync=True)
enable_lighting = Bool(False, sync=True)
def zoom_to(self, lon, lat, alt, heading=0, pitch=-90, roll=0):
self._zoomto = [lon, lat, alt, heading, pitch, roll]
def fly_to(self, lon, lat, alt, heading=0, pitch=-90, roll=0):
self._flyto = [lon, lat, alt, heading, pitch, roll]
def zoom_to_region(self, west, south, east, north):
self._zoomtoregion = [west, south, east, north]