Last updated

API / geotoolkit / flowcharts / plugins / VisualFactory / VisualFactory

Class: VisualFactory

plugins.VisualFactory.VisualFactory

Factory that is used for creating Diagram Visual prototypes. getInstance returns a singleton instance, otherwise, new visual prototypes can be registered with registerPlugin method.

Example

import {VisualFactory} from '@int/geotoolkit/flowcharts/plugins/VisualFactory';
import {DiagramVisual} from '@int/geotoolkit/flowcharts/shapes/DiagramVisual';
VisualFactory.getInstance().registerPlugin(new DiagramVisual({...}))

Table of contents

Constructors
Methods

Contents

Constructors

new VisualFactory()

new VisualFactory()

Methods

getDefaultFillStyle

getDefaultFillStyle(): FillStyle

Gets a default fill style that should be applied to all newly created visuals

Returns

FillStyle

a fill style instance


getDefaultLineStyle

getDefaultLineStyle(): LineStyle

Gets a default line style that should be applied to all newly created visuals

Returns

LineStyle

a line style instance


getPlugins

getPlugins(): IComponent[]

Gets all available plugins

Returns

IComponent[]


getVisual

getVisual(prototypeId, width?, height?): Component

Creates a new visual plugin instance using the given prototypeId name

Parameters

Name Type Description
prototypeIdstringclass name for a component to create
Optional widthnumberthe desired width of the newly created component. If not set, a default value from prototype will be used
Optional heightnumberthe desired height of the newly created component. If not set, a default value from prototype will be used

Returns

Component

a new visual plugin instance or null if an error has occured


registerPlugin

registerPlugin(component): void

Registers the given component in the factory

Parameters

Name Type Description
componentComponenta visual plugin instance

Returns

void


setDefaultFillStyle

setDefaultFillStyle(fillStyle, merge?): VisualFactory

Sets a default fill style that should be applied to all newly created visuals

Parameters

Name Type Description
fillStyleTypea fill style instance
Optional mergebooleantrue if you want to merge fillStyle with existing attribute, false by default

Returns

VisualFactory

this


setDefaultLineStyle

setDefaultLineStyle(lineStyle, merge?): VisualFactory

Sets a default line style that should be applied to all newly created visuals

Parameters

Name Type Description
lineStyleTypea line style instance
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

VisualFactory

this


getInstance

Static getInstance(): VisualFactory

Gets a singleton instance

Returns

VisualFactory

factory