Last updated

API / geotoolkit / attributes / LineStyle / LineStyle

Class: LineStyle

attributes.LineStyle.LineStyle

Defines properties of outline. It contains line color, line width, and pattern. Patterns can be passed in using LineStyle.Pattern.Dot etc.

Hierarchy

Table of contents

Constructors
Accessors
Methods
Css Properties
Name Type Description
colorstringColor in CSS form
fillstringOptional fill style to be used to fill lines generated with this style
fillFillStyleOptional fill style to be used to fill lines generated with this style
fill-colorstringColor in CSS form
fill-evenoddmodebooleanEven-odd fill mode
fill-fillpatternPatternPattern
fill-fillpattern-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
fill-fillpattern-patternnamestringName of this pattern for indexing
fill-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
fill-foregroundstringForeground color
fill-patternPatternPattern
linecapCapStyleThe line cap style
linedashoffsetnumberLine dash offset of dashed line
linejoinJoinStyleThe line join style
pixelsnapmodebooleanPixel Snap Mode, default(
scalablebooleanTrue if width should depend on transformation
unitstringOptional unit for the width
widthnumber | stringThe line thickness

Contents

Constructors

new LineStyle(color, width, pattern)

new LineStyle(color?, width?, pattern?)

Create LineStyle

Example

import {LineStyle} from '@int/geotoolkit/attributes/LineStyle';

const blackLineStyle = new LinesStyle();
const redLineStyle = new LineStyle('red', 1).setPixelSnapode(true);
const greenLineStyle = new LineStyle({
'color': 'green',
'width': 1,
'pixelsnapmode: true
});
const blueLineStyle = new LineStyle('1px solid blue');

Parameters

Name Type Description
Optional colorTypeThe line color, a properties or CSS style formated string that containes style, width, and color
Optional widthnumberThe line thickness
Optional patternnumber[] | PatternsThe line pattern

Overrides

ColoredStyle.constructor

Accessors

Empty

Static get Empty(): LineStyle

Empty style

Returns

LineStyle

Methods

clone

clone(): LineStyle

All inheritors should implement copy constructor or provide custom implementation for this method

Returns

LineStyle

this

Overrides

ColoredStyle.clone


copyConstructor

Protected copyConstructor(src, deepCopy?): LineStyle

copy constructor

Parameters

Name Type Description
srcLineStyleSource to copy from
Optional deepCopybooleandeep copy

Returns

LineStyle

this

Overrides

ColoredStyle.copyConstructor


dispose

dispose(): void

Dispose.

Returns

void

Inherited from

ColoredStyle.dispose


equalsTo

equalsTo(other): boolean

Returns true if linestyles are identical

Parameters

Name Type Description
otherLineStyleLineStyle to compare against

Returns

boolean


getCapStyle

getCapStyle(): string

Get current line cap style

Returns

string

capStyle can be 'butt', 'square', or 'round'


getClassName

getClassName(): string

Returns

string

Inherited from

ColoredStyle.getClassName


getColor

getColor(): string

Returns color

Returns

string

color in CSS form

Inherited from

ColoredStyle.getColor


getFillStyle

getFillStyle(): FillStyle

Returns fill style

Returns

FillStyle

fill style


getJoinStyle

getJoinStyle(): string

Get current join style

Returns

string

join style


getLineDashOffset

getLineDashOffset(): number

Get line dash offset

Returns

number

Line dash offset


getPattern

getPattern(): number[] | Patterns

Return line pattern

Returns

number[] | Patterns

pattern


getPixelSnapMode

getPixelSnapMode(): PixelSnapMode

return Pixel Snap Mode

Returns

PixelSnapMode


getProperties

getProperties(context?): OptionsOut

Gets all the properties pertaining to this object

Parameters

Name Type Description
Optional contextISerializationContextserialization context

Returns

OptionsOut

Overrides

ColoredStyle.getProperties


getRgbaColor

getRgbaColor(): RgbaColor

Return RGBA color

Returns

RgbaColor

color

Inherited from

ColoredStyle.getRgbaColor


getShadow

getShadow(): Shadow

Gets all properties pertaining to shadow

Returns

Shadow

JSON with offsetX, offsetY, color and blur properties

Inherited from

ColoredStyle.getShadow


getTimeStamp

getTimeStamp(): number

Gets time stamp

Returns

number

timeStamp

Inherited from

ColoredStyle.getTimeStamp


getUnit

getUnit(): AbstractUnit

Returns unit of the measure for the width

Returns

AbstractUnit


getWidth

getWidth(): number

Return line width

Returns

number

line 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

ColoredStyle.hasEventListener


invalidate

invalidate(): LineStyle

notify the node that the style is invalidated

Returns

LineStyle

this

Inherited from

ColoredStyle.invalidate


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

ColoredStyle.isDisposed


isScalable

isScalable(): boolean

Returns true if width depends on transformation

Returns

boolean

true if width depends on transformation


isSilent

isSilent(): boolean

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

Returns

boolean

Inherited from

ColoredStyle.isSilent


notify

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

Notify listeners

Type parameters

NameType
Eextends string

Parameters

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

Returns

LineStyle

this

Inherited from

ColoredStyle.notify


off

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

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: LineStyle, args: EventMap[E]) => voidfunction to be called

