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

All Known Implementing Classes:
LShapeFactory

public interface IShapeFactory

Defines an interface to implement an abstract factory.

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.

01/04/2011

Since:
3.0
Version:
3.0
Author:
Arnaud BLOUIN

Method Summary
 IArc createArc(boolean isUniqueID)
          Creates a circled arc with a 1 radius.
 IArc createArc(IPoint tl, IPoint br, boolean uniqueID)
          Creates an arc.
 IArrow createArrow(IArrow arrow, IShape owner)
          Creates an arrow from an other arrow.
 IArrow createArrow(IShape owner)
          Creates an arrow.
 IAxes createAxes(boolean isUniqueID, IPoint pt)
          Creates axes with default values.
 IBezierCurve createBezierCurve(boolean isUniqueID)
          Creates a model with no point.
 IBezierCurve createBezierCurve(IPoint point, IPoint point2, boolean uniqueID)
          Creates a bezier curve with two points.
 ICircle createCircle(boolean isUniqueID)
           
 ICircle createCircle(IPoint pt, double radius, boolean isUniqueID)
          Creates a circle.
 ICircleArc createCircleArc(boolean isUniqueID)
          Creates a circled arc with a 1 radius.
 ICircleArc createCircleArc(IPoint tl, IPoint br, boolean uniqueID)
          Creates a circled arc.
 IDot createDot(IPoint pt, boolean isUniqueID)
           
 IDrawing createDrawing()
           
 IEllipse createEllipse(boolean isUniqueID)
           
 IEllipse createEllipse(IPoint tl, IPoint br, boolean isUniqueID)
          Creates an ellipse.
 IFreehand createFreeHand(IPoint pt, boolean uniqueID)
          Creates and initialises a freehand model.
 IGrid createGrid(boolean isUniqueID, IPoint pt)
          Creates a grid with a predefined point.
 IGroup createGroup(boolean uniqueID)
           
 ILine createLine(double x1, double y1, double x2, double y2)
          Constructs a line from the specified coordinates.
 ILine createLine(double b, IPoint p1)
          Creates a line by creating a second point with:
 ILine createLine(IPoint p1, IPoint p2)
          Constructs a line from the specified Point2D objects.
 IPicture createPicture(boolean isUniqueID, IPoint pt)
          Creates a picture and the corresponding EPS picture.
 IPoint createPoint()
           
 IPoint createPoint(double x, double y)
          Creates a Point2D with the specified coordinates.
 IPoint createPoint(IPoint pt)
          Creates a Point2D with the specified coordinates.
 IPoint createPoint(java.awt.Point pt)
          Creates a point from the java Point.
 IPolygon createPolygon(boolean uniqueID)
           
 IPolygon createPolygon(IPoint point, IPoint point2, boolean uniqueID)
          Creates a polygon with two points.
 IPolyline createPolyline(boolean uniqueID)
           
 IPolyline createPolyline(IPoint point, IPoint point2, boolean uniqueID)
          Creates a model with two points.
 IRectangle createRectangle(boolean uniqueID)
           
 IRectangle createRectangle(IPoint pos, double width, double height, boolean uniqueID)
          Creates a rectangle.
 IRectangle createRectangle(IPoint tl, IPoint br, boolean uniqueID)
          Creates a rectangle.
 IRhombus createRhombus(boolean isUniqueID)
           
 IRhombus createRhombus(IPoint centre, double width, double height, boolean uniqueID)
          Creates a rhombus.
 ISquare createSquare(boolean uniqueID)
          Creates a square at position (0,0) which width equals 10.
 ISquare createSquare(IPoint pos, double width, boolean uniqueID)
          Creates a square.
 IText createText(boolean uniqueID)
          Create a text at position (0,0) which text is "text".
 IText createText(boolean isUniqueID, IPoint pt, java.lang.String text)
          Creates a text.
 ITriangle createTriangle(boolean isUniqueID)
           
 ITriangle createTriangle(IPoint pos, double width, double height, boolean uniqueID)
          Creates a triangle.
 IShape duplicate(IShape shape)
          Duplicates the given shape.
