Skip to content

Best Nodes

  • Plugin name: "best_nodes"
  • Plugin namespace: "best_nodes"

Loading the plugin

var input_options = {
    container: "container-id",
    plugins: ["best_nodes"]
};

DVM.loadModule("map_viewer", input_options)
    .then(function(viewer) {
        start(viewer);
    })
    .catch(function(err) {
        console.error(err);
    });

function start(viewer) {
    // ...
}

If this plugin is loaded, the module will have the following additional features:

Methods

getBestNodes()

Asynchronous method that returns the best nodes of a map.

As in getNeighbors method, if you want to use filter_single_seats flags, you need to previously use filterRows method.

Warning

This method requires special metadata to compute the best nodes, so it will not work with all maps, only those with that additional information.

Warning

This method is asynchronous.

Input

  • type (string): Node type from which you want to obtain the best nodes.
  • count (number): Desired group size.
  • filter_single_seats (boolean): if true, seats that can cause stranded single seats when selecting count seats will be filtered.
  • parent (string | MapViewerNode) [optional]: You can apply the filter on the children of some specific node.

Output

  • promise (Promise): A promise that resolves in a list with the best nodes.

Example

viewer.filterRows(3, true);
viewer.best_nodes.getBestNodes("seat", 3, true)
    .then(function(result) {
        viewer.unselectAll();
        viewer.select(result);
    })
    .catch(function(err) {
        // Probably the map has no best nodes information
        doSomethingElse();
    });