API Docs for: 0.99.4
Show:

JXG.Composition Class

Module: JXG

A composition is a simple container that manages none or more JXG.GeometryElements.

Constructor

JXG.Composition

(
  • elements
)

Parameters:

  • elements Object

    A list of elements with a descriptive name for the element as the key and a reference to the element as the value of every list entry. The name is used to access the element later on.

Example:

var p1 = board.create('point', [1, 2]),
            p2 = board.create('point', [2, 3]),
            c = new JXG.Composition({
                start: p1,
                end: p2
            });
        
        // moves p1 to [3, 3]
        c.start.moveTo([3, 3]);

Methods

add

(
  • what
  • element
)
Boolean

Adds an element to the composition container.

Parameters:

  • what String

    Descriptive name for the element, e.g. startpoint or area. This is used to access the element later on. There are some reserved names: elements, add, remove, update, prepareUpdate, updateRenderer, highlight, noHighlight, and all names that would form invalid object property names in JavaScript.

  • element JXG.GeometryElement | JXG.Composition

    A reference to the element that is to be added. This can be another composition, too.

Returns:

Boolean:

True, if the element was added successfully. Reasons why adding the element failed include using a reserved name and providing an invalid element.

getAttributes

() Object

Return list of attributes. Unused

Returns:

Object:

List of attributes

getParents

() Array

List of the element ids resp. values. Unused.

Returns:

getType

() String

Type of composition. Unused.

Returns:

String:

Empty sring

highlight

()

Invokes highlight for every stored element with a highlight method and hands over the given arguments. See JXG.GeometryElement#highlight for further description, valid parameters and return values.

nameListener

(
  • oval
  • nval
  • el
)
Object chainable

Change element list of composition

Parameters:

Returns:

Object:

this

noHighlight

()

Invokes noHighlight for every stored element with a noHighlight method and hands over the given arguments. See JXG.GeometryElement#noHighlight for further description, valid parameters and return values.

prepareUpdate

()

Invokes prepareUpdate for every stored element with a prepareUpdate method and hands over the given arguments. See JXG.GeometryElement#prepareUpdate for further description, valid parameters and return values.

remove

(
  • what
)
Boolean

Remove an element from the composition container.

Parameters:

  • what String

    The name used to access the element.

Returns:

Boolean:

True, if the element has been removed successfully.

select

(
  • filter
)
JXG.GeometryElement | JXG.Composition

Select elements of the composition. For the filter {@see JXG.Board}

Parameters:

  • filter String | Object | Function

    The name, id or a reference to a JSXGraph element on this board. An object will be used as a filter to return multiple elements at once filtered by the properties of the object.

Returns:

JXG.GeometryElement | JXG.Composition:

Composition or element

setAttribute

()

Invokes setAttribute for every stored element with a setAttribute method and hands over the given arguments. See JXG.GeometryElement#setAttribute for further description, valid parameters and return values.

update

()

Invokes update for every stored element with a update method and hands over the given arguments. See JXG.GeometryElement#update for further description, valid parameters and return values.

updateRenderer

()

Invokes updateRenderer for every stored element with a updateRenderer method and hands over the given arguments. See JXG.GeometryElement#updateRenderer for further description, valid parameters and return values.