Class CircleMBLayer

Object
MBLayer
CircleMBLayer

public class CircleMBLayer extends MBLayer
A filled circle.

MBLayer wrapper around a JSONObject representation of a "circle" type layer. All methods act as accessors on provided JSON layer, no other state is maintained. This allows modifications to be made cleanly with out chance of side-effect.

  • get methods: access the json directly
  • query methods: provide logic / transforms to GeoTools classes as required.
Author:
Reggie Beckwith (Boundless)
  • Constructor Details

    • CircleMBLayer

      public CircleMBLayer(JSONObject json)
  • Method Details

    • defaultSemanticType

      protected SemanticType defaultSemanticType()
    • getCircleRadius

      public Number getCircleRadius() throws MBFormatException
      (Optional) Circle radius in pixels. Defaults to 5.
      Returns:
      The circle radius
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleRadius

      public Expression circleRadius() throws MBFormatException
      Access circle-radius as literal or function expression, defaults to 5
      Returns:
      The circle radius as literal or function expression
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • getCircleColor

      public Color getCircleColor() throws MBFormatException
      (Optional) The fill color of the circle. Defaults to #000000.
      Returns:
      The fill color of the circle
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleColor

      public Expression circleColor() throws MBFormatException
      Access circle-color as literal or function expression, defaults to black.
      Returns:
      The circle color as literal or function expression
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • getCircleBlur

      public Number getCircleBlur() throws MBFormatException
      (Optional) Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. Defaults to 0.
      Returns:
      The amount to blur the circle.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleBlur

      public Expression circleBlur() throws MBFormatException
      Access circle-blur as literal or function expression, defaults to 0
      Returns:
      The amount to blur the circle, as literal or function expression
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • getCircleOpacity

      public Number getCircleOpacity() throws MBFormatException
      (Optional) The opacity at which the circle will be drawn. Defaults to 1.
      Returns:
      The opacity at which the circle will be drawn.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleOpacity

      public Expression circleOpacity() throws MBFormatException
      Access circle-opacity, defaults to 1.
      Returns:
      The opacity at which the circle will be drawn as literal or function expression.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • getCircleTranslate

      public int[] getCircleTranslate() throws MBFormatException
      (Optional) The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. Units in pixels. Defaults to 0, 0.
      Returns:
      x and y offset in pixels.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleTranslate

      public Point circleTranslate() throws MBFormatException
      Access circle-translate
      Returns:
      x and y offset in pixels as Point
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleTranslateDisplacement

      public Displacement circleTranslateDisplacement()
      Processes the filter-translate into a Displacement.

      This should handle both literals and function stops:

       filter-translate: [0,0]
       filter-translate: { property: "building-height", "stops": [[0,[0,0]],[5,[1,2]]] }
       filter-translate: [ 0, { property: "building-height", "TYPE":"exponential","stops": [[0,0],[30, 5]] }
       
      Returns:
      Displacement to offset symbol
    • getCircleTranslateAnchor

      public CircleMBLayer.CircleTranslateAnchor getCircleTranslateAnchor()
      (Optional) Controls the translation reference point.

      CircleMBLayer.CircleTranslateAnchor.MAP: The circle is translated relative to the map. CircleMBLayer.CircleTranslateAnchor.VIEWPORT: The circle is translated relative to the viewport.

      Defaults to CircleMBLayer.CircleTranslateAnchor.MAP. Requires circle-translate.

      Returns:
      The translation reference point.
    • getCirclePitchScale

      public CircleMBLayer.CirclePitchScale getCirclePitchScale()
      (Optional) Controls the scaling behavior of the circle when the map is pitched.

      CircleMBLayer.CirclePitchScale.MAP: Circles are scaled according to their apparent distance to the camera. CircleMBLayer.CirclePitchScale.VIEWPORT: Circles are not scaled.

      Defaults to CircleMBLayer.CirclePitchScale.MAP.

      Returns:
      The circle scaling behavior.
    • getCircleStrokeWidth

      public Number getCircleStrokeWidth() throws MBFormatException
      (Optional) The width of the circle's stroke. Strokes are placed outside of the circle-radius.

      Units in pixels. Defaults to 0.

      Returns:
      The circle stroke width.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaitonthrows
    • circleStrokeWidth

      public Expression circleStrokeWidth() throws MBFormatException
      Access circle-stroke-width, defaults to 0.
      Returns:
      The circle stroke width.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • getCircleStrokeColor

      public Color getCircleStrokeColor() throws MBFormatException
      (Optional) The stroke color of the circle.

      Defaults to #000000.

      Returns:
      The color of the circle stroke.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleStrokeColor

      public Expression circleStrokeColor() throws MBFormatException
      Access circle-stroke-color as literal or function expression, defaults to black.
      Returns:
      The color of the circle stroke.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • getCircleStrokeOpacity

      public Number getCircleStrokeOpacity() throws MBFormatException
      (Optional) The opacity of the circle's stroke.

      Defaults to 1.

      Returns:
      Number representing the stroke opacity.
      Throws:
      MBFormatException - JSON provided inconsistent with specificaiton
    • circleStrokeOpacity

      public Expression circleStrokeOpacity() throws MBFormatException
      Access circle-stroke-opacity, defaults to 1.
      Returns:
      Number representing the stroke opacity.
      Throws:
      MBFormatException - JSON provided inconsistent with specification
    • transformInternal

      public List<FeatureTypeStyle> transformInternal(MBStyle styleContext)
      Transform CircleMBLayer to GeoTools FeatureTypeStyle.
      Specified by:
      transformInternal in class MBLayer
      Parameters:
      styleContext - The MBStyle to which this layer belongs, used as a context for things like resolving sprite and glyph names to full urls.
      Returns:
      FeatureTypeStyle
    • getType

      public String getType()
      Rendering type of this layer.
      Specified by:
      getType in class MBLayer
      Returns:
      TYPE