kopia lustrzana https://github.com/robhawkes/vizicities
Merge pull request #177 from UDST/feature/expose-tile-components
Expose tile components and change payload of tile eventfeature/threejs-update
commit
819421b59d
|
@ -86,7 +86,9 @@ class Layer extends EventEmitter {
|
|||
}
|
||||
|
||||
// Must return a promise
|
||||
_onAdd(world) {}
|
||||
_onAdd(world) {
|
||||
return Promise.resolve(this);
|
||||
}
|
||||
|
||||
getPickingId() {
|
||||
if (this._world._engine._picking) {
|
||||
|
|
|
@ -30,7 +30,9 @@ class LayerGroup extends Layer {
|
|||
this._world.removeLayer(layer);
|
||||
}
|
||||
|
||||
_onAdd(world) {}
|
||||
_onAdd(world) {
|
||||
return Promise.resolve(this);
|
||||
}
|
||||
|
||||
// Destroy the layers and remove them from the scene and memory
|
||||
destroy() {
|
||||
|
|
|
@ -237,7 +237,8 @@ class GeoJSONTile extends Tile {
|
|||
this._request = reqwest({
|
||||
url: url,
|
||||
type: 'json',
|
||||
crossOrigin: true
|
||||
crossOrigin: true,
|
||||
headers: this._options.headers
|
||||
}).then(res => {
|
||||
// Clear request reference
|
||||
this._request = null;
|
||||
|
@ -261,7 +262,7 @@ class GeoJSONTile extends Tile {
|
|||
// Using this creates a huge amount of memory due to the quantity of tiles
|
||||
this._geojsonLayer = GeoJSONClass(data, this._options);
|
||||
this._geojsonLayer.addTo(this._world).then(() => {
|
||||
this._mesh = this._geojsonLayer._object3D;
|
||||
this._mesh.add(this._geojsonLayer._object3D);
|
||||
this._pickingMesh = this._geojsonLayer._pickingMesh;
|
||||
|
||||
// Free the GeoJSON memory as we don't need it
|
||||
|
|
|
@ -128,7 +128,7 @@ class TileLayer extends Layer {
|
|||
});
|
||||
|
||||
// Emit event notifying of new tiles
|
||||
this.emit('tilesList', this._tileList.map((tile) => tile._tile));
|
||||
this.emit('tilesList', this._tileList.map((tile) => tile));
|
||||
}
|
||||
|
||||
// Works out tiles in the view frustum and stores them in an array
|
||||
|
|
|
@ -4,10 +4,12 @@ import Controls from './controls/index';
|
|||
import Geo from './geo/Geo.js';
|
||||
|
||||
import Layer, {layer} from './layer/Layer';
|
||||
import LayerGroup, {layerGroup} from './layer/LayerGroup';
|
||||
import EnvironmentLayer, {environmentLayer} from './layer/environment/EnvironmentLayer';
|
||||
import ImageTileLayer, {imageTileLayer} from './layer/tile/ImageTileLayer';
|
||||
import GeoJSONTileLayer, {geoJSONTileLayer} from './layer/tile/GeoJSONTileLayer';
|
||||
import TopoJSONTileLayer, {topoJSONTileLayer} from './layer/tile/TopoJSONTileLayer';
|
||||
import GeoJSONTile, {geoJSONTile} from './layer/tile/GeoJSONTile';
|
||||
import GeoJSONLayer, {geoJSONLayer} from './layer/GeoJSONLayer';
|
||||
import TopoJSONLayer, {topoJSONLayer} from './layer/TopoJSONLayer';
|
||||
import GeoJSONWorkerLayer, {geoJSONWorkerLayer} from './layer/GeoJSONWorkerLayer';
|
||||
|
@ -39,6 +41,8 @@ const VIZI = {
|
|||
imageTileLayer: imageTileLayer,
|
||||
GeoJSONTileLayer: GeoJSONTileLayer,
|
||||
geoJSONTileLayer: geoJSONTileLayer,
|
||||
GeoJSONTile: GeoJSONTile,
|
||||
geoJSONTile: geoJSONTile,
|
||||
TopoJSONTileLayer: TopoJSONTileLayer,
|
||||
topoJSONTileLayer: topoJSONTileLayer,
|
||||
GeoJSONLayer: GeoJSONLayer,
|
||||
|
|
Ładowanie…
Reference in New Issue