API / geotoolkit / attributes / LineStyle / 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.
↳
LineStyle
Constructors
Accessors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
color | string | Color in CSS form |
fill | string | Optional fill style to be used to fill lines generated with this style |
fill | FillStyle | Optional fill style to be used to fill lines generated with this style |
fill-color | string | Color in CSS form |
fill-evenoddmode | boolean | Even-odd fill mode |
fill-fillpattern | Pattern | Pattern |
fill-fillpattern-containername | string | An 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-patternname | string | Name of this pattern for indexing |
fill-fillpattern-scalable | boolean | Flag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported) |
fill-foreground | string | Foreground color |
fill-pattern | Pattern | Pattern |
linecap | CapStyle | The line cap style |
linedashoffset | number | Line dash offset of dashed line |
linejoin | JoinStyle | The line join style |
pixelsnapmode | boolean | Pixel Snap Mode, default( |
scalable | boolean | True if width should depend on transformation |
unit | string | Optional unit for the width |
width | number | string | The line thickness |
Constructors
• 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');| Name | Type | Description |
|---|---|---|
Optional color | Type | The line color, a properties or CSS style formated string that containes style, width, and color |
Optional width | number | The line thickness |
Optional pattern | number[] | Patterns | The line pattern |
ColoredStyle.constructor
Methods
▸ clone(): LineStyle
All inheritors should implement copy constructor or provide custom implementation for this method
this
▸ Protected copyConstructor(src, deepCopy?): LineStyle
copy constructor
| Name | Type | Description |
|---|---|---|
src | LineStyle | Source to copy from |
Optional deepCopy | boolean | deep copy |
this
▸ dispose(): void
Dispose.
void
▸ equalsTo(other): boolean
Returns true if linestyles are identical
| Name | Type | Description |
|---|---|---|
other | LineStyle | LineStyle to compare against |
boolean
▸ getCapStyle(): string
Get current line cap style
string
capStyle can be 'butt', 'square', or 'round'
▸ getClassName(): string
string
▸ getColor(): string
Returns color
string
color in CSS form
▸ getFillStyle(): FillStyle
Returns fill style
fill style
▸ getJoinStyle(): string
Get current join style
string
join style
▸ getLineDashOffset(): number
Get line dash offset
number
Line dash offset
▸ getPattern(): number[] | Patterns
Return line pattern
number[] | Patterns
pattern
▸ getPixelSnapMode(): PixelSnapMode
return Pixel Snap Mode
▸ getProperties(context?): OptionsOut
Gets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional context | ISerializationContext | serialization context |
▸ getRgbaColor(): RgbaColor
Return RGBA color
color
▸ getShadow(): Shadow
Gets all properties pertaining to shadow
JSON with offsetX, offsetY, color and blur properties
▸ getTimeStamp(): number
Gets time stamp
number
timeStamp
▸ getUnit(): AbstractUnit
Returns unit of the measure for the width
▸ getWidth(): number
Return line width
number
line width
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
▸ invalidate(): LineStyle
notify the node that the style is invalidated
this
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isScalable(): boolean
Returns true if width depends on transformation
boolean
true if width depends on transformation
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(type, source, args?): LineStyle
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | Style | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: LineStyle, args: EventMap[E]) => void | function to be called |
this
▸ 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.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: LineStyle, args: EventMap[E]) => void | to be called |
this
▸ setCapStyle(capStyle): LineStyle
Line cap style, passes through to canvas directly
| Name | Type | Description |
|---|---|---|
capStyle | string | can be 'butt', 'square', or 'round' |
this
▸ setColor(color): LineStyle
Sets color
| Name | Type | Description |
|---|---|---|
color | string | RgbaColor | HsvColor | HlsColor | in CSS string form or RgbaColor object |
this
▸ setFillStyle(fill): LineStyle
Sets fill style to fill line content. if fill is set line color is ignored
| Name | Type | Description |
|---|---|---|
fill | Type | fill style to be used to fill line. |
this
▸ setJoinStyle(lineJoin): LineStyle
Line join style, passes through to the underlying html5 canvas renderer.
| Name | Type | Description |
|---|---|---|
lineJoin | string | style' |
this
▸ setLineDashOffset(lineDashOffset): LineStyle
Set line dash offset of dashed line
| Name | Type | Description |
|---|---|---|
lineDashOffset | number | Offset for line dash |
this
▸ setPattern(pattern): LineStyle
Sets line pattern
| Name | Type | Description |
|---|---|---|
pattern | number[] | Patterns | line pattern |
this
▸ setPixelSnapMode(pixelSnapMode?): LineStyle
Set Pixel Snap Mode
| Name | Type | Description |
|---|---|---|
Optional pixelSnapMode | boolean | PixelSnapMode | Pixel Snap Mode |
this
▸ setProperties(properties?): LineStyle
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | An object containing the properties to set |
this
▸ setScalable(scalable): LineStyle
Set true if width should depend on transformation
| Name | Type | Description |
|---|---|---|
scalable | boolean | true if width should depend on transformation |
this
▸ setShadow(shadow): LineStyle
Sets all properties pertaining to shadow
this
▸ setSilent(bool, force?): LineStyle
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
Optional force | boolean | true if parent should be invalidated immediately |
this
▸ setUnit(unit): LineStyle
Sets unit of the measure for the width
| Name | Type | Description |
|---|---|---|
unit | string | AbstractUnit | a scale unit or string symbol |
this
▸ setWidth(width): LineStyle
Sets line width
| Name | Type | Description |
|---|---|---|
width | string | number | line width |
this
▸ toGrayScale(clone?): LineStyle
Clone the instance in grayscale style, or convert itself if [clone] is false.
| Name | Type | Description |
|---|---|---|
Optional clone | boolean | clone instance if true, default is true |
▸ updateTimeStamp(silent?): LineStyle
Update time stamp to indicate that style has been changed.
| Name | Type | Description |
|---|---|---|
Optional silent | boolean | silent mode. If this parameter equals to true then style doesn't send invalidate event |
this
▸ Static fromObject(object?): LineStyle
Create or get line style from object
line style
▸ Static getClassName(): string
string
▸ Static isStyleNotificationEnabled(): boolean
Return status of the global notification for all styles.
boolean
ColoredStyle.isStyleNotificationEnabled
▸ 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);| Name | Type | Description |
|---|---|---|
node | IStyleListener | node |
lineStyle | LineStyle | instance of node property |
object | Type | OptionsWithPatternsExtended | contains line style |
Optional merge | boolean | merge flag |
Optional invalidateMethod | AttributeCallback<EventDispatcher> | invalidate method |
lineStyle