Class GeoMap

java.lang.Object
com.vaadin.flow.component.Component
io.jmix.mapsflowui.kit.component.JmixMap
io.jmix.mapsflowui.component.GeoMap
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class GeoMap extends JmixMap implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
UI component that displays a geographical data provided by Layers.

The map is built by superposing layers. Initially, map does not have layers.

See Also:
  • Field Details

    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • projections

      protected Collection<ProjectionRegistration> projections
  • Constructor Details

    • GeoMap

      public GeoMap()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • autowireDependencies

      protected void autowireDependencies()
    • addLayer

      public void addLayer(Layer<?> layer)
      Adds layer to the map.
      Overrides:
      addLayer in class JmixMap
      Parameters:
      layer - layer to add
    • getLayerOrNull

      @Nullable public <L extends Layer<?>> L getLayerOrNull(String layerId)
      Returns a layer by its ID or null if the map does not contain a layer with the provided ID.
      Overrides:
      getLayerOrNull in class JmixMap
      Type Parameters:
      L - layer type
      Parameters:
      layerId - ID of a layer
      Returns:
      layer
    • getMapView

      public GeoMapView getMapView()
      Overrides:
      getMapView in class JmixMap
      Returns:
      map view
    • setMapView

      public void setMapView(MapView view)
      Sets map view. It replaces previous default map view. To change zoom or center coordinate, use JmixMap.getMapView(), for instance:
       map.getMapView().setZoom(10);
       
      Overrides:
      setMapView in class JmixMap
      Parameters:
      view - map view to set
      See Also:
    • setProjection

      public void setProjection(CRS projection)
      Sets the projection for coordinates supplied from and returned by API methods.

      Note, the projection will be used for all maps on the page.

      Parameters:
      projection - projection to set
    • addClickListener

      public com.vaadin.flow.shared.Registration addClickListener(com.vaadin.flow.component.ComponentEventListener<MapClickEvent> listener)
      Adds map click listener. Note, if the user makes double click on a map, the MapClickEvent will be fired twice.
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • addSingleClickListener

      public com.vaadin.flow.shared.Registration addSingleClickListener(com.vaadin.flow.component.ComponentEventListener<MapSingleClickEvent> listener)
      Adds map single click listener. Single click means that an event won't be fired if the user makes double click.
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • addDoubleClickListener

      public com.vaadin.flow.shared.Registration addDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<MapDoubleClickEvent> listener)
      Adds map double click listener.
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • getAdditionalPropertiesToUpdate

      protected Map<String,elemental.json.JsonValue> getAdditionalPropertiesToUpdate()
      Overrides:
      getAdditionalPropertiesToUpdate in class JmixMap
    • createSerializer

      protected JmixMapSerializer createSerializer()
      Overrides:
      createSerializer in class JmixMap
    • createMapOptions

      protected MapOptions createMapOptions()
      Overrides:
      createMapOptions in class JmixMap
    • onFeatureClickEvent

      protected void onFeatureClickEvent(AbstractFeatureClickDomEvent event)
      Overrides:
      onFeatureClickEvent in class JmixMap
    • fireFeatureClickEvent

      protected void fireFeatureClickEvent(EventBus eventBus, AbstractFeatureClickDomEvent event, Feature feature)
      Overrides:
      fireFeatureClickEvent in class JmixMap
    • fireSourceFeatureClickEvent

      protected void fireSourceFeatureClickEvent(EventBus eventBus, AbstractFeatureClickDomEvent event, Feature feature, AbstractFeatureSource source)
      Overrides:
      fireSourceFeatureClickEvent in class JmixMap
    • onMapClickDomEvent

      protected void onMapClickDomEvent(MapClickDomEvent event)
      Overrides:
      onMapClickDomEvent in class JmixMap
    • fireMapClickEvent

      protected void fireMapClickEvent(MapClickDomEvent domEvent)
    • onMapSingleClickDomEvent

      protected void onMapSingleClickDomEvent(MapSingleClickDomEvent event)
      Overrides:
      onMapSingleClickDomEvent in class JmixMap
    • fireMapSingleClickDomEvent

      protected void fireMapSingleClickDomEvent(MapSingleClickDomEvent domEvent)
    • onMapDoubleClickDomEvent

      protected void onMapDoubleClickDomEvent(MapDoubleClickDomEvent event)
      Overrides:
      onMapDoubleClickDomEvent in class JmixMap
    • fireMapDoubleClickDomEvent

      protected void fireMapDoubleClickDomEvent(MapDoubleClickDomEvent domEvent)
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component