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

Update vectorlayer styling in map-cesium #207

Merged
merged 12 commits into from
Dec 8, 2023

Conversation

lucas-angermann
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Vector layers are only displayed in the Cesium default style.

What is the new behavior?

Vector layers can now be styled with optional input.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Is it part of one/more packages and which?
@dlr-eoc/map-cesium

Copy link

Updated and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@cesium/engine 3.0.2...6.1.0 None +1/-0 22.4 MB ggetz
@cesium/widgets 3.0.2...4.3.0 None +2/-1 23.4 MB ggetz

🚮 Removed packages: @types/[email protected]

fillColor: '#FFFFFF',
strokeColor: '#0072a3',
strokeWidth: 2,
clampToGround: false
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can find a better solution here so that the values are not duplicated in the object.

Here is how this object is used in the other mapping libraries

map-ol:

map-maplibre:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found a way to access the style properties in a similar way as in map-maplibre. Therefore, I removed the duplicate entries.

Copy link
Member

Choose a reason for hiding this comment

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

nice.

@boeckMt
Copy link
Member

boeckMt commented Dec 1, 2023

Thanks @lucas-angermann for this PR! I'll try to check it out soon.

@@ -21,8 +21,8 @@
"dependencies": {
"@dlr-eoc/services-map-state": "12.0.0-alpha.2",
"@dlr-eoc/services-layers": "12.0.0-alpha.2",
"@cesium/engine": "^3.0.2",
"@cesium/widgets": "^3.0.2",
"@cesium/engine": "^6.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

Updating libraries in the major version could be considered a breaking change.

@voinSR and @MichaelLangbein I think we discussed this once. But with a lot of libraries in our repo, the versions could get very high very quickly. We have to decide how to deal with that.

For now, it is ok because this library was only available as an alpha version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wanted to update the versions before we create a new release of the libraries.

if(l.options && l.options.style){
const styleProperties = l.options.style(l.data)[0];
if(styleProperties){
fillColor = Color.fromCssColorString(styleProperties.fill_.color_) || fillColor;
Copy link
Member

Choose a reason for hiding this comment

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

It is not optimal to use private properties from OpenLayers here, but we can change that later.

Maybe we can define some common style properties.

l.options.style{
 fillColor?: string;
 strokeColor?: string;
 strokeWidth?: string;
 strokeOpacity?: number;
 fillOpacity?: number;
 circleRadius?: number;
 iconImg?: any;
 ...
}

@voinSR what do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be ideal.

Copy link
Member

@boeckMt boeckMt left a comment

Choose a reason for hiding this comment

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

@lucas-angermann thanks for the PR and fixes!

@lucas-angermann lucas-angermann merged commit f6461f5 into main Dec 8, 2023
11 checks passed
@lucas-angermann lucas-angermann deleted the cesium-update-vectorlayer branch December 8, 2023 14:51
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.

2 participants