Skip to content
Last updated

API / geotoolkit / scene / ViewCache / ViewCache

Class: ViewCache

scene.ViewCache.ViewCache

Defines a cache strategy to prerender composite node's children in a set of tiles, which have a raster format. For example, it can be an image or texture. The format depends on rendering engine.

Hierarchy

Table of contents

Constructors
[new ViewCache()](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.scene.viewcache.viewcache.md#new viewcache())[new ViewCache(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.scene.viewcache.viewcache.md#new viewcache(options))[new ViewCache(tileWidth, tileHeight, mode, memoryLimit, async)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.scene.viewcache.viewcache.md#new viewcache(tilewidth, tileheight, mode, memorylimit, async))
Methods

Contents

Constructors

new ViewCache()

• new ViewCache()

Overrides

Cache.constructor


new ViewCache(options)

• new ViewCache(options?)

Creates cache

Parameters

Name Type Description
Optional optionsOptionscache options

Overrides

Cache.constructor


new ViewCache(tileWidth, tileHeight, mode, memoryLimit, async)

• new ViewCache(tileWidth?, tileHeight?, mode?, memoryLimit?, async?)

Creates cache

Parameters

Name Type Description
Optional tileWidthnumbertile width in device coordinates
Optional tileHeightnumbertile height in device coordinates
Optional modeCacheModeShared mode by default
Optional memoryLimitnumbermemoryLimit Upper memory limit in Megabyte, ignored when in Shared mode use TileResourceManager.getInstance().setMemoryLimit() to set memory limit in Shared mode
Optional asyncbooleantrue if actions are performed asynchronously

Overrides

Cache.constructor

Methods

clone

▸ clone(): Cache

Returns a cloned cache object. All inheritors should implement copy constructor or provide custom implementation for this method.

Returns

Cache

Inherited from

Cache.clone


copyConstructor

▸ Protected copyConstructor(src): void

copy constructor

Parameters

Name Type Description
srcViewCacheSource to copy from

Returns

void


getClassName

▸ getClassName(): string

Returns

string

Inherited from

Cache.getClassName


getOwner

▸ getOwner(): Node

Returns cache owner.

Returns

Node

owner this cache's owner

Overrides

Cache.getOwner


getResourceManager

▸ getResourceManager(): TileResourceManager

Returns resource manager.

Returns

TileResourceManager

Overrides

Cache.getResourceManager


getStopCreationOrUpdate

▸ getStopCreationOrUpdate(): boolean

Returns flag which freezes the cache.

Returns

boolean

stop


getTileHeight

▸ getTileHeight(): number

Returns tile height.

Returns

number

height


getTileWidth

▸ getTileWidth(): number

Returns tile width.

Returns

number

width


invalidate

▸ invalidate(bounds?): ViewCache

Invalidates cache. Marks cache to be rendered.

Parameters

Name Type Description
Optional boundsRectrectangular area to be invalidated

Returns

ViewCache

this

Overrides

Cache.invalidate


isAsync

▸ isAsync(): boolean

Checks if cache is asynchronous

Returns

boolean


rebuild

▸ rebuild(force?): ViewCache

Flags the ViewCache as needing a clear / rebuild. Called after zooming or when we've hit the cap for number of images

Parameters

Name Type Description
Optional forcebooleanforce flag

Returns

ViewCache

this

Overrides

Cache.rebuild


render

▸ render(context): void

Render to context. Will only render tiles within visible model limits.

Parameters

Name Type Description
contextRenderingContextrendering context

Returns

void

Overrides

Cache.render


setAsync

▸ setAsync(bool?): ViewCache

Sets asynchronous cache rendering

Parameters

Name Type Description
Optional boolbooleantrue if cache should be asynchronous

Returns

ViewCache

this


setExtend

▸ setExtend(extend): ViewCache

Set extend

Parameters

Name Type Description
extendDimensionoverlap between 2 tiles

Returns

ViewCache

this


setKeepAlive

▸ setKeepAlive(keepAlive): ViewCache

Set keep alive strategy, keep tiles alive when rebuild as much as possible

Parameters

Name Type Description
keepAlivebooleanflag

Returns

ViewCache


setOwner

▸ setOwner(owner): ViewCache

Sets cache owner.

Throws

Error This exception is thrown if type is not supported

Parameters

Name Type Description
ownerNodenode which should be cached

Returns

ViewCache

this

Overrides

Cache.setOwner


setRenderContent

▸ setRenderContent(renderContentDelegate): ViewCache

Sets render content.

Parameters

Name Type Description
renderContentDelegate(context: RenderingContext) => voidexternal method to render tiles

Returns

ViewCache

this

Overrides

Cache.setRenderContent


setStopCreationOrUpdate

▸ setStopCreationOrUpdate(stop): ViewCache

When this is set to true will essentially freeze the cache - tiles will no longer be created, existing tiles will be used and scaled to fit the visible bounds if tiles do not exist for a particular area nothing will be rendered.

Parameters

Name Type Description
stopbooleanflag to freeze the cache

Returns

ViewCache

this


stopRenderAsync

▸ stopRenderAsync(): ViewCache

Stops all asynchronous rendering processes (if existed)

Returns

ViewCache

this


getClassName

▸ Static getClassName(): string

Returns

string

Inherited from

Cache.getClassName


getDebugMode

▸ Static getDebugMode(): DebugInfo

Return current debug mode states

Returns

DebugInfo


setDebugMode

▸ Static setDebugMode(debugInfo): void

Set debug mode states

Parameters

Name Type Description
debugInfoDebugInfodebug information

Returns

void