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 sprite handling #308

Merged
merged 7 commits into from
Dec 1, 2023
Merged

Conversation

KaiVolland
Copy link
Contributor

@KaiVolland KaiVolland commented Nov 30, 2023

This updates the handling of mapbox sprites to make use of the geostyler Sprite.

❗ breaking change

@KaiVolland KaiVolland changed the title feat: add sprite support Update sprite handling Nov 30, 2023
BREAKING CHANGE: use geostyler-style Sprite instead of string syntax
@KaiVolland KaiVolland changed the title Update sprite handling DRAFT: Update sprite handling Nov 30, 2023
@KaiVolland KaiVolland changed the title DRAFT: Update sprite handling Draft: Update sprite handling Nov 30, 2023
@KaiVolland KaiVolland changed the title Draft: Update sprite handling Update sprite handling Nov 30, 2023
@KaiVolland KaiVolland marked this pull request as draft November 30, 2023 13:33
@KaiVolland KaiVolland marked this pull request as ready for review November 30, 2023 13:56
Copy link

@simonseyock simonseyock left a comment

Choose a reason for hiding this comment

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

Just a remark about the fetch. I am not that into the geostyler code, but the tests look sensible so I'd argue the code does the correct thing.

src/MapboxStyleParser.ts Outdated Show resolved Hide resolved
src/MapboxStyleParser.ts Show resolved Hide resolved
src/MapboxStyleParser.ts Show resolved Hide resolved
src/MapboxStyleParser.ts Show resolved Hide resolved
@KaiVolland
Copy link
Contributor Author

I created an issue for refactoring as coding/reviewing is already getting difficult: #309

Copy link
Contributor

@jansule jansule left a comment

Choose a reason for hiding this comment

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

I'm not sure, if I like moving the metadata to a class member. IMHO, this only introduces not needed state handling, just for the benefit of not passing an additional argument to the methods.

I agree that this parser needs some refactoring, but I don't think that this approach is the solution to it.

const { output: geoStylerStyle } = await styleParser.readStyle(mb_line_simpleline);
expect(geoStylerStyle).toBeDefined();
expect(geoStylerStyle).toEqual(line_simpleline);
});

it('can read a mapbox Line style with fill pattern', async () => {
expect.assertions(2);
mockFetchResult({
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to put this into a beforeEach?

Copy link
Contributor Author

@KaiVolland KaiVolland Dec 1, 2023

Choose a reason for hiding this comment

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

It is only needed for certain tests, so I would say it is not needed in a beforeEach.

@@ -204,8 +230,16 @@ export class MapboxStyleParser implements StyleParser<Omit<MbStyle, 'sources'>>
'geostyler:ref': GeoStylerRef;
};

private gsMetadata: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this into a separate PR for better code review?

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'd prefer to refactor this in a followup. See #309

src/MapboxStyleParser.ts Outdated Show resolved Hide resolved
src/MapboxStyleParser.ts Outdated Show resolved Hide resolved
src/MapboxStyleParser.ts Outdated Show resolved Hide resolved
src/MapboxStyleParser.ts Show resolved Hide resolved
src/MapboxStyleParser.ts Show resolved Hide resolved
src/Util/MapboxStyleUtil.ts Outdated Show resolved Hide resolved
src/Util/MapboxStyleUtil.ts Outdated Show resolved Hide resolved
@KaiVolland KaiVolland merged commit 194ba80 into geostyler:master Dec 1, 2023
3 checks passed
@dnlkoch
Copy link

dnlkoch commented Dec 4, 2023

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants