Holes
Extends: module:shapers/Shaper.Shaper
Source: Holes.js:43
This Shaper consists of a set of arbitrary shapes placed over a main rectangle that
acts as a enclosure.
The components can be of type module:AWT.Rectangle, module:AWT.Ellipse or module:AWT.Path.
This components have internal dimension values relative to the horizontal and vertical
sizes of the enclosure. Its values (always between 0 and 1) must be scaled to real sizes
of graphic objects.
Constructor
new Holes(nx: number, ny: number): HolesHoles constructor
Parameters
nx(number) — Not usedny(number) — Not used
Instance Methods
buildShapes()
Shapes are already loaded by Shaper, so this function just sets initiated to true
getEnclosingShapeData(): module:AWT.Rectangle
Gets the rectangle that contains all shapes
Returns
reset(nCols: number, nRows: number)
Inherited from module:shapers/Shaper.Shaper#reset
Overrides: module:shapers/Shaper.Shaper#reset
Initializes this Shaper to default values
Parameters
nCols(number) — Number of columnsnRows(number) — Number of rows
setProperties($xml: external:jQuery)
Inherited from module:shapers/Shaper.Shaper#setProperties
Overrides: module:shapers/Shaper.Shaper#setProperties
Loads this shaper settings from a specific JQuery XML element
Parameters
$xml(external:jQuery) — The XML element with the shaper data
getAttributes(): object
Inherited from module:shapers/Shaper.Shaper#getAttributes
Overrides: module:shapers/Shaper.Shaper#getAttributes
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
Returns
object
buildShapes()
Inherited from module:shapers/Holes.Holes#buildShapes
Overrides: module:shapers/Shaper.Shaper#buildShapes
Shapes are already loaded by Shaper, so this function just sets initiated to true
getShape(
n: number,
rect: module:AWT.Rectangle,
): module:AWT.Shape
Inherited from module:shapers/Shaper.Shaper#getShape
Overrides: module:shapers/Shaper.Shaper#getShape
Gets a clone of the nth Shape object, scaled and located inside a Rectangle
Parameters
n(number)rect(module:AWT.Rectangle)
Returns
getShapeData(n: number): object
Inherited from module:shapers/Shaper.Shaper#getShapeData
Overrides: module:shapers/Shaper.Shaper#getShapeData
Gets the nth Shape data object
Parameters
n(number)
Returns
object
getEnclosingShapeData(): module:AWT.Rectangle
Inherited from module:shapers/Holes.Holes#getEnclosingShapeData
Overrides: module:shapers/Shaper.Shaper#getEnclosingShapeData
Gets the rectangle that contains all shapes
Returns
getRemainderShape(
rect: module:AWT.Rectangle,
): module:AWT.Rectangle
Inherited from module:shapers/Shaper.Shaper#getRemainderShape
Overrides: module:shapers/Shaper.Shaper#getRemainderShape
When hasRemainder is true, this method gets the rectangle containing the full surface where
the Shaper develops.
Parameters
rect(module:AWT.Rectangle) — The frame where to move and scale all the shapes
Returns
buildShapes()
Inherited from module:shapers/Holes.Holes#buildShapes
Overrides: module:shapers/Shaper.Shaper#buildShapes
Shapes are already loaded by Shaper, so this function just sets initiated to true
getEnclosingShapeData(): module:AWT.Rectangle
Inherited from module:shapers/Holes.Holes#getEnclosingShapeData
Overrides: module:shapers/Shaper.Shaper#getEnclosingShapeData
Gets the rectangle that contains all shapes
Returns
Static Methods
registerClass(
shaperName: string,
shaperClass: function,
): module:shapers/Shaper.Shaper
Inherited from module:shapers/Shaper.Shaper
Registers a new type of shaper
Parameters
shaperName(string) — The name used to identify this shapershaperClass(function) — The shaper class, usually extending Shaper
Returns
getShaper(
className: string,
nx: number,
ny: number,
): module:shapers/Shaper.Shaper
Inherited from module:shapers/Shaper.Shaper
Factory constructor that returns a Shaper of the requested class.
Parameters
className(string) — The class name of the requested Shaper.nx(number) — Number of columns (in grid-based shapers)ny(number) — Number of rows (in grid-based shapers)
Returns
readShapeData(
$xml: external:jQuery,
scaleX: number,
scaleY: number,
): module:AWT.Shape
Inherited from module:shapers/Shaper.Shaper
Reads an individual shape from an XML element.
Shapes are arrays of stroke objects.
Each stroke has an action (move to, line to, quad to...) and associated data.
Parameters
$xml(external:jQuery) — The XML element with the shape datascaleX(number)scaleY(number)
Returns
factory(data: object): module:shapers/Shaper.Shaper
Inherited from module:shapers/Shaper.Shaper
Builds a new shaper, based on the properties specified in a data object
Parameters
data(object) — The data object to be parsed
Returns
Instance Fields
className: string
Inherited from module:shapers/Shaper.Shaper#className
Overrides: module:shapers/Shaper.Shaper#className
This shaper class name
nCols: number
Inherited from module:shapers/Shaper.Shaper#nCols
Overrides: module:shapers/Shaper.Shaper#nCols
Number of columns (useful in grid-based shapers)
nRows: number
Inherited from module:shapers/Shaper.Shaper#nRows
Overrides: module:shapers/Shaper.Shaper#nRows
Number of rows (useful in grid-based shapers)
nCells: number
Inherited from module:shapers/Shaper.Shaper#nCells
Overrides: module:shapers/Shaper.Shaper#nCells
Number of cells managed by this shaper
shapeData: object
Inherited from module:shapers/Shaper.Shaper#shapeData
Overrides: module:shapers/Shaper.Shaper#shapeData
Contains the specific definition of each shape
initiated: boolean
Inherited from module:shapers/Shaper.Shaper#initiated
Overrides: module:shapers/Shaper.Shaper#initiated
Flag used to check if the Shaper has been initialized against a real surface
baseWidthFactor: number
Inherited from module:shapers/Shaper.Shaper#baseWidthFactor
Overrides: module:shapers/Shaper.Shaper#baseWidthFactor
In JigSaw, ratio between the base width of the tooth and the total length of the side.
toothHeightFactor: number
Inherited from module:shapers/Shaper.Shaper#toothHeightFactor
Overrides: module:shapers/Shaper.Shaper#toothHeightFactor
In JigSaw, ratio between the tooth height and the total length of the side.
randomLines: boolean
Inherited from module:shapers/Shaper.Shaper#randomLines
Overrides: module:shapers/Shaper.Shaper#randomLines
In JigSaw, whether the tooths take random directions or not
scaleX: number
Inherited from module:shapers/Shaper.Shaper#scaleX
Overrides: module:shapers/Shaper.Shaper#scaleX
In Holes, scale to be applied to horizontal positions and lengths to achieve the real
value of the shape placed on a real surface.
scaleY: number
Inherited from module:shapers/Shaper.Shaper#scaleY
Overrides: module:shapers/Shaper.Shaper#scaleY
In Holes, scale to be applied to vertical positions and lengths to achieve the real
value of the shape placed on a real surface.
enclosing: module:AWT.Shape
Inherited from module:shapers/Shaper.Shaper#enclosing
Overrides: module:shapers/Shaper.Shaper#enclosing
In Holes, the enclosing area where all shapes are placed.
showEnclosure: boolean
Inherited from module:shapers/Shaper.Shaper#showEnclosure
Overrides: module:shapers/Shaper.Shaper#showEnclosure
In Holes, when true, the enclosing area will be drawn
rectangularShapes: boolean
Inherited from module:shapers/Shaper.Shaper#rectangularShapes
Overrides: module:shapers/Shaper.Shaper#rectangularShapes
Flag indicating if this shaper organizes its cells in rows and columns
hasRemainder: boolean
Inherited from module:shapers/Shaper.Shaper#hasRemainder
Overrides: module:shapers/Shaper.Shaper#hasRemainder
Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
all its shapes
customShapes: boolean
Inherited from module:shapers/Shaper.Shaper#customShapes
Overrides: module:shapers/Shaper.Shaper#customShapes
Only the Holes shaper has this flag activated
Static Fields
CLASSES: object
Inherited from module:shapers/Shaper.Shaper
List of known classes derived from Shaper. It should be filled by real shaper classes at
declaration time.