Skip to content
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

Cesium2d viewer #7234

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Cesium2d viewer #7234

wants to merge 7 commits into from

Conversation

glughi
Copy link
Contributor

@glughi glughi commented Jul 10, 2024

What this PR does

Added Cesium in 2D mode (SCENE2D) to possible map viewers; WebMercator is set as map projection when using this mode. Cesium 2D is faster than Leaflet and the behavior of the two views (3d and 2d) in this way is homogeneous. Leaflet is not removed from the project and you can use one, the other or both.
Added the parameter mapViewers with which in config.json you can indicate which map viewers must be enabled and available in the MapSettings panel (the possible values are now "3d", "3dsmooth", "2d" and "cesium2d"). By default it keeps the known behavior.

Test me

Put "mapViewers":["3d", "cesium2d"], in your config.json and reload. In MapSettings panel you should see the new option.

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@na9da
Copy link
Collaborator

na9da commented Jul 17, 2024

@glughi - Thanks for this and other PRs you have created. We currently have a bit of a backlog but will hopefully be able to review yours soon :)

@ljowen ljowen requested a review from nf-s August 13, 2024 04:19
@@ -173,6 +179,8 @@ export default class TerriaViewer {
viewerFromPromise = leafletFromPromise.get();
} else if (this.attached && this.viewerMode === ViewerMode.Cesium) {
viewerFromPromise = cesiumFromPromise.get();
} else if (this.attached && this.viewerMode === ViewerMode.Cesium2D) {
viewerFromPromise = cesium2dFromPromise.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, the body of cesiumFromPromise looks identical to the body of cesium2dFromPromise. Can't this entire else-if be folded into the previous else if, but with the condition this.attached && (this.viewerMode === ViewerMode.Cesium || this.viewerMode === ViewerMode.Cesium2D)?

@@ -373,6 +373,11 @@ export interface ConfigParameters {
*/
searchBarConfig?: ModelPropertiesFromTraits<SearchBarTraits>;
searchProviders: ModelPropertiesFromTraits<SearchProviderTraits>[];

/**
* List of the enabled MapViewers: 3d, 3dsmooth, 2d, cesium2d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type says this is an array rather than a list. The JSDoc for the other array-options seems to start with just "The", so "The enabled MapViewers .." in this case.

cesium2d: {
viewerMode: ViewerMode.Cesium2D,
terrain: false,
label: "settingPanel.viewerModeLabels.Leaflet",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other entries have unique labels, so I'm guessing this entry shouldn't use the already used Leaflet-label.

<Text mini>{t(viewerMode.label)}</Text>
</SettingsButton>
))}
{Object.entries(MapViewers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous line contains elementsNo={3}, which coincides with MapViewers.length. Does this work as intended when the filtering filters out some objects?

And even without filtering, why does the previous line not need to be updated to contain 4 since there is one more item in MapViewers in this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants