You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.component.map.

Class MapBase

    • Constructor Detail

      • MapBase

        protected MapBase()
    • Method Detail

      • getView

        public View getView()

        Gets the View of the map. The view allows controlling properties of the map's viewport, such as center, zoom level and rotation.

        Returns:

        the map's view

      • setView

        public void setView​(View view)

        Sets the view of the map. This is only necessary when dealing with map services that use custom coordinate projection, in which case a view with a matching projection needs to be created and used.

        Parameters:

        view - the new view

      • onAttach

        protected void onAttach​(AttachEvent attachEvent)

        Description copied from class: Component

        Called when the component is attached to a UI.

        The default implementation does nothing.

        This method is invoked before the AttachEvent is fired for the component.

        Overrides:

        onAttach in class Component

        Parameters:

        attachEvent - the attach event

      • addViewMoveEndEventListener

        public Registration addViewMoveEndEventListener​(ComponentEventListener<MapViewMoveEndEvent> listener)

        Adds an event listener for changes to the map's viewport. The event will only be triggered after the user has finished manipulating the viewport, for example after letting go of the mouse button after a mouse drag interaction.

        Parameters:

        listener -

        Returns:

        a registration object for removing the added listener

      • addClickEventListener

        public Registration addClickEventListener​(ComponentEventListener<MapClickEvent> listener)

        Adds a click listener for the map.

        Note that the listener will also be invoked when clicking on a Feature. Use MapClickEvent.getFeatures() to distinguish whether a feature exists at the clicked location.

        Parameters:

        listener -

        Returns:

        a registration object for removing the added listener

      • addFeatureClickListener

        public Registration addFeatureClickListener​(VectorLayer layer,
                                                    ComponentEventListener<MapFeatureClickEvent> listener)

        Adds a click listener for geographical features. The listener will be invoked for a click on any feature in the specified layer. For clicks on overlapping features, the listener will be invoked only for the top-level feature at that location.

        Parameters:

        listener - the listener to trigger

        Returns:

        registration for the listener

        See Also:

        Feature

      • getFeatureFlags

        protected FeatureFlags getFeatureFlags()

        Gets the feature flags for the current UI.

        Extracted with protected visibility to support mocking

        Returns:

        the current set of feature flags

      • addThemeVariants

        public void addThemeVariants​(MapVariant... variants)

        Adds theme variants to the component.

        Parameters:

        variants - theme variants to add

      • removeThemeVariants

        public void removeThemeVariants​(MapVariant... variants)

        Removes theme variants from the component.

        Parameters:

        variants - theme variants to remove