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

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.LDot
All Implemented Interfaces:
Dottable, IArrowable, IDot, IPositionShape, IShape, Modifiable

 class LDot
extends LPositionShape
implements IDot

Defines a model of a dot.

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.IDot
IDot.DotStyle
 
Nested classes/interfaces inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape
IShape.BorderPos, IShape.FillingStyle, IShape.LineStyle, IShape.Position
 
Field Summary
protected  double radius
          The radius of the dot.
protected  IDot.DotStyle style
          The current style of the dot.
 
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.IDot
PLUS_COEFF_WIDTH, THICKNESS_O_STYLE_FACTOR
 
Fields inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape
GOLDEN_ANGLE, PPC
 
Constructor Summary
  LDot(IPoint pt)
          Initialises a dot using a centre point.
protected LDot(IPoint pt, boolean isUniqueID)
           
 
Method Summary
 void copy(IShape sh)
          Copies a shape using another.
 IDot duplicate()
          Creates a duplicate of the shape (however id are not the same).
 double getBarGap()
           
 double getBarThickness()
           
 IPoint getBottomLeftPoint()
           
 IPoint getBottomRightPoint()
           
 double getCrossGap()
           
 java.awt.Color getDotFillingCol()
           
 IDot.DotStyle getDotStyle()
           
 java.awt.Color getFillingCol()
           
 double getGeneralGap()
           
 IPoint getLazyBottomRightPoint()
          While getBottomRightPoint takes care about the current shape of the dot to compute the bottom right point, this function computes the bottom right point only using the centre and the width of the dot which are the same for all the dot styles
 IPoint getLazyTopLeftPoint()
          While getTopLeftPoint takes care about the current shape of the dot to compute the top left point, this function computes the top left point only using the centre and the width of the dot which are the same for all the dot styles
protected  double getNewRadius(double value, boolean isX)
          Returns the radius computed using a new position (value) and an axe (isX).
 double getOGap()
           
 double getPlusGap()
           
 IPoint getPosition()
           
 double getRadius()
           
protected  void getTopLeftBottomRightPoints(IPoint tl, IPoint br)
          Gives the top-left point and the bottom-right point of the dot considering its current style.
 IPoint getTopLeftPoint()
           
 IPoint getTopRightPoint()
           
 double getX()
           
 double getY()
           
 boolean hasDot()
           
 boolean isFillable()
           
 boolean isFilled()
           
 boolean isParametersEquals(IShape s, boolean considerShadow)
          Checks if the parameters of the shapes are equals.
 void mirrorHorizontal(IPoint origin)
          Returns horizontally the shape.
 void mirrorVertical(IPoint origin)
          Returns vertically the shape.
 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 setDotFillingCol(java.awt.Color value)
          Sets the filling colour of the dottable.
 void setDotStyle(IDot.DotStyle style)
          Defines the style of the dot.
 void setRadius(double radius)
          Defines the radius of the dot.
 void setX(double x)
          Sets the X coordinate of the shape (of the bottom-left point of the shape).
 void setY(double y)
          Sets the Y coordinate of the shape (of the bottom-left point of the shape).
 
Methods inherited from class net.sf.latexdraw.glib.models.impl.LPositionShape
setPosition, setPosition
 
Methods inherited from class net.sf.latexdraw.glib.models.impl.LShape
addToRotationAngle, copyArrows, copyPoints, getArrowAt, getArrowInset, getArrowLength, getArrowLine, getArrows, getArrowSizeDim, getArrowSizeNum, getArrowStyle, getBorderGap, getBordersPosition, getBracketNum, getDashSepBlack, getDashSepWhite, getDbleBordCol, getDbleBordSep, getDotSep, getDotSizeDim, getDotSizeNum, 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, 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.IPositionShape
setPosition, setPosition
 
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape
addToRotationAngle, getArrowAt, getArrowLine, getArrows, getArrowStyle, getBorderGap, getBordersPosition, getDashSepBlack, getDashSepWhite, getDbleBordCol, getDbleBordSep, getDotSep, 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, hasDbleBord, hasGradient, hasHatchings, hasShadow, isArrowable, isBordersMovable, isColourable, isDbleBorderable, isInteriorStylable, isLineStylable, isShadowable, isShowPts, isShowPtsable, isThicknessable, 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

style

protected IDot.DotStyle style
The current style of the dot.


radius

protected double radius
The radius of the dot.

Constructor Detail

LDot

protected LDot(IPoint pt,
               boolean isUniqueID)
Parameters:
isUniqueID - True: the shape will have a unique ID.
pt - The centre of the dot.

LDot

public LDot(IPoint pt)
Initialises a dot using a centre point.

Parameters:
pt - The centre of the dot.
Method Detail

duplicate

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

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

getFillingCol

public java.awt.Color getFillingCol()
Specified by:
getFillingCol in interface IShape
Overrides:
getFillingCol in class LShape
Returns:
the fillingCol.

getDotStyle

public IDot.DotStyle getDotStyle()
Specified by:
getDotStyle in interface Dottable
Returns:
The style of the dot.

getRadius

public double getRadius()
Specified by:
getRadius in interface Dottable
Returns:
the radius of the dot.

setDotStyle

public void setDotStyle(IDot.DotStyle style)
Description copied from interface: Dottable
Defines the style of the dot.

Specified by:
setDotStyle in interface Dottable
Parameters:
style - The new style.

setRadius

public void setRadius(double radius)
Description copied from interface: Dottable
Defines the radius of the dot.

Specified by:
setRadius in interface Dottable
Parameters:
radius - the radius to set. Must be greater than 0.

getNewRadius

protected double getNewRadius(double value,
                              boolean isX)
Returns the radius computed using a new position (value) and an axe (isX).

Parameters:
value - The new X or Y coordinate of the extremity of the dot.
isX - True: the value will be considered on the X-axe. Otherwise, on the Y-axe.
Returns:
The new radius.
Since:
3.0

mirrorHorizontal

public void mirrorHorizontal(IPoint origin)
Description copied from interface: IShape
Returns horizontally the shape.

Specified by:
mirrorHorizontal in interface IShape
Overrides:
mirrorHorizontal in class LShape
Parameters:
origin - The location of the horizontal axe.

mirrorVertical

public void mirrorVertical(IPoint origin)
Description copied from interface: IShape
Returns vertically the shape.

Specified by:
mirrorVertical in interface IShape
Overrides:
mirrorVertical in class LShape
Parameters:
origin - The location of the vertical axe.

setX

public void setX(double x)
Description copied from interface: IPositionShape
Sets the X coordinate of the shape (of the bottom-left point of the shape).

Specified by:
setX in interface IPositionShape
Overrides:
setX in class LPositionShape
Parameters:
x - The X coordinate of the shape.

setY

public void setY(double y)
Description copied from interface: IPositionShape
Sets the Y coordinate of the shape (of the bottom-left point of the shape).

Specified by:
setY in interface IPositionShape
Overrides:
setY in class LPositionShape
Parameters:
y - The Y coordinate of the shape.

getX

public double getX()
Specified by:
getX in interface IPositionShape
Overrides:
getX in class LPositionShape
Returns:
The X coordinate of the shape (of the bottom-left point of the shape).

getY

public double getY()
Specified by:
getY in interface IPositionShape
Overrides:
getY in class LPositionShape
Returns:
The Y coordinate of the shape (of the bottom-left point of the shape).

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.

getPosition

public IPoint getPosition()
Specified by:
getPosition in interface IPositionShape
Overrides:
getPosition in class LPositionShape
Returns:
The position of the shape (the bottom-left point of the shape).

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 LShape
Parameters:
sh - The shape to copy.

getBottomLeftPoint

public IPoint getBottomLeftPoint()
Specified by:
getBottomLeftPoint in interface IShape
Overrides:
getBottomLeftPoint in class LShape
Returns:
The bottom left point of the shape. It does not take account of the thickness, the rotation angle, the double border, nor any parameters; only the points of the shape are used to compute the returned point.

getBottomRightPoint

