Class MapViewState

    • Method Detail

      • findTopLeftInWindow

        static Point findTopLeftInWindow​(JComponent position)
        This is visible for JMockit.
        Parameters:
        position - The component to get the top left position of its window
        Returns:
        the top left point in window
      • findTopLeftOnScreen

        static Point findTopLeftOnScreen​(JComponent position)
        This is visible for JMockit.
        Parameters:
        position - The component to get the top left position of its screen
        Returns:
        the top left point on screen
      • getScale

        public double getScale()
        The scale in east/north units per pixel.
        Returns:
        The scale.
      • getForView

        public MapViewState.MapViewPoint getForView​(double x,
                                                    double y)
        Gets the MapViewPoint representation for a position in view coordinates.
        Parameters:
        x - The x coordinate inside the view.
        y - The y coordinate inside the view.
        Returns:
        The MapViewPoint.
      • getViewWidth

        public double getViewWidth()
        Gets the width of the view on the Screen;
        Returns:
        The width of the view component in screen pixel.
      • getViewHeight

        public double getViewHeight()
        Gets the height of the view on the Screen;
        Returns:
        The height of the view component in screen pixel.
      • getProjecting

        public Projecting getProjecting()
        Gets the current projecting instance that is used to convert between east/north and lat/lon space.
        Returns:
        The projection.
        Since:
        12161
      • getAffineTransform

        public AffineTransform getAffineTransform()
        Creates an affine transform that is used to convert the east/north coordinates to view coordinates.
        Returns:
        The affine transform. It should not be changed.
        Since:
        10375
      • getArea

        public Area getArea​(Bounds bounds)
        Returns the area for the given bounds.
        Parameters:
        bounds - bounds
        Returns:
        the area for the given bounds
      • usingCenter

        public MapViewState usingCenter​(EastNorth newCenter)
        Creates a new state that is the same as the current state except for that it is using a new center.
        Parameters:
        newCenter - The new center coordinate.
        Returns:
        The new state.
        Since:
        10375
      • movedTo

        public MapViewState movedTo​(MapViewState.MapViewPoint mapViewPoint,
                                    EastNorth newEastNorthThere)
        Creates a new state that is moved to an east/north coordinate.
        Parameters:
        mapViewPoint - The reference point.
        newEastNorthThere - The east/north coordinate that should be there.
        Returns:
        The new state.
        Since:
        10375
      • usingScale

        public MapViewState usingScale​(double newScale)
        Creates a new state that is the same as the current state except for that it is using a new scale.
        Parameters:
        newScale - The new scale to use.
        Returns:
        The new state.
        Since:
        10375
      • usingLocation

        public MapViewState usingLocation​(JComponent position)
        Creates a new state that is the same as the current state except for that it is using the location of the given component.

        The view is moved so that the center is the same as the old center.

        Parameters:
        position - The new location to use.
        Returns:
        The new state.
        Since:
        10375
      • usingProjection

        public MapViewState usingProjection​(Projection projection)
        Creates a state that uses the projection.
        Parameters:
        projection - The projection to use.
        Returns:
        The new state.
        Since:
        10486
      • createDefaultState

        public static MapViewState createDefaultState​(int width,
                                                      int height)
        Create the default MapViewState object for the given map view. The screen position won't be set so that this method can be used before the view was added to the hierarchy.
        Parameters:
        width - The view width
        height - The view height
        Returns:
        The state
        Since:
        10375
      • equalsInWindow

        public boolean equalsInWindow​(MapViewState other)
        Check if this MapViewState equals another one, disregarding the position of the JOSM window on screen.
        Parameters:
        other - the other MapViewState
        Returns:
        true if the other MapViewState has the same size, scale, position and projection, false otherwise