Class: Proxy

bu.source. Proxy

An object that stores global features for all the viewers when they are read from file sources.


new Proxy( [opt_options])

Parameters:
Name Type Argument Description
opt_options bu.source.ProxyOptions <optional>

Options.

Source:
bu/source/sourceproxy.js

Extends

  • ol.Object

Methods


addInMemorySource( [layout])

Returns the ID of a new bu.source.Vector created in-memory. The source is defined with 'EPSG:4326' projection and an empty collection of features.

A in-memory source is different from a source generated through a source definition. It has name and localFileFormat set as undefined. Apart from that can be used as any other source.

Parameters:
Name Type Argument Description
layout ol.geom.GeometryLayout <optional>

The optional layout of the geometries. If no provided then the default of a bu.source.Vector is used.

Source:
bu/source/sourceproxy.js
Returns:

The ID of new source.

Type
string

addSources(sourcedef, projection)

Returns a promise that uses a source definition for reading a file, convert it to bu.source.Vector objects and transform them to a given projection.

This promise never rejects. The resolve function always returns an array of objects. The objects contains a value key with the ID of a source, or an error key with a error message. Returns only one object if the source definition has one single file, or several if it is a ZIP file.

ZIP files inside ZIP files are not supported and ignored as explained in bu.format.local.ZIP reader.

Parameters:
Name Type Description
sourcedef bu.source.SourceDefinition

The source definition.

projection string

Projection EPSG code.

Source:
bu/source/sourceproxy.js
Returns:

A Promise that returns an array of objects for the resolve function, and that has no reject function. The objects returned have a property named value with the ID of the source added if adding the source was a success or a property named error with the error message if adding the source was unsuccessful.

Type
Promise

getSource(id)

Gets an existing bu.source.Vector for a given source definition.

Parameters:
Name Type Description
id string

The ID of the source.

Source:
bu/source/sourceproxy.js
Returns:
Type
bu.source.Vector

removeSource(id)

Decreases the references to an existing bu.source.Vector and if references are zero then removes the source.

Parameters:
Name Type Description
id string

The ID of the source.

Source:
bu/source/sourceproxy.js