public IPoint getBottomRightPoint()
Specified by:
getBottomRightPoint in interface IShape
Overrides:
getBottomRightPoint in class LShape
Returns:
The bottom right point of the shape. It does not take account of the thickness, the rotation angle, the double border, nor any parameters; only the points of the shape are used to compute the returned point.

getTopLeftPoint

public IPoint getTopLeftPoint()
Specified by:
getTopLeftPoint in interface IShape
Overrides:
getTopLeftPoint in class LShape
Returns:
The top left point of the shape. It does not take account of the thickness, the rotation angle, the double border, nor any parameters; only the points of the shape are used to compute the returned point.

getTopRightPoint

public IPoint getTopRightPoint()
Specified by:
getTopRightPoint in interface IShape
Overrides:
getTopRightPoint in class LShape
Returns:
The top right point of the shape. It does not take account of the thickness, the rotation angle, the double border, nor any parameters; only the points of the shape are used to compute the returned point.

getTopLeftBottomRightPoints

protected void getTopLeftBottomRightPoints(IPoint tl,
                                           IPoint br)
Gives the top-left point and the bottom-right point of the dot considering its current style.

Parameters:
tl - The top-left point to set. Must not be null.
br - The bottom-right point to set. Must not be null.
Throws:
java.lang.NullPointerException - If tl or br is null.
Since:
3.0

isFillable

public boolean isFillable()
Specified by:
isFillable in interface Dottable
Specified by:
isFillable in interface IShape
Overrides:
isFillable in class LShape
Returns:
True if the shape can have an interior colour.

isFilled

public boolean isFilled()
Specified by:
isFilled in interface IShape
Overrides:
isFilled in class LShape
Returns:
the isFilled.

isParametersEquals

public boolean isParametersEquals(IShape s,
                                  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 LShape
Parameters:
s - The shape to compare.
considerShadow - True if the parameters of the shadows must be considered.
Returns:
True if the parameters are equals.

getLazyTopLeftPoint

public IPoint getLazyTopLeftPoint()
Description copied from interface: IDot
While getTopLeftPoint takes care about the current shape of the dot to compute the top left point, this function computes the top left point only using the centre and the width of the dot which are the same for all the dot styles

Specified by:
getLazyTopLeftPoint in interface IDot
Returns:
The top left point of the dot.

getLazyBottomRightPoint

public IPoint getLazyBottomRightPoint()
Description copied from interface: IDot
While getBottomRightPoint takes care about the current shape of the dot to compute the bottom right point, this function computes the bottom right point only using the centre and the width of the dot which are the same for all the dot styles

Specified by:
getLazyBottomRightPoint in interface IDot
Returns:
The top bottom right of the dot.

getPlusGap

public double getPlusGap()
Specified by:
getPlusGap in interface IDot
Returns:
The gap used to create plus-shaped dots.

getCrossGap

public double getCrossGap()
Specified by:
getCrossGap in interface IDot
Returns:
The gap used to create cross-shaped dots.

getBarGap

public double getBarGap()
Specified by:
getBarGap in interface IDot
Returns:
The gap used to create bar-shaped dots.

getBarThickness

public double getBarThickness()
Specified by:
getBarThickness in interface IDot
Returns:
The thickness used to create bar-shaped dots.

getGeneralGap

public double getGeneralGap()
Specified by:
getGeneralGap in interface IDot
Returns:
The gap used to compute the shape of several kinds of dot.

getOGap

public double getOGap()
Specified by:
getOGap in interface IDot
Returns:
The gap used to create O-shaped dots.

hasDot

public boolean hasDot()
Specified by:
hasDot in interface Dottable
Returns:
True if the dottable has or is a dot.

getDotFillingCol

public java.awt.Color getDotFillingCol()
Specified by:
getDotFillingCol in interface Dottable
Returns:
The filling colour of the dottable or null if not fillable.

setDotFillingCol

public void setDotFillingCol(java.awt.Color value)
Description copied from interface: Dottable
Sets the filling colour of the dottable.

Specified by:
setDotFillingCol in interface Dottable
Parameters:
value - its new colour.