net.sf.latexdraw.glib.models.interfaces
Interface IShape

All Superinterfaces:
IArrowable, Modifiable
All Known Subinterfaces:
IArc, IAxes, IBezierCurve, ICircle, ICircleArc, IControlPointShape, ICurve, IDot, IEllipse, IFreehand, IGrid, IGroup, IModifiablePointsShape, IPicture, IPlot, IPolygon, IPolyline, IPositionShape, IRectangle, IRectangularShape, IRhombus, ISquare, IStandardGrid, IText, ITriangle
All Known Implementing Classes:
LAbstractCtrlPointShape, LAbstractGrid, LArc, LAxes, LBezierCurve, LCircle, LCircleArc, LDot, LDrawing, LEllipse, LFreehand, LGrid, LGroup, LModifiablePointsShape, LPicture, LPolygon, LPolyline, LPositionShape, LRectangle, LRectangularShape, LRhombus, LShape, LSquare, LText, LTriangle

public interface IShape
extends Modifiable, IArrowable

Defines an interface that classes defining an abstract shape should implement.

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/02/2009

Since:
3.0
Version:
3.0
Author:
Arnaud BLOUIN

Nested Class Summary
static class IShape.BorderPos
          The different positions of the border.
static class IShape.FillingStyle
          The different styles of filling.
static class IShape.LineStyle
          The different styles of the lines.
static class IShape.Position
          The different cardinal points.
 
Field Summary
static double GOLDEN_ANGLE
          Corresponds to the golden angle (Useful for golden diamond).
static int PPC
          The number of pixels per centimetre by default.
 
