Package 

Class AbstractWormhole2D

  • All Implemented Interfaces:
    it.unibo.alchemist.boundary.wormhole.interfaces.Wormhole2D

    
    public abstract class AbstractWormhole2D<P extends Position2D<out P>>
     implements Wormhole2D<P>
                        

    Partial, abstract, implementation for the interface Wormhole2D. This implementation considers the particular case of the view as an entity into the sceern-space: the y-axis grows on the bottom side of the screen. This abstract class is independent from the 2D graphical component wrapped.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      double getZoom() Gets the zoom factor.
      void setZoom(double zoom) Changes the zoom factor.
      double getRotation() Getter method for the rotation angle, in radians.
      void setRotation(double rad)
      Wormhole2D.Mode getMode() Gets the rendering mode.
      void setMode(Wormhole2D.Mode mode) Allows child-classes to modify the mode field.
      P getEnvPoint(Point viewPoint) Converts a point from the view-space to the env-space.
      Point getViewPoint(P envPoint) Converts a point from the env-space to the view-space.
      Point getViewPosition() Gets the Position.
      void setViewPosition(Point viewPoint) Sets the Position to viewPoint.
      Dimension2D getViewSize() Gets the view's size.
      boolean isInsideView(Point viewPoint) Check if a point of the view-space is "visible", i.e.
      void rotateAroundPoint(Point p, double a) Rotates around a point into the view-space.
      void setEnvPosition(P envPoint) Sets the position to the view-point corresponding to envPoint.
      void optimalZoom() Automatically sets the zoom rate in order to make the environment entirely visible on the view.
      void zoomOnPoint(Point point, double zoomRate) Zooms on a point into the view-space.
      void center() Points the center of the view on the center of the environment.
      • Methods inherited from class it.unibo.alchemist.boundary.wormhole.interfaces.Wormhole2D

        setRotation, setZoom
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • getZoom

         double getZoom()

        Gets the zoom factor.

      • setZoom

         void setZoom(double zoom)

        Changes the zoom factor.

      • getRotation

         double getRotation()

        Getter method for the rotation angle, in radians.

      • getEnvPoint

         P getEnvPoint(Point viewPoint)

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

      • getViewPoint

         Point getViewPoint(P envPoint)

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

      • isInsideView

         boolean isInsideView(Point viewPoint)

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

      • setEnvPosition

         void setEnvPosition(P envPoint)

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

      • optimalZoom

         void optimalZoom()

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

      • zoomOnPoint

         void zoomOnPoint(Point point, double zoomRate)

        Zooms on a point into the view-space.

      • center

         void center()

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