Merge pull request #1178 from roy-mdr/profile-dxf

Profile DXF download
This commit is contained in:
Markus Schütz 2022-11-29 12:34:39 +01:00 committed by GitHub
commit fbedbbe1a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 345 additions and 6 deletions

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.0"
id="svg3797"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
width="42"
height="16"
viewBox="0 0 42 16"
style="enable-background:new 0 0 42 16;"
xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="37.553698" inkscape:cy="-22.077233" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1137" inkscape:window-maximized="1" inkscape:window-width="1600" inkscape:window-x="2552" inkscape:window-y="-8" inkscape:zoom="5.5989008" pagecolor="#ffffff" showgrid="true">
<inkscape:grid empspacing="5" enabled="true" id="grid3805" snapvisiblegridlinesonly="true" type="xygrid" visible="true">
</inkscape:grid>
</sodipodi:namedview>
<g>
<path d="M39.1,5.8c-0.3-0.8-0.7-1.6-1.2-2.3c-0.2-0.3-0.6-0.6-1.1-0.6H36c-0.4,0-0.9,0.2-1.1,0.6c0,0.1-0.1,0.1-0.1,0.2
c-0.3-0.2-0.6-0.4-1-0.5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.5,0.4-0.9,0.5-1.2s0.2-0.6,0.3-1s0.1-0.7,0.2-1s0.1-0.7,0.1-1c0-0.7-0.1-1.4-0.2-2
c-0.2-0.6-0.4-1.4-0.8-2.3h0.8c0.4,0.6,0.8,1.3,1,2c0.2,0.7,0.4,1.4,0.4,2.1c0,0.6-0.1,1.3-0.3,2c-0.2,0.8-0.6,1.6-1.1,2.3H36z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg3797" inkscape:export-filename="D:\dev\workspaces\potree\develop\resources\icons\point.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" sodipodi:docname="file_csv_2d.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 42 16"
style="enable-background:new 0 0 42 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="37.553698" inkscape:cy="-22.077233" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1137" inkscape:window-maximized="1" inkscape:window-width="1600" inkscape:window-x="2552" inkscape:window-y="-8" inkscape:zoom="5.5989008" pagecolor="#ffffff" showgrid="true">
<inkscape:grid empspacing="5" enabled="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6,1.4c-0.4,0.4-0.9,0.6-1.5,0.6c-0.6,0-1.1-0.2-1.5-0.5
S24.6,9.6,24.5,9z"/>
<path class="st0" d="M29.8,4.3h2.4c0.5,0,0.9,0,1.2,0.1c0.4,0.1,0.7,0.3,1,0.6c0.3,0.3,0.5,0.6,0.6,1s0.2,0.9,0.2,1.5
c0,0.5-0.1,1-0.2,1.4c-0.2,0.5-0.4,0.8-0.7,1.1c-0.2,0.2-0.5,0.4-0.9,0.5c-0.3,0.1-0.7,0.1-1.2,0.1h-2.5V4.3z M31.1,5.4v4.3h1
c0.4,0,0.6,0,0.8-0.1c0.2-0.1,0.4-0.1,0.5-0.3c0.1-0.1,0.3-0.3,0.3-0.6s0.1-0.7,0.1-1.2s0-0.9-0.1-1.1c-0.1-0.3-0.2-0.5-0.4-0.6
c-0.2-0.2-0.4-0.3-0.6-0.3c-0.2,0-0.5-0.1-1.1-0.1H31.1z"/>
<path class="st0" d="M36,12.6c0.2-0.5,0.4-0.9,0.5-1.2c0.1-0.3,0.2-0.6,0.3-1c0.1-0.4,0.1-0.7,0.2-1c0-0.3,0.1-0.7,0.1-1
c0-0.7-0.1-1.4-0.2-2c-0.1-0.6-0.4-1.4-0.8-2.3h0.8c0.4,0.6,0.8,1.3,1,2c0.2,0.7,0.4,1.4,0.4,2.2c0,0.6-0.1,1.3-0.3,2
c-0.2,0.8-0.6,1.6-1.1,2.3H36z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,177 @@
/**
*
* @author roy.mdr / http://...
*
*/
export class DXFProfileExporter {
static toXYZ(points, flatten = false) {
/*
points: {
...
data: {
mileage: [0, 1, 2...], -> one per point
position: [0, 0, 0, 1, 1, 1, 2, 2, 2...], -> X, Y, Z
rgba: [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2...] -> R, G, B, A
},
numPoints: Int
}
*/
const pointsXYZ = {
x: [],
y: [],
z: [],
minX: Number.MAX_VALUE,
minY: Number.MAX_VALUE,
minZ: Number.MAX_VALUE,
maxX: -Number.MAX_VALUE,
maxY: -Number.MAX_VALUE,
maxZ: -Number.MAX_VALUE,
numPoints: 0
};
const pData = points.data;
const pMileage = pData.mileage;
const pCoords = pData.position;
const pColor = pData.rgba;
for (let pIx = 0; pIx < points.numPoints; pIx++) {
const poMileage = pMileage[pIx];
const poCoordX = pCoords[ ((pIx * 3) + 0) ];
const poCoordY = pCoords[ ((pIx * 3) + 1) ];
const poCoordZ = pCoords[ ((pIx * 3) + 2) ];
// const poColorR = pColor[ ((pIx * 4) + 0) ];
// const poColorG = pColor[ ((pIx * 4) + 1) ];
// const poColorB = pColor[ ((pIx * 4) + 2) ];
// const poColorA = pColor[ ((pIx * 4) + 3) ];
if (flatten === true) {
pointsXYZ.x.push(poMileage);
pointsXYZ.y.push(0);
pointsXYZ.z.push(poCoordZ);
// Get boundaries X
if (pointsXYZ.maxX < poMileage) pointsXYZ.maxX = poMileage;
if (pointsXYZ.minX > poMileage) pointsXYZ.minX = poMileage;
// Get boundaries Z
if (pointsXYZ.maxZ < poCoordZ) pointsXYZ.maxZ = poCoordZ;
if (pointsXYZ.minZ > poCoordZ) pointsXYZ.minZ = poCoordZ;
} else {
pointsXYZ.x.push(poCoordX);
pointsXYZ.y.push(poCoordY);
pointsXYZ.z.push(poCoordZ);
// Get boundaries X
if (pointsXYZ.maxX < poCoordX) pointsXYZ.maxX = poCoordX;
if (pointsXYZ.minX > poCoordX) pointsXYZ.minX = poCoordX;
// Get boundaries Y
if (pointsXYZ.maxY < poCoordY) pointsXYZ.maxY = poCoordY;
if (pointsXYZ.minY > poCoordY) pointsXYZ.minY = poCoordY;
// Get boundaries Z
if (pointsXYZ.maxZ < poCoordZ) pointsXYZ.maxZ = poCoordZ;
if (pointsXYZ.minZ > poCoordZ) pointsXYZ.minZ = poCoordZ;
}
}
if (flatten === true) {
// Set boundaries Y
pointsXYZ.maxY = 0;
pointsXYZ.minY = 0;
}
pointsXYZ.numPoints = points.numPoints;
return pointsXYZ;
}
static plotPCloudPoint(x, y, z) {
const dxfSection = `0
POINT
8
layer_pointCloud
10
${x}
20
${y}
30
${z}
`;
return dxfSection;
}
static toString(points, flatten = false) {
const pCloud = DXFProfileExporter.toXYZ(points, flatten);
const dxfHeader = `999
DXF created from potree
0
SECTION
2
HEADER
9
$ACADVER
1
AC1006
9
$INSBASE
10
0.0
20
0.0
30
0.0
9
$EXTMIN
10
${pCloud.minX}
20
${pCloud.minY}
30
${pCloud.minZ}
9
$EXTMAX
10
${pCloud.maxX}
20
${pCloud.maxY}
30
${pCloud.maxZ}
0
ENDSEC
`;
let dxfBody = `0
SECTION
2
ENTITIES
`;
for (let i = 0; i < pCloud.numPoints; i++) {
dxfBody += DXFProfileExporter.plotPCloudPoint(pCloud.x[i], pCloud.y[i], pCloud.z[i]);
}
dxfBody += `0
ENDSEC
`;
const dxf = dxfHeader + dxfBody + '0\nEOF';
return dxf;
}
}

