finish profile->csv exporter
This commit is contained in:
parent
b07e7ae197
commit
509503d41d
@ -594,15 +594,74 @@ Potree.Viewer.Profile = class ProfileWindow{
|
||||
}
|
||||
|
||||
getPointsInProfileAsCSV(){
|
||||
if(this.points.length === 0){
|
||||
return "no points in profile";
|
||||
}
|
||||
|
||||
let file = "";
|
||||
let points = this.points.slice();
|
||||
|
||||
points.sort((a, b) => (a.distance - b.distance));
|
||||
|
||||
{ // header-line
|
||||
let header = "x, y";
|
||||
|
||||
if(points[0].hasOwnProperty("color")){
|
||||
header += ", r, g, b";
|
||||
}
|
||||
|
||||
if(points[0].hasOwnProperty("intensity")){
|
||||
header += ", intensity";
|
||||
}
|
||||
|
||||
if(points[0].hasOwnProperty("classification")){
|
||||
header += ", classification";
|
||||
}
|
||||
|
||||
if(points[0].hasOwnProperty("numberOfReturns")){
|
||||
header += ", numberOfReturns";
|
||||
}
|
||||
|
||||
if(points[0].hasOwnProperty("pointSourceID")){
|
||||
header += ", pointSourceID";
|
||||
}
|
||||
|
||||
if(points[0].hasOwnProperty("returnNumber")){
|
||||
header += ", returnNumber";
|
||||
}
|
||||
|
||||
file += header + "\n";
|
||||
}
|
||||
|
||||
// actual data
|
||||
for(let point of points){
|
||||
let line = point.distance.toFixed(4) + ", ";
|
||||
line += point.altitude.toFixed(4) + ", ";
|
||||
line += point.color.join(", ");
|
||||
|
||||
if(point.hasOwnProperty("color")){
|
||||
line += point.color.join(", ");
|
||||
}
|
||||
|
||||
if(point.hasOwnProperty("intensity")){
|
||||
line += ", " + point.intensity;
|
||||
}
|
||||
|
||||
if(point.hasOwnProperty("classification")){
|
||||
line += ", " + point.classification;
|
||||
}
|
||||
|
||||
if(point.hasOwnProperty("numberOfReturns")){
|
||||
line += ", " + point.numberOfReturns;
|
||||
}
|
||||
|
||||
if(point.hasOwnProperty("pointSourceID")){
|
||||
line += ", " + point.pointSourceID;
|
||||
}
|
||||
|
||||
if(point.hasOwnProperty("returnNumber")){
|
||||
line += ", " + point.returnNumber;
|
||||
}
|
||||
|
||||
line += "\n";
|
||||
|
||||
file = file + line;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user