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

Polygon Inner rings orientation #85

Merged
merged 1 commit into from
May 4, 2016
Merged

Conversation

Montago
Copy link
Contributor

@Montago Montago commented May 4, 2016

This change orients inner rings (holes) in polygons correctly (CCW)

This change orients inner rings (holes) in polygons correctly (CCW)
@arthur-e arthur-e merged commit ddea48a into arthur-e:master May 4, 2016
@arthur-e
Copy link
Owner

arthur-e commented May 4, 2016

This fixed the problem for Polygons but not for MultiPolygons. The (new) example of a MultiPolygons with a hole from Wikipedia still does not render correctly.

MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))

@arthur-e
Copy link
Owner

arthur-e commented May 4, 2016

There is one small change to get this to work for MultiPolygons; you have to check for the Polygon type.

// Orient inner rings correctly
if (polygonIsClockwise(c[j]) && this.type == 'polygon') {
  verts.reverse();
}

arthur-e added a commit that referenced this pull request May 4, 2016
@arthur-e
Copy link
Owner

arthur-e commented May 4, 2016

The deconstruct() method in wicket-gmaps3.js needs the same kind of fix, but the code is more complicated. One of the things that needs to be fixed is the determination of multiFlag; the determination of whether or not a google.maps.Polygon instance is a Polygon or MultiPolygon.

@Montago
Copy link
Contributor Author

Montago commented May 5, 2016

It should be very easy to find out if Google maps contain multi polygons or not by looking at the direction they are made.. eg, if two polygons are CW => multi
If one polygon is CW and the rest are CCW, then its a polygon with holes

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