View File

@ -48,6 +48,14 @@
<img id="potree_profile_move_forward" class="text-icon"/>
<img id="potree_profile_move_backward" class="text-icon"/>
<a id="potree_download_profile_dxf2D_link" href="#" download="profile_2D.dxf">
<img id="potree_download_dxf2D_icon" class="text-icon"/>
</a>
<a id="potree_download_profile_dxf3D_link" href="#" download="profile_3D.dxf">
<img id="potree_download_dxf3D_icon" class="text-icon"/>
</a>
<a id="potree_download_profile_ortho_link" href="#" download="profile.csv">
<img id="potree_download_csv_icon" class="text-icon"/>
</a>

View File

@ -2,6 +2,7 @@
import * as THREE from "../../libs/three.js/build/three.module.js";
import {Utils} from "../utils.js";
import {Points} from "../Points.js";
import {DXFProfileExporter} from "../exporter/DXFProfileExporter.js";
import {CSVExporter} from "../exporter/CSVExporter.js";
import {LASExporter} from "../exporter/LASExporter.js";
import { EventDispatcher } from "../EventDispatcher.js";
@ -262,6 +263,12 @@ export class ProfileWindow extends EventDispatcher {
let backwardIcon = `${exports.resourcePath}/icons/arrow_down.svg`;
$('#potree_profile_move_backward').attr('src', backwardIcon);
let dxf2DIcon = `${exports.resourcePath}/icons/file_dxf_2d.svg`;
$('#potree_download_dxf2D_icon').attr('src', dxf2DIcon);
let dxf3DIcon = `${exports.resourcePath}/icons/file_dxf_3d.svg`;
$('#potree_download_dxf3D_icon').attr('src', dxf3DIcon);
let csvIcon = `${exports.resourcePath}/icons/file_csv_2d.svg`;
$('#potree_download_csv_icon').attr('src', csvIcon);
@ -478,19 +485,25 @@ export class ProfileWindow extends EventDispatcher {
this.hide();
});
let getProfilePoints = () => {
let getProfilePoints = (truePosition) => {
let points = new Points();
for(let [pointcloud, entry] of this.pointclouds){
for(let pointSet of entry.points){
let originPos = pointSet.data.position;
let trueElevationPosition = new Float32Array(originPos);
let truePointPosition = new Float64Array(originPos);
for(let i = 0; i < pointSet.numPoints; i++){
trueElevationPosition[3 * i + 2] += pointcloud.position.z;
if (truePosition === true) {
truePointPosition[3 * i + 0] += pointcloud.position.x;
truePointPosition[3 * i + 1] += pointcloud.position.y;
}
truePointPosition[3 * i + 2] += pointcloud.position.z;
}
pointSet.data.position = trueElevationPosition;
pointSet.data.position = truePointPosition;
points.add(pointSet);
pointSet.data.position = originPos;
}
@ -499,9 +512,29 @@ export class ProfileWindow extends EventDispatcher {
return points;
};
$('#potree_download_dxf2D_icon').click(() => {
const points = getProfilePoints();
const string = DXFProfileExporter.toString(points, true);
const blob = new Blob([string], {type: "text/string"});
$('#potree_download_profile_dxf2D_link').attr('href', URL.createObjectURL(blob));
});
$('#potree_download_dxf3D_icon').click(() => {
const points = getProfilePoints(true);
const string = DXFProfileExporter.toString(points);
const blob = new Blob([string], {type: "text/string"});
$('#potree_download_profile_dxf3D_link').attr('href', URL.createObjectURL(blob));
});
$('#potree_download_csv_icon').click(() => {
let points = getProfilePoints();
let points = getProfilePoints(true);
let string = CSVExporter.toString(points);
@ -511,7 +544,7 @@ export class ProfileWindow extends EventDispatcher {
$('#potree_download_las_icon').click(() => {
let points = getProfilePoints();
let points = getProfilePoints(true);
let buffer = LASExporter.toLAS(points);