Class MultiLineStringFeature
java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.feature.Feature
io.jmix.mapsflowui.component.model.feature.MultiLineStringFeature
- All Implemented Interfaces:
FeatureClickNotifier<MultiLineStringFeature>,HasFeatureModifyStyles,HasFeatureSelectStyles,Serializable
public class MultiLineStringFeature
extends Feature
implements FeatureClickNotifier<MultiLineStringFeature>
Multilinestring feature with predefined
MultiLineStringFeature.
Usage example:
private void addMultiLineString(VectorSource vectorSource) {
GeometryFactory factory = GeometryUtils.getGeometryFactory();
LineString lineString1 = factory.createLineString(new Coordinate[]{
new Coordinate(37.59610278959945, 55.75230701125054),
new Coordinate(24.94409456852425, 60.18627418174103),
new Coordinate(12.483009200616205, 41.87228189777008)});
LineString lineString2 = factory.createLineString(new Coordinate[]{
new Coordinate(30.799901492251276, 36.89489780945887),
new Coordinate(-3.71329777467964, 40.4106248584977)});
MultiLineString multiLineString = factory.createMultiLineString(new LineString[]{lineString1, lineString2});
vectorSource.addFeature(new MultiLineStringFeature(multiLineString));
}
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEventNested classes/interfaces inherited from interface io.jmix.mapsflowui.component.model.feature.FeatureClickNotifier
FeatureClickNotifier.AbstractFeatureClickEvent<F>, FeatureClickNotifier.FeatureClickEvent<F extends Feature>, FeatureClickNotifier.FeatureDoubleClickEvent<F extends Feature>, FeatureClickNotifier.FeatureSingleClickEvent<F extends Feature> -
Field Summary
Fields inherited from class io.jmix.mapsflowui.kit.component.model.feature.Feature
geometry, modifyStyles, properties, selectStyles, stylesFields inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
children, dirty, eventBus, metaProperties, parent, removedChildren, syncId -
Constructor Summary
ConstructorsConstructorDescriptionMultiLineStringFeature(org.locationtech.jts.geom.MultiLineString multiLineString) -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationAdds feature click listener.com.vaadin.flow.shared.RegistrationaddDoubleClickListener(Consumer<FeatureClickNotifier.FeatureDoubleClickEvent<MultiLineStringFeature>> listener) Adds feature double click listener.com.vaadin.flow.shared.RegistrationaddSingleClickListener(Consumer<FeatureClickNotifier.FeatureSingleClickEvent<MultiLineStringFeature>> listener) Adds feature single click listener.voidAdds style to the feature.org.locationtech.jts.geom.MultiLineStringvoidsetMultiLineString(org.locationtech.jts.geom.MultiLineString multiLineString) Sets multilinestring to the feature's geometry.withModifyStyles(Style... styles) withProperties(Map<String, Object> properties) Sets the properties that will be associated with the feature.withProperty(String name, Object value) Sets the property that will be associated with the feature.withSelectStyles(Style... styles) withStyles(Style... styles) SeeaddStyles(Style...).Methods inherited from class io.jmix.mapsflowui.kit.component.model.feature.Feature
addAllModifyStyles, addAllSelectStyles, addModifyStyles, addSelectStyles, getModifyStyles, getProperties, getSelectStyles, getStyles, getType, removeAllModifyStyles, removeAllProperties, removeAllSelectStyles, removeAllStyles, removeModifyStyles, removeProperty, removeSelectStyles, removeStyles, updateModifyStyleIds, updateSelectStyleIdsMethods inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
addChild, addListener, clearRemovedChildren, clearRemovedChildrenInDepth, equals, fireChangeEvent, getChildren, getEventBus, getMetaProperties, getRemovedChildren, getSuperParent, getSyncId, hashCode, isAttachedToMap, isDirty, isDirtyInDepth, markAsDirty, markAsDirtyInDepth, removeChild, setMetaProperty, setParent, unmarkDirtyInDepth
-
Constructor Details
-
MultiLineStringFeature
public MultiLineStringFeature(org.locationtech.jts.geom.MultiLineString multiLineString)
-
-
Method Details
-
getGeometry
- Overrides:
getGeometryin classFeature- Returns:
- feature's geometry
-
getMultiLineString
public org.locationtech.jts.geom.MultiLineString getMultiLineString()- Returns:
- multilinestring from feature's geometry
getGeometry()
-
setMultiLineString
public void setMultiLineString(org.locationtech.jts.geom.MultiLineString multiLineString) Sets multilinestring to the feature's geometry.- Parameters:
multiLineString- multiLineString to set
-
addStyles
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.For instance, custom multilinestring style:
new MultiLineStringFeature(multiLineString) .withStyles(new LineStringStyle() .withStroke(new Stroke() .withWidth(3.0) .withColor("#F60018")) .build()); -
withStyles
SeeaddStyles(Style...).- Overrides:
withStylesin classFeature- Parameters:
styles- styles to add- Returns:
- current instance
-
withSelectStyles
Description copied from class:Feature- Overrides:
withSelectStylesin classFeature- Parameters:
styles- styles to add- Returns:
- current instance
-
withModifyStyles
Description copied from class:Feature- Overrides:
withModifyStylesin classFeature- Parameters:
styles- styles to add- Returns:
- current instance
-
withProperties
Description copied from class:FeatureSets 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); });- Overrides:
withPropertiesin classFeature- Parameters:
properties- properties to set- Returns:
- current instance
-
withProperty
Description copied from class:FeatureSets 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); });- Overrides:
withPropertyin classFeature- Parameters:
name- property namevalue- value- Returns:
- current instance
-
addClickListener
public com.vaadin.flow.shared.Registration addClickListener(Consumer<FeatureClickNotifier.FeatureClickEvent<MultiLineStringFeature>> listener) Description copied from interface:FeatureClickNotifierAdds feature click listener. Note, if the user makes double click on a feature, theFeatureClickNotifier.FeatureClickEventwill be fired twice.- Specified by:
addClickListenerin interfaceFeatureClickNotifier<MultiLineStringFeature>- Parameters:
listener- listener to add- Returns:
- a registration object for removing an event listener
-
addSingleClickListener
public com.vaadin.flow.shared.Registration addSingleClickListener(Consumer<FeatureClickNotifier.FeatureSingleClickEvent<MultiLineStringFeature>> listener) Description copied from interface:FeatureClickNotifierAdds feature single click listener. Single click means that an event won't be fired if the user makes double click.- Specified by:
addSingleClickListenerin interfaceFeatureClickNotifier<MultiLineStringFeature>- Parameters:
listener- listener to add- Returns:
- a registration object for removing an event listener
-
addDoubleClickListener
public com.vaadin.flow.shared.Registration addDoubleClickListener(Consumer<FeatureClickNotifier.FeatureDoubleClickEvent<MultiLineStringFeature>> listener) Description copied from interface:FeatureClickNotifierAdds feature double click listener.- Specified by:
addDoubleClickListenerin interfaceFeatureClickNotifier<MultiLineStringFeature>- Parameters:
listener- listener to add- Returns:
- a registration object for removing an event listener
-