<T extends IShape>
T
newShape(java.lang.Class<T> shapeClass)
           
 

Method Detail

newShape

<T extends IShape> T newShape(java.lang.Class<T> shapeClass)
Parameters:
shapeClass - The class of the shape to instantiated.
Returns:
A new instance of the class given as argument or null.
Since:
3.0

createDrawing

IDrawing createDrawing()
Returns:
The created drawing.
Since:
3.0

createArrow

IArrow createArrow(IArrow arrow,
                   IShape owner)
Creates an arrow from an other arrow.

Parameters:
arrow - The arrow to copy.
owner - The shape that contains the arrow.
Returns:
The created arrow.
Throws:
java.lang.IllegalArgumentException - If the given arrow is null.

createArrow

IArrow createArrow(IShape owner)
Creates an arrow.

Parameters:
owner - The shape that contains the arrow.
Returns:
The created arrow.

createAxes

IAxes createAxes(boolean isUniqueID,
                 IPoint pt)
Creates axes with default values.

Parameters:
pt - The bottom left position of the axes.
isUniqueID - True: the model will have a unique ID.
Returns:
The created axes.

createDot

IDot createDot(IPoint pt,
               boolean isUniqueID)
Parameters:
isUniqueID - True: the shape will have a unique ID.
pt - The centre of the dot.
Returns:
The created dot.

createBezierCurve

IBezierCurve createBezierCurve(boolean isUniqueID)
Creates a model with no point.

Parameters:
isUniqueID - True: the model will have a unique ID.
Returns:
The created bezier curve.

createBezierCurve

IBezierCurve createBezierCurve(IPoint point,
                               IPoint point2,
                               boolean uniqueID)
Creates a bezier curve with two points.

Parameters:
point - The first point of the curve.
point2 - The second point of the curve.
uniqueID - uniqueID True: the model will have a unique ID.
Returns:
The created bezier curve.

createEllipse

IEllipse createEllipse(IPoint tl,
                       IPoint br,
                       boolean isUniqueID)
Creates an ellipse.

Parameters:
tl - The top-left point of the ellipse.
br - The bottom-right point of the ellipse.
isUniqueID - True: the ellipse will have a unique ID.
Returns:
The created ellipse.
Throws:
java.lang.IllegalArgumentException - If a or b is not valid.

createEllipse

IEllipse createEllipse(boolean isUniqueID)
Parameters:
isUniqueID - True: the ellipse will have a unique ID.
Returns:
The created ellipse.

createTriangle

ITriangle createTriangle(IPoint pos,
                         double width,
                         double height,
                         boolean uniqueID)
Creates a triangle.

Parameters:
pos - The north-west point of the triangle.
width - The width of the triangle.
height - The height of the triangle.
uniqueID - True: the triangle will have a unique ID.
Returns:
The created triangle.
Throws:
java.lang.IllegalArgumentException - If the width or the height is not valid.

createTriangle

ITriangle createTriangle(boolean isUniqueID)
Parameters:
isUniqueID - True: the shape will have a unique ID.
Returns:
The created triangle.

createRhombus

IRhombus createRhombus(IPoint centre,
                       double width,
                       double height,
                       boolean uniqueID)
Creates a rhombus.

Parameters:
centre - The centre of the rhombus.
width - The width of the rhombus.
height - The height of the rhombus.
uniqueID - True: the rhombus will have a unique ID.
Returns:
The created rhombus.
Throws:
java.lang.IllegalArgumentException - If the width, the height or the centre is not valid.

createRhombus

IRhombus createRhombus(boolean isUniqueID)
Parameters:
isUniqueID - True: the shape will have a unique ID.
Returns:
The created rhombus.

createPicture

