Documentation of 'japlot.jaxodraw.JaxoGrid' Java class
JaxoGrid
japlot.jaxodraw

Class JaxoGrid



  • public class JaxoGrid
    extends java.lang.Object
    Draws agrid on the canvas.
    • Constructor Summary

      Constructors 
      Constructor and Description
      JaxoGrid(int gs, java.lang.String hx)
      Constructor: Sets the dimension to the current screen size and the grid size to gs.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getGridSize()
      Returns the current size of the grid.
      boolean getGridType()
      Returns the type of the grid.
      void jaxoDrawGrid(java.awt.Graphics2D g2)
      Draws the grid.
      void setGridSize(int gs)
      Sets the size of the grid to the given value.
      void setGridType(boolean hx)
      Sets the type of the grid (false: rectangular, true: hexagonal).
      int snapX(int x)
      Returns the x coordinate of the grid point that is closest to the given coordinate.
      int snapY(int y)
      Returns the y coordinate of the grid point that is closest to the given coordinate.
      • Methods inherited from class java.lang.Object

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

      • JaxoGrid

        public JaxoGrid(int gs,
                        java.lang.String hx)
        Constructor: Sets the dimension to the current screen size and the grid size to gs.
        Parameters:
        hx - A string that indicates whether the grid is hexagonal or not.
        gs - The grid size to be set.
    • Method Detail

      • snapX

        public final int snapX(int x)
        Returns the x coordinate of the grid point that is closest to the given coordinate.
        Parameters:
        x - The current x coordinate.
        Returns:
        The x coordinate of the grid point corresponding to x.
      • snapY

        public final int snapY(int y)
        Returns the y coordinate of the grid point that is closest to the given coordinate.
        Parameters:
        y - The current y coordinate.
        Returns:
        The y coordinate of the grid point corresponding to y.
      • jaxoDrawGrid

        public final void jaxoDrawGrid(java.awt.Graphics2D g2)
        Draws the grid.
        Parameters:
        g2 - The graphics context to draw the grid.
      • setGridSize

        public final void setGridSize(int gs)
        Sets the size of the grid to the given value.
        Parameters:
        gs - The gridsize to be set.
      • getGridSize

        public final int getGridSize()
        Returns the current size of the grid.
        Returns:
        The grid size.
      • setGridType

        public final void setGridType(boolean hx)
        Sets the type of the grid (false: rectangular, true: hexagonal).
        Parameters:
        hx - The gridtype to be set.
      • getGridType

        public final boolean getGridType()
        Returns the type of the grid.
        Returns:
        The gridtype (false: rectangular, true: hexagonal).

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.