Skip to content

StyleImages

Namespace: ThinkGeo.Core.Styling

The images a style document carries by name, drawn from code rather than fetched from a sprite: a symbol's picture, a fill's pattern, a label's mask. A style layer names one the way it names a sprite icon, by id.

public sealed class StyleImages

Inheritance object → StyleImages

Properties

Count

Gets how many images the document carries.

public int Count { get; }

Property Value

int

Ids

The names of the images added here, by either Add. Icons a sprite sheet carries are not among them.

public IEnumerable<string> Ids { get; }

Property Value

IEnumerable<string>

Methods

Add(string, GeoImage, float)

Adds a picture under a name, or replaces the one the name had.

public void Add(string id, GeoImage image, float pixelRatio)

Parameters

id string
The name style layers use for it.

image GeoImage
The picture.

pixelRatio float
The ratio it was drawn at: 2 for a picture drawn twice as large as it is shown.

Returns

void

Add(string, Style, int, float)

Draws a style once and adds the drawing under a name: a point style becomes the symbol it draws, an area style the swatch it fills. A point style is drawn at the size it needs; any other at , or 32 when that is 0.

public void Add(string id, Style style, int sizeInPixel, float pixelRatio)

Parameters

id string
The name style layers use for it.

style Style
The style to draw.

sizeInPixel int
The side of the square to draw into, or 0 to size it from the style.

pixelRatio float
The ratio the drawing is shown at.

Returns

void

Remarks:

What is kept is the picture, not the style: changing the style afterwards does not change the image. Add it again under the same name to redraw it.

Add(string, GeoHatchBrush)

Draws one period of a hatch pattern and adds it under a name, for a layer's fill-pattern: the period repeats seamlessly, so the fill looks the way the same brush draws on a classic layer.

public void Add(string id, GeoHatchBrush brush)

Parameters

id string
The name style layers use for it.

brush GeoHatchBrush
The hatch brush: its pattern, foreground and background.

Returns

void

Remove(string)

Takes an image away by name.

public bool Remove(string id)

Parameters

id string

Returns

bool
True when there was one.

TryGetSize(string, Int32&, Int32&, Single&)

The size an image was registered at, in its own pixels, and the pixel ratio it was registered with: on screen at its own size it measures Width / PixelRatio by Height / PixelRatio CSS pixels. For a style drawn to fit this is the measured canvas - what a marker naming the image draws at when its size is left at 0. An icon a renderer read out of a sprite sheet answers too, once the style has compiled. False for a name nothing is registered under. https://community.thinkgeo.com/t/v15-beta160-follow-up-remaining-gpu-style-parity-source-lifecycle-wfs-v2-and-wms-gaps/12468

public bool TryGetSize(string id, Int32& width, Int32& height, Single& pixelRatio)

Parameters

id string
The name the style uses for the image.

width Int32&
The width in the image's own pixels.

height Int32&
The height in the image's own pixels.

pixelRatio Single&
The pixel ratio it was registered at.

Returns

bool
Whether the size is known.

Contains(string)

Whether an image is carried under a name.

public bool Contains(string id)

Parameters

id string

Returns

bool

TryGetImage(string, GeoImage&, Single&)

Gets an image added here by name: the picture - for a style, the one it was drawn to - and the pixel ratio it was added with.

public bool TryGetImage(string id, GeoImage& image, Single& pixelRatio)

Parameters

id string
The name the style uses for the image.

image GeoImage&
The picture.

pixelRatio Single&
The pixel ratio it was added with.

Returns

bool
False for a name nothing was added under.