Last updated

API / geotoolkit / attributes / Pattern / Pattern

Class: Pattern

attributes.Pattern.Pattern

Defines a base class to define a pattern.

Hierarchy

Table of contents

Constructors
Methods
Css Properties
Name Type Description
containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
patternnamestringName of this pattern for indexing
scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)

Contents

Constructors

new Pattern(data)

new Pattern(data?)

Parameters

Name Type
Optional dataOptions

Overrides

EventDispatcher.constructor

Methods

dispose

dispose(): void

Dispose.

Returns

void

Inherited from

EventDispatcher.dispose


getClassName

getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName


getContainerName

getContainerName(): string

Returns a name of the pattern container

Returns

string

a container name


getDataURL

getDataURL(): Promise<string>

Return the imagepattern data url promise

Returns

Promise<string>


getHeight

getHeight(): number

Height of this pattern's image

Returns

number

height


getPattern

getPattern(context, repetition, foregroundColor?, transform?): any

Makes a pattern from the image

Parameters

Name Type Description
contextIPatternContext2d rendering context from canvas
repetitionstringstyle of repetition
Optional foregroundColorstringof the pattern
Optional transformTransformationtransform

Returns

any

pattern


getPatternName

getPatternName(): string

Returns pattern name

Returns

string

a pattern name


getPromise

getPromise(): Promise<IBaseImage>

return the load image promise

Returns

Promise<IBaseImage>


getProperties

getProperties(context?): OptionsOut

Gets all the properties pertaining to this object

Parameters

Name Type Description
Optional contextISerializationContextserializer context

Returns

OptionsOut

An object containing the properties


getScaleX

getScaleX(): number

Gets the X scale for image transformation.

Returns

number


getScaleY

getScaleY(): number

Gets the Y scale for image transformation.

Returns

number


getSize

getSize(): Dimension

Returns size as a Dimension object with width and height attributes

Returns

Dimension

size


getUserHandle

getUserHandle(): Function

Gets user handle

Deprecated

since 4.0. Not used anymore.

Returns

Function

userHandle


getWidth

getWidth(): number

Width of this pattern's image

Returns

number

width


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

EventDispatcher.hasEventListener


invalidate

invalidate(foregroundColor?): Pattern

invalidate parent

Parameters

Name Type Description
Optional foregroundColorstringof the pattern

Returns

Pattern

this


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

EventDispatcher.isDisposed


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

EventDispatcher.isSilent


notify

notify<E>(type, source, args?): Pattern

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourcePatternof the event
Optional argsEventMap[E]arguments of the event

Returns

Pattern

this

Overrides

EventDispatcher.notify


off

off<E>(type?, callback?): Pattern

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: Pattern, args: EventMap[E]) => voidfunction to be called

Returns

Pattern

this

Overrides

EventDispatcher.off


on

on<E>(type, callback): Pattern

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: Pattern, args: EventMap[E]) => voidto be called

Returns

Pattern

this

Overrides

EventDispatcher.on


setPatternName

setPatternName(patternName, containerName): Pattern

This method sets the container and pattern name to be used for serialization.

Parameters

Name Type Description
patternNamestringpattern name
containerNamestringcontainer name

Returns

Pattern

this


setProperties

setProperties(properties?): Pattern

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

Pattern

this


setSilent

setSilent(bool): Pattern

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

Pattern

this

Inherited from

EventDispatcher.setSilent


getClassName

Static getClassName(): string

Returns

string

Inherited from

EventDispatcher.getClassName