geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/features/FeatureTiles.java
private Paint getStylePaint(StyleRow style, FeatureDrawType drawType) {

        Paint paint = featurePaintCache.getPaint(style, drawType);

        if (paint == null) {

            Color color = null;
            Style paintStyle = null;
            Float strokeWidth = null;

            switch (drawType) {
                case CIRCLE:
                    color = style.getColorOrDefault();
                    paintStyle = Style.FILL;
                    break;
                case STROKE:
                    color = style.getColorOrDefault();
                    paintStyle = Style.STROKE;
                    strokeWidth = this.density * (float) style.getWidthOrDefault();
                    break;
                case FILL:
                    color = style.getFillColor();
                    paintStyle = Style.FILL;
                    strokeWidth = this.density * (float) style.getWidthOrDefault();
                    break;
                default:
                    throw new GeoPackageException("Unsupported Draw Type: " + drawType);
            }

            Paint stylePaint = new Paint();
            stylePaint.setAntiAlias(true);
            stylePaint.setStyle(paintStyle);
            stylePaint.setColor(color.getColorWithAlpha());
            if (strokeWidth != null) {
                stylePaint.setStrokeWidth(strokeWidth);
            }

            synchronized (featurePaintCache) {

                paint = featurePaintCache.getPaint(style, drawType);

                if (paint == null) {
                    featurePaintCache.setPaint(style, drawType, stylePaint);
                    paint = stylePaint;
                }

            }
        }

        return paint;
    }
private Paint getStylePaint(StyleRow style, FeatureDrawType drawType) {

        Paint paint = featurePaintCache.getPaint(style, drawType);

        if (paint == null) {

            Color color = null;
            Style paintStyle = null;
            Float strokeWidth = null;

            switch (drawType) {
                case CIRCLE:
                    color = style.getColorOrDefault();
                    paintStyle = Style.FILL;
                    break;
                case STROKE:
                    color = style.getColorOrDefault();
                    paintStyle = Style.STROKE;
                    strokeWidth = this.density * (float) style.getWidthOrDefault();
                    break;
                case FILL:
                    color = style.getFillColor();
                    paintStyle = Style.FILL;
                    strokeWidth = this.density * (float) style.getWidthOrDefault();
                    break;
                default:
                    throw new GeoPackageException("Unsupported Draw Type: " + drawType);
            }

            Paint stylePaint = new Paint();
            stylePaint.setAntiAlias(true);
            stylePaint.setStyle(paintStyle);
            stylePaint.setColor(color.getColorWithAlpha());
            if (strokeWidth != null) {
                stylePaint.setStrokeWidth(strokeWidth);
            }

            synchronized (featurePaintCache) {

                paint = featurePaintCache.getPaint(style, drawType);

                if (paint == null) {
                    featurePaintCache.setPaint(style, drawType, stylePaint);
                    paint = stylePaint;
                }

            }
        }

        return paint;
    }
private Paint getStylePaint ( StyleRow style , FeatureDrawType drawType ) { Paint paint = featurePaintCache . getPaint ( style , drawType ) ; if ( paint == null ) { Color color = null ; Style paintStyle = null ; Float strokeWidth = null ; switch ( drawType ) { case CIRCLE : color = style . getColorOrDefault ( ) ; paintStyle = Style . FILL ; break ; case STROKE : color = style . getColorOrDefault ( ) ; paintStyle = Style . STROKE ; strokeWidth = this . density * ( float ) style . getWidthOrDefault ( ) ; break ; case FILL : color = style . getFillColor ( ) ; paintStyle = Style . FILL ; strokeWidth = this . density * ( float ) style . getWidthOrDefault ( ) ; break ; default : throw new GeoPackageException ( "Unsupported Draw Type: " + drawType ) ; } Paint stylePaint = new Paint ( ) ; stylePaint . setAntiAlias ( true ) ; stylePaint . setStyle ( paintStyle ) ; stylePaint . setColor ( color . getColorWithAlpha ( ) ) ; if ( strokeWidth != null ) { stylePaint . setStrokeWidth ( strokeWidth ) ; } synchronized ( featurePaintCache ) { paint = featurePaintCache . getPaint ( style , drawType ) ; if ( paint == null ) { featurePaintCache . setPaint ( style , drawType , stylePaint ) ; paint = stylePaint ; } } } return paint ; }
Get the style paint from cache, or create and cache it

@param style    style row
@param drawType draw type
@return paint
Get the style paint from cache or create and cache it