IPicture createPicture(boolean isUniqueID,
                       IPoint pt)
Creates a picture and the corresponding EPS picture.

Parameters:
isUniqueID - True: the shape will have a unique ID.
pt - The position of the top-left point of the picture.
Returns:
The created picture.
Throws:
java.lang.IllegalArgumentException - If the given picture path is not valid.

createGrid

IGrid createGrid(boolean isUniqueID,
                 IPoint pt)
Creates a grid with a predefined point.

Parameters:
isUniqueID - True: the shape will have a unique ID.
pt - The position.
Returns:
The created grid.

createFreeHand

IFreehand createFreeHand(IPoint pt,
                         boolean uniqueID)
Creates and initialises a freehand model.

Parameters:
pt - The first point.
uniqueID - True: the model will have a unique ID.
Returns:
The created freehand shape.
Throws:
java.lang.IllegalArgumentException - If the given point is not valid.
Since:
3.0

createCircle

ICircle createCircle(IPoint pt,
                     double radius,
                     boolean isUniqueID)
Creates a circle.

Parameters:
pt - The centre of the circle.
radius - The radius.
isUniqueID - True: the model will have a unique ID.
Returns:
The created circle.
Throws:
java.lang.IllegalArgumentException - If the radius is not valid.

createCircle

ICircle createCircle(boolean isUniqueID)
Parameters:
isUniqueID - True: the circle will have a unique ID.
Returns:
The created circle.

createGroup

IGroup createGroup(boolean uniqueID)
Parameters:
uniqueID - True: the model will have a unique ID.
Returns:
The created group of shapes.
Since:
3.0

createLine

ILine createLine(double x1,
                 double y1,
                 double x2,
                 double y2)
Constructs a line from the specified coordinates.

Parameters:
x1 - the X coordinate of the start point.
y1 - the Y coordinate of the start point.
x2 - the X coordinate of the end point.
y2 - the Y coordinate of the end point.
Returns:
The created line.
Throws:
java.lang.IllegalArgumentException - If one of the given coordinate is not valid.

createLine

ILine createLine(double b,
                 IPoint p1)
Creates a line by creating a second point with:

Parameters:
b - y = ax+ b
p1 - The first point.
Returns:
The created line.
Throws:
java.lang.IllegalArgumentException - If one of the given parameter is not valid.

createLine

ILine createLine(IPoint p1,
                 IPoint p2)
Constructs a line from the specified Point2D objects.

Parameters:
p1 - the start Point2D of this line segment.
p2 - the end Point2D of this line segment.
Returns:
The created line.
Throws:
java.lang.IllegalArgumentException - If one of the given points is not valid.

createPoint

IPoint createPoint()
Returns:
The created point with coordinates (0, 0).
Since:
3.0

createPoint

IPoint createPoint(double x,
                   double y)
Creates a Point2D with the specified coordinates.

Parameters:
x - The X-coordinate to set.
y - The Y-coordinate to set.
Returns:
The created point.
Since:
3.0

createPoint

IPoint createPoint(java.awt.Point pt)
Creates a point from the java Point.

Parameters:
pt - The java point.
Returns:
The created point or null.
Since:
3.0

createPoint

IPoint createPoint(IPoint pt)
Creates a Point2D with the specified coordinates.

Parameters:
pt - The IPoint, if null the default value (0,0) will be used.
Returns:
The created point.
Since:
3.0

createPolyline

IPolyline createPolyline(boolean uniqueID)
Parameters:
uniqueID - True: the shape will have a unique ID.
Returns:
The created polyline
Since:
3.0

createPolyline

IPolyline createPolyline(IPoint point,
                         IPoint point2,
                         boolean uniqueID)
Creates a model with two points.

Parameters:
uniqueID - True: the shape will have a unique ID.
point - The first point of the shape.
point2 - The second point of the shape.
Returns:
The created polyline.
Since:
3.0

createPolygon

