Class PolygonFeature
java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.feature.Feature
io.jmix.mapsflowui.component.model.feature.PolygonFeature
- All Implemented Interfaces:
FeatureClickNotifier<PolygonFeature>
,Serializable
Polygon feature with predefined
PolygonGeometry
.
Usage example:
protected void addPolygons(VectorSource source) { GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); LinearRing shell = geometryFactory.createLinearRing(new Coordinate[]{ new Coordinate(9.844944, 44.011077), new Coordinate(12.286243, 44.525239), new Coordinate(18.389491, 40.011935), new Coordinate(15.732783, 38.003544), new Coordinate(9.844944, 44.011077), }); Polygon polygon = geometryFactory.createPolygon(shell); source.addFeature(new PolygonFeature(polygon)); }
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
MapObservableObject.ObjectChangeEvent
Nested 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.MapObservableObject
children, dirty, eventBus, listener, metaProperties, removedChildren, syncId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
Adds feature click listener.com.vaadin.flow.shared.Registration
addDoubleClickListener
(Consumer<FeatureClickNotifier.FeatureDoubleClickEvent<PolygonFeature>> listener) Adds feature double click listener.com.vaadin.flow.shared.Registration
addSingleClickListener
(Consumer<FeatureClickNotifier.FeatureSingleClickEvent<PolygonFeature>> listener) Adds feature single click listener.Adds style to the feature.org.locationtech.jts.geom.Polygon
void
setPolygon
(org.locationtech.jts.geom.Polygon polygon) Sets polygon to feature's geometryMethods inherited from class io.jmix.mapsflowui.kit.component.model.feature.Feature
getStyles, getType, removeAllStyles, removeStyles
Methods inherited from class io.jmix.mapsflowui.kit.component.model.MapObservableObject
addChild, addListener, clearRemovedChildren, clearRemovedChildrenInDepth, equals, fireChangeEvent, getChildren, getEventBus, getMetaProperties, getRemovedChildren, getSyncId, hashCode, isDirty, isDirtyInDepth, markAsDirty, markAsDirtyInDepth, removeChild, setMapObjectChangeListener, setMetaProperty, unmarkDirtyInDepth
-
Constructor Details
-
PolygonFeature
public PolygonFeature(org.locationtech.jts.geom.Polygon polygon)
-
-
Method Details
-
getGeometry
- Overrides:
getGeometry
in classFeature
- Returns:
- feature's geometry
-
getPolygon
public org.locationtech.jts.geom.Polygon getPolygon()- Returns:
- polygon from feature's geometry
getGeometry()
-
setPolygon
public void setPolygon(org.locationtech.jts.geom.Polygon polygon) Sets polygon to feature's geometry- Parameters:
polygon
- polygon 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 polygon style:
new PolygonFeature(geometries.createPolygon(shell)) .addStyles(new Style() .withFill(new Fill("rgba(1, 147, 154, 0.2)")) .withStroke(new Stroke() .withWidth(3.) .withColor("#123EAB")));
-
addClickListener
public com.vaadin.flow.shared.Registration addClickListener(Consumer<FeatureClickNotifier.FeatureClickEvent<PolygonFeature>> listener) Description copied from interface:FeatureClickNotifier
Adds feature click listener. Note, if the user makes double click on a feature, theFeatureClickNotifier.FeatureClickEvent
will be fired twice.- Specified by:
addClickListener
in interfaceFeatureClickNotifier<PolygonFeature>
- 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<PolygonFeature>> listener) Description copied from interface:FeatureClickNotifier
Adds feature single click listener. Single click means that an event won't be fired if the user makes double click.- Specified by:
addSingleClickListener
in interfaceFeatureClickNotifier<PolygonFeature>
- 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<PolygonFeature>> listener) Description copied from interface:FeatureClickNotifier
Adds feature double click listener.- Specified by:
addDoubleClickListener
in interfaceFeatureClickNotifier<PolygonFeature>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-