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

Polygon hole can not show on VectorLayer #178

Open

Description

@sunshine0576

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()));

Activity

  1. sunshine0576 commented on Dec 14, 2017

    @sunshine0576
    Author

    polygon

  2. devemux86 commented on Dec 14, 2017

    @devemux86

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

    For questions please use our forum.

  3. devemux86 commented on Dec 26, 2017

    @devemux86

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions