Class MapClickEvent

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<MapBase>
com.vaadin.flow.component.map.events.MapClickEvent
All Implemented Interfaces:
Serializable

@DomEvent("map-click") public class MapClickEvent extends com.vaadin.flow.component.ComponentEvent<MapBase>
Representing OpenLayers' @code{click} event
See Also:
  • Field Summary

    Fields inherited from class java.util.EventObject

    source
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapClickEvent(Map source, boolean fromClient, com.fasterxml.jackson.databind.node.ArrayNode coordinate, com.fasterxml.jackson.databind.node.ArrayNode featureIds, com.fasterxml.jackson.databind.node.ArrayNode layerIds, int pageX, int pageY, boolean altKey, boolean ctrlKey, boolean metaKey, boolean shiftKey, int button)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the coordinate of the click on viewport.
    List of map features at the clicked position.
    Gets the click's mouse event details.

    Methods inherited from class com.vaadin.flow.component.ComponentEvent

    getSource, isFromClient, unregisterListener

    Methods inherited from class java.util.EventObject

    toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MapClickEvent

      public MapClickEvent(Map source, boolean fromClient, @EventData("event.detail.coordinate") com.fasterxml.jackson.databind.node.ArrayNode coordinate, @EventData("event.detail.features.map(feature => feature.feature.id)") com.fasterxml.jackson.databind.node.ArrayNode featureIds, @EventData("event.detail.features.map(feature => feature.layer.id)") com.fasterxml.jackson.databind.node.ArrayNode layerIds, @EventData("event.detail.originalEvent.pageX") int pageX, @EventData("event.detail.originalEvent.pageY") int pageY, @EventData("event.detail.originalEvent.altKey") boolean altKey, @EventData("event.detail.originalEvent.ctrlKey") boolean ctrlKey, @EventData("event.detail.originalEvent.metaKey") boolean metaKey, @EventData("event.detail.originalEvent.shiftKey") boolean shiftKey, @EventData("event.detail.originalEvent.button") int button)
  • Method Details

    • getCoordinate

      public Coordinate getCoordinate()
      Gets the coordinate of the click on viewport. Coordinates are returned in the map's user projection, which by default is EPSG:4326, also referred to as GPS coordinates. If the user projection has been changed using Map.setUserProjection(String), then coordinates must be specified in that projection instead.
      Returns:
      coordinate of the click
    • getFeatures

      public List<FeatureEventDetails> getFeatures()
      List of map features at the clicked position. Can be used to distinguish whether the click was on the background, or on a feature. The features are sorted by their display order, meaning the top-most feature is the first item in the list.
      Returns:
      the list of features at the clicked position, or an empty list otherwise
    • getMouseDetails

      public MouseEventDetails getMouseDetails()
      Gets the click's mouse event details.
      Returns:
      mouse event details