java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.style.Style
All Implemented Interfaces:
Serializable

public class Style extends MapObservableObject
Class for styling features.

Default style for point:

 new Style()
         .withImage(new CircleStyle()
                 .withRadius(5)
                 .withFill(new Fill("rgba(255,255,255,0.4"))
                 .withStroke(new Stroke()
                         .withWidth(1.25)
                         .withColor("#3399CC")));
 
Default style for linestring:
 new Style()
         .withStroke(new Stroke()
                 .withWidth(1.25)
                 .withColor("#3399CC"));
 
Default style for polygon:
 new Style()
         .withFill(new Fill("rgba(255,255,255,0.4)"))
         .withStroke(new Stroke()
                 .withWidth(1.25)
                 .withColor("#3399CC"));
 

For more details see: Style docs

See Also:
  • Field Details

  • Constructor Details

    • Style

      public Style()
  • Method Details

    • getImage

      public ImageStyle getImage()
      Returns:
      an image style or null if not set
    • setImage

      public void setImage(ImageStyle image)
      Sets the image style. The image can contain an icon or can be an instance of RegularShape class.

      For more details see: setImage() docs

      Parameters:
      image - image to set
    • withImage

      public Style withImage(ImageStyle image)
      Parameters:
      image - image to set
      Returns:
      current instance
    • getFill

      public Fill getFill()
      Returns:
      fill style or null if not set
    • setFill

      public void setFill(Fill fill)
      Sets fill object that describes which color should be used for filling feature.

      For more details see: setFill() docs

      Parameters:
      fill - fill to set
    • withFill

      public Style withFill(Fill fill)
      Parameters:
      fill - fill to set
      Returns:
      current instance
    • getStroke

      public Stroke getStroke()
      Returns:
      stroke style or null if not set
    • setStroke

      public void setStroke(Stroke stroke)
      Sets stroke style for feature. It describes line styling: width, color, dash, etc.

      For more details see: setStroke() docs

      Parameters:
      stroke - stroke style
    • withStroke

      public Style withStroke(Stroke stroke)
      Parameters:
      stroke - stroke style
      Returns:
      current instance
    • getText

      public TextStyle getText()
    • setText

      public void setText(TextStyle text)
      Sets text style for feature. Text style describes how to display text.

      For more details see: setText() docs

      Parameters:
      text - text style
    • withText

      public Style withText(TextStyle text)
      Parameters:
      text - text style
      Returns:
      current instance
    • getzIndex

      public Integer getzIndex()
    • setZIndex

      public void setZIndex(Integer zIndex)
      Sets Z-index to style. It is used to order styles added to the feature.

      For more details see: setZIndex() docs

      Parameters:
      zIndex - z-index to set
    • withZIndex

      public Style withZIndex(Integer zIndex)
      Parameters:
      zIndex - z-index to set
      Returns:
      current instance
    • getType

      protected String getType()
      Specified by:
      getType in class MapObservableObject
    • setParent

      protected void setParent(MapObservableObject parent)
      Overrides:
      setParent in class MapObservableObject