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

Fix calculation of ends in ol.geom.MultiPolygon#getPolygons #1820

Merged
merged 1 commit into from Mar 7, 2014

Conversation

twpayne
Copy link
Contributor

@twpayne twpayne commented Mar 7, 2014

This fixes a bug reported by @pagameba on the mailing list. The polygons returned by ol.geom.MultiPolygon#getPolygons were invalid.

@ahocevar I suspect that this same bug is present in other ol.geom classes, which in turn might be causing #1808. Will investigate.

for (i = 0, ii = endss.length; i < ii; ++i) {
var ends = endss[i];
var end = ends[ends.length - 1];
var polygon = new ol.geom.Polygon(null);
var polygonEnds = ends.slice();
for (j = 0, jj = polygonEnds.length; j < jj; ++j) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it is worth avoiding this for the first polygon (offset === 0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot. Will change.

@tschaub
Copy link
Member

tschaub commented Mar 7, 2014

Minor optimization comment. Either way, please merge.

twpayne added a commit that referenced this pull request Mar 7, 2014
Fix calculation of ends in ol.geom.MultiPolygon#getPolygons
@twpayne twpayne merged commit 7a1e4aa into openlayers:master Mar 7, 2014
@twpayne twpayne deleted the fix-multipolygon-get-polygons branch March 7, 2014 18:50
@ahocevar
Copy link
Member

ahocevar commented Mar 8, 2014

@twpayne This was not the problem that causes #1808.

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.

None yet

3 participants