Class LevelRelation


  • public class LevelRelation
    extends java.lang.Object
    Represents the relation between two map levels by some coordinate transformation. Currently translation and scaling is allowed
    Version:
    1.0, 21.05.2008
    Author:
    Ralf Duckstein
    • Constructor Detail

      • LevelRelation

        public LevelRelation​(int translateX,
                             int translateY,
                             int toLevel,
                             int scaleX,
                             int scaleY,
                             int fromLevel)
        Parameters:
        translateX - x-coordinate of the region in toLevel centered below (0,0,fromLevel).
        translateY - y-coordinate of the region in toLevel centered below (0,0,fromLevel).
        toLevel -
        scaleX - this many regions in toLevel fit into one region of fromLevel
        scaleY - this many regions in toLevel fit into one region of fromLevel
        fromLevel -
    • Method Detail

      • getRelatedCoordinate

        public CoordinateID getRelatedCoordinate​(CoordinateID c)
        Translates a coordinate in getFromLevel() to a coordinate in getZ()
        Returns:
        a new coordinate, scaled or null if c==null or c is in the wrong level.
      • getInverseRelatedCoordinate

        public CoordinateID getInverseRelatedCoordinate​(CoordinateID c)
        Translates a coordinate in getZ() to a coordinate in getFromLevel()
        Returns:
        a new coordinate, scaled or null if c==null or c is in the wrong level.
      • equals

        public boolean equals​(java.lang.Object o)
        Returns true if o is a LevelRelation with all parameters equal to this one's.
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • getX

        public int getX()
        Returns the x value.
      • getY

        public int getY()
        Returns the y value.
      • getZ

        public int getZ()
        Returns the z value (which is the "toLevel").
      • getFromLevel

        public int getFromLevel()
        Returns the value of fromLevel.
        Returns:
        Returns fromLevel.
      • getScaleX

        public int getScaleX()
        Returns the value of scaleX.
        Returns:
        Returns scaleX.
      • getScaleY

        public int getScaleY()
        Returns the value of scaleY.
        Returns:
        Returns scaleY.