clientUtil
This module helps client create the correct parameters for the application.
Loading tiles also accessible from here.
- loading tiles: tiles that are in the fetching stages and not downloaded yet.
loading tiles are important because tiles that are not loaded represented by textures of zeros and
not quite understandable.
GeographicalShapeShifterObserver
I called it shape shifter because there is some sort of builder pattern inside.
The implementation is not reflected to the client.
Additional pipelines are constructed
based on the customlayer they pushed in,
on top of base pipelines
This approach is followed considering the performance upgrade when using the same base on multiple different custom layers.
loading tiles
GeographicalShapeShifterObserver.getLoadingTilesAsObservable() gives the tiles that on fecthing stage which
have intersaction with the observers range
clientUtil.TileManager.LoadingTilesAsObservable gives the all tiles that are fetching.
Constructor
export class GeographicalShapeShifterObserver{
constructor(
name,
height$,
lngLat$,
range$,
zoomLevel$,
rasterTileResolution,
map_toCalculateMercatorCoordinate,
rgb$,
alpha$,
tileDB,
antiAliasing = true,
samplingMilliseconds = 50,
textureType = 'dem',
turfOptions = {"units":"meters"},
)
Usage
const mouseGozlemci = new GeographicalShapeShifterObserver(
'mouseGozlemcisi',
mouseHeight$,
mouselngLat$,
mouseRange$,
zoomFloorLevel$,
RASTERSIZE,
mapboxgl,
rgb$,
alpha$,
tileTB,
'dem');
const gozlemciListesi = [mouseGozlemci];
viewShedCustomLayer
Constructor
- constantObserverList,
- mapboxgl,
- id='highlight'
Usage
map.on('load', () => {
console.log('index on load viewShedOfObservers is loading...');
map.addLayer(new viewShedOfObservers( gozlemciListesi, mapboxgl), 'building');
});
TileManager
Constructor
- urlCreater
type TileServiceUrlCreaterFactory
Two methods are used by client
deleteIndexedDBAllTiles(){
textureDBManager.clear()
}
deleteRamDBAllTiles(){
this.requestedTileKeySet = new Set();
tilesOnRam.clear();
}
TileServiceUrlCreaterFactory
TileServiceUrlCreaterFactory returns url creater function for texture services.
TileManager class is dependent to TileServiceUrlCreaterFactory:new = TileManager(TileServiceUrlCreaterFactory)
.
function demTileService(x,y,z,resolution){
return `https://servis.pirireis.com.tr/mesh_service/elevation_xyz?FLOAT=1&MESHN=${resolution}&CN=1&C1z=${z}&C1x=${x}&C1y=${y}`;
}
function demTilesServiceNew(x,y,z,resolution){
return `http://192.168.1.64:5602/elevation_xyz_new?FLOAT=1&MESHN=${resolution}&CN=1&C1z=${z}&C1x=${x}&C1y=${y}`;
}
export default function TileServiceUrlCreaterFactory(textureType){
switch ( textureType ){
case "dem":
return demTileService;
case "newDem":
return demTilesServiceNew;
default:
throw new Error(`texture type ${textureType} is not in the menu`);
}
}
Developer of this project
Folders and Submodules
CustomLayers
This module is a connection to mapbox customlayer
DataManagement
Data needs to be fetched, cached in ram and indexedDB.
Data format is designed to be used by gpujs, webgl programs.
Geometry
Coords, indexes to pixel index, lat long, all geometrical conversation takes place here.
Clipping and merging Tiles also takes place here.
GPU
GPU js programs and kernels are here. There is factory pattern file for creating and caching appropriate sized kernels.
Produceses image output in Logic.
Logic
Work flow is here. It is reactive pattern with rxjs.
WebGlMapboxRenderer
WebGl for rendering image. Shape of the image and alpha(opacity) is here.
workers
This project might use webworkers in the future