Class TileAnchor


  • public class TileAnchor
    extends java.lang.Object
    Class that fixes the position of a tile in a given coordinate space. This is done by storing the coordinates of the tile origin and the opposite tile corner.

    It may represent a reprojected tile, i.e. the tile is rotated / deformed in an arbitrary way. In general, the tile origin cannot be expected to be the upper left corner of the rectangle that is spanned by the 2 points.

    The coordinate space may be

    • pixel coordinates of the image file
    • projected coordinates (east / north)
    • screen pixel coordinates
    Since:
    11846
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.awt.geom.Point2D nextTileOrigin  
      protected java.awt.geom.Point2D tileOrigin  
    • Constructor Summary

      Constructors 
      Constructor Description
      TileAnchor​(java.awt.geom.Point2D tileOrigin, java.awt.geom.Point2D nextTileOrigin)
      Create a new tile anchor.
      TileAnchor​(org.openstreetmap.gui.jmapviewer.interfaces.IProjected tileOrigin, org.openstreetmap.gui.jmapviewer.interfaces.IProjected nextTileOrigin)
      Constructs a new TileAnchor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.geom.AffineTransform convert​(TileAnchor other)
      Create a transformation that converts points from this coordinate space to another coordinate space.
      java.awt.geom.Point2D getNextTileOrigin()
      Returns the position of the opposite tile corner.
      java.awt.geom.Point2D getTileOrigin()
      Returns the position of the tile origin.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • tileOrigin

        protected final java.awt.geom.Point2D tileOrigin
      • nextTileOrigin

        protected final java.awt.geom.Point2D nextTileOrigin
    • Constructor Detail

      • TileAnchor

        public TileAnchor​(java.awt.geom.Point2D tileOrigin,
                          java.awt.geom.Point2D nextTileOrigin)
        Create a new tile anchor.
        Parameters:
        tileOrigin - position of the tile origin
        nextTileOrigin - position of the opposite tile corner, i.e. the origin of the tile with index (x+1,y+1), when current tile has index (x,y)
      • TileAnchor

        public TileAnchor​(org.openstreetmap.gui.jmapviewer.interfaces.IProjected tileOrigin,
                          org.openstreetmap.gui.jmapviewer.interfaces.IProjected nextTileOrigin)
        Constructs a new TileAnchor.
        Parameters:
        tileOrigin - position of the tile origin
        nextTileOrigin - position of the opposite tile corner, i.e. the origin of the tile with index (x+1,y+1), when current tile has index (x,y)
    • Method Detail

      • getTileOrigin

        public java.awt.geom.Point2D getTileOrigin()
        Returns the position of the tile origin.
        Returns:
        the position of the tile origin
      • getNextTileOrigin

        public java.awt.geom.Point2D getNextTileOrigin()
        Returns the position of the opposite tile corner.
        Returns:
        the position of the opposite tile corner, i.e. the origin of the tile with index (x+1,y+1), when current tile has index (x,y)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • convert

        public java.awt.geom.AffineTransform convert​(TileAnchor other)
        Create a transformation that converts points from this coordinate space to another coordinate space.
        Parameters:
        other - tile anchor of the tile in the target coordinate space
        Returns:
        affine transformation from this coordinate space to the target coordinate space