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

Polygon hole can not show on VectorLayer #178

Open
sunshine0576 opened this issue Dec 14, 2017 · 3 comments
Open

Polygon hole can not show on VectorLayer #178

sunshine0576 opened this issue Dec 14, 2017 · 3 comments

Comments

@sunshine0576
Copy link

sunshine0576 commented Dec 14, 2017

when i add "PolygonDrawable " to the VectorLayer
Polygon holes cannot be drawn,Is there a way to solve this problem?,Is my style wrong?

VectorLayer vectorLayer = new VectorLayer(mMap);
Polygon shell =(Polygon) new GeomBuilder()
.point(0, 0)
.point()
.buffer(20)
.get();

    Polygon hole = (Polygon)new GeomBuilder()
            .point(0, 0)
            .point()
            .buffer(10)
            .get();

    Polygon polygon=new GeometryFactory().createPolygon((LinearRing) shell.getExteriorRing(),
            new LinearRing[]{(LinearRing)hole.getExteriorRing()});

    vectorLayer.add(new PolygonDrawable(polygon, defaultStyle()));
@sunshine0576
Copy link
Author

polygon

@devemux86
Copy link

VTM development continues at https://github.com/mapsforge/vtm.

For questions please use our forum.

@devemux86
Copy link

devemux86 commented Dec 26, 2017

Since have not asked in https://github.com/mapsforge/vtm or in forum, I post the answer here.

Depends if JTS geometries are properly constructed, e.g. JTS polygons should have their exterior shell in clockwise direction and their interior holes in counter-clockwise direction.
So can normalize the created JTS polygon to handle that:

polygon.normalize();

polygons

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

No branches or pull requests

2 participants