Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Adding example of using TurfTransformation#circle to create visual ring #1039

Merged
merged 1 commit into from
May 14, 2019

Conversation

langsmith
Copy link
Contributor

@langsmith langsmith commented Apr 23, 2019

This pr adds an example using TurfTransformation#circle() and TurfMeta.coordAll() to create a ring around a center Point coordinate. TurfTransformation#circle() is used twice. The first time is to get the coordinates for the FillLayer Polygon's outer ring coordinates. The second time is to get the inner ring coordinates. The final Polygon is then constructed with the outer and inner LineString objects.

This pr is related to #1032 but I'm not sure whether it resolves it. Might be good to add a more basic TurfTransformation#circle() example (i.e. no hollow ring) to this demo app.

ezgif com-resize

@langsmith
Copy link
Contributor Author

Inspired by this, which I saw online recently:

Screen Shot 2019-04-23 at 1 17 30 PM

@langsmith langsmith force-pushed the ls-hollow-circle-example branch 2 times, most recently from 9686b73 to 4d81399 Compare April 23, 2019 20:31
@langsmith langsmith force-pushed the ls-hollow-circle-example branch 2 times, most recently from a4da1a5 to 92f9512 Compare April 27, 2019 01:07
@langsmith langsmith force-pushed the ls-hollow-circle-example branch from 92f9512 to 6a3d650 Compare April 29, 2019 18:49
@riastrad
Copy link
Contributor

riastrad commented May 2, 2019

This pr is related to #1032 but I'm not sure whether it resolves it. Might be good to add a more basic TurfTransformation#circle() example (i.e. no hollow ring) to this demo app.

This example is fantastic, @langsmith! But I agree that it's distinct enough from #1032 that they shouldn't be mutually exclusive.

@langsmith
Copy link
Contributor Author

This BART map is a good example of why a ring would be drawn

Screen Shot 2019-05-03 at 2 11 38 PM

Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

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

Looks good, :shipit:


private void moveRing(Point centerPoint) {
if (mapboxMap.getStyle() != null) {
Style style = mapboxMap.getStyle();
Copy link
Member

Choose a reason for hiding this comment

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

just as fyi, alternatively to avoid nullability of a style you can use mapboxMap.getStyle(OnStyleLoadedCallback) this will give you a hook where style will always be non null.

@langsmith langsmith merged commit 0327821 into master May 14, 2019
@langsmith langsmith deleted the ls-hollow-circle-example branch May 14, 2019 22:44
@langsmith langsmith mentioned this pull request May 22, 2019
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants