net.sf.latexdraw.glib.models.impl
Class LGrid

java.lang.Object
  extended by net.sf.latexdraw.glib.models.impl.LShape
      extended by net.sf.latexdraw.glib.models.impl.LPositionShape
          extended by net.sf.latexdraw.glib.models.impl.LAbstractGrid
              extended by net.sf.latexdraw.glib.models.impl.LGrid
All Implemented Interfaces:
IArrowable, IGrid, IPositionShape, IShape, IStandardGrid, Modifiable

 class LGrid
extends LAbstractGrid
implements IGrid

Defines a model of a grid.

This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

07/05/2009

Since:
3.0
Version:
3.0
Author:
Arnaud BLOUIN

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape
IShape.BorderPos, IShape.FillingStyle, IShape.LineStyle, IShape.Position
 
Field Summary
protected  int gridDots
          The number of dots in the lines of the grid ( if >0, replace a plain line)
protected  java.awt.Color gridLabelsColour
          The colour of the labels
protected  double gridWidth
          The thickness of the main borders of the grid.
static int MIN_LABELS_SIZE
          The minimum possible size of the labels
protected  java.awt.Color subGridColour
          The colour of the sub-grid.
protected  int subGridDiv
          The number of division in a sub-grid.
protected  int subGridDots
          The number of dots in the lines of the sub-grid ( if >0, replace a plain line)
protected  double subGridWidth
          The thickness of the lines of the sub-grid
protected  double unit
          The unit of the grid
 
Fields inherited from class net.sf.latexdraw.glib.models.impl.LAbstractGrid
gridEndx, gridEndy, gridStartx, gridStarty, labelSize, originx, originy, xLabelSouth, yLabelWest
 
Fields inherited from class net.sf.latexdraw.glib.models.impl.LShape
arrows, bordersPosition, dashSepBlack, dashSepWhite, dbleBordCol, dbleBordSep, dotSep, fillingCol, fillingStyle, gradAngle, gradColEnd, gradColStart, gradMidPt, hasDbleBord, hasShadow, hatchingsAngle, hatchingsCol, hatchingsSep, hatchingsWidth, id, lineColour, lineStyle, modified, opacity, points, rotationAngle, shadowAngle, shadowCol, shadowSize, showPts, thickness
 
Fields inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape
GOLDEN_ANGLE, PPC
 
Constructor Summary
protected LGrid(boolean isUniqueID, IPoint pt)
          Creates a grid with a predefined point.
 
Method Summary
 void copy(IShape sh)
          Copies a shape using another.
 IGrid duplicate()
          Creates a duplicate of the shape (however id are not the same).
 int getGridDots()
           
 java.awt.Color getGridLabelsColour()
           
 double getGridWidth()
           
 double getStep()
           
 java.awt.Color getSubGridColour()
           
 int getSubGridDiv()
           
 int getSubGridDots()
           
 double getSubGridWidth()
           
 double getUnit()
           
 boolean isParametersEquals(IShape sh, boolean considerShadow)
          Checks if the parameters of the shapes are equals.
 void scale(double x, double y, IShape.Position pos, java.awt.geom.Rectangle2D bound)
          Scales the shape where the move reference point is the bottom right point, and the fixation point the top left point.
 void setGridDots(int gridDots)
           
 void setGridLabelsColour(java.awt.Color gridLabelsColour)
           
 void setGridWidth(double gridWidth)
           
 void setSubGridColour(java.awt.Color subGridColour)
           
 void setSubGridDiv(int subGridDiv)
           
 void setSubGridDots(int subGridDots)
           
 void setSubGridWidth(double subGridWidth)
           
 void setUnit(double unit)
           
 
Methods inherited from class net.sf.latexdraw.glib.models.impl.LAbstractGrid
getBottomRightPoint, getGridEnd, getGridEndX, getGridEndY, getGridMaxX, getGridMaxY, getGridMinX, getGridMinY, getGridStart, getGridStartX, getGridStartY, getLabelsSize, getOriginX, getOriginY, getTopLeftPoint, getTopRightPoint, isXLabelSouth, isYLabelWest, mirrorHorizontal, mirrorVertical, setGridEnd, setGridEndX, setGridEndY, setGridStart, setGridStartX, setGridStartY, setLabelsSize, setOrigin, setOriginX, setOriginY, setXLabelSouth, setYLabelWest
 
Methods inherited from class net.sf.latexdraw.glib.models.impl.LPositionShape
getPosition, getX, getY, setPosition, setPosition, setX, setY
 
Methods inherited from class net.sf.latexdraw.glib.models.impl.LShape
addToRotationAngle, copyArrows, copyPoints, getArrowAt, getArrowInset, getArrowLength, getArrowLine, getArrows, getArrowSizeDim, getArrowSizeNum, getArrowStyle, getBorderGap, getBordersPosition, getBottomLeftPoint, getBracketNum, getDashSepBlack, getDashSepWhite, getDbleBordCol, getDbleBordSep, getDotSep, getDotSizeDim, getDotSizeNum, getFillingCol, getFillingStyle, getFullBottomRightPoint, getFullTopLeftPoint, getGradAngle, getGradColEnd, getGradColStart, getGradMidPt, getGravityCentre, getHatchingsAngle, getHatchingsCol, getHatchingsSep, getHatchingsWidth, getId, getLineColour, getLineStyle, getNbPoints, getOpacity, getPoints, getPtAt, getRBracketNum, getRotationAngle, getShadowAngle, getShadowCol, getShadowGap, getShadowSize, getTBarSizeDim, getTBarSizeNum, getThickness, hasDbleBord, hasGradient, hasHatchings, hasShadow, isArrowable, isBordersMovable, isColourable, isDbleBorderable, isFillable, isFilled, isInteriorStylable, isLineStylable, isModified, isShadowable, isShowPts, isShowPtsable, isThicknessable, rotate, scaleSetPoints, setArrowInset, setArrowLength, setArrowSizeDim, setArrowSizeNum, setArrowStyle, setBordersPosition, setBracketNum, setDashSepBlack, setDashSepWhite, setDbleBordCol, setDbleBordSep, setDotSep, setDotSizeDim, setDotSizeNum, setFilled, setFillingCol, setFillingStyle, setGradAngle, setGradColEnd, setGradColStart, setGradMidPt, setHasDbleBord, setHasShadow, setHatchingsAngle, setHatchingsCol, setHatchingsSep, setHatchingsWidth, setId, setLineColour, setLineStyle, setModified, setNewId, setOpacity, setRBracketNum, setRotationAngle, setShadowAngle, setShadowCol, setShadowSize, setShowPts, setTBarSizeDim, setTBarSizeNum, setThickness, shadowFillsShape, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IStandardGrid
getGridEnd, getGridEndX, getGridEndY, getGridMaxX, getGridMaxY, getGridMinX, getGridMinY, getGridStart, getGridStartX, getGridStartY, getLabelsSize, getOriginX, getOriginY, isXLabelSouth, isYLabelWest, setGridEnd, setGridEndX, setGridEndY, setGridStart, setGridStartX, setGridStartY, setLabelsSize, setOrigin, setOriginX, setOriginY, setXLabelSouth, setYLabelWest
 
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IPositionShape
getPosition, getX, getY, setPosition, setPosition, setX, setY
 
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape
addToRotationAngle, getArrowAt, getArrowLine, getArrows, getArrowStyle, getBorderGap, getBordersPosition, getBottomLeftPoint, getBottomRightPoint, getDashSepBlack, getDashSepWhite, getDbleBordCol, getDbleBordSep, getDotSep, getFillingCol, getFillingStyle, getFullBottomRightPoint, getFullTopLeftPoint, getGradAngle, getGradColEnd, getGradColStart, getGradMidPt, getGravityCentre, getHatchingsAngle, getHatchingsCol, getHatchingsSep, getHatchingsWidth, getId, getLineColour, getLineStyle, getNbPoints, getOpacity, getPoints, getPtAt, getRotationAngle, getShadowAngle, getShadowCol, getShadowGap, getShadowSize, getThickness, getTopLeftPoint, getTopRightPoint, hasDbleBord, hasGradient, hasHatchings, hasShadow, isArrowable, isBordersMovable, isColourable, isDbleBorderable, isFillable, isFilled, isInteriorStylable, isLineStylable, isShadowable, isShowPts, isShowPtsable, isThicknessable, mirrorHorizontal, mirrorVertical, rotate, setArrowStyle, setBordersPosition, setDashSepBlack, setDashSepWhite, setDbleBordCol, setDbleBordSep, setDotSep, setFilled, setFillingCol, setFillingStyle, setGradAngle, setGradColEnd, setGradColStart, setGradMidPt, setHasDbleBord, setHasShadow, setHatchingsAngle, setHatchingsCol, setHatchingsSep, setHatchingsWidth, setId, setLineColour, setLineStyle, setNewId, setOpacity, setRotationAngle, setShadowAngle, setShadowCol, setShadowSize, setShowPts, setThickness, shadowFillsShape, translate
 
Methods inherited from interface org.malai.properties.Modifiable
isModified, setModified
 
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IArrowable
getArrowInset, getArrowLength, getArrowSizeDim, getArrowSizeNum, getBracketNum, getDotSizeDim, getDotSizeNum, getRBracketNum, getTBarSizeDim, getTBarSizeNum, setArrowInset, setArrowLength, setArrowSizeDim, setArrowSizeNum, setBracketNum, setDotSizeDim, setDotSizeNum, setRBracketNum, setTBarSizeDim, setTBarSizeNum
 

Field Detail

subGridColour

protected java.awt.Color subGridColour
The colour of the sub-grid.


subGridDiv

protected int subGridDiv
The number of division in a sub-grid.


gridWidth

protected double gridWidth
The thickness of the main borders of the grid.


gridLabelsColour

protected java.awt.Color gridLabelsColour
The colour of the labels


gridDots

protected int gridDots
The number of dots in the lines of the grid ( if >0, replace a plain line)


subGridWidth

protected double subGridWidth
The thickness of the lines of the sub-grid


subGridDots

protected int subGridDots
The number of dots in the lines of the sub-grid ( if >0, replace a plain line)


unit

protected double unit
The unit of the grid


MIN_LABELS_SIZE

public static final int MIN_LABELS_SIZE
The minimum possible size of the labels

See Also:
Constant Field Values
Constructor Detail

LGrid

protected LGrid(boolean isUniqueID,
                IPoint pt)
Creates a grid with a predefined point.

Parameters:
isUniqueID - True: the shape will have a unique ID.
pt - The position.
Method Detail

copy

public void copy(IShape sh)
Description copied from interface: IShape
Copies a shape using another.

Specified by:
copy in interface IShape
Overrides:
copy in class LAbstractGrid
Parameters:
sh - The shape to copy.

duplicate

public IGrid duplicate()
Description copied from interface: IShape
Creates a duplicate of the shape (however id are not the same).

Specified by:
duplicate in interface IGrid
Specified by:
duplicate in interface IShape
Overrides:
duplicate in class LShape
Returns:
The duplicata.

isParametersEquals

public boolean isParametersEquals(IShape sh,
                                  boolean considerShadow)
Description copied from interface: IShape
Checks if the parameters of the shapes are equals.

Specified by:
isParametersEquals in interface IShape
Overrides:
isParametersEquals in class LAbstractGrid
Parameters:
sh - The shape to compare.
considerShadow - True if the parameters of the shadows must be considered.
Returns:
True if the parameters are equals.

scale

public void scale(double x,
                  double y,
                  IShape.Position pos,
                  java.awt.geom.Rectangle2D bound)
Description copied from interface: IShape
Scales the shape where the move reference point is the bottom right point, and the fixation point the top left point.

Specified by:
scale in interface IShape
Overrides:
scale in class LShape
Parameters:
x - The X scale factor, in ]0,double].
y - The Y scale factor, in ]0,double].
pos - The position of the reference point: if the reference point is top-left point, then the scale will extend or reduce the shape at the bottom-right point. If the reference position is NORTH or SOUTH the sx parameter will not be used. If it is EAST or WEST the sy parameter will not be used.
bound - The bound (e.g. the border of the selected shapes) used to compute the scaling.

getGridDots

public int getGridDots()
Specified by:
getGridDots in interface IGrid
Returns:
Returns the gridDots.

getGridLabelsColour

public java.awt.Color getGridLabelsColour()
Specified by:
getGridLabelsColour in interface IGrid
Returns:
Returns the gridLabelsColor.

getGridWidth

public double getGridWidth()
Specified by:
getGridWidth in interface IGrid
Returns:
Returns the gridWidth.

getSubGridColour

public java.awt.Color getSubGridColour()
Specified by:
getSubGridColour in interface IGrid
Returns:
Returns the subGridColor.

getSubGridDiv

public int getSubGridDiv()
Specified by:
getSubGridDiv in interface IGrid
Returns:
Returns the subGridDiv.

getSubGridDots

public int getSubGridDots()
Specified by:
getSubGridDots in interface IGrid
Returns:
Returns the subGridDots.

getSubGridWidth

public double getSubGridWidth()
Specified by:
getSubGridWidth in interface IGrid
Returns:
Returns the subGridWidth.

getUnit

public double getUnit()
Specified by:
getUnit in interface IGrid
Returns:
Returns the unit.

setGridDots

public void setGridDots(int gridDots)
Specified by:
setGridDots in interface IGrid
Parameters:
gridDots - The gridDots to set. Must be greater or equal than 0.

setGridLabelsColour

public void setGridLabelsColour(java.awt.Color gridLabelsColour)
Specified by:
setGridLabelsColour in interface IGrid
Parameters:
gridLabelsColour - The gridLabelsColor to set.

setGridWidth

public void setGridWidth(double gridWidth)
Specified by:
setGridWidth in interface IGrid
Parameters:
gridWidth - The gridWidth to set. Must be greater than 0.

setSubGridColour

public void setSubGridColour(java.awt.Color subGridColour)
Specified by:
setSubGridColour in interface IGrid
Parameters:
subGridColour - The subGridColor to set.

setSubGridDiv

public void setSubGridDiv(int subGridDiv)
Specified by:
setSubGridDiv in interface IGrid
Parameters:
subGridDiv - The subGridDiv to set. Must be greater or equal than 0.

setSubGridDots

public void setSubGridDots(int subGridDots)
Specified by:
setSubGridDots in interface IGrid
Parameters:
subGridDots - The subGridDots to set. Must be greater or equal than 0.

setSubGridWidth

public void setSubGridWidth(double subGridWidth)
Specified by:
setSubGridWidth in interface IGrid
Parameters:
subGridWidth - The subGridWidth to set. Must be greater than 0.

setUnit

public void setUnit(double unit)
Specified by:
setUnit in interface IGrid
Parameters:
unit - The unit to set. Must be greater than 0.

getStep

public double getStep()
Specified by:
getStep in interface IStandardGrid
Returns:
The size of a step of the grid (can be LShape.PPC or LShape.PPC*unit for instance).