Returns

LineStyle

this

Inherited from

ColoredStyle.off


on

on<E>(type, callback): LineStyle

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: LineStyle, args: EventMap[E]) => voidto be called

Returns

LineStyle

this

Inherited from

ColoredStyle.on


setCapStyle

setCapStyle(capStyle): LineStyle

Line cap style, passes through to canvas directly

Parameters

Name Type Description
capStylestringcan be 'butt', 'square', or 'round'

Returns

LineStyle

this


setColor

setColor(color): LineStyle

Sets color

Parameters

Name Type Description
colorstring | RgbaColor | HsvColor | HlsColorin CSS string form or RgbaColor object

Returns

LineStyle

this

Inherited from

ColoredStyle.setColor


setFillStyle

setFillStyle(fill): LineStyle

Sets fill style to fill line content. if fill is set line color is ignored

Parameters

Name Type Description
fillTypefill style to be used to fill line.

Returns

LineStyle

this


setJoinStyle

setJoinStyle(lineJoin): LineStyle

Line join style, passes through to the underlying html5 canvas renderer.

Parameters

Name Type Description
lineJoinstringstyle'

Returns

LineStyle

this


setLineDashOffset

setLineDashOffset(lineDashOffset): LineStyle

Set line dash offset of dashed line

Parameters

Name Type Description
lineDashOffsetnumberOffset for line dash

Returns

LineStyle

this


setPattern

setPattern(pattern): LineStyle

Sets line pattern

Parameters

Name Type Description
patternnumber[] | Patternsline pattern

Returns

LineStyle

this


setPixelSnapMode

setPixelSnapMode(pixelSnapMode?): LineStyle

Set Pixel Snap Mode

Parameters

Name Type Description
Optional pixelSnapModeboolean | PixelSnapModePixel Snap Mode

Returns

LineStyle

this


setProperties

setProperties(properties?): LineStyle

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

LineStyle

this

Overrides

ColoredStyle.setProperties


setScalable

setScalable(scalable): LineStyle

Set true if width should depend on transformation

Parameters

Name Type Description
scalablebooleantrue if width should depend on transformation

Returns

LineStyle

this


setShadow

setShadow(shadow): LineStyle

Sets all properties pertaining to shadow

Parameters

Name Type Description
shadowPartial<Merge<Shadow, { color?: string | RgbaColor }>>data

Returns

LineStyle

this

Inherited from

ColoredStyle.setShadow


setSilent

setSilent(bool, force?): LineStyle

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode
Optional forcebooleantrue if parent should be invalidated immediately

Returns

LineStyle

this

Inherited from

ColoredStyle.setSilent


setUnit

setUnit(unit): LineStyle

Sets unit of the measure for the width

Parameters

Name Type Description
unitstring | AbstractUnita scale unit or string symbol

Returns

LineStyle

this


setWidth

setWidth(width): LineStyle

Sets line width

Parameters

Name Type Description
widthstring | numberline width

Returns

LineStyle

this


toGrayScale

toGrayScale(clone?): LineStyle

Clone the instance in grayscale style, or convert itself if [clone] is false.

Parameters

Name Type Description
Optional clonebooleanclone instance if true, default is true

Returns

LineStyle

Overrides

ColoredStyle.toGrayScale


updateTimeStamp

updateTimeStamp(silent?): LineStyle

Update time stamp to indicate that style has been changed.

Parameters

Name Type Description
Optional silentbooleansilent mode. If this parameter equals to true then style doesn't send invalidate event

Returns

LineStyle

this

Inherited from

ColoredStyle.updateTimeStamp


fromObject

Static fromObject(object?): LineStyle

Create or get line style from object

Parameters

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

Returns

LineStyle

line style


getClassName

Static getClassName(): string

Returns

string

Inherited from

ColoredStyle.getClassName


isStyleNotificationEnabled

Static isStyleNotificationEnabled(): boolean

Return status of the global notification for all styles.

Returns

boolean

Inherited from

ColoredStyle.isStyleNotificationEnabled


mergeFromObject

Static mergeFromObject(node, lineStyle, object, merge?, invalidateMethod?): LineStyle

Merge css linestyle object with existing instance

Example

import {Shape} from '@int/geotoolkit/scene/shapes/Shape';
import {LineStyle} from '@int/geotoolkit/attributes/LineStyle';

class CustomSymbol extends Shape {
...
public setLineStyle (lineStyle: LineStyle.Type, merge?: boolean): this {
lineStyle = LineStyle.mergeFromObject(this, this.getLineStyle(), lineStyle, merge);
return super.setLineStyle(lineStyle);
}
...
}

const symbol = new CustomSymbol(new Rect(50, 50, 150, 150))
.setLineStyle({
'color': KnownColors.Orange
})
.setLineStyle({
'width': 13
}, true);

Parameters

Name Type Description
nodeIStyleListenernode
lineStyleLineStyleinstance of node property
objectType | OptionsWithPatternsExtendedcontains line style
Optional mergebooleanmerge flag
Optional invalidateMethodAttributeCallback<EventDispatcher>invalidate method

Returns

LineStyle

lineStyle