Method Summary
 void addToRotationAngle(IPoint gravCentre, double angle)
          Adds the given angle to the current rotation angle.
 void copy(IShape s)
          Copies a shape using another.
 IShape duplicate()
          Creates a duplicate of the shape (however id are not the same).
 IArrow getArrowAt(int position)
           
 ILine getArrowLine(IArrow arrow)
           
 java.util.List<IArrow> getArrows()
           
 IArrow.ArrowStyle getArrowStyle(int position)
           
 double getBorderGap()
          Computes the gap created by the thickness, the double borders and the position of the border.
 IShape.BorderPos getBordersPosition()
           
 IPoint getBottomLeftPoint()
           
 IPoint getBottomRightPoint()
           
 double getDashSepBlack()
           
 double getDashSepWhite()
           
 java.awt.Color getDbleBordCol()
           
 double getDbleBordSep()
           
 double getDotSep()
           
 java.awt.Color getFillingCol()
           
 IShape.FillingStyle getFillingStyle()
           
 IPoint getFullBottomRightPoint()
           
 IPoint getFullTopLeftPoint()
           
 double getGradAngle()
           
 java.awt.Color getGradColEnd()
           
 java.awt.Color getGradColStart()
           
 double getGradMidPt()
           
 IPoint getGravityCentre()
           
 double getHatchingsAngle()
           
 java.awt.Color getHatchingsCol()
           
 double getHatchingsSep()
           
 double getHatchingsWidth()
           
 int getId()
           
 java.awt.Color getLineColour()
           
 IShape.LineStyle getLineStyle()
           
 int getNbPoints()
           
 double getOpacity()
           
 java.util.List<IPoint> getPoints()
           
 IPoint getPtAt(int position)
           
 double getRotationAngle()
           
 double getShadowAngle()
           
 java.awt.Color getShadowCol()
           
 IPoint getShadowGap()
          Computes the translation vector between the shape itself and its shadow.
 double getShadowSize()
           
 double getThickness()
           
 IPoint getTopLeftPoint()
           
 IPoint getTopRightPoint()
           
 boolean hasDbleBord()
           
 boolean hasGradient()
           
 boolean hasHatchings()
           
 boolean hasShadow()
           
 boolean isArrowable()
           
 boolean isBordersMovable()
           
 boolean isColourable()
           
 boolean isDbleBorderable()
           
 boolean isFillable()
           
 boolean isFilled()
           
 boolean isInteriorStylable()
           
 boolean isLineStylable()
           
 boolean isParametersEquals(IShape s, boolean considerShadow)
          Checks if the parameters of the shapes are equals.
 boolean isShadowable()
           
 boolean isShowPts()
           
 boolean isShowPtsable()
           
 boolean isThicknessable()
           
 void mirrorHorizontal(IPoint origin)
          Returns horizontally the shape.
 void mirrorVertical(IPoint origin)
          Returns vertically the shape.
 void rotate(IPoint point, double angle)
          Rotates the shape.
 void scale(double sx, double sy, 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 setArrowStyle(IArrow.ArrowStyle style, int position)
          Sets the style of the arrow at the given position.
 void setBordersPosition(IShape.BorderPos position)
          Sets the position of the borders.
 void setDashSepBlack(double dashSepBlack)
           
 void setDashSepWhite(double dashSepWhite)
           
 void setDbleBordCol(java.awt.Color dbleBordCol)
           
 void setDbleBordSep(double dbleBordSep)
           
 void setDotSep(double dotSep)
           
 void setFilled(boolean isFilled)
           
 void setFillingCol(java.awt.Color fillingCol)
           
 void setFillingStyle(IShape.FillingStyle fillingStyle)
           
 void setGradAngle(double gradAngle)
           
 void setGradColEnd(java.awt.Color gradColEnd)
           
 void setGradColStart(java.awt.Color gradColStart)
           
 void setGradMidPt(double gradMidPt)
           
 void setHasDbleBord(boolean hasDbleBord)
           
 void setHasShadow(boolean hasShadow)
           
 void setHatchingsAngle(double hatchingsAngle)
           
 void setHatchingsCol(java.awt.Color hatchingsCol)
           
 void setHatchingsSep(double hatchingsSep)
           
 void setHatchingsWidth(double hatchingsWidth)
           
 void setId(int id)
           
 void setLineColour(java.awt.Color lineColour)
           
 void setLineStyle(IShape.LineStyle lineStyle)
           
 void setNewId()
          Defines a new unique ID to the shape.
 void setOpacity(double opacity)
           
 void setRotationAngle(double rotationAngle)
           
 void setShadowAngle(double shadowAngle)
           
 void setShadowCol(java.awt.Color shadowCol)
           
 void setShadowSize(double shadowSize)
           
 void setShowPts(boolean showPts)
           
 void setThickness(double thickness)
           
 boolean shadowFillsShape()
           
 void translate(double tx, double ty)
          Translates the shape.
 
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

PPC

static final int PPC
The number of pixels per centimetre by default.

See Also:
Constant Field Values

GOLDEN_ANGLE

static final double GOLDEN_ANGLE
Corresponds to the golden angle (Useful for golden diamond).

See Also:
Constant Field Values
Method Detail

getPoints

java.util.List<IPoint> getPoints()
Returns:
The points of the shape.
Since:
3.0

getNbPoints

int getNbPoints()
Returns:
The number of points of the shape.

getPtAt

IPoint getPtAt(int position)
Parameters:
position - The position of the wanted points (-1 for the last point).
Returns:
The point at the given position or null if the position is not valid.
Since:
3.0

copy

void copy(IShape s)
Copies a shape using another.

Parameters:
s - The shape to copy.

isThicknessable

boolean isThicknessable()
Returns:
True if the thickness of the shape can be changed.
Since:
3.0

isDbleBorderable

boolean isDbleBorderable()
Returns:
True if the shape can have a double border.
Since:
3.0

isColourable

boolean isColourable()
Returns:
True if the shape can have colours.
Since:
3.0

isFillable

boolean isFillable()
Returns:
True if the shape can have an interior colour.
Since:
3.0

isBordersMovable

boolean isBordersMovable()
Returns:
True if the borders of the shape can be moved.
Since:
3.0

isInteriorStylable

boolean isInteriorStylable()
Returns:
True if the interior of the shape can have a style (hatchings, gradient).
Since:
3.0

isShowPtsable

boolean isShowPtsable()
Returns:
True if the points of the shape can be displayed.
Since:
3.0

isLineStylable

boolean isLineStylable()
Returns:
True if the line style of the shape can be changed.
Since:
3.0

isShadowable

boolean isShadowable()
Returns:
True if the shape can have a shadow.
Since:
3.0

isArrowable

boolean isArrowable()
Returns:
True if the shape can have arrows.
Since:
3.0

getTopLeftPoint

IPoint getTopLeftPoint()
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.
Since:
3.0

getTopRightPoint

IPoint getTopRightPoint()
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.
Since:
3.0

getBottomRightPoint

IPoint getBottomRightPoint()
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.
Since:
3.0

getBottomLeftPoint

IPoint getBottomLeftPoint()
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.
Since:
3.0

getFullTopLeftPoint

IPoint getFullTopLeftPoint()
Returns:
The top left point of the shape. It takes account of the thickness, the rotation angle, the double border, or any parameters but not the rotation angle; in contrary to getTopLeftPoint().
Since:
3.0

getFullBottomRightPoint

IPoint getFullBottomRightPoint()
Returns:
The bottom right point of the shape. It takes account of the thickness, the rotation angle, the double border, or any parameters but not the rotation angle; in contrary to getBottomRightPoint().
Since:
3.0

scale

void scale(double sx,
           double sy,
           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.

Parameters:
sx - The X scale factor, in ]0,double].
sy - 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.
Throws:
java.lang.IllegalArgumentException - If one of the parameter is not valid.
Since:
3.0

mirrorHorizontal

void mirrorHorizontal(IPoint origin)
Returns horizontally the shape.

Parameters:
origin - The location of the horizontal axe.
Since:
1.8

mirrorVertical

void mirrorVertical(IPoint origin)
Returns vertically the shape.

Parameters:
origin - The location of the vertical axe.
Since:
1.8

translate

void translate(double tx,
               double ty)
Translates the shape.

Parameters:
tx - The X translation.
ty - The Y translation.

isParametersEquals

boolean isParametersEquals(IShape s,
                           boolean considerShadow)
Checks if the parameters of the shapes are equals.

Parameters:
s - The shape to compare.
considerShadow - True if the parameters of the shadows must be considered.
Returns:
True if the parameters are equals.
Since:
1.9

hasHatchings

boolean hasHatchings()
Returns:
True if the shape has hatchings.
Since:
3.0

hasGradient

boolean hasGradient()
Returns:
True if the shape has a gradient.
Since:
3.0

getThickness

double getThickness()
Returns:
the thickness.

setThickness

void setThickness(double thickness)
Parameters:
thickness - the thickness to set.

getLineColour

java.awt.Color getLineColour()
Returns:
the lineColour.

setLineColour

void setLineColour(java.awt.Color lineColour)
Parameters:
lineColour - the lineColour to set.

getLineStyle

IShape.LineStyle getLineStyle()
Returns:
the lineStyle.

setLineStyle

void setLineStyle(IShape.LineStyle lineStyle)
Parameters:
lineStyle - the lineStyle to set.

getDashSepWhite

double getDashSepWhite()
Returns:
the dashSepWhite.

setDashSepWhite

void setDashSepWhite(double dashSepWhite)
Parameters:
dashSepWhite - the dashSepWhite to set.

getDashSepBlack

double getDashSepBlack()
Returns:
the dashSepBlack.

setDashSepBlack

void setDashSepBlack(double dashSepBlack)
Parameters:
dashSepBlack - the dashSepBlack to set.

getDotSep

double getDotSep()
Returns:
the dotSep.

setDotSep

void setDotSep(double dotSep)
Parameters:
dotSep - the dotSep to set.

getFillingCol

java.awt.Color getFillingCol()
Returns:
the fillingCol.

setFillingCol

void setFillingCol(java.awt.Color fillingCol)
Parameters:
fillingCol - the fillingCol to set.

getFillingStyle

IShape.FillingStyle getFillingStyle()
Returns:
the fillingStyle.

setFillingStyle

void setFillingStyle(IShape.FillingStyle fillingStyle)
Parameters:
fillingStyle - the fillingStyle to set.

getGradColStart

java.awt.Color getGradColStart()
Returns:
the gradColStart.

setGradColStart

void setGradColStart(java.awt.Color gradColStart)
Parameters:
gradColStart - the gradColStart to set.

getGradColEnd

java.awt.Color getGradColEnd()
Returns:
the gradColEnd.

setGradColEnd

void setGradColEnd(java.awt.Color gradColEnd)
Parameters:
gradColEnd - the gradColEnd to set.

getGradAngle

double getGradAngle()
Returns:
the gradAngle.

setGradAngle

void setGradAngle(double gradAngle)
Parameters:
gradAngle - the gradAngle to set. In radian.

getGradMidPt

double getGradMidPt()
Returns:
the gradMidPt.

setGradMidPt

void setGradMidPt(double gradMidPt)
Parameters:
gradMidPt - the gradMidPt to set. Must be in [0,1].

getHatchingsSep

double getHatchingsSep()
Returns:
the hatchingsSep.

setHatchingsSep

void setHatchingsSep(double hatchingsSep)
Parameters:
hatchingsSep - the hatchingsSep to set. Must be greater or equal than 0.

getHatchingsCol

java.awt.Color getHatchingsCol()
Returns:
the hatchingsCol.

setHatchingsCol

void setHatchingsCol(java.awt.Color hatchingsCol)
Parameters:
hatchingsCol - the hatchingsCol to set.

getHatchingsAngle

double getHatchingsAngle()
Returns:
the hatchingsAngle.

setHatchingsAngle

void setHatchingsAngle(double hatchingsAngle)
Parameters:
hatchingsAngle - the hatchingsAngle to set. In radian.

getHatchingsWidth

double getHatchingsWidth()
Returns:
the hatchingsWidth.

setHatchingsWidth

void setHatchingsWidth(double hatchingsWidth)
Parameters:
hatchingsWidth - the hatchingsWidth to set. Must be greater than 0.

getRotationAngle

double getRotationAngle()
Returns:
the rotationAngle.

setRotationAngle

void setRotationAngle(double rotationAngle)
Parameters:
rotationAngle - the rotationAngle to set. In radian.

