Interface MapWindow

    • Method Summary

      Modifier and Type Method and Description
      void addChangeListener(MapWindowChangeListener listener)
      Add the given listener to the set of general change listeners.
      void addWorldScaleListener(MapWindowWorldScaleListener listener)
      Add the given listener to the set of world scale change listeners.
      void addZoomListener(ZoomChangedListener listener)
      Add the given listener to the set of zoom change listeners.
      boolean containsPoint(OverlayPoint point)
      Test whether this point is within this window.
      BBox getBoundingBox()
      Get the covered area as a bounding box.
      double getCenterLat()
       
      double getCenterLon()
       
      int getHeight()
       
      int getMaxZoom()
       
      int getMinZoom()
       
      double getPositionLat(int y)
      Get the latitude of the given y in view space.
      double getPositionLon(int x)
      Get the longitude of the given x in view space.
      int getWidth()
       
      int getWorldScale()
       
      double getWorldsizePixels()
       
      double getZoom()
       
      void gotoLonLat(double longitude, double latitude)
      Center the map on this position.
      void gotoLonLat(double lon1, double lon2, double lat1, double lat2)
       
      void gotoPoints(Collection<OverlayPoint> points)
      Move the viewport to show all points.
      double latitudeToY(double ilat)
      Calculate the current y position of the given latitude.
      double longitudeToX(double ilon)
      Calculate the current x position of the given longitude.
      double mercatorToX(double mx)
      Calculate the current x position of the given mercator x.
      double mercatorToY(double my)
      Calculate the current y position of the given mercator y.
      void move(int dx, int dy)
      Reposition the map window with the given values.
      void resize(int newWidth, int newHeight)
      Adjust the size of the window.
      void setMaxZoom(int zoomMax)
      Set the maximum allowed zoomlevel.
      void setMinZoom(int zoomMin)
      Set the minimum allowed zoomlevel.
      boolean setWorldScale(int worldScale)
      Set the scale factor of the map that determines how big the image of the world is.
      boolean zoom(int zoomlevel)
      zoom in to the denoted zoomlevel if possible.
      boolean zoomIn()
      zoom in to center if possible.
      void zoomInToPosition(int x, int y)
       
      boolean zoomOut()
      zoom out from center if possible.
      void zoomOutToPosition(int x, int y)
       
    • Method Detail

      • setWorldScale

        boolean setWorldScale(int worldScale)
        Set the scale factor of the map that determines how big the image of the world is.
        Parameters:
        worldScale - the factor by which to multiply the worldsize.
        Returns:
        whether the scale actually changed
      • getWorldScale

        int getWorldScale()
        Returns:
        the scale factor the world image is scaled up with.
      • getWorldsizePixels

        double getWorldsizePixels()
        Returns:
        the size of the whole worlds image in pixels
      • getCenterLon

        double getCenterLon()
        Returns:
        the MapWindow's center's longitude
      • getCenterLat

        double getCenterLat()
        Returns:
        the MapWindow's center's latitude
      • getZoom

        double getZoom()
        Returns:
        the current zoom level.
      • getPositionLon

        double getPositionLon(int x)
        Get the longitude of the given x in view space.
        Parameters:
        x - the position in view space.
        Returns:
        the longitude of this position.
      • getPositionLat

        double getPositionLat(int y)
        Get the latitude of the given y in view space.
        Parameters:
        y - the position in view space.
        Returns:
        the latitude of this position.
      • getBoundingBox

        BBox getBoundingBox()
        Get the covered area as a bounding box.
        Returns:
        the bounding box.
      • getWidth

        int getWidth()
        Returns:
        the current width.
      • getHeight

        int getHeight()
        Returns:
        the current height.
      • resize

        void resize(int newWidth,
                    int newHeight)
        Adjust the size of the window.
        Parameters:
        newWidth - the new width value.
        newHeight - the new height value.
      • move

        void move(int dx,
                  int dy)
        Reposition the map window with the given values. Positive values move the window up and left. You may supply negative values here.
        Parameters:
        dx - the amount of pixels to move to the left.
        dy - the amount of pixels to move to the top.
      • setMaxZoom

        void setMaxZoom(int zoomMax)
        Set the maximum allowed zoomlevel.
        Parameters:
        zoomMax - the maximum zoomlevel to allow
      • setMinZoom

        void setMinZoom(int zoomMin)
        Set the minimum allowed zoomlevel.
        Parameters:
        zoomMin - the minimum zoomlevel to allow
      • getMaxZoom

        int getMaxZoom()
        Returns:
        the maximal zoom level allowed.
      • getMinZoom

        int getMinZoom()
        Returns:
        the minimal zoom level allowed.
      • zoomIn

        boolean zoomIn()
        zoom in to center if possible.
        Returns:
        whether this operation changed the zoom level.
      • zoomOut

        boolean zoomOut()
        zoom out from center if possible.
        Returns:
        whether this operation changed the zoom level.
      • zoom

        boolean zoom(int zoomlevel)
        zoom in to the denoted zoomlevel if possible.
        Parameters:
        zoomlevel - the new zoomlevel to set.
        Returns:
        whether this operation changed the zoom level.
      • zoomInToPosition

        void zoomInToPosition(int x,
                              int y)
      • zoomOutToPosition

        void zoomOutToPosition(int x,
                               int y)
      • addChangeListener

        void addChangeListener(MapWindowChangeListener listener)
        Add the given listener to the set of general change listeners. The listener will be notified on all events.
        Parameters:
        listener - the listener to add.
      • addZoomListener

        void addZoomListener(ZoomChangedListener listener)
        Add the given listener to the set of zoom change listeners. The listener will be notified on zoom events only.
        Parameters:
        listener - the listener to add.
      • addWorldScaleListener

        void addWorldScaleListener(MapWindowWorldScaleListener listener)
        Add the given listener to the set of world scale change listeners. The listener will be notified on world scale events only.
        Parameters:
        listener - the listener to add.
      • longitudeToX

        double longitudeToX(double ilon)
        Calculate the current x position of the given longitude.
        Parameters:
        ilon - the longitude.
        Returns:
        the longitude's position on this window.
      • latitudeToY

        double latitudeToY(double ilat)
        Calculate the current y position of the given latitude.
        Parameters:
        ilat - the latitude.
        Returns:
        the latitude's position on this window.
      • mercatorToX

        double mercatorToX(double mx)
        Calculate the current x position of the given mercator x.
        Parameters:
        mx - the mercator value in the window's zoom level dimension.
        Returns:
        the longitude's position on this window.
      • mercatorToY

        double mercatorToY(double my)
        Calculate the current y position of the given mercator y.
        Parameters:
        my - the mercator value in the window's zoom level dimension.
        Returns:
        the latitude's position on this window.
      • gotoLonLat

        void gotoLonLat(double longitude,
                        double latitude)
        Center the map on this position.
        Parameters:
        longitude - the longitude.
        latitude - the latitude.
      • gotoPoints

        void gotoPoints(Collection<OverlayPoint> points)
        Move the viewport to show all points.
        Parameters:
        points - the points to show
      • gotoLonLat

        void gotoLonLat(double lon1,
                        double lon2,
                        double lat1,
                        double lat2)
        Parameters:
        lon1 - minimum longitude.
        lon2 - maximum longitude.
        lat1 - minimum latitude.
        lat2 - maximum latitude.
      • containsPoint

        boolean containsPoint(OverlayPoint point)
        Test whether this point is within this window.
        Parameters:
        point - the point to test for.
        Returns:
        whether this point is currently within this window.