import Dispatcher from "./Dispatcher"; import Camera from "./Camera"; import Graph from "./Graph"; import { Settings } from "./Configurable"; import { Keyed, SigmaSettings, Renderer, SigmaUtils, SigmaMisc, SigmaWebGLUtilities, SigmaSvgUtils, SigmaCanvasUtils, Killable } from "../../interfaces"; /** * This is the sigma instances constructor. One instance of sigma represent * one graph. It is possible to represent this grapĥ with several renderers * at the same time. By default, the default renderer (WebGL + Canvas * polyfill) will be used as the only renderer, with the container specified * in the configuration. * * @param {?*} conf The configuration of the instance. There are a lot of * different recognized forms to instantiate sigma, check * example files, documentation in this file and unit * tests to know more. * @return {Sigma} The fresh new sigma instance. * * Instanciating sigma: * ******************** * If no parameter is given to the constructor, the instance will be created * without any renderer or camera. It will just instantiate the graph, and * other modules will have to be instantiated through the public methods, * like "addRenderer" etc: * * > s0 = new sigma(); * > s0.addRenderer({ * > type: 'canvas', * > container: 'my-container-id' * > }); * * In most of the cases, sigma will simply be used with the default renderer. * Then, since the only required parameter is the DOM container, there are * some simpler way to call the constructor. The four following calls do the * exact same things: * * > s1 = new sigma('my-container-id'); * > s2 = new sigma(document.getElementById('my-container-id')); * > s3 = new sigma({ * > container: document.getElementById('my-container-id') * > }); * > s4 = new sigma({ * > renderers: [{ * > container: document.getElementById('my-container-id') * > }] * > }); * * Recognized parameters: * ********************** * Here is the exhaustive list of every accepted parameters, when calling the * constructor with to top level configuration object (fourth case in the * previous examples): * * {?string} id The id of the instance. It will be generated * automatically if not specified. * {?array} renderers An array containing objects describing renderers. * {?object} graph An object containing an array of nodes and an array * of edges, to avoid having to add them by hand later. * {?object} settings An object containing instance specific settings that * will override the default ones defined in the object * sigma.settings. */ declare class Sigma extends Dispatcher { static classes: any; static settings: SigmaSettings; static version: string; static renderers: Keyed; static plugins: Keyed; static middlewares: Keyed; static utils: SigmaUtils; static misc: SigmaMisc; static captors: Keyed; static canvas: SigmaCanvasUtils; static svg: SigmaSvgUtils; static webgl: SigmaWebGLUtilities; events: string[]; private conf; readonly id: string; settings: Settings; graph: Graph; middlewares: Function[]; cameras: Keyed; renderers: Keyed; renderersPerCamera: Keyed; cameraFrames: Keyed; constructor(conf?: any); private initializeMiddleware; private initializeRenderers; private initializeGraphData; private _handler; readonly camera: Camera; private nextCameraId; /** * This methods will instantiate and reference a new camera. If no id is * specified, then an automatic id will be generated. * * @param {?string} id Eventually the camera id. * @return {sigma.classes.camera} The fresh new camera instance. */ addCamera(id?: string): any; /** * This method kills a camera, and every renderer attached to it. * * @param {string|camera} v The camera to kill or its ID. * @return {Sigma} Returns the instance. */ killCamera(v: string | Camera): this; /** * This methods will instantiate and reference a new renderer. The "type" * argument can be the constructor or its name in the "sigma.renderers" * package. If no type is specified, then "sigma.renderers.def" will be used. * If no id is specified, then an automatic id will be generated. * * @param {?object} options Eventually some options to give to the renderer * constructor. * @return {renderer} The fresh new renderer instance. * * Recognized parameters: * ********************** * Here is the exhaustive list of every accepted parameters in the "options" * object: * * {?string} id Eventually the renderer id. * {?(function|string)} type Eventually the renderer constructor or its * name in the "sigma.renderers" package. * {?(camera|string)} camera Eventually the renderer camera or its * id. */ addRenderer(options?: any): any; /** * This method kills a renderer. * * @param {string|renderer} v The renderer to kill or its ID. * @return {Sigma} Returns the instance. */ killRenderer(v: string | Renderer): this; /** * This method calls the "render" method of each renderer, with the same * arguments than the "render" method, but will also check if the renderer * has a "process" method, and call it if it exists. * * It is useful for quadtrees or WebGL processing, for instance. * * @param {?object} options Eventually some options to give to the refresh * method. * @return {Sigma} Returns the instance itself. * * Recognized parameters: * ********************** * Here is the exhaustive list of every accepted parameters in the "options" * object: * * {?boolean} skipIndexation A flag specifying wether or not the refresh * function should reindex the graph in the * quadtrees or not (default: false). */ refresh(options?: { skipIndexation?: boolean; }): this; _forEachRenderer(name: string): void; /** * This method calls the "render" method of each renderer. * * @return {Sigma} Returns the instance itself. */ render(): this; /** * This method calls the "render" method of each renderer that is bound to * the specified camera. To improve the performances, if this method is * called too often, the number of effective renderings is limitated to one * per frame, unless you are using the "force" flag. * * @param {sigma.classes.camera} camera The camera to render. * @param {?boolean} force If true, will render the camera * directly. * @return {Sigma} Returns the instance itself. */ renderCamera(camera: Camera, force?: boolean): this; /** * This method calls the "kill" method of each module and destroys any * reference from the instance. */ kill(): void; /** * Returns a clone of the instances object or a specific running instance. * * @param {?string} id Eventually an instance ID. * @return {object} The related instance or a clone of the instances * object. */ static instances(id?: string): Sigma | { [x: string]: Sigma; }; static register(packageName: string, item: any, override?: boolean): void; } export default Sigma;