Class Figure
Defined in: primitives.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Figure(name)
A figure is simply a collection of basic primitives: Points, Lines, Arcs, Curves and Paths
A figure should not care about grouping primitives into Paths, each shape should draw itself.
|
Field Attributes | Field Name and Description |
---|---|
the Group'id to which this figure belongs to
|
|
Each Figure will have an unique Id on canvas
|
|
Figure's name
|
|
Object type used for JSON deserialization
|
|
An {Array} of primitives that make the figure
|
|
An {Array} of BuilderProperty objects
|
|
We keep the figure position by having different points
[central point of the figure, the middle of upper edge]
An {Array} or Points
|
|
The Style use to draw tis figure
|
Method Attributes | Method Name and Description |
---|---|
addPrimitive(primitive)
|
|
clone()
TODO: this clone is not gonna be equal with the original
as it will have a different id
|
|
contains(x, y)
|
|
equals(anotherFigure)
|
|
finalise()
|
|
getText()
|
|
<static> |
Figure.load(o)
Creates a new {Figure} out of JSON parsed object
|
<static> |
Figure.loadArray(v)
Creates a new {Array} of {Figure}s out of JSON parsed object
|
near(x, y, radius)
|
|
paint(context)
|
|
setText(text)
|
|
toString()
|
|
toSVG()
|
|
transform(matrix, transformConnector)
|
Class Detail
Figure(name)
A figure is simply a collection of basic primitives: Points, Lines, Arcs, Curves and Paths
A figure should not care about grouping primitives into Paths, each shape should draw itself.
The Figure only delegate the painting to the composing shape.
- Parameters:
- {String} name
- - the name of the figure
Field Detail
groupId
the Group'id to which this figure belongs to
id
Each Figure will have an unique Id on canvas
name
Figure's name
oType
Object type used for JSON deserialization
primitives
An {Array} of primitives that make the figure
properties
An {Array} of BuilderProperty objects
rotationCoords
We keep the figure position by having different points
[central point of the figure, the middle of upper edge]
An {Array} or Points
style
The Style use to draw tis figure
Method Detail
addPrimitive(primitive)
- Parameters:
- primitive
clone()
TODO: this clone is not gonna be equal with the original
as it will have a different id
contains(x, y)
- Parameters:
- x
- y
equals(anotherFigure)
- Parameters:
- anotherFigure
finalise()
getBounds()
getPoints()
getText()
<static>
{Figure}
Figure.load(o)
Creates a new {Figure} out of JSON parsed object
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {JSONObject} o
- - the JSON parsed object
- Returns:
- {Figure} a newly constructed Figure
<static>
{Array}
Figure.loadArray(v)
Creates a new {Array} of {Figure}s out of JSON parsed object
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {JSONObject} v
- - the JSON parsed object
- Returns:
- {Array} of newly constructed {Figure}s
near(x, y, radius)
- Parameters:
- x
- y
- radius
paint(context)
- Parameters:
- context
setText(text)
- Parameters:
- text
toString()
toSVG()
transform(matrix, transformConnector)
- Parameters:
- matrix
- transformConnector