Interface Wormhole2D

  • All Implemented Interfaces:

    
    public interface Wormhole2D<P extends Position2D<out P>>
    
                        

    A Wormhole (in this context) is an entity that "connects" two worlds: the "environment" and the "view". Above all it provides services to convert coordinates from the "environment-space" to the "view-space". IWormhole2D is the type of a wormhole whose both environment and view are bi-dimensional spaces. Terminology: - "Environment" is the 'rectangle' we need to render ON the view. - "View" is a 'window' that let us see the environment. - "Environment-space" is the algebraic space on which 'lies' the environment. - "View-space" is the algebraic space on which 'lies' the view. - "Env" before a point's name => it refers to a point into the environment-space. - "View" before a point's name => it refers to a point into the view-space. - "Position" is the point of the view-space every transformation applied to the environment refers to: e.g. if I want to move the environment, I have to change the position; it is also the point the environment rotates around. - "EnvOffset" is the vector from (0; 0) into env-space to the left-bottom corner of the part of the environment we want to render. E.g. if I am representing a map with Earth-coordinates (16; 48), the intersection between the prime meridian and the equator is (0; 0), so I have to set the envOffset to (16; 48) in order to see the "beginning" of the map on the left-bottom corner of the view.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public enum Wormhole2D.Mode

      Wormhole mode.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract P getEnvPoint(Point viewPoint) Converts a point from the view-space to the env-space.
      abstract Wormhole2D.Mode getMode() Gets the rendering mode.
      abstract Point getViewPoint(P envPoint) Converts a point from the env-space to the view-space.
      abstract Point getViewPosition() Gets the Position.
      abstract Dimension2D getViewSize() Gets the view's size.
      abstract double getZoom() Gets the zoom factor.
      abstract boolean isInsideView(Point viewPoint) Check if a point of the view-space is "visible", i.e.
      abstract void rotateAroundPoint(Point p, double a) Rotates around a point into the view-space.
      abstract void setEnvPosition(P envPoint) Sets the position to the view-point corresponding to envPoint.
      abstract void optimalZoom() Automatically sets the zoom rate in order to make the environment entirely visible on the view.
      abstract void setRotation(double rad) Rotates the environment around the Position.
      abstract void setViewPosition(Point viewPoint) Sets the Position to viewPoint.
      abstract void setZoom(double value) Changes the zoom factor.
      abstract void zoomOnPoint(Point p, double z) Zooms on a point into the view-space.
      abstract void center() Points the center of the view on the center of the environment.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getEnvPoint

         abstract P getEnvPoint(Point viewPoint)

        Converts a point from the view-space to the env-space.

        Parameters:
        viewPoint - is the Point object whose coordinates are from view-space
        Returns:

        a Position2D object whose coordinates are from env-space

      • getViewPoint

         abstract Point getViewPoint(P envPoint)

        Converts a point from the env-space to the view-space.

        Parameters:
        envPoint - is the Position2D object whose coordinates are from env-space
        Returns:

        a Point object whose coordinates are from view-space

      • getViewSize

         abstract Dimension2D getViewSize()

        Gets the view's size.

        Returns:

        a tuple containing the view's width and height

      • getZoom

         abstract double getZoom()

        Gets the zoom factor.

        Returns:

        a double representing the zoom factor

      • isInsideView

         abstract boolean isInsideView(Point viewPoint)

        Check if a point of the view-space is "visible", i.e. it is inside the view.

        Parameters:
        viewPoint - is the Point to check
        Returns:

        true if it is visible, false instead

      • rotateAroundPoint

         abstract void rotateAroundPoint(Point p, double a)

        Rotates around a point into the view-space.

        Parameters:
        p - is the Point
        a - is the absolute angle (in radians)
      • setEnvPosition

         abstract void setEnvPosition(P envPoint)

        Sets the position to the view-point corresponding to envPoint.

        Parameters:
        envPoint - is the Position2D object representing the new position with env-coordinates
      • optimalZoom

         abstract void optimalZoom()

        Automatically sets the zoom rate in order to make the environment entirely visible on the view.

      • setRotation

         abstract void setRotation(double rad)

        Rotates the environment around the Position.

        Parameters:
        rad - is the double value representing the angle expressed with radians
      • setViewPosition

         abstract void setViewPosition(Point viewPoint)

        Sets the Position to viewPoint.

        Parameters:
        viewPoint - is the Point object representing the new position with view-coordinates
      • setZoom

         abstract void setZoom(double value)

        Changes the zoom factor.

        Parameters:
        value - is the double value representing the new zoom
      • zoomOnPoint

         abstract void zoomOnPoint(Point p, double z)

        Zooms on a point into the view-space.

        Parameters:
        p - is the Point
        z - is the absolute zoom rate
      • center

         abstract void center()

        Points the center of the view on the center of the environment.