java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.feature.Feature
All Implemented Interfaces:
HasFeatureModifyStyles, HasFeatureSelectStyles, Serializable
Direct Known Subclasses:
LineStringFeature, MarkerFeature, MultiLineStringFeature, MultiMarkerFeature, MultiPointFeature, MultiPolygonFeature, PointFeature, PolygonFeature

public abstract class Feature extends MapObservableObject implements HasFeatureSelectStyles, HasFeatureModifyStyles
Abstract class for vector object for geographic features with a geometry.

For more details see: Feature docs

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getType

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

      public SimpleGeometry getGeometry()
      Returns:
      feature's geometry
    • getStyles

      public List<Style> getStyles()
      Returns:
      list of added styles or empty list if no styles added
    • addStyles

      public void addStyles(Style... styles)
      Adds style to the feature. Note, if the feature contains custom styles, the default styles or added ones to the layer won't be applied to this feature. And you have to provide fully described style to the specific feature.
      Parameters:
      styles - styles to add
    • withStyles

      public Feature withStyles(Style... styles)
      Parameters:
      styles - styles to add
      Returns:
      current instance
    • removeStyles

      public void removeStyles(Style... styles)
      Removes styles from feature.
      Parameters:
      styles - styles to remove
    • removeAllStyles

      public void removeAllStyles()
      Removes all added styles from feature.
    • getSelectStyles

      public Collection<Style> getSelectStyles()
      Specified by:
      getSelectStyles in interface HasFeatureSelectStyles
      Returns:
      collection of added select styles or empty collection if no styles added
    • addSelectStyles

      public void addSelectStyles(Style... styles)
      Description copied from interface: HasFeatureSelectStyles
      Adds select styles to a feature.

      The styles will be applied for a feature's geometry when the user selects it.

      To enable select mode set SupportsFeatureSelect.setFeatureSelectEnabled(Boolean) to true.

      Specified by:
      addSelectStyles in interface HasFeatureSelectStyles
      Parameters:
      styles - styles to add
    • addAllSelectStyles

      public void addAllSelectStyles(Collection<Style> styles)
      Specified by:
      addAllSelectStyles in interface HasFeatureSelectStyles
      Parameters:
      styles - styles to add
      See Also:
    • removeSelectStyles

      public void removeSelectStyles(Style... styles)
      Description copied from interface: HasFeatureSelectStyles
      Removes styles from feature.
      Specified by:
      removeSelectStyles in interface HasFeatureSelectStyles
      Parameters:
      styles - styles to remove
    • removeAllSelectStyles

      public void removeAllSelectStyles()
      Description copied from interface: HasFeatureSelectStyles
      Removes all added select styles from feature.
      Specified by:
      removeAllSelectStyles in interface HasFeatureSelectStyles
    • withSelectStyles

      public Feature withSelectStyles(Style... styles)
      Parameters:
      styles - styles to add
      Returns:
      current instance
    • getModifyStyles

      public Collection<Style> getModifyStyles()
      Specified by:
      getModifyStyles in interface HasFeatureModifyStyles
      Returns:
      collection of modify styles or empty collection if no styles were added
    • addModifyStyles

      public void addModifyStyles(Style... styles)
      Description copied from interface: HasFeatureModifyStyles
      Adds modify styles to a feature.

      Note, modify styles will be applied not to the feature's geometry, but to the generated vertex point of the feature's geometry. This is because the map generates a point for geometry's vertices to enable modification: adding new vertex, change vertex position. So the provided styles should be valid for the point feature. So the provided styles should be valid for the point feature.

      To enable modify mode set SupportsFeatureModify.setFeatureModifyEnabled(Boolean) to true.

      Specified by:
      addModifyStyles in interface HasFeatureModifyStyles
      Parameters:
      styles - styles to add
    • addAllModifyStyles

      public void addAllModifyStyles(Collection<Style> styles)
      Specified by:
      addAllModifyStyles in interface HasFeatureModifyStyles
      Parameters:
      styles - styles to add
      See Also:
    • removeModifyStyles

      public void removeModifyStyles(Style... styles)
      Description copied from interface: HasFeatureModifyStyles
      Removes modify styles from a feature.
      Specified by:
      removeModifyStyles in interface HasFeatureModifyStyles
      Parameters:
      styles - styles to remove
    • removeAllModifyStyles

      public void removeAllModifyStyles()
      Description copied from interface: HasFeatureModifyStyles
      Removes all added modify styles from a feature.
      Specified by:
      removeAllModifyStyles in interface HasFeatureModifyStyles
    • withModifyStyles

      public Feature withModifyStyles(Style... styles)
      Parameters:
      styles - styles to add
      Returns:
      current instance
    • getProperties

      public Map<String,Object> getProperties()
    • withProperties

      public Feature withProperties(Map<String,Object> properties)
      Sets the properties that will be associated with the feature.

      For instance, if cluster specified weight property it will try to get it from the feature's properties. The same with heatmap when it is specified its weight property.

      Another example of using feature's properties is listening click events in source. For instance:

       vectorSource.addSourceFeatureClickListener(event -> {
           Feature feature = event.getFeature();
           String description = (String) feature.getProperties().get("description");
           notifications.show(description);
       });
       
      Parameters:
      properties - properties to set
      Returns:
      current instance
    • withProperty

      public Feature withProperty(String name, Object value)
      Sets the property that will be associated with the feature.

      For instance, if cluster specified weight property it will try to get it from the feature's properties. The same with heatmap when it is specified its weight property.

      Another example of using feature's properties is listening click events in source. For instance:

       vectorSource.addSourceFeatureClickListener(event -> {
           Feature feature = event.getFeature();
           String description = (String) feature.getProperties().get("description");
           notifications.show(description);
       });
       
      Parameters:
      name - property name
      value - value
      Returns:
      current instance
    • removeProperty

      public void removeProperty(String name)
      Removes property from the feature.
      Parameters:
      name - property name to remove
    • removeAllProperties

      public void removeAllProperties()
      Removes all properties from the feature.
    • updateSelectStyleIds

      protected void updateSelectStyleIds()
    • updateModifyStyleIds

      protected void updateModifyStyleIds()