Class StyleCache


  • public class StyleCache
    extends Object
    Style utilities for populating markers and shapes. Caches icons for a single GeoPackage
    Since:
    3.2.0
    • Constructor Detail

      • StyleCache

        public StyleCache​(GeoPackage geoPackage,
                          float density)
        Constructor
        Parameters:
        geoPackage - GeoPackage
        density - display density: DisplayMetrics.density
      • StyleCache

        public StyleCache​(GeoPackage geoPackage,
                          float density,
                          int iconCacheSize)
        Constructor
        Parameters:
        geoPackage - GeoPackage
        density - display density: DisplayMetrics.density
        iconCacheSize - number of icon bitmaps to cache
      • StyleCache

        public StyleCache​(FeatureStyleExtension featureStyleExtension,
                          float density)
        Constructor
        Parameters:
        featureStyleExtension - feature style extension
        density - display density: DisplayMetrics.density
      • StyleCache

        public StyleCache​(FeatureStyleExtension featureStyleExtension,
                          float density,
                          int iconCacheSize)
        Constructor
        Parameters:
        featureStyleExtension - feature style extension
        density - display density: DisplayMetrics.density
        iconCacheSize - number of icon bitmaps to cache
    • Method Detail

      • clear

        public void clear()
        Clear the cache
      • getFeatureStyleExtension

        public FeatureStyleExtension getFeatureStyleExtension()
        Get the feature style extension
        Returns:
        feature style extension
      • getDensity

        public float getDensity()
        Get the display density
        Returns:
        density
      • setDensity

        public void setDensity​(float density)
        Set the display density
        Parameters:
        density - density
      • createMarkerOptions

        public MarkerOptions createMarkerOptions​(FeatureRow featureRow)
        Create new marker options populated with the feature row style (icon or style)
        Parameters:
        featureRow - feature row
        Returns:
        marker options populated with the feature style
      • setFeatureStyle

        public boolean setFeatureStyle​(MarkerOptions markerOptions,
                                       FeatureRow featureRow)
        Set the feature row style (icon or style) into the marker options
        Parameters:
        markerOptions - marker options
        featureRow - feature row
        Returns:
        true if icon or style was set into the marker options
      • createMarkerOptions

        public MarkerOptions createMarkerOptions​(FeatureStyle featureStyle)
        Create new marker options populated with the feature style (icon or style)
        Parameters:
        featureStyle - feature style
        Returns:
        marker options populated with the feature style
      • setFeatureStyle

        public boolean setFeatureStyle​(MarkerOptions markerOptions,
                                       FeatureStyle featureStyle)
        Set the feature style (icon or style) into the marker options
        Parameters:
        markerOptions - marker options
        featureStyle - feature style
        Returns:
        true if icon or style was set into the marker options
      • createMarkerOptions

        public MarkerOptions createMarkerOptions​(IconRow icon)
        Create new marker options populated with the icon
        Parameters:
        icon - icon row
        Returns:
        marker options populated with the icon
      • setIcon

        public boolean setIcon​(MarkerOptions markerOptions,
                               IconRow icon)
        Set the icon into the marker options
        Parameters:
        markerOptions - marker options
        icon - icon row
        Returns:
        true if icon was set into the marker options
      • createIcon

        public Bitmap createIcon​(IconRow icon)
        Create the icon bitmap
        Parameters:
        icon - icon row
        Returns:
        icon bitmap
      • createMarkerOptions

        public MarkerOptions createMarkerOptions​(StyleRow style)
        Create new marker options populated with the style
        Parameters:
        style - style row
        Returns:
        marker options populated with the style
      • setStyle

        public boolean setStyle​(MarkerOptions markerOptions,
                                StyleRow style)
        Set the style into the marker options
        Parameters:
        markerOptions - marker options
        style - style row
        Returns:
        true if style was set into the marker options
      • createPolylineOptions

        public PolylineOptions createPolylineOptions​(FeatureRow featureRow)
        Create new polyline options populated with the feature row style
        Parameters:
        featureRow - feature row
        Returns:
        polyline options populated with the feature style
      • setFeatureStyle

        public boolean setFeatureStyle​(PolylineOptions polylineOptions,
                                       FeatureRow featureRow)
        Set the feature row style into the polyline options
        Parameters:
        polylineOptions - polyline options
        featureRow - feature row
        Returns:
        true if style was set into the polyline options
      • createPolylineOptions

        public PolylineOptions createPolylineOptions​(FeatureStyle featureStyle)
        Create new polyline options populated with the feature style
        Parameters:
        featureStyle - feature style
        Returns:
        polyline options populated with the feature style
      • setFeatureStyle

        public boolean setFeatureStyle​(PolylineOptions polylineOptions,
                                       FeatureStyle featureStyle)
        Set the feature style into the polyline options
        Parameters:
        polylineOptions - polyline options
        featureStyle - feature style
        Returns:
        true if style was set into the polyline options
      • createPolylineOptions

        public PolylineOptions createPolylineOptions​(StyleRow style)
        Create new polyline options populated with the style
        Parameters:
        style - style row
        Returns:
        polyline options populated with the style
      • setStyle

        public boolean setStyle​(PolylineOptions polylineOptions,
                                StyleRow style)
        Set the style into the polyline options
        Parameters:
        polylineOptions - polyline options
        style - style row
        Returns:
        true if style was set into the polyline options
      • createPolygonOptions

        public PolygonOptions createPolygonOptions​(FeatureRow featureRow)
        Create new polygon options populated with the feature row style
        Parameters:
        featureRow - feature row
        Returns:
        polygon options populated with the feature style
      • setFeatureStyle

        public boolean setFeatureStyle​(PolygonOptions polygonOptions,
                                       FeatureRow featureRow)
        Set the feature row style into the polygon options
        Parameters:
        polygonOptions - polygon options
        featureRow - feature row
        Returns:
        true if style was set into the polygon options
      • createPolygonOptions

        public PolygonOptions createPolygonOptions​(FeatureStyle featureStyle)
        Create new polygon options populated with the feature style
        Parameters:
        featureStyle - feature style
        Returns:
        polygon options populated with the feature style
      • setFeatureStyle

        public boolean setFeatureStyle​(PolygonOptions polygonOptions,
                                       FeatureStyle featureStyle)
        Set the feature style into the polygon options
        Parameters:
        polygonOptions - polygon options
        featureStyle - feature style
        Returns:
        true if style was set into the polygon options
      • createPolygonOptions

        public PolygonOptions createPolygonOptions​(StyleRow style)
        Create new polygon options populated with the style
        Parameters:
        style - style row
        Returns:
        polygon options populated with the style
      • setStyle

        public boolean setStyle​(PolygonOptions polygonOptions,
                                StyleRow style)
        Set the style into the polygon options
        Parameters:
        polygonOptions - polygon options
        style - style row
        Returns:
        true if style was set into the polygon options