Tour API Demos Download Tests
Aperture version 1.0
Generated by: JsDoc Toolkit 2.4.0

Class aperture.Layer.NodeSet

Represents a set or subset of layer nodes, defined through subsequent calls to selector methods. NodeSet is abstract. A new node set is retrieved with a call to layer.nodes(), or is retrieved from an event.

Method Summary

Method Detail

  • {aperture.Layer.NodeSet} and(nodeSet)
    Unions this node set with another and returns the result.
    Parameters:
    nodeSet
    Returns:
    {aperture.Layer.NodeSet} the union set of nodes
  • {Object} data()
    Returns a new data iterator for this node set. The iterator will be a simple object with a next() method that will return data for the next node in the set until there are no more to return.
    var data,
        iter = layer.all().data();
    
    for (data = iter.next(); data != null; data = iter.next()) {
    Returns:
    {Object} iterator object with method next()
  • {Boolean} hasLayer(layer)
    Returns true if the specified layer is included in this node set.
    Parameters:
    layer
    Returns:
    {Boolean} true if has this layer
  • inside(left, top, right, bottom)
    TODO
    Parameters:
    left
    top
    right
    bottom
  • layout()
    TODO
  • {this} redraw(transition)
    Invokes a visual layer update of the node set.
    Parameters:
    {aperture.Transition} transition Optional
    an optional animated transition to use to phase in the changes.
    Returns:
    {this} this set
  • remove()
    TODO
  • toBack(planes, planeProperty)
    Sends layer nodes successively to the back of their parent node(s), using the same instruction api as toFront.
    Parameters:
    planes
    planeProperty
  • {this} toFront(planes, planeProperty)
    Brings layer nodes successively to the front of their parent node(s), using lighter or heavier weight techniques as desired. Ordering at the layer level rather than in data is typically used for state based changes like popping selected nodes to the top. Note that ordering nodes of a layer that inherits its data from a parent layer has no effect, since there will be only one layer node per parent node.

    Usage examples:
    // bring any layer node with a 'plane' value of 'selected' to the front,
    // leaving others as they are.
    nodes.toFront( 'selected' );
    
    // bring any layer node with a 'selected' value of true to the front,
    // leaving unselected as they are.
    nodes.toFront( true, 'selected' );
    
    // all in a set to front by data order
    nodes.toFront( );
    
    // bring all 'unfiltered's to front, then all 'selected's above those
    nodes.toFront( ['unfiltered', 'selected'] );
    
    // call a sort function on the 'z-index' property value of layer nodes
    nodes.toFront( function(a,b) {return a-b;}, 'z-index' );
    Parameters:
    {Array|Object|Function} planes Optional
    an array specifying a set of planes to bring forward (in back to front order); or one such plane; or a function to sort based on plane value. If planes is omitted all nodes are assumed to be in the same plane and are sorted in the order in which they appear in the data. See the examples for more information.
    {String} planeProperty Optional
    optionally, the name of the property that supplies the plane value for layer nodes. If omitted it is assumed to be 'plane'.
    Returns:
    {this} this set
  • {this} where(test, match)
    Applies a selection criteria on this node set where node data must pass a conditional test.
      // redraw data nodes with id C4501
      layer.all().where('id', 'C4501').redraw();
      
      // redraw data nodes with id C4501, C4502
      layer.all().where('id', ['C4501', 'C4502']).redraw();
      
      // redraw data nodes data0, data1
      layer.all().where([data0, data1]).redraw();
      
      // redraw nodes which pass a filter function
      function big(data) {
         return data.size > 100000000;
      }
      layer.all().where(big).redraw();
    Parameters:
    {Function|String} test Optional
    A test to be executed for each node's data. If a function is supplied it will be called for each node with this = data and the return value will be evaluated according to the match criteria. If a string value is supplied the value of that data field name will be evaluated instead. The test parameter may be excluded if the match parameter provides a set of data objects to match against.
    {Array|Object} match Optional
    Optionally one or more matches to evaluate the results of the test against, or if the test is omitted, one or more data objects to match against. If match is omitted the test will pass if it returns any 'truthy' value.
    Returns:
    {this} this set