Skip to content

Commit

Permalink
feat(networkservice): Adding networkservice methods
Browse files Browse the repository at this point in the history
* adds type VisMoveToOptions
* adds methods getConnectedNodes, getPositions, moveTo, startSimulation and stopSimulation

see #69
  • Loading branch information
hypery2k committed Mar 17, 2018
1 parent e15b8f6 commit 81990b7
Show file tree
Hide file tree
Showing 13 changed files with 212 additions and 5 deletions.
48 changes: 48 additions & 0 deletions bundles/ngx-vis.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified bundles/ngx-vis.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion bundles/ngx-vis.js.map

Large diffs are not rendered by default.

Binary file modified bundles/ngx-vis.js.map.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion bundles/ngx-vis.min.js

Large diffs are not rendered by default.

Binary file modified bundles/ngx-vis.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion bundles/ngx-vis.min.js.map

Large diffs are not rendered by default.

Binary file modified bundles/ngx-vis.min.js.map.gz
Binary file not shown.
1 change: 1 addition & 0 deletions components/network/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as Vis from 'vis';
import { VisDataSetOptions, VisDataSetQueueOptions, VisId } from '../timeline/index';
export { VisId } from '../timeline/index';
export declare type VisNetworkEvents = Vis.NetworkEvents;
export declare type VisMoveToOptions = Vis.MoveToOptions;
export interface VisClusterOptions extends Vis.ClusterOptions {
}
export interface VisOpenClusterOptions extends Vis.OpenClusterOptions {
Expand Down
2 changes: 1 addition & 1 deletion components/network/index.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"__symbolic":"module","version":4,"metadata":{"VisNetworkEvents":{"__symbolic":"interface"},"VisClusterOptions":{"__symbolic":"interface"},"VisOpenClusterOptions":{"__symbolic":"interface"},"VisNetworkData":{"__symbolic":"interface"},"VisNode":{"__symbolic":"interface"},"VisEdge":{"__symbolic":"interface"},"VisNodeSelectionOptions":{"__symbolic":"interface"},"VisEdgeSelectionOptions":{"__symbolic":"interface"},"VisFitOptions":{"__symbolic":"interface"},"VisNetworkOptions":{"__symbolic":"interface"},"VisEdgeOptions":{"__symbolic":"interface"},"VisNetwork":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"vis","name":"Network","line":17,"character":32}},"VisNodeOptions":{"__symbolic":"interface"},"VisPosition":{"__symbolic":"interface"},"VisNodes":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"vis","name":"DataSet","line":21,"character":30},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"../timeline/index","name":"VisDataSetOptions","line":22,"character":51}]}],"getLength":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"distinct":[{"__symbolic":"method"}],"flush":[{"__symbolic":"method"}],"forEach":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"getById":[{"__symbolic":"method"}],"getByIds":[{"__symbolic":"method"}],"getDataSet":[{"__symbolic":"method"}],"getIds":[{"__symbolic":"method"}],"map":[{"__symbolic":"method"}],"max":[{"__symbolic":"method"}],"min":[{"__symbolic":"method"}],"on":[{"__symbolic":"method"}],"off":[{"__symbolic":"method"}],"removeItems":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}},"VisEdges":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"vis","name":"DataSet","line":103,"character":30},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"../timeline/index","name":"VisDataSetOptions","line":22,"character":51}]}],"getLength":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"distinct":[{"__symbolic":"method"}],"flush":[{"__symbolic":"method"}],"forEach":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"getById":[{"__symbolic":"method"}],"getByIds":[{"__symbolic":"method"}],"getDataSet":[{"__symbolic":"method"}],"getIds":[{"__symbolic":"method"}],"map":[{"__symbolic":"method"}],"max":[{"__symbolic":"method"}],"min":[{"__symbolic":"method"}],"on":[{"__symbolic":"method"}],"off":[{"__symbolic":"method"}],"removeItems":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}}},"exports":[{"from":"../timeline/index","export":["VisId"]},{"from":"./vis-network.directive"},{"from":"./vis-network.service"}]}]
[{"__symbolic":"module","version":4,"metadata":{"VisNetworkEvents":{"__symbolic":"interface"},"VisMoveToOptions":{"__symbolic":"interface"},"VisClusterOptions":{"__symbolic":"interface"},"VisOpenClusterOptions":{"__symbolic":"interface"},"VisNetworkData":{"__symbolic":"interface"},"VisNode":{"__symbolic":"interface"},"VisEdge":{"__symbolic":"interface"},"VisNodeSelectionOptions":{"__symbolic":"interface"},"VisEdgeSelectionOptions":{"__symbolic":"interface"},"VisFitOptions":{"__symbolic":"interface"},"VisNetworkOptions":{"__symbolic":"interface"},"VisEdgeOptions":{"__symbolic":"interface"},"VisNetwork":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"vis","name":"Network","line":18,"character":32}},"VisNodeOptions":{"__symbolic":"interface"},"VisPosition":{"__symbolic":"interface"},"VisNodes":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"vis","name":"DataSet","line":22,"character":30},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"../timeline/index","name":"VisDataSetOptions","line":23,"character":49}]}],"getLength":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"distinct":[{"__symbolic":"method"}],"flush":[{"__symbolic":"method"}],"forEach":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"getById":[{"__symbolic":"method"}],"getByIds":[{"__symbolic":"method"}],"getDataSet":[{"__symbolic":"method"}],"getIds":[{"__symbolic":"method"}],"map":[{"__symbolic":"method"}],"max":[{"__symbolic":"method"}],"min":[{"__symbolic":"method"}],"on":[{"__symbolic":"method"}],"off":[{"__symbolic":"method"}],"removeItems":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}},"VisEdges":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"vis","name":"DataSet","line":104,"character":30},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"../timeline/index","name":"VisDataSetOptions","line":23,"character":49}]}],"getLength":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"distinct":[{"__symbolic":"method"}],"flush":[{"__symbolic":"method"}],"forEach":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"getById":[{"__symbolic":"method"}],"getByIds":[{"__symbolic":"method"}],"getDataSet":[{"__symbolic":"method"}],"getIds":[{"__symbolic":"method"}],"map":[{"__symbolic":"method"}],"max":[{"__symbolic":"method"}],"min":[{"__symbolic":"method"}],"on":[{"__symbolic":"method"}],"off":[{"__symbolic":"method"}],"removeItems":[{"__symbolic":"method"}],"setOptions":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}]}}},"exports":[{"from":"../timeline/index","export":["VisId"]},{"from":"./vis-network.directive"},{"from":"./vis-network.service"}]}]
44 changes: 44 additions & 0 deletions components/network/vis-network.service.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EventEmitter } from '@angular/core';
import * as vis from "vis";
import { VisMoveToOptions } from '..';
import { VisClusterOptions, VisEdgeOptions, VisFitOptions, VisId, VisNetworkData, VisNetworkEvents, VisNetworkOptions, VisNodeOptions, VisOpenClusterOptions } from './index';
/**
* A service to create, manage and control VisNetwork instances.
Expand Down Expand Up @@ -670,4 +671,47 @@ export declare class VisNetworkService {
* @memberOf VisNetworkService
*/
getConnectedEdges(visNetwork: string, nodeId: vis.IdType): vis.IdType[];
/**
* Returns an array of nodeIds of the all the nodes that are directly connected to this node.
* If you supply an edgeId, vis will first match the id to nodes.
* If no match is found, it will search in the edgelist and return an array: [fromId, toId].
*
* @param {string} visNetwork The network name/identifier.
* @param nodeOrEdgeId a node or edge id
* @returns {VisId[]} Return array of node ids
*/
getConnectedNodes(visNetwork: string, nodeOrEdgeId: vis.IdType): vis.IdType[] | {
fromId: vis.IdType;
toId: vis.IdType;
}[];
/**
* Returns the positions of the nodes.
* @param {string} visNetwork The network name/identifier.
* @param {Array.<Node.id>|String} [ids] --> optional, can be array of nodeIds, can be string
* @returns {{}}
*/
getPositions(visNetwork: string, nodeIds: VisId[]): {
[nodeId: string]: vis.Position;
};
/**
* You can animate or move the camera using the moveTo method.
*
* @param {string} visNetwork The network name/identifier.
* @param {VisFocusOptions} options Options for moveTo function.
*/
moveTo(visNetwork: string, moveToOptions: VisMoveToOptions): void;
/**
* Start the physics simulation.
* This is normally done whenever needed and is only really useful
* if you stop the simulation yourself and wish to continue it afterwards.
* @param {string} visNetwork The network name/identifier.
*/
startSimulation(visNetwork: string): void;
/**
* This stops the physics simulation and triggers a stabilized event.
* Tt can be restarted by dragging a node,
* altering the dataset or calling startSimulation().
* @param {string} visNetwork The network name/identifier.
*/
stopSimulation(visNetwork: string): void;
}
114 changes: 114 additions & 0 deletions components/network/vis-network.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,120 @@ var VisNetworkService = /** @class */ (function () {
function (visNetwork, nodeId) {
return this.networks[visNetwork].getConnectedEdges(nodeId);
};
/**
* Returns an array of nodeIds of the all the nodes that are directly connected to this node.
* If you supply an edgeId, vis will first match the id to nodes.
* If no match is found, it will search in the edgelist and return an array: [fromId, toId].
*
* @param {string} visNetwork The network name/identifier.
* @param nodeOrEdgeId a node or edge id
* @returns {VisId[]} Return array of node ids
*/
/**
* Returns an array of nodeIds of the all the nodes that are directly connected to this node.
* If you supply an edgeId, vis will first match the id to nodes.
* If no match is found, it will search in the edgelist and return an array: [fromId, toId].
*
* @param {string} visNetwork The network name/identifier.
* @param nodeOrEdgeId a node or edge id
* @returns {VisId[]} Return array of node ids
*/
VisNetworkService.prototype.getConnectedNodes = /**
* Returns an array of nodeIds of the all the nodes that are directly connected to this node.
* If you supply an edgeId, vis will first match the id to nodes.
* If no match is found, it will search in the edgelist and return an array: [fromId, toId].
*
* @param {string} visNetwork The network name/identifier.
* @param nodeOrEdgeId a node or edge id
* @returns {VisId[]} Return array of node ids
*/
function (visNetwork, nodeOrEdgeId) {
return this.networks[visNetwork].getConnectedNodes(nodeOrEdgeId);
};
/**
* Returns the positions of the nodes.
* @param {string} visNetwork The network name/identifier.
* @param {Array.<Node.id>|String} [ids] --> optional, can be array of nodeIds, can be string
* @returns {{}}
*/
/**
* Returns the positions of the nodes.
* @param {string} visNetwork The network name/identifier.
* @param {Array.<Node.id>|String} [ids] --> optional, can be array of nodeIds, can be string
* @returns {{}}
*/
VisNetworkService.prototype.getPositions = /**
* Returns the positions of the nodes.
* @param {string} visNetwork The network name/identifier.
* @param {Array.<Node.id>|String} [ids] --> optional, can be array of nodeIds, can be string
* @returns {{}}
*/
function (visNetwork, nodeIds) {
return this.networks[visNetwork].getPositions(nodeIds);
};
/**
* You can animate or move the camera using the moveTo method.
*
* @param {string} visNetwork The network name/identifier.
* @param {VisFocusOptions} options Options for moveTo function.
*/
/**
* You can animate or move the camera using the moveTo method.
*
* @param {string} visNetwork The network name/identifier.
* @param {VisFocusOptions} options Options for moveTo function.
*/
VisNetworkService.prototype.moveTo = /**
* You can animate or move the camera using the moveTo method.
*
* @param {string} visNetwork The network name/identifier.
* @param {VisFocusOptions} options Options for moveTo function.
*/
function (visNetwork, moveToOptions) {
return this.networks[visNetwork].moveTo(moveToOptions);
};
/**
* Start the physics simulation.
* This is normally done whenever needed and is only really useful
* if you stop the simulation yourself and wish to continue it afterwards.
* @param {string} visNetwork The network name/identifier.
*/
/**
* Start the physics simulation.
* This is normally done whenever needed and is only really useful
* if you stop the simulation yourself and wish to continue it afterwards.
* @param {string} visNetwork The network name/identifier.
*/
VisNetworkService.prototype.startSimulation = /**
* Start the physics simulation.
* This is normally done whenever needed and is only really useful
* if you stop the simulation yourself and wish to continue it afterwards.
* @param {string} visNetwork The network name/identifier.
*/
function (visNetwork) {
return this.networks[visNetwork].startSimulation();
};
/**
* This stops the physics simulation and triggers a stabilized event.
* Tt can be restarted by dragging a node,
* altering the dataset or calling startSimulation().
* @param {string} visNetwork The network name/identifier.
*/
/**
* This stops the physics simulation and triggers a stabilized event.
* Tt can be restarted by dragging a node,
* altering the dataset or calling startSimulation().
* @param {string} visNetwork The network name/identifier.
*/
VisNetworkService.prototype.stopSimulation = /**
* This stops the physics simulation and triggers a stabilized event.
* Tt can be restarted by dragging a node,
* altering the dataset or calling startSimulation().
* @param {string} visNetwork The network name/identifier.
*/
function (visNetwork) {
return this.networks[visNetwork].stopSimulation();
};
VisNetworkService.decorators = [
{ type: core_1.Injectable },
];
Expand Down

0 comments on commit 81990b7

Please sign in to comment.