-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introducing workers for LAS parser
- Loading branch information
1 parent
9abdeed
commit 0505297
Showing
5 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { expose, Transfer } from 'threads/worker'; | ||
import LASLoader from 'Loader/LASLoader'; | ||
|
||
const loader = new LASLoader(); | ||
|
||
function transferable(attributes) { | ||
return Object.values(attributes) | ||
.filter(ArrayBuffer.isView) | ||
.map(a => a.buffer); | ||
} | ||
|
||
expose({ | ||
lazPerf(path) { | ||
loader.lazPerf = path; | ||
}, | ||
|
||
async parseChunk(data, options) { | ||
const result = await loader.parseChunk(data, options); | ||
return Transfer(result, transferable(result.attributes)); | ||
}, | ||
|
||
async parseFile(data, options) { | ||
const result = await loader.parseFile(data, options); | ||
return Transfer(result, transferable(result.attributes)); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters