Skip to content

API / geotoolkit / data / DataSet / DataSet

Class: DataSet

data.DataSet.DataSet

Define a set of tables to make requests, manage allocated memory, merge received data samples <p> Data source can contain several data tables with different data ranges. Each table has a virtual range, which usually contains a full data range on server. If method fetch is called then data set verifies if data already exists. If data does not exist then it makes request to retrieve a data range. If data set receives a new data it merges existing data table with new data and keeps a valid range. if data is not received then it marks invalid range and it can be updated the next time. In the same time data set tracks allocated memory and deallocate automatically old ranges. </p>

Example

// How to provide data
import {Events} from '@int/geotoolkit/data/Events';
import {Range} from '@int/geotoolkit/util/Range';
...
dataset.on(Events.DataFetching, (event, sender, args) =&gt; {
const data = &#91;[500, 600&#93;, &#91;0.5, 0.7&#93;, &#91;100, 200&#93;];
args['callback'](null, &#91;data&#93;);
});
dataset.fetch(new Range(1000, 2000), 5);

Example

// How to provide data with limits
dataset.on(Events.DataFetching, (event, sender, args) =&gt; {
const data = &#91;[500, 600&#93;, &#91;0.5, 0.7&#93;, &#91;100, 200&#93;];
args['callback'](null, { 'limits': new Range(500, 600), 'colsdata': data });
});
dataset.fetch(new Range(500, 600), 5);

Hierarchy

Table of contents

Constructors
  • [new DataSet(options)](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit.data.dataset.dataset.md#new dataset(options))
Methods

Contents

Constructors

new DataSet(options)

• new DataSet(options?)

Creates data set

Parameters

Name Type Description
Optional optionsOptionsoptions

Overrides

DataSource.constructor

Methods

addChild

▸ addChild(data): DataSet

Add a child object

Parameters

Name Type Description
dataDataObject | DataObject[]the child data to be added

Returns

DataSet

this

Inherited from

DataSource.addChild


addTable

▸ addTable(table, range, indexColumnName?): DataSet

Add a new data table to data set

Throws

if table is null or range is null or table has less then one column or index column is not NumericalDataSeries

Parameters

Name Type Description
tableDataTablea table to add
rangeRangea virtual range on the server
Optional indexColumnNamestringname of column used for Index data, index column must be NumericalDataSeries

Returns

DataSet

this


beginUpdate

▸ beginUpdate(): DataSet

begin transaction

Returns

DataSet

this

Inherited from

DataSource.beginUpdate


cancelAllRequests

▸ cancelAllRequests(): DataSet

Returns

DataSet


clearAllTables

▸ clearAllTables(limits?): DataSet

Clear the current data

Parameters

Name Type Description
Optional limitsRangelimits that has been released

Returns

DataSet

this


clearChildren

▸ clearChildren(): DataSet

Remove all child data

Returns

DataSet

this

Inherited from

DataSource.clearChildren


dispose

▸ dispose(): void

Dispose.

Returns

void

Overrides

DataSource.dispose


enableDecimation

▸ enableDecimation(enabled): DataSet

Enable / disable decimation

Parameters

Name Type Description
enabledbooleanenable decimation

Returns

DataSet

this


endUpdate

▸ endUpdate(): DataSet

end transaction

Returns

DataSet

Inherited from

DataSource.endUpdate


fetch

▸ fetch(limits, scale): DataSet

Fetch data for all tables from the source. This method can modify existing data

Parameters

Name Type Description
limitsRangedata range to fetch
scalenumbercurrent scale factor

Returns

DataSet

this


fetchDataRange

▸ Protected fetchDataRange(tables, limits, scale, callback): void

Fetch data range.

Parameters

Name Type Description
tablesDataTable[]an array of updating tables
limitsRangelimits
scalenumberscale
callbackFetchCallbackcallback function to return a result of query

Returns

void


fetchTable

▸ fetchTable(index, limits, scale): DataSet

Fetch data table from the source. This method can modify existing data

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of the table
limitsRangedata range to fetch
scalenumbercurrent scale factor

Returns

DataSet

this


getChild

▸ getChild(i): DataObject

Return data by index

Parameters

Name Type Description
inumberindex of the data

Returns

DataObject

Inherited from

DataSource.getChild


getChildrenCount

▸ getChildrenCount(): number

Return number of child data

Returns

number

Inherited from

DataSource.getChildrenCount


getClassName

▸ getClassName(): string

Returns

string

Inherited from

DataSource.getClassName


getFullIndexRange

▸ getFullIndexRange(): Range

Return a union data range by all tables

Returns

Range


getIndexColumn

▸ getIndexColumn(index): AbstractDataSeries<any&gt;

Gets index column for the specified table

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of table

Returns

AbstractDataSeries<any&gt;


getIndexRange

▸ getIndexRange(index): Range

Return data range by index

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of table

Returns

Range

data table depth or time range


getIndexScale

▸ getIndexScale(index): number

Return data scale by index

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of table

Returns

number

data table scale


getNumberOfTables

▸ getNumberOfTables(): number

Returns number of tables

Returns

number

number of tables


getTable

▸ getTable(index): DataTable

Return data table by index

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of table

Returns

DataTable

data table


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

DataSource.hasEventListener


invalidateRange

▸ invalidateRange(range?, clearData?): void

Invalid a data range of all tables

Parameters

Name Type Description
Optional rangeRangerange to invalidate
Optional clearDatabooleanclear rows of data table

Returns

void


invalidateTableRange

▸ invalidateTableRange(index, range?, clearData?): DataSet

Invalid a data range of the specified table

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of table
Optional rangeRangerange to invalidate
Optional clearDatabooleanclear rows of data table

Returns

DataSet

this


isDecimationEnabled

▸ isDecimationEnabled(): boolean

Returns status if decimation is enabled

Returns

boolean


isDisposed

▸ isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

DataSource.isDisposed


isSilent

▸ isSilent(): boolean

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

Returns

boolean

Inherited from

DataSource.isSilent


needIncludeRequestLimits

▸ needIncludeRequestLimits(): boolean

Return need to include request limits

Returns

boolean

need to include request limits


needIncludeRequestRimits

▸ needIncludeRequestRimits(): boolean

Return need to include request limits

Deprecated

since 4.2 Use needIncludeRequestLimits instead

Returns

boolean

need to include request limits


notify

▸ notify<E&gt;(type, source, args?): DataSet

Notify listeners

Type parameters

NameType
Eextends string

Parameters

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

Returns

DataSet

this

Overrides

DataSource.notify


off

▸ off<E&gt;(type?, callback?): DataSet

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

Returns

DataSet

this

Overrides

DataSource.off


on

▸ on<E&gt;(type, callback): DataSet

Attach listener on event that will be called whenever the specified event is delivered to the target <p> If the callback function is already in the list of event listeners for this target, the function is not added a second time. </p> <p> 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. </p>

Type parameters

NameType
Eextends string

Parameters

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

Returns

DataSet

this

Overrides

DataSource.on


query

▸ query(): QueryBuilder<any&gt;

Query data object items

Returns

QueryBuilder<any&gt;

Inherited from

DataSource.query


removeChild

▸ removeChild(data): DataSet

Remove child data object

Parameters

Name Type Description
dataDataObjectdata to be removed

Returns

DataSet

this

Inherited from

DataSource.removeChild


removeTable

▸ removeTable(table?): DataSet

Remove table from data set

Parameters

Name Type Description
Optional tableDataTabletable to be removed

Returns

DataSet

this


removeTableAt

▸ removeTableAt(index): DataSet

Remove table from data set by index

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of the table to be removed

Returns

DataSet

this


setIndexRange

▸ setIndexRange(index, range): DataSet

Sets data range by index

Throws

if index is out of range

Parameters

Name Type Description
indexnumberindex of table
rangeRangea virtual range on the server

Returns

DataSet

this


setSilent

▸ setSilent(bool): DataSet

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

DataSet

this

Inherited from

DataSource.setSilent


update

▸ update(): DataSet

Load a part of the data

Returns

DataSet

this

Inherited from

DataSource.update


updateTable

▸ updateTable(index, limits, data, scale?): DataSet

Update table data

Throws

if index is out of range

Example

// How to update data with limits
const data = &#91;[500, 600&#93;, &#91;0.5, 0.7&#93;, &#91;100, 200&#93;];
dataSet.updateTableData(0, new Range(500, 600), data);

Parameters

Name Type Description
indexnumberindex of the table
limitsRangelimits to be update
datanumber[][]an arrays of cells
Optional scalenumberscale to be update

Returns

DataSet

this


getClassName

▸ Static getClassName(): string

Returns

string

Inherited from

DataSource.getClassName