IPolygon createPolygon(boolean uniqueID)
Parameters:
uniqueID - True: the shape will have a unique ID.
Returns:
The created polygon
Since:
3.0

createPolygon

IPolygon createPolygon(IPoint point,
                       IPoint point2,
                       boolean uniqueID)
Creates a polygon with two points.

Parameters:
uniqueID - True: the shape will have a unique ID.
point - The first point of the shape.
point2 - The second point of the shape.
Returns:
The created polygon.
Since:
3.0

createRectangle

IRectangle createRectangle(boolean uniqueID)
Parameters:
uniqueID - True: the shape will have a unique ID.
Returns:
The created rectangle with position (0,0) and width=10 and height=10.
Since:
3.0

createRectangle

IRectangle createRectangle(IPoint pos,
                           double width,
                           double height,
                           boolean uniqueID)
Creates a rectangle.

Parameters:
pos - The north-west point of the rectangle.
width - The width of the rectangle.
height - The height of the rectangle.
uniqueID - True: the rectangle will have a unique ID.
Returns:
The created rectangle.
Throws:
java.lang.IllegalArgumentException - If the width or the height is not valid.
Since:
3.0

createRectangle

IRectangle createRectangle(IPoint tl,
                           IPoint br,
                           boolean uniqueID)
Creates a rectangle.

Parameters:
tl - The top left point of the rectangle.
br - The bottom right point of the rectangle.
uniqueID - True: the rectangle will have a unique ID.
Returns:
The created rectangle.
Since:
3.0

createText

IText createText(boolean uniqueID)
Create a text at position (0,0) which text is "text".

Parameters:
uniqueID - True: the shape will have a unique ID.
Returns:
The created text.
Since:
3.0

createText

IText createText(boolean isUniqueID,
                 IPoint pt,
                 java.lang.String text)
Creates a text.

Parameters:
isUniqueID - True: the model will have a unique ID.
pt - The position of the text.
text - The text.
Returns:
The created text.
Throws:
java.lang.IllegalArgumentException - If pt is not valid.
Since:
3.0

createSquare

ISquare createSquare(boolean uniqueID)
Creates a square at position (0,0) which width equals 10.

Parameters:
uniqueID - True: the shape will have a unique ID.
Returns:
The created square.
Since:
3.0

createSquare

ISquare createSquare(IPoint pos,
                     double width,
                     boolean uniqueID)
Creates a square.

Parameters:
pos - The north-west point of the square.
width - The width of the square.
uniqueID - True: the shape will have a unique ID.
Returns:
The created square.
Throws:
java.lang.IllegalArgumentException - If the width or the height is not valid.
Since:
3.0

createCircleArc

ICircleArc createCircleArc(IPoint tl,
                           IPoint br,
                           boolean uniqueID)
Creates a circled arc.

Parameters:
tl - The top left point of the circled arc.
br - The bottom right point of the circled arc.
uniqueID - True: the circled arc will have a unique ID.
Returns:
The created circled arc.
Since:
3.0

createCircleArc

ICircleArc createCircleArc(boolean isUniqueID)
Creates a circled arc with a 1 radius.

Parameters:
isUniqueID - True: the model will have a unique ID.
Returns:
The created circled arc.
Since:
3.0

createArc

IArc createArc(IPoint tl,
               IPoint br,
               boolean uniqueID)
Creates an arc.

Parameters:
tl - The top left point of the arc.
br - The bottom right point of the arc.
uniqueID - True: the arc will have a unique ID.
Returns:
The created arc.
Since:
3.0

createArc

IArc createArc(boolean isUniqueID)
Creates a circled arc with a 1 radius.

Parameters:
isUniqueID - True: the model will have a unique ID.
Returns:
The created arc.
Since:
3.0

duplicate

IShape duplicate(IShape shape)
Duplicates the given shape.

Parameters:
shape - The shape to duplicate
Returns:
The duplicated shape or null.
Since:
3.0