-
Couldn't load subscription status.
- Fork 39
feat: Support globe view #908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
02d6e13
View model definitions
kylebarron ab8c55d
Allow none
kylebarron 71b0b4e
Pass in views to Map constructor
kylebarron 4bfd2ba
move html export to separate file
kylebarron f14cdba
move view_state down after view
kylebarron c490176
Set up maplibre basemap widet
kylebarron aaf66a3
Define split renderers
kylebarron ca7bfd4
Implement split renderers
kylebarron a043703
alphabetize
kylebarron fa0940c
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron 879bff0
Merge branch 'main' into kyle/split-renderers2
kylebarron 08ce7f8
Merge branch 'kyle/split-renderers2' into kyle/view-basemap-refactor
kylebarron 18aacb4
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron e185723
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron 05b1ec2
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron 3571acf
reduce diff
kylebarron 2e59606
Support deck views
kylebarron 6ff3540
Apply linear gradient background
kylebarron e846164
Add dark background when in globe view
kylebarron 8c88487
pass undefined when no views passed
kylebarron 188164c
Remove multi-view support for now
kylebarron 89d70eb
fix basemap when constructing `Map` without any parameters
kylebarron 582d606
Let `views` be None
kylebarron 9b8ebcc
remove accidental render_mode
kylebarron d72e7b7
reduce diff
kylebarron 5ff4d12
remove controller
kylebarron a273191
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,253 @@ | ||
| import traitlets as t | ||
|
|
||
| from lonboard._base import BaseWidget | ||
|
|
||
|
|
||
| class BaseView(BaseWidget): | ||
| """A deck.gl View. | ||
|
|
||
| The `View` class and its subclasses are used to specify where and how your deck.gl layers should be rendered. Applications typically instantiate at least one `View` subclass. | ||
|
|
||
| """ | ||
|
|
||
| x = t.Union([t.Int(), t.Unicode()], allow_none=True, default_value=None).tag( | ||
| sync=True, | ||
| ) | ||
| """The x position of the view. | ||
|
|
||
| A relative (e.g. `'50%'`) or absolute position. Default `0`. | ||
| """ | ||
|
|
||
| y = t.Union([t.Int(), t.Unicode()], allow_none=True, default_value=None).tag( | ||
| sync=True, | ||
| ) | ||
| """The y position of the view. | ||
|
|
||
| A relative (e.g. `'50%'`) or absolute position. Default `0`. | ||
| """ | ||
|
|
||
| width = t.Union([t.Int(), t.Unicode()], allow_none=True, default_value=None).tag( | ||
| sync=True, | ||
| ) | ||
| """The width of the view. | ||
|
|
||
| A relative (e.g. `'50%'`) or absolute extent. Default `'100%'`. | ||
| """ | ||
|
|
||
| height = t.Union([t.Int(), t.Unicode()], allow_none=True, default_value=None).tag( | ||
| sync=True, | ||
| ) | ||
| """The height of the view. | ||
|
|
||
| A relative (e.g. `'50%'`) or absolute extent. Default `'100%'`. | ||
| """ | ||
|
|
||
|
|
||
| class FirstPersonView(BaseView): | ||
| """A deck.gl FirstPersonView. | ||
|
|
||
| The `FirstPersonView` class is a subclass of `View` that describes a camera placed at a provided location, looking towards the direction and orientation specified by viewState. The behavior is similar to that of a first-person game. | ||
| """ | ||
|
|
||
| _view_type = t.Unicode("first-person-view").tag(sync=True) | ||
|
|
||
| projection_matrix = t.List( | ||
| t.Float(), | ||
| allow_none=True, | ||
| default_value=None, | ||
| minlen=16, | ||
| maxlen=16, | ||
| ).tag( | ||
| sync=True, | ||
| ) | ||
| """Projection matrix. | ||
|
|
||
| If `projectionMatrix` is not supplied, the `View` class will build a projection matrix from the following parameters: | ||
| """ | ||
|
|
||
| fovy = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Field of view covered by camera, in the perspective case. In degrees. | ||
|
|
||
| Default `50`. | ||
| """ | ||
|
|
||
| near = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of near clipping plane. | ||
|
|
||
| Default `0.1`. | ||
| """ | ||
|
|
||
| far = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of far clipping plane. | ||
|
|
||
| Default `1000`. | ||
| """ | ||
|
|
||
| focal_distance = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Modifier of viewport scale. | ||
|
|
||
| Corresponds to the number of pixels per meter. Default `1`. | ||
| """ | ||
|
|
||
|
|
||
| class GlobeView(BaseView): | ||
| """A deck.gl GlobeView. | ||
|
|
||
| The `GlobeView` class is a subclass of `View`. This view projects the earth into a 3D globe. | ||
| """ | ||
|
|
||
| _view_type = t.Unicode("globe-view").tag(sync=True) | ||
|
|
||
| resolution = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """The resolution at which to turn flat features into 3D meshes, in degrees. | ||
|
|
||
| Smaller numbers will generate more detailed mesh. Default `10`. | ||
| """ | ||
|
|
||
| near_z_multiplier = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Scaler for the near plane, 1 unit equals to the height of the viewport. | ||
|
|
||
| Default to `0.1`. Overwrites the `near` parameter. | ||
| """ | ||
|
|
||
| far_z_multiplier = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Scaler for the far plane, 1 unit equals to the distance from the camera to the top edge of the screen. | ||
|
|
||
| Default to `2`. Overwrites the `far` parameter. | ||
| """ | ||
|
|
||
|
|
||
| class MapView(BaseView): | ||
| """A deck.gl MapView. | ||
|
|
||
| The `MapView` class is a subclass of `View`. This viewport creates a camera that looks at a geospatial location on a map from a certain direction. The behavior of `MapView` is generally modeled after that of Mapbox GL JS. | ||
| """ | ||
|
|
||
| _view_type = t.Unicode("map-view").tag(sync=True) | ||
|
|
||
| repeat = t.Bool(allow_none=True, default_value=None).tag(sync=True) | ||
| """ | ||
| Whether to render multiple copies of the map at low zoom levels. Default `false`. | ||
| """ | ||
|
|
||
| near_z_multiplier = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Scaler for the near plane, 1 unit equals to the height of the viewport. | ||
|
|
||
| Default to `0.1`. Overwrites the `near` parameter. | ||
| """ | ||
|
|
||
| far_z_multiplier = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Scaler for the far plane, 1 unit equals to the distance from the camera to the top edge of the screen. | ||
|
|
||
| Default to `1.01`. Overwrites the `far` parameter. | ||
| """ | ||
|
|
||
| projection_matrix = t.List( | ||
| t.Float(), | ||
| allow_none=True, | ||
| default_value=None, | ||
| minlen=16, | ||
| maxlen=16, | ||
| ).tag( | ||
| sync=True, | ||
| ) | ||
| """Projection matrix. | ||
|
|
||
| If `projectionMatrix` is not supplied, the `View` class will build a projection matrix from the following parameters: | ||
| """ | ||
|
|
||
| fovy = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Field of view covered by camera, in the perspective case. In degrees. | ||
|
|
||
| If not supplied, will be calculated from `altitude`. | ||
| """ | ||
|
|
||
| altitude = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of the camera relative to viewport height. | ||
|
|
||
| Default `1.5`. | ||
| """ | ||
|
|
||
| orthographic = t.Bool(allow_none=True, default_value=None).tag(sync=True) | ||
| """Whether to create an orthographic or perspective projection matrix. | ||
|
|
||
| Default is `false` (perspective projection). | ||
| """ | ||
|
|
||
|
|
||
| class OrbitView(BaseView): | ||
| """A deck.gl OrbitView. | ||
|
|
||
| The `OrbitView` class is a subclass of `View` that creates a 3D camera that rotates around a target position. It is usually used for the examination of a 3D scene in non-geospatial use cases. | ||
| """ | ||
|
|
||
| _view_type = t.Unicode("orbit-view").tag(sync=True) | ||
|
|
||
| orbit_axis = t.Unicode(allow_none=True, default_value=None).tag(sync=True) | ||
| """Axis with 360 degrees rotating freedom, either `'Y'` or `'Z'`, default to `'Z'`.""" | ||
|
|
||
| projection_matrix = t.List( | ||
| t.Float(), | ||
| allow_none=True, | ||
| default_value=None, | ||
| minlen=16, | ||
| maxlen=16, | ||
| ).tag( | ||
| sync=True, | ||
| ) | ||
| """Projection matrix. | ||
|
|
||
| If `projectionMatrix` is not supplied, the `View` class will build a projection matrix from the following parameters: | ||
| """ | ||
|
|
||
| fovy = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Field of view covered by camera, in the perspective case. In degrees. | ||
|
|
||
| Default `50`. | ||
| """ | ||
|
|
||
| near = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of near clipping plane. | ||
|
|
||
| Default `0.1`. | ||
| """ | ||
|
|
||
| far = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of far clipping plane. | ||
|
|
||
| Default `1000`. | ||
| """ | ||
|
|
||
| orthographic = t.Bool(allow_none=True, default_value=None).tag(sync=True) | ||
| """Whether to create an orthographic or perspective projection matrix. | ||
|
|
||
| Default is `false` (perspective projection). | ||
| """ | ||
|
|
||
|
|
||
| class OrthographicView(BaseView): | ||
| """A deck.gl OrthographicView. | ||
|
|
||
| The `OrthographicView` class is a subclass of `View` that creates a top-down view of the XY plane. It is usually used for rendering 2D charts in non-geospatial use cases. | ||
| """ | ||
|
|
||
| _view_type = t.Unicode("orthographic-view").tag(sync=True) | ||
|
|
||
| flip_y = t.Bool(allow_none=True, default_value=None).tag(sync=True) | ||
| """ | ||
| Whether to use top-left coordinates (`true`) or bottom-left coordinates (`false`). | ||
|
|
||
| Default `true`. | ||
| """ | ||
|
|
||
| near = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of near clipping plane. | ||
|
|
||
| Default `0.1`. | ||
| """ | ||
|
|
||
| far = t.Float(allow_none=True, default_value=None).tag(sync=True) | ||
| """Distance of far clipping plane. | ||
|
|
||
| Default `1000`. | ||
| """ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.