T - The type of the items.public class GridConstraintProvider<T> extends Object implements IGridConstraintProvider<T>
IGridConstraintProvider.| Constructor and Description |
|---|
GridConstraintProvider(double gridSize)
Creates a new instance using the given grid distances.
|
GridConstraintProvider(double gridWidth,
double gridHeight)
Creates a new instance using the given grid specification.
|
GridConstraintProvider(GridInfo gridInfo)
Creates a new instance using the given grid info.
|
| Modifier and Type | Method and Description |
|---|---|
GridInfo |
getGridInfo()
Gets the grid info that describes the geometry of the grid.
|
PointD |
getGridOrigin()
Gets the grid origin.
|
double |
getHorizontalGridWidth()
Gets the grid height.
|
double |
getVerticalGridWidth()
Gets the grid width.
|
void |
setGridInfo(GridInfo value)
Sets the grid info that describes the geometry of the grid.
|
boolean |
snapToGrid(IInputModeContext context,
T item,
IMutablePoint location,
SnapPolicy xSnapPolicy,
SnapPolicy ySnapPolicy)
Performs the actual snapping to grid coordinates.
|
public GridConstraintProvider(double gridSize)
public GridConstraintProvider(double gridWidth,
double gridHeight)
gridWidth - Width of the grid.gridHeight - Height of the grid.public GridConstraintProvider(GridInfo gridInfo)
gridInfo - The grid info object.public final GridInfo getGridInfo()
setGridInfo(GridInfo)public final PointD getGridOrigin()
This implementation delegates to the GridInfo
getGridOrigin in interface IGridConstraintProvider<T>public final double getHorizontalGridWidth()
This implementation delegates to the GridInfo
getHorizontalGridWidth in interface IGridConstraintProvider<T>public final double getVerticalGridWidth()
This implementation delegates to the GridInfo
getVerticalGridWidth in interface IGridConstraintProvider<T>public final void setGridInfo(GridInfo value)
value - The grid info.getGridInfo()public boolean snapToGrid(IInputModeContext context, T item, IMutablePoint location, SnapPolicy xSnapPolicy, SnapPolicy ySnapPolicy)
IGridConstraintProvidersnapToGrid in interface IGridConstraintProvider<T>context - The context in which the snapping should occur.item - The item of which the coordinates should be snapped.location - The coordinates to snap.xSnapPolicy - The policy for the x coordinate.ySnapPolicy - The policy for the y coordinate.