net.sf.jaxodraw.gui.grid
Interface JaxoGrid

All Known Implementing Classes:
JaxoDefaultGrid

public interface JaxoGrid

Grid: A grid "is" a collection of Points in the plane. An arbitrary point can be mapped to its closest point on the grid. This interface only knows about points on the grid, not about painting. In general, the grid is assumed to be infinite in all directions, not restricted to current bounding boxes or canvas size (Of course, a specific grid could, e.g., claim that there are no grid points with negative coordinates.)

Since:
2.0

Method Summary
 boolean isSnapped(java.awt.Point p)
          Determines if 'p' is on the grid.
 java.awt.Point snappedPoint(java.awt.Point p)
          Closest point to 'p' on the grid.
 void snapPoint(java.awt.Point p)
          Change 'p' to the closest point on the grid.
 

Method Detail

isSnapped

boolean isSnapped(java.awt.Point p)
Determines if 'p' is on the grid. This is equivalent to p.equals(snappedPoint(p)).

Parameters:
p - The point to snap.
Returns:
True if p is on the grid.

snappedPoint

java.awt.Point snappedPoint(java.awt.Point p)
Closest point to 'p' on the grid.

Parameters:
p - The point to snap.
Returns:
The closest grid point.

snapPoint

void snapPoint(java.awt.Point p)
Change 'p' to the closest point on the grid.

Parameters:
p - The point to snap.


Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.