Last updated

API / geotoolkit / util / Helpers / Helpers

Class: Helpers

util.Helpers.Helpers

This class contains various helpers methods

Table of contents

Constructors
Methods

Contents

Constructors

new Helpers()

new Helpers()

Methods

getClassName

getClassName(): string

Returns

string


createFillStyleFromObject

Static createFillStyleFromObject(object?): FillStyle

Create or get fill style from object

Parameters

Name Type Description
Optional objectTypeobject can be in format of constructor FillStyle

Returns

FillStyle


getClassName

Static getClassName(): string

Returns

string


mergeFillStyleFromObject

Static mergeFillStyleFromObject(node, fillStyle, object, merge?, invalidateMethod?): FillStyle

Merge css fillstyle object with existing instance

Example

import {Shape} from '@int/geotoolkit/scene/shapes/Shape';
import {Helpers} from '@int/geotoolkit/util/Helpers';
import {FillStyle} from '@int/geotoolkit/attributes/FillStyle';

class CustomSymbol extends Shape {
...
setFillStyle(fillStyle, merge) {
fillStyle = Helpers.mergeFillStyleFromObject(this, this.getFillStyle(), fillStyle, merge);
return Shape.prototype.setLFillStyle.call(this, fillStyle);
}
...
}
const imgPattern = PatternFactory.getInstance().createPattern(imgurl);

const symbol = new CustomSymbol(new Rect(50, 50, 150, 150))
.setFillStyle({
'color': KnownColors.Orange
})
.setFillStyle({
'pattern': imgPattern
}, true);

Parameters

Name Type Description
nodeIStyleListenernode
fillStyleFillStyleinstance of node property
objectTypecontains fill style
Optional mergebooleanmerge flag
Optional invalidateMethodAttributeCallback<EventDispatcher>invalidate method

Returns

FillStyle

fillStyle