Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@pirireis/gpu-analysis
Advanced tools
Analysis with gpu processing and webworkers and indexeddb. viewShed with r3 for now
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.
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.
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.
export class GeographicalShapeShifterObserver{
/**
*
* @param {string} name name of the object
* @param {rxjs.Observable<number> int preferably} height$ Unit of observer height. Same unit as texture data(dem).
* @param {rxjs.Observable<Dictionary{lng:number,lat:number}>} lngLat$
* @param {rxjs.Observable<number> int preferably} range$ Unit of range. Default unite type is "meter". Can be changed via turfOptions
* @param {rxjs.Observable<number>} zoomLevel$ Floor zoom level.
* @param {int} rasterTileResolution int value for MxM tile resolution. DEM texture resolution
* @param {mapboxgl} map_toCalculateMercatorCoordinate Dependent to mapboxgl for coordinate calculations
* @param {rxjs.Observable<[(0 - 1),(0 - 1),(0 - 1)]>} rgb$ red green blue values to adjust color
* @param {rxjs.Observable<(0 - 1)>} alpha$ visiblity of color aka opacity.
* @param {TileManager} tileDB Manages texture data. Fetches it, caches it, memories it, clears it.
* @param {boolean} antiAliasing Choice process program
* @param {int} samplingMilliseconds To adjust workload. Can be assigned only on construction.
* There should be a scheduler that manages resourches instead of this parameter
* @param {String} textureType 'dem' Digital Elevation model is the only type for now. It should be enum instead of string
* @param {Dictionary} turfOptions for detial https://www.npmjs.com/package/@turf/destination
*/
constructor(
name,
height$,
lngLat$,
range$, // range observable
zoomLevel$, // zoomLevel observable // probably created from event with rxjs.fromEvent('', object)
rasterTileResolution,
map_toCalculateMercatorCoordinate,
rgb$, // combinedLatest of {r:r, g:g, b:b} // make it a funciton
alpha$,
tileDB,
antiAliasing = true,
samplingMilliseconds = 50,
textureType = 'dem',
turfOptions = {"units":"meters"},
)
const mouseGozlemci = new GeographicalShapeShifterObserver(
'mouseGozlemcisi',
mouseHeight$,
mouselngLat$,
mouseRange$,
zoomFloorLevel$,
RASTERSIZE,
mapboxgl,
rgb$,
alpha$,
tileTB,
'dem');
const gozlemciListesi = [mouseGozlemci];
Usage
map.on('load', () => {
console.log('index on load viewShedOfObservers is loading...');
map.addLayer(new viewShedOfObservers( gozlemciListesi, mapboxgl), 'building');
});
Two methods are used by client
deleteIndexedDBAllTiles(){// use for cache invalidation.
textureDBManager.clear() // clear indexeddb
}
deleteRamDBAllTiles(){ // use when textures getting too much space on ram.
// manage some things
this.requestedTileKeySet = new Set(); // Clear x,y,z,textureType cache
tilesOnRam.clear(); // clears textures On ram
}
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`);
}
}
This module is a connection to mapbox customlayer
Data needs to be fetched, cached in ram and indexedDB. Data format is designed to be used by gpujs, webgl programs.
Coords, indexes to pixel index, lat long, all geometrical conversation takes place here. Clipping and merging Tiles also takes place here.
GPU js programs and kernels are here. There is factory pattern file for creating and caching appropriate sized kernels.
Produceses image output in Logic.
Work flow is here. It is reactive pattern with rxjs.
WebGl for rendering image. Shape of the image and alpha(opacity) is here.
This project might use webworkers in the future
FAQs
Analysis with gpu processing and webworkers and indexeddb. viewShed with r3 for now
We found that @pirireis/gpu-analysis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.