Class TileAnchor


  • public class TileAnchor
    extends 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
    • Constructor Detail

      • TileAnchor

        public TileAnchor​(Point2D tileOrigin,
                          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 Point2D getTileOrigin()
        Returns the position of the tile origin.
        Returns:
        the position of the tile origin
      • getNextTileOrigin

        public 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)
      • convert

        public 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