isShowPts

boolean isShowPts()
Returns:
the showPts.

setShowPts

void setShowPts(boolean showPts)
Parameters:
showPts - the showPts to set.

hasDbleBord

boolean hasDbleBord()
Returns:
the hasDbleBord.

setHasDbleBord

void setHasDbleBord(boolean hasDbleBord)
Parameters:
hasDbleBord - the hasDbleBord to set.

getDbleBordCol

java.awt.Color getDbleBordCol()
Returns:
the dbleBordCol.

setDbleBordCol

void setDbleBordCol(java.awt.Color dbleBordCol)
Parameters:
dbleBordCol - the dbleBordCol to set.

getDbleBordSep

double getDbleBordSep()
Returns:
the dbleBordSep.

setDbleBordSep

void setDbleBordSep(double dbleBordSep)
Parameters:
dbleBordSep - the dbleBordSep to set. Must be greater or equal to 0.

hasShadow

boolean hasShadow()
Returns:
the hasShadow.

setHasShadow

void setHasShadow(boolean hasShadow)
Parameters:
hasShadow - the hasShadow to set.

getShadowCol

java.awt.Color getShadowCol()
Returns:
the shadowCol.

setShadowCol

void setShadowCol(java.awt.Color shadowCol)
Parameters:
shadowCol - the shadowCol to set.

getShadowAngle

double getShadowAngle()
Returns:
the shadowAngle in radian.

setShadowAngle

void setShadowAngle(double shadowAngle)
Parameters:
shadowAngle - the shadowAngle to set. In radian.

getGravityCentre

IPoint getGravityCentre()
Returns:
the gravityCentre.

getId

int getId()
Returns:
the id.

getArrows

java.util.List<IArrow> getArrows()
Returns:
the arrows.

setArrowStyle

void setArrowStyle(IArrow.ArrowStyle style,
                   int position)
Sets the style of the arrow at the given position.

Parameters:
style - The style to set.
position - The position of the arrow to modify.
Since:
3.0

getArrowStyle

IArrow.ArrowStyle getArrowStyle(int position)
Parameters:
position - The position of the arrow to use.
Returns:
The style of the arrow at the given position.
Since:
3.0

getArrowLine

ILine getArrowLine(IArrow arrow)
Parameters:
arrow - The arrow to analyse.
Returns:
The line that will be used to place the arrow.
Since:
3.0

getArrowAt

IArrow getArrowAt(int position)
Parameters:
position - The position of the wanted arrow (-1 for the last arrow).
Returns:
The arrow at the given position or null if the position is not valid.
Since:
3.0

isFilled

boolean isFilled()
Returns:
the isFilled.

setFilled

void setFilled(boolean isFilled)
Parameters:
isFilled - the isFilled to set.

setId

void setId(int id)
Parameters:
id - the id to set.

setNewId

void setNewId()
Defines a new unique ID to the shape.


addToRotationAngle

void addToRotationAngle(IPoint gravCentre,
                        double angle)
Adds the given angle to the current rotation angle.

Parameters:
gravCentre - The gravity centre of the rotation. If null, the gravity centre of the shape will be used.
angle - The angle to add. In radian.

getShadowSize

double getShadowSize()
Returns:
the shadowSize in pixel.

setShadowSize

void setShadowSize(double shadowSize)
Parameters:
shadowSize - the shadowSize to set. Must be greater than 0.

getBordersPosition

IShape.BorderPos getBordersPosition()
Returns:
the bordersPosition.

setBordersPosition

void setBordersPosition(IShape.BorderPos position)
Sets the position of the borders.

Parameters:
position - The new position.
Since:
3.0

shadowFillsShape

boolean shadowFillsShape()
Returns:
True if when the shape has a shadow, it must be filled.
Since:
2.0

getOpacity

double getOpacity()
Returns:
the opacity between 0 and 1 included.
Since:
3.0

setOpacity

void setOpacity(double opacity)
Parameters:
opacity - the opacity to set. Must be in [0,1].
Since:
3.0

getBorderGap

double getBorderGap()
Computes the gap created by the thickness, the double borders and the position of the border. For example, it helps to compute the top left point that considers the attributes of the shape (thickness, double borders,...).

Returns:
The computed gap.
Since:
3.0

duplicate

IShape duplicate()
Creates a duplicate of the shape (however id are not the same).

Returns:
The duplicata.
Since:
3.0

getShadowGap

IPoint getShadowGap()
Computes the translation vector between the shape itself and its shadow.

Returns:
The computed translation vector. (0,0) is the shape cannot have shadow.
Since:
3.0

rotate

void rotate(IPoint point,
            double angle)
Rotates the shape.

Parameters:
point - The rotation centre.
angle - The angle of rotation in radians.
Since:
3.0