• public final class PolygonDataSource
    extends NativeBase

    Polygon data source allows the rendering engine access to the user provided polygons geometry and their attributes.

    Polygon segments are rendered following the shortest path between their end points.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  PolygonDataSource.PolygonDataProcessor
      Called for each polygon, allowing inspection, removal or update of geometry and attributes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(PolygonData polygon)
      Adds a new polygon to the data source.
      void add​(java.util.List<PolygonData> polygons)
      Adds new polygons to the data source.
      void destroy()
      Frees all internally used resources.
      void forEach​(PolygonDataSource.PolygonDataProcessor processor)
      Iterates through all the polygons from the data source and passes them to the given processor, one by one.
      void removeAll()
      Removes all polygons from the data source.
      void removeIf​(PolygonDataSource.PolygonDataProcessor inspector)
      Iterates through all the polygons from the data source and passes them to the given inspector, one by one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • add

        public void add​(@NonNull
                        PolygonData polygon)

        Adds a new polygon to the data source.

        Parameters:
        polygon -

        Polygon to add.

      • add

        public void add​(@NonNull
                        java.util.List<PolygonData> polygons)

        Adds new polygons to the data source.

        Parameters:
        polygons -

        Polygons to add.

      • removeAll

        public void removeAll()

        Removes all polygons from the data source.

      • forEach

        public void forEach​(@NonNull
                            PolygonDataSource.PolygonDataProcessor processor)

        Iterates through all the polygons from the data source and passes them to the given processor, one by one. The processor can update the polygon data.

        The iteration stops after all polygons have been processed or the processor returns false from the process call.

        Parameters:
        processor -

        Polygon processor.

      • removeIf

        public void removeIf​(@NonNull
                             PolygonDataSource.PolygonDataProcessor inspector)

        Iterates through all the polygons from the data source and passes them to the given inspector, one by one. All polygons for which the inspector returns true get removed from the data source. The inspector cannot update the polygon data.

        Parameters:
        inspector -

        Polygon data processor.

      • destroy

        public void destroy()

        Frees all internally used resources. After calling this method, the object is not usable anymore.