Skip to content

Commit

Permalink
basic ready version
Browse files Browse the repository at this point in the history
  • Loading branch information
m-schuetz committed Jun 20, 2018
1 parent f139dc5 commit e52b4bf
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 33 deletions.
36 changes: 10 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@

# Development
Status: experimental / crashy

install dependencies from package.json

npm install
# Installation / Build

start server

cd build/potree_server
node potree_server.js
1.) Install dependencies as specified package.json

watch and rebuild/restart on changes in source
npm install --save

gulp watch
2.) Open settings.json and adjust values for path and outputDirectory.

Path points to the root folder of your main/file server. Potree server will attempt to look for point clouds relative to this location.

# Installation
OutputDirectory is where the filter results will be stored. At this time, this folder won't automatically be cleared of past results so you have to make sure to clean it up manually.

Copy build/potree_server to any location

Install dependencies form package.json and run server

npm install
node potree_server.js

Alternatively, you can use pm2 to manage the server process

npm install
npm install pm2 -g
pm2 start potree_server.js

# list running processes
pm2 list

# stop process by name
pm2 stop potree_server
3.) Run the server:



node ./src/potree_server.js


13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.1",
"description": "Server Backend for Potree",
"dependencies": {
"async": "^2.6.1",
"cors": "^2.8.4",
"express": "^4.16.3",
"uuid": "^3.2.1"
Expand Down
4 changes: 2 additions & 2 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"authenticate": false,

"#":"Only requests with an estimate below this threshold will be processed",
"maxPointsPerRequest": 20000000,
"maxPointsPerRequest": 100000000,

"#":"Only requests with an estimate below this threshold will be processed",
"maxNodesPerRequest": 20000
"maxNodesPerRequest": 40000

}
27 changes: 22 additions & 5 deletions src/RegionsFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
//const os = require("os");
const fs = require('fs');
const path = require('path');

const async = require("async");

const Vector3 = require("./Vector3.js").Vector3;
const Box3 = require("./Box3.js").Box3;
const Plane = require("./Plane.js").Plane;
Expand All @@ -13,6 +16,7 @@ const PointAttributes = require("./PointAttributes.js").PointAttributes;
const Matrix4 = require("./Matrix4.js").Matrix4;



let readFile = function(file){
return new Promise( (resolve, reject) => {
fs.readFile(file, function (err, data) {
Expand All @@ -35,6 +39,14 @@ let endStream = function(stream){
});
};

let asyncParallelLoad = function(tasks, limit){
return new Promise( (resolve, reject) => {
async.parallelLimit(tasks, limit, () => {
resolve();
});
});
};


// time in seconds
function now(){
Expand Down Expand Up @@ -449,14 +461,16 @@ class RegionsFilter{
localClipRegions.push(localRegion);
}

let tasks = [];

for(let node of visibleNodes){

let hierarchyPath = getHierarchyPath(node.name, metadata.hierarchyStepSize);
let nodePath = `${pointcloud.path}/../data/${hierarchyPath}/${node.name}.bin`;
let promise = readFile(nodePath);
promises.push(promise);


promise.then( (result) => {
let task = async () => {
let result = await readFile(nodePath);

let buffer = result;

Expand Down Expand Up @@ -621,10 +635,13 @@ class RegionsFilter{
this.progress.timestamps["filter-end"] = now();

this.updateReport();
});
};

tasks.push(task);

}

await Promise.all(promises);
await asyncParallelLoad(tasks, 10);

await endStream(wstream);

Expand Down

0 comments on commit e52b4bf

Please sign in to comment.