shapers/Holes. Holes

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, ny)

Holes constructor

Parameters:
NameTypeDescription
nxnumber

Not used

nynumber

Not used

Extends

Members

baseWidthFactor :number

In JigSaw, ratio between the base width of the tooth and the total length of the side.

Type:
  • number

className :string

This shaper class name

Type:
  • string

customShapes :boolean

Only the Holes shaper has this flag activated

Type:
  • boolean

enclosing :module:AWT.Shape

In Holes, the enclosing area where all shapes are placed.

hasRemainder :boolean

Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
all its shapes

Type:
  • boolean

initiated :boolean

Flag used to check if the Shaper has been initialized against a real surface

Type:
  • boolean

nCells :number

Number of cells managed by this shaper

Type:
  • number

nCols :number

Number of columns (useful in grid-based shapers)

Type:
  • number

nRows :number

Number of rows (useful in grid-based shapers)

Type:
  • number

randomLines :boolean

In JigSaw, whether the tooths take random directions or not

Type:
  • boolean

rectangularShapes :boolean

Flag indicating if this shaper organizes its cells in rows and columns

Type:
  • boolean

scaleX :number

In Holes, scale to be applied to horizontal positions and lengths to achieve the real
value of the shape placed on a real surface.

Type:
  • number

scaleY :number

In Holes, scale to be applied to vertical positions and lengths to achieve the real
value of the shape placed on a real surface.

Type:
  • number

shapeData :object

Contains the specific definition of each shape

Type:
  • object

showEnclosure :boolean

In Holes, when true, the enclosing area will be drawn

Type:
  • boolean

toothHeightFactor :number

In JigSaw, ratio between the tooth height and the total length of the side.

Type:
  • number

Methods

buildShapes()

Shapes are already loaded by Shaper, so this function just sets initiated to true

getAttributes() → {object}

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:
  • The resulting object, with minimal attrributes
Type: 
object

getEnclosingShapeData() → {module:AWT.Rectangle}

Gets the rectangle that contains all shapes

Returns:
Type: 
module:AWT.Rectangle

getRemainderShape(rect) → {module:AWT.Rectangle}

When hasRemainder is true, this method gets the rectangle containing the full surface where
the Shaper develops.

Parameters:
NameTypeDescription
rectmodule:AWT.Rectangle

The frame where to move and scale all the shapes

Returns:
Type: 
module:AWT.Rectangle

getShape(n, rect) → {module:AWT.Shape}

Gets a clone of the nth Shape object, scaled and located inside a Rectangle

Parameters:
NameTypeDescription
nnumber
rectmodule:AWT.Rectangle
Returns:
Type: 
module:AWT.Shape

getShapeData(n) → {object}

Gets the nth Shape data object

Parameters:
NameTypeDescription
nnumber
Returns:
Type: 
object

reset(nCols, nRows)

Initializes this Shaper to default values

Parameters:
NameTypeDescription
nColsnumber

Number of columns

nRowsnumber

Number of rows

setProperties($xml)

Loads this shaper settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element with the shaper data