update sdk and demo
This commit is contained in:
@ -26,7 +26,7 @@
|
|||||||
<div id="myCanvas" class="container"></div>
|
<div id="myCanvas" class="container"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer, ViewerEvent } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer, ViewerEvent,ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
||||||
import LayerManager from './demo/layerManager/LayerManager.js';
|
import LayerManager from './demo/layerManager/LayerManager.js';
|
||||||
|
|
||||||
@ -44,10 +44,45 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(viewerCfg);
|
const viewer = new DxfViewer(viewerCfg);
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
@ -55,13 +90,7 @@
|
|||||||
};
|
};
|
||||||
await viewer.loadModelAsync(modelCfg, onProgress);
|
await viewer.loadModelAsync(modelCfg, onProgress);
|
||||||
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
||||||
if (!viewer.layerManager) {
|
|
||||||
viewer.layerManager = new LayerManager(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer);
|
|
||||||
|
|
||||||
const measurementData = [{
|
const measurementData = [{
|
||||||
type: "Distance",
|
type: "Distance",
|
||||||
id: "measure_data_id_1",
|
id: "measure_data_id_1",
|
||||||
@ -112,12 +141,6 @@
|
|||||||
|
|
||||||
viewer.setMeasurements(measurementData);
|
viewer.setMeasurements(measurementData);
|
||||||
viewer.setMarkups(markupData);
|
viewer.setMarkups(markupData);
|
||||||
|
|
||||||
viewer.addEventListener(ViewerEvent.MarkupClicked, (data) => {
|
|
||||||
if (data.markup) {
|
|
||||||
console.log("[Demo] Clicked on markup:", data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<div id="myCanvas" class="container"></div>
|
<div id="myCanvas" class="container"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer,ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
||||||
import LayerManager from "./demo/layerManager/LayerManager.js";
|
import LayerManager from "./demo/layerManager/LayerManager.js";
|
||||||
|
|
||||||
@ -31,10 +31,45 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(viewerCfg);
|
const viewer = new DxfViewer(viewerCfg);
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
@ -42,12 +77,6 @@
|
|||||||
};
|
};
|
||||||
await viewer.loadModelAsync(modelCfg, onProgress);
|
await viewer.loadModelAsync(modelCfg, onProgress);
|
||||||
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
||||||
if (!viewer.layerManager) {
|
|
||||||
viewer.layerManager = new LayerManager(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer);
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<div id="myCanvas" class="container"></div>
|
<div id="myCanvas" class="container"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer, ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
||||||
import LayerManager from "./demo/layerManager/LayerManager.js";
|
import LayerManager from "./demo/layerManager/LayerManager.js";
|
||||||
|
|
||||||
@ -31,10 +31,45 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(viewerCfg);
|
const viewer = new DxfViewer(viewerCfg);
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
@ -42,12 +77,6 @@
|
|||||||
};
|
};
|
||||||
await viewer.loadModelAsync(modelCfg, onProgress);
|
await viewer.loadModelAsync(modelCfg, onProgress);
|
||||||
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
||||||
if (!viewer.layerManager) {
|
|
||||||
viewer.layerManager = new LayerManager(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer);
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div id="myCanvas" class="container"></div>
|
<div id="myCanvas" class="container"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer, ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfComparePanel from "./demo/compare/dxfComparePanel.js"
|
import DxfComparePanel from "./demo/compare/dxfComparePanel.js"
|
||||||
import DxfSettingsPanel from "./demo/settings/DxfSettingsPanel.js";
|
import DxfSettingsPanel from "./demo/settings/DxfSettingsPanel.js";
|
||||||
import LayerManager from "./demo/layerManager/LayerManager.js";
|
import LayerManager from "./demo/layerManager/LayerManager.js";
|
||||||
@ -28,11 +28,46 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(config);
|
const viewer = new DxfViewer(config);
|
||||||
// const fontFiles = ["three/fonts/Microsoft_YaHei_Regular.typeface.json"];
|
// const fontFiles = ["three/fonts/Microsoft_YaHei_Regular.typeface.json"];
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
@ -40,16 +75,8 @@
|
|||||||
};
|
};
|
||||||
await viewer.compare({src: url1, modelId: "doors_and_windows.dxf"}, {src: url2, modelId: "doors_and_windows_mopdified.dxf"}, onProgress).then(() => {
|
await viewer.compare({src: url1, modelId: "doors_and_windows.dxf"}, {src: url2, modelId: "doors_and_windows_mopdified.dxf"}, onProgress).then(() => {
|
||||||
console.log(`[Demo] Compared models: ${url1}, ${url2}`);
|
console.log(`[Demo] Compared models: ${url1}, ${url2}`);
|
||||||
if (!viewer.layerManager) {
|
|
||||||
viewer.layerManager = new LayerManager(viewer);
|
|
||||||
}
|
|
||||||
if (!viewer.dxfComparePanel) {
|
|
||||||
viewer.dxfComparePanel = new DxfComparePanel(viewer);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer);
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<div id="myCanvas3" class="container"></div>
|
<div id="myCanvas3" class="container"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer, ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfComparePanel from "./demo/compare/dxfComparePanel.js"
|
import DxfComparePanel from "./demo/compare/dxfComparePanel.js"
|
||||||
import DxfSettingsPanel from "./demo/settings/DxfSettingsPanel.js";
|
import DxfSettingsPanel from "./demo/settings/DxfSettingsPanel.js";
|
||||||
import LayerManager from "./demo/layerManager/LayerManager.js";
|
import LayerManager from "./demo/layerManager/LayerManager.js";
|
||||||
@ -78,6 +78,40 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer1 = new DxfViewer({ containerId: "myCanvas1"});
|
const viewer1 = new DxfViewer({ containerId: "myCanvas1"});
|
||||||
const viewer2 = new DxfViewer({ containerId: "myCanvas2"});
|
const viewer2 = new DxfViewer({ containerId: "myCanvas2"});
|
||||||
@ -87,6 +121,8 @@
|
|||||||
await viewer2.setFont(fontFiles);
|
await viewer2.setFont(fontFiles);
|
||||||
await viewer3.setFont(fontFiles);
|
await viewer3.setFont(fontFiles);
|
||||||
|
|
||||||
|
window.viewer = viewer3;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
console.log(`[Demo] Loading progress: ${progress}%`);
|
console.log(`[Demo] Loading progress: ${progress}%`);
|
||||||
@ -95,16 +131,11 @@
|
|||||||
await viewer2.loadModelAsync(modelConfig2, onProgress);
|
await viewer2.loadModelAsync(modelConfig2, onProgress);
|
||||||
await viewer3.compare(modelConfig1, modelConfig2, onProgress).then(() => {
|
await viewer3.compare(modelConfig1, modelConfig2, onProgress).then(() => {
|
||||||
console.log(`[Demo] Compared models: ${url1}, ${url2}`);
|
console.log(`[Demo] Compared models: ${url1}, ${url2}`);
|
||||||
if (!viewer3.layerManager) {
|
if (!viewer.dxfComparePanel) {
|
||||||
viewer3.layerManager = new LayerManager(viewer3);
|
viewer.dxfComparePanel = new DxfComparePanel(viewer);
|
||||||
}
|
|
||||||
if (!viewer3.dxfComparePanel) {
|
|
||||||
viewer3.dxfComparePanel = new DxfComparePanel(viewer3);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer3);
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer, ViewerEvent } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer, ViewerEvent, ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
||||||
import LayerManager from './demo/layerManager/LayerManager.js';
|
import LayerManager from './demo/layerManager/LayerManager.js';
|
||||||
|
|
||||||
@ -64,10 +64,45 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(viewerCfg);
|
const viewer = new DxfViewer(viewerCfg);
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
@ -75,12 +110,6 @@
|
|||||||
};
|
};
|
||||||
await viewer.loadModelAsync(modelCfg, onProgress);
|
await viewer.loadModelAsync(modelCfg, onProgress);
|
||||||
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
||||||
if (!viewer.layerManager) {
|
|
||||||
viewer.layerManager = new LayerManager(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer);
|
|
||||||
|
|
||||||
const markupButtonClicked = (markupType, btn) => {
|
const markupButtonClicked = (markupType, btn) => {
|
||||||
// deactive current markup
|
// deactive current markup
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { DxfViewer, ViewerEvent } from "./demo/libs/gemini-viewer.esm.min.js";
|
import { DxfViewer, ViewerEvent, ToolbarMenuId } from "./demo/libs/gemini-viewer.esm.min.js";
|
||||||
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
import DxfSettingsPanel from './demo/settings/DxfSettingsPanel.js';
|
||||||
import LayerManager from './demo/layerManager/LayerManager.js';
|
import LayerManager from './demo/layerManager/LayerManager.js';
|
||||||
|
|
||||||
@ -118,10 +118,45 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(viewerCfg);
|
const viewer = new DxfViewer(viewerCfg);
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const onProgress = (event) => {
|
const onProgress = (event) => {
|
||||||
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
const progress = ((event.loaded * 100) / event.total).toFixed(1);
|
||||||
@ -129,12 +164,6 @@
|
|||||||
};
|
};
|
||||||
await viewer.loadModelAsync(modelCfg, onProgress);
|
await viewer.loadModelAsync(modelCfg, onProgress);
|
||||||
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
console.log(`[Demo] Loaded model ${modelCfg.src}`);
|
||||||
if (!viewer.layerManager) {
|
|
||||||
viewer.layerManager = new LayerManager(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// as a demo page, add dxfSettingsPanel to window!
|
|
||||||
window.dxfSettingsPanel = new DxfSettingsPanel(viewer);
|
|
||||||
|
|
||||||
let addingHotpoint = false;
|
let addingHotpoint = false;
|
||||||
let hotpointCount = 0; // used to generate unique id
|
let hotpointCount = 0; // used to generate unique id
|
||||||
|
@ -83,11 +83,46 @@
|
|||||||
enableSpinner: true,
|
enableSpinner: true,
|
||||||
enableProgressBar: true,
|
enableProgressBar: true,
|
||||||
enableLayoutBar: true,
|
enableLayoutBar: true,
|
||||||
|
toolbarMenuConfig: {
|
||||||
|
[ToolbarMenuId.Settings]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Settings");
|
||||||
|
if (!window.dxfSettingsPanel) {
|
||||||
|
window.dxfSettingsPanel = new DxfSettingsPanel(window.viewer);
|
||||||
|
}
|
||||||
|
window.dxfSettingsPanel.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[ToolbarMenuId.Layers]: {
|
||||||
|
onActive: () => {
|
||||||
|
console.log("[Toolbar]", "Activate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.show();
|
||||||
|
},
|
||||||
|
onDeactive: () => {
|
||||||
|
console.log("[Toolbar]", "Deactivate Layers");
|
||||||
|
if (!window.layerManager) {
|
||||||
|
window.layerManager = new LayerManager(window.viewer);
|
||||||
|
}
|
||||||
|
window.layerManager.hide();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const viewer = new DxfViewer(config);
|
const viewer = new DxfViewer(config);
|
||||||
// const fontFiles = ["three/fonts/Microsoft_YaHei_Regular.typeface.json"];
|
// const fontFiles = ["three/fonts/Microsoft_YaHei_Regular.typeface.json"];
|
||||||
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
const fontFiles = ["./demo/three/fonts/hztxt.shx", "./demo/three/fonts/simplex.shx"];
|
||||||
await viewer.setFont(fontFiles);
|
await viewer.setFont(fontFiles);
|
||||||
|
window.viewer = viewer;
|
||||||
|
|
||||||
const modelUploader = new LocalDxfUploader(viewer);
|
const modelUploader = new LocalDxfUploader(viewer);
|
||||||
modelUploader.onSuccess = () => {
|
modelUploader.onSuccess = () => {
|
||||||
|
@ -18,7 +18,7 @@ export default class LayerManager {
|
|||||||
|
|
||||||
init(viewer, container) {
|
init(viewer, container) {
|
||||||
this.viewer = viewer;
|
this.viewer = viewer;
|
||||||
this.container = container;
|
this.container = viewer.viewerContainer;
|
||||||
this.layers = this.viewer.getLayers();
|
this.layers = this.viewer.getLayers();
|
||||||
this.buildPage();
|
this.buildPage();
|
||||||
this.addContent();
|
this.addContent();
|
||||||
@ -47,12 +47,12 @@ export default class LayerManager {
|
|||||||
destroy() {
|
destroy() {
|
||||||
this.closeBtn?.removeEventListener("click", this.hide);
|
this.closeBtn?.removeEventListener("click", this.hide);
|
||||||
|
|
||||||
this.checkboxes?.forEach((checkbox) => {
|
this.checkboxes?.forEach((checkbox, i) => {
|
||||||
checkbox.removeEventListener("change", () => {
|
checkbox.removeEventListener("change", () => {
|
||||||
this.checkboxHandler(checkbox);
|
this.checkboxHandler(checkbox, i);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
document.body.removeChild(this.listContainer);
|
this.listContainer.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
buildPage() {
|
buildPage() {
|
||||||
@ -86,6 +86,7 @@ export default class LayerManager {
|
|||||||
<span class="popup-layer-name">图层名称</span>
|
<span class="popup-layer-name">图层名称</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const bAppendModelId = this.layers.length > 1;
|
const bAppendModelId = this.layers.length > 1;
|
||||||
for (let i = 0; i < this.layers.length; ++i) {
|
for (let i = 0; i < this.layers.length; ++i) {
|
||||||
const layers = this.layers[i].layers;
|
const layers = this.layers[i].layers;
|
||||||
@ -106,15 +107,15 @@ export default class LayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add checkboxes events
|
// add checkboxes events
|
||||||
const checkboxEles = document.querySelectorAll("input[type=checkbox]");
|
const checkboxEles = this.listContainer.querySelectorAll("input[type=checkbox]");
|
||||||
this.checkboxes = [].slice.call(checkboxEles, 0);
|
this.checkboxes = [].slice.call(checkboxEles, 0);
|
||||||
const colorInputsEles = document.querySelectorAll("input[type=color]");
|
const colorInputsEles = this.listContainer.querySelectorAll("input[type=color]");
|
||||||
this.colorInputs = [].slice.call(colorInputsEles, 0);
|
this.colorInputs = [].slice.call(colorInputsEles, 0);
|
||||||
|
|
||||||
// input[type=checkbox]
|
// input[type=checkbox]
|
||||||
this.checkboxes.forEach((checkbox) => {
|
this.checkboxes.forEach((checkbox, i) => {
|
||||||
checkbox.addEventListener("change", () => {
|
checkbox.addEventListener("change", () => {
|
||||||
this.checkboxHandler(checkbox);
|
this.checkboxHandler(checkbox, i);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -134,21 +135,22 @@ export default class LayerManager {
|
|||||||
addEventHandlers() {
|
addEventHandlers() {
|
||||||
this.closeBtn?.addEventListener("click", this.hide.bind(this));
|
this.closeBtn?.addEventListener("click", this.hide.bind(this));
|
||||||
|
|
||||||
const layersBtn = document.querySelector("#Layers");
|
// const layersBtn = document.querySelector("#Layers");
|
||||||
layersBtn && layersBtn.addEventListener("click", () => {
|
// layersBtn &&
|
||||||
if (layersBtn.classList.contains("active")) {
|
// layersBtn.addEventListener("click", () => {
|
||||||
if (!this.viewer.layerManager) {
|
// if (layersBtn.classList.contains("active")) {
|
||||||
this.viewer.layerManager = new LayerManager(this.viewer);
|
// if (!this.viewer.layerManager) {
|
||||||
} else {
|
// this.viewer.layerManager = new LayerManager(this.viewer);
|
||||||
this.viewer.layerManager.show();
|
// } else {
|
||||||
}
|
// this.viewer.layerManager.show();
|
||||||
} else {
|
// }
|
||||||
this.hide();
|
// } else {
|
||||||
}
|
// this.hide();
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
checkboxHandler(checkbox) {
|
checkboxHandler(checkbox, index) {
|
||||||
if (checkbox.id === "toggleAllLayers") {
|
if (checkbox.id === "toggleAllLayers") {
|
||||||
for (let i = 0; i < this.layers.length; ++i) {
|
for (let i = 0; i < this.layers.length; ++i) {
|
||||||
const modelId = this.layers[i].modelId;
|
const modelId = this.layers[i].modelId;
|
||||||
@ -164,6 +166,11 @@ export default class LayerManager {
|
|||||||
|
|
||||||
let modelId = "";
|
let modelId = "";
|
||||||
let layerName = checkbox.value;
|
let layerName = checkbox.value;
|
||||||
|
let layerHandle = undefined;
|
||||||
|
if (index === this.checkboxes.length - 1) {
|
||||||
|
layerHandle = Object.values(this.layers.at(-1).layers)[0].handle;
|
||||||
|
}
|
||||||
|
|
||||||
const idx = layerName.indexOf(">");
|
const idx = layerName.indexOf(">");
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
modelId = layerName.slice(1, idx);
|
modelId = layerName.slice(1, idx);
|
||||||
|
@ -23,7 +23,7 @@ input[type="color"] {
|
|||||||
.popup-container {
|
.popup-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 76px;
|
top: 76px;
|
||||||
right: 10px;
|
left: calc(5%);
|
||||||
width: 330px;
|
width: 330px;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
max-height: 90%; /* fix the issue when canvas's height is less than 600px */
|
max-height: 90%; /* fix the issue when canvas's height is less than 600px */
|
||||||
|
4959
public/demo/libs/gemini-viewer.esm.min.js
vendored
4959
public/demo/libs/gemini-viewer.esm.min.js
vendored
File diff suppressed because one or more lines are too long
42
public/demo/libs/types/src/components/bottom-bar/BottomBar.d.ts
vendored
Normal file
42
public/demo/libs/types/src/components/bottom-bar/BottomBar.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { IconClass } from "../../core/utils/CommonUtils";
|
||||||
|
import { BimViewer, DxfViewer, VRViewer } from "../../core/viewers";
|
||||||
|
import { Tooltip } from "../tool-tip/Tooltip";
|
||||||
|
declare enum BottomBarItemId {
|
||||||
|
statistics = "statistics",
|
||||||
|
cameraInfo = "cameraInfo",
|
||||||
|
stats = "stats",
|
||||||
|
tips = "tips"
|
||||||
|
}
|
||||||
|
interface BottomBarItemConfig {
|
||||||
|
icon: IconClass;
|
||||||
|
mutexIds?: BottomBarItemId[];
|
||||||
|
onActive?: (item: BottomBarItem) => void;
|
||||||
|
onDeactive?: (item: BottomBarItem) => void;
|
||||||
|
onClick?: (item: BottomBarItem) => void;
|
||||||
|
onUpdate?: (item: BottomBarItem) => void;
|
||||||
|
}
|
||||||
|
export declare class BottomBar {
|
||||||
|
protected readonly viewer: BimViewer | DxfViewer | VRViewer;
|
||||||
|
private element;
|
||||||
|
itemList: Map<string, BottomBarItem>;
|
||||||
|
constructor(viewer: BimViewer | DxfViewer | VRViewer);
|
||||||
|
update(): void;
|
||||||
|
private init;
|
||||||
|
private createItem;
|
||||||
|
}
|
||||||
|
declare class BottomBarItem {
|
||||||
|
readonly viewer: BimViewer | DxfViewer | VRViewer;
|
||||||
|
private readonly bottomBar;
|
||||||
|
protected readonly menuId: string;
|
||||||
|
protected cfg: BottomBarItemConfig;
|
||||||
|
private eventBus;
|
||||||
|
private itemconfig;
|
||||||
|
tooltip: Tooltip;
|
||||||
|
element: HTMLElement;
|
||||||
|
active: boolean;
|
||||||
|
constructor(viewer: BimViewer | DxfViewer | VRViewer, bottomBar: BottomBar, menuId: string, cfg: BottomBarItemConfig);
|
||||||
|
private createButton;
|
||||||
|
setActive(active: boolean): void;
|
||||||
|
update(): void;
|
||||||
|
}
|
||||||
|
export {};
|
1
public/demo/libs/types/src/components/bottom-bar/index.d.ts
vendored
Normal file
1
public/demo/libs/types/src/components/bottom-bar/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./BottomBar";
|
2
public/demo/libs/types/src/components/context-menu/ContextMenu.config.d.ts
vendored
Normal file
2
public/demo/libs/types/src/components/context-menu/ContextMenu.config.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import { ContextMenuItem } from "../../core/Configs";
|
||||||
|
export declare const contextMenuItems: ContextMenuItem[][];
|
31
public/demo/libs/types/src/components/context-menu/ContextMenu.d.ts
vendored
Normal file
31
public/demo/libs/types/src/components/context-menu/ContextMenu.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { Context as ContextFromConfigs, ContextMenuConfig as ContextMenuConfigFromConfigs, ContextMenuItem } from "../../core/Configs";
|
||||||
|
import { AxisPlaneSection, ObjectsBoxSection, ObjectsPlaneSection, PickPlaneSection } from "../../core/section";
|
||||||
|
import { BimViewer } from "../../core/viewers";
|
||||||
|
import { Toolbar } from "../toolbar";
|
||||||
|
export interface Context extends ContextFromConfigs {
|
||||||
|
section?: ObjectsBoxSection | ObjectsPlaneSection | PickPlaneSection | AxisPlaneSection;
|
||||||
|
toolbar?: Toolbar<BimViewer>;
|
||||||
|
}
|
||||||
|
export interface ContextMenuConfig extends ContextMenuConfigFromConfigs {
|
||||||
|
context: Context;
|
||||||
|
}
|
||||||
|
export declare class ContextMenu {
|
||||||
|
private id;
|
||||||
|
private container;
|
||||||
|
private element;
|
||||||
|
private handleClick;
|
||||||
|
context: Context;
|
||||||
|
itemList: [ContextMenuItem, HTMLElement][];
|
||||||
|
constructor(cfg: ContextMenuConfig);
|
||||||
|
private isEnable;
|
||||||
|
private isShown;
|
||||||
|
private getTitle;
|
||||||
|
private createMenuUI;
|
||||||
|
private createMenuGroup;
|
||||||
|
private createMenuItem;
|
||||||
|
private updateMenuItems;
|
||||||
|
private showMenuElement;
|
||||||
|
show(pageX: number, pageY: number): void;
|
||||||
|
hide(): void;
|
||||||
|
destroy(): void;
|
||||||
|
}
|
2
public/demo/libs/types/src/components/context-menu/index.d.ts
vendored
Normal file
2
public/demo/libs/types/src/components/context-menu/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from "./ContextMenu";
|
||||||
|
export * from "./ContextMenu.config";
|
73
public/demo/libs/types/src/components/dat-gui/BimViewerDatGui.d.ts
vendored
Normal file
73
public/demo/libs/types/src/components/dat-gui/BimViewerDatGui.d.ts
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import * as dat from "dat.gui";
|
||||||
|
import { Exploder } from "../../core/exploder/Exploder";
|
||||||
|
import { BimViewer } from "../../core/viewers";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class BimViewerDatGui {
|
||||||
|
viewer: BimViewer | undefined;
|
||||||
|
gui?: dat.GUI;
|
||||||
|
exploderDict?: {
|
||||||
|
[objId: number]: Exploder;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param viewer pass in the Viewer3D, so we can reference its data members
|
||||||
|
*/
|
||||||
|
constructor(viewer: BimViewer);
|
||||||
|
/**
|
||||||
|
* Defined all controls here, which will be displyed in dat.GUI
|
||||||
|
* Color should follow these formats:
|
||||||
|
* '#ffffff', [0, 0, 0], [0, 0, 0, 0.5], \{ h: 100, s: 0.9, v: 0.3 \}
|
||||||
|
*/
|
||||||
|
readonly controls: {
|
||||||
|
showGroundGrid: boolean;
|
||||||
|
showGrassGround: boolean;
|
||||||
|
skyMode: string[];
|
||||||
|
environments: string[];
|
||||||
|
homeView: () => void;
|
||||||
|
views: string[];
|
||||||
|
OrthographicCamera: boolean;
|
||||||
|
viewpoints: boolean;
|
||||||
|
annotations: boolean;
|
||||||
|
takeSnapshot: () => void;
|
||||||
|
fullScreen: () => void;
|
||||||
|
webcam: boolean;
|
||||||
|
uploadFile: () => void;
|
||||||
|
showBimTree: boolean;
|
||||||
|
showPropertyPanel: boolean;
|
||||||
|
transparentMode: boolean;
|
||||||
|
showVertexNormals: boolean;
|
||||||
|
sectionMode: string[];
|
||||||
|
alVisible: boolean;
|
||||||
|
alColor: string;
|
||||||
|
alIntensity: number;
|
||||||
|
dlColor: string;
|
||||||
|
showDlHelper: boolean;
|
||||||
|
hlVisible: boolean;
|
||||||
|
hlIntensity: number;
|
||||||
|
hlColor: number[];
|
||||||
|
hlGroundColor: number[];
|
||||||
|
fogEnabled: boolean;
|
||||||
|
fogColor: number;
|
||||||
|
fogNearDistance: number;
|
||||||
|
fogFarDistance: number;
|
||||||
|
composerEnabled: boolean;
|
||||||
|
renderPassEnabled: boolean;
|
||||||
|
fxaaEnabled: boolean;
|
||||||
|
saoEnabled: boolean;
|
||||||
|
ssaoEnabled: boolean;
|
||||||
|
outlineEnabled: boolean;
|
||||||
|
ssaaEnabled: boolean;
|
||||||
|
bloomEnabled: boolean;
|
||||||
|
unrealBloomEnabled: boolean;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Init dat.GUI
|
||||||
|
*/
|
||||||
|
init(): void;
|
||||||
|
private setExplodeMode;
|
||||||
|
open(): void;
|
||||||
|
close(): void;
|
||||||
|
beforeDestroy(): void;
|
||||||
|
}
|
26
public/demo/libs/types/src/components/dxf-layout-bar/DxfLayoutBar.d.ts
vendored
Normal file
26
public/demo/libs/types/src/components/dxf-layout-bar/DxfLayoutBar.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { DxfViewer } from "../../core/viewers";
|
||||||
|
export declare class DxfLayoutBar {
|
||||||
|
protected readonly viewer: DxfViewer;
|
||||||
|
private element?;
|
||||||
|
private content?;
|
||||||
|
private itemList;
|
||||||
|
constructor(viewer: DxfViewer);
|
||||||
|
init(): void;
|
||||||
|
private handleMouseWheel;
|
||||||
|
private createItem;
|
||||||
|
destroy(): void;
|
||||||
|
show(): void;
|
||||||
|
hide(): void;
|
||||||
|
}
|
||||||
|
export declare class ModelLayoutSwitchItem {
|
||||||
|
protected readonly viewer: DxfViewer;
|
||||||
|
private eventBus;
|
||||||
|
element: HTMLElement;
|
||||||
|
resetActivate?: () => void;
|
||||||
|
active: boolean;
|
||||||
|
constructor(viewer: DxfViewer, name: string);
|
||||||
|
private createItem;
|
||||||
|
setActive(active: boolean): void;
|
||||||
|
resetActive(): void;
|
||||||
|
destroy(): void;
|
||||||
|
}
|
1
public/demo/libs/types/src/components/dxf-layout-bar/index.d.ts
vendored
Normal file
1
public/demo/libs/types/src/components/dxf-layout-bar/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./DxfLayoutBar";
|
20
public/demo/libs/types/src/components/pop-panel/AxisSectionPopPanel.d.ts
vendored
Normal file
20
public/demo/libs/types/src/components/pop-panel/AxisSectionPopPanel.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Emitter } from "mitt";
|
||||||
|
import { PopPanel } from "./PopPanel";
|
||||||
|
import { AxisType } from "../../core/section/AxisPlaneSection";
|
||||||
|
export type Events = {
|
||||||
|
axis: AxisType;
|
||||||
|
visible: boolean;
|
||||||
|
};
|
||||||
|
export declare class AxisSectionPopPanel extends PopPanel {
|
||||||
|
protected axis: string;
|
||||||
|
protected activeItem?: string;
|
||||||
|
protected groupSelectNode?: HTMLElement;
|
||||||
|
protected activeSelectNode?: HTMLElement;
|
||||||
|
protected isVisible: boolean;
|
||||||
|
eventBus: Emitter<Events>;
|
||||||
|
constructor(container?: HTMLElement);
|
||||||
|
createGroupSelectLayout(): void;
|
||||||
|
addGroupSelectItems(): void;
|
||||||
|
createActiveSelectLayout(): void;
|
||||||
|
addActiveItems(): void;
|
||||||
|
}
|
19
public/demo/libs/types/src/components/pop-panel/PickSectionPopPanel.d.ts
vendored
Normal file
19
public/demo/libs/types/src/components/pop-panel/PickSectionPopPanel.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Emitter } from "mitt";
|
||||||
|
import { PopPanel } from "./PopPanel";
|
||||||
|
export type Events = {
|
||||||
|
visible: boolean;
|
||||||
|
reset: void;
|
||||||
|
};
|
||||||
|
export declare class PickSectionPopPanel extends PopPanel {
|
||||||
|
eventBus: Emitter<Events>;
|
||||||
|
protected activeSelectNode?: Element;
|
||||||
|
protected isVisible: boolean;
|
||||||
|
protected enabled: boolean;
|
||||||
|
protected visibleNode?: HTMLElement;
|
||||||
|
protected resetNode?: HTMLElement;
|
||||||
|
constructor(container?: HTMLElement);
|
||||||
|
createActiveSelectLayout(): void;
|
||||||
|
addActiveItems(): void;
|
||||||
|
enable(): void;
|
||||||
|
disable(): void;
|
||||||
|
}
|
14
public/demo/libs/types/src/components/pop-panel/PopPanel.d.ts
vendored
Normal file
14
public/demo/libs/types/src/components/pop-panel/PopPanel.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
export declare class PopPanel {
|
||||||
|
private readonly container;
|
||||||
|
private element;
|
||||||
|
header: HTMLElement;
|
||||||
|
body: HTMLElement;
|
||||||
|
private isFollowing;
|
||||||
|
private diffX;
|
||||||
|
private diffY;
|
||||||
|
constructor(id: string, content: string | HTMLElement, container?: HTMLElement);
|
||||||
|
start: (event: MouseEvent) => void;
|
||||||
|
stop: () => void;
|
||||||
|
follow: (event: MouseEvent) => void;
|
||||||
|
destroy(): void;
|
||||||
|
}
|
34
public/demo/libs/types/src/components/progress-bar/ProgressBar.d.ts
vendored
Normal file
34
public/demo/libs/types/src/components/progress-bar/ProgressBar.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
export interface ProgressItem {
|
||||||
|
id: string;
|
||||||
|
div: HTMLDivElement;
|
||||||
|
}
|
||||||
|
export declare class ProgressBar {
|
||||||
|
private element;
|
||||||
|
private progresseItems;
|
||||||
|
constructor(parentElement: HTMLElement);
|
||||||
|
setVisibility(visible: boolean): void;
|
||||||
|
/**
|
||||||
|
* Adds a progress item
|
||||||
|
* @param progressItemId
|
||||||
|
* @param message Initial message
|
||||||
|
* @param progress number between 0-100
|
||||||
|
*/
|
||||||
|
addProgressItem(progressItemId: string, message?: string): void;
|
||||||
|
/**
|
||||||
|
* Updates a progress item
|
||||||
|
* @param progressItemId
|
||||||
|
* @param message
|
||||||
|
* @param progress number between 0-100
|
||||||
|
*/
|
||||||
|
updateProgress(progressItemId: string, message?: string, progress?: number): void;
|
||||||
|
/**
|
||||||
|
* Removes a progress item
|
||||||
|
* @param progressItemId
|
||||||
|
*/
|
||||||
|
removeProgressItem(progressItemId: string): void;
|
||||||
|
/**
|
||||||
|
* Removes a progress item after some time
|
||||||
|
* @param progressItemId
|
||||||
|
*/
|
||||||
|
delayRemoveProgressItem(progressItemId: string, delayInMs?: number): void;
|
||||||
|
}
|
1
public/demo/libs/types/src/components/progress-bar/index.d.ts
vendored
Normal file
1
public/demo/libs/types/src/components/progress-bar/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./ProgressBar";
|
44
public/demo/libs/types/src/components/settings/ProjectSettingsDef.d.ts
vendored
Normal file
44
public/demo/libs/types/src/components/settings/ProjectSettingsDef.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Perspective and Orthographic camera share the same settings
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface CameraSettings {
|
||||||
|
near: number;
|
||||||
|
far: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface MouseSetting {
|
||||||
|
sensitivity: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface KeyboardSetting {
|
||||||
|
sensitivity: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface Settings {
|
||||||
|
unit: string;
|
||||||
|
decimalPrecision: number;
|
||||||
|
camera: CameraSettings;
|
||||||
|
mouse: MouseSetting;
|
||||||
|
keyboard: KeyboardSetting;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const defaultSettings: Settings;
|
||||||
|
export declare const cameraNearRange: number[];
|
||||||
|
export declare const cameraFarRange: number[];
|
||||||
|
export declare const unitRange: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
export declare const sensitivityRange: number[];
|
||||||
|
export declare const decimalPrecisionRange: {
|
||||||
|
[key: string]: number;
|
||||||
|
};
|
||||||
|
export declare const settingStoreKeyName = "THREE_RENDER_SETTING";
|
20
public/demo/libs/types/src/components/tool-tip/Tooltip.d.ts
vendored
Normal file
20
public/demo/libs/types/src/components/tool-tip/Tooltip.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
interface TooltipConfig {
|
||||||
|
showOnCreate?: boolean;
|
||||||
|
followPointer?: boolean;
|
||||||
|
parentNode?: HTMLElement;
|
||||||
|
target?: HTMLElement;
|
||||||
|
}
|
||||||
|
export declare class Tooltip {
|
||||||
|
private node;
|
||||||
|
private parentNode;
|
||||||
|
private target;
|
||||||
|
private childNode;
|
||||||
|
constructor(id: string, content?: string | HTMLElement | null, cfg?: TooltipConfig);
|
||||||
|
setContent(content: string | HTMLElement): void;
|
||||||
|
updateChildContent(content: string | HTMLElement): void;
|
||||||
|
follow: (event: MouseEvent) => void;
|
||||||
|
show: () => false | void;
|
||||||
|
hide: () => false | void;
|
||||||
|
destroy: () => void;
|
||||||
|
}
|
||||||
|
export {};
|
13
public/demo/libs/types/src/components/toolbar/MarkupToolbar.d.ts
vendored
Normal file
13
public/demo/libs/types/src/components/toolbar/MarkupToolbar.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Toolbar } from "./Toolbar";
|
||||||
|
import { ToolbarConfig, ToolbarMenuId } from "./Toolbar.constants";
|
||||||
|
import { BimViewer, DxfViewer, VRViewer } from "../../core/viewers";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const DEFAULT_MARKUP_TOOLBAR_CONFIG: ToolbarConfig<DxfViewer>;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class MarkupToolbar<T extends BimViewer | DxfViewer | VRViewer> extends Toolbar<T> {
|
||||||
|
constructor(bimViewer: T, menuConfig: ToolbarConfig<T>, groupConfig?: ToolbarMenuId[][] | string[][]);
|
||||||
|
}
|
21
public/demo/libs/types/src/components/toolbar/Toolbar.config.d.ts
vendored
Normal file
21
public/demo/libs/types/src/components/toolbar/Toolbar.config.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { ToolbarConfig, ToolbarMenuId } from "./Toolbar.constants";
|
||||||
|
import { BimViewer, DxfViewer, VRViewer } from "../../core/viewers";
|
||||||
|
/**
|
||||||
|
* Toolbar.config
|
||||||
|
**/
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const DEFAULT_BIMVIEWER_TOOLBAR_CONFIG: ToolbarConfig<BimViewer>;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const GROUP_CONFIG: ToolbarMenuId[][];
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const DEFAULT_VRVIEWER_TOOLBAR_CONFIG: ToolbarConfig<VRViewer>;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const DEFAULT_DXFVIEWER_TOOLBAR_CONFIG: ToolbarConfig<DxfViewer>;
|
91
public/demo/libs/types/src/components/toolbar/Toolbar.constants.d.ts
vendored
Normal file
91
public/demo/libs/types/src/components/toolbar/Toolbar.constants.d.ts
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import { Toolbar } from "./Toolbar";
|
||||||
|
import { IconClass } from "../../core/utils";
|
||||||
|
import type { BaseViewer } from "../../core/viewers";
|
||||||
|
/**
|
||||||
|
* @type
|
||||||
|
* 1: click event
|
||||||
|
* 2:show popup
|
||||||
|
* 3:show submenu
|
||||||
|
* 4:turn on/off
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare enum MenuTypeEnums {
|
||||||
|
ClickEvent = 1,
|
||||||
|
Popup = 2,
|
||||||
|
SubMenu = 3,
|
||||||
|
Switch = 4
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Buildin toolbar ids
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare enum ToolbarMenuId {
|
||||||
|
HomeView = "HomeView",
|
||||||
|
OrthoMode = "OrthoMode",
|
||||||
|
Measure = "Measure",
|
||||||
|
MeasureDistance = "MeasureDistance",
|
||||||
|
MeasureArea = "MeasureArea",
|
||||||
|
MeasureAngle = "MeasureAngle",
|
||||||
|
MeasureCoordinate = "MeasureCoordinate",
|
||||||
|
MeasureClear = "MeasureClear",
|
||||||
|
Markup = "Markup",
|
||||||
|
MarkupArrow = "Arrow",
|
||||||
|
MarkupRect = "Rect",
|
||||||
|
MarkupCloudRect = "CloudRect",
|
||||||
|
MarkupPolyLine = "PolyLine",
|
||||||
|
MarkupCloudLine = "CloudLine",
|
||||||
|
MarkupEllipse = "Ellipse",
|
||||||
|
MarkupCircle = "Circle",
|
||||||
|
MarkupDot = "Dot",
|
||||||
|
MarkupText = "Text",
|
||||||
|
MarkupX = "X",
|
||||||
|
MarkupStrokeStyle = "StrokeStyle",
|
||||||
|
MarkupLineWidth = "LineWidth",
|
||||||
|
MarkupLineWidth2 = "LineWidth2",
|
||||||
|
MarkupLineWidth5 = "LineWidth5",
|
||||||
|
MarkupLineWidth10 = "LineWidth10",
|
||||||
|
MarkupFontSize = "FontSize",
|
||||||
|
MarkupFontSize14 = "FontSize14",
|
||||||
|
MarkupFontSize18 = "FontSize18",
|
||||||
|
MarkupFontSize24 = "FontSize24",
|
||||||
|
MarkupClear = "MarkupClear",
|
||||||
|
MarkupQuit = "MarkupQuit",
|
||||||
|
Section = "Section",
|
||||||
|
SectionBox = "SectionBox",
|
||||||
|
SectionPlane = "SectionPlane",
|
||||||
|
AxisSectionPlane = "AxisSectionPlane",
|
||||||
|
BimTree = "BimTree",
|
||||||
|
Viewpoint = "Viewpoint",
|
||||||
|
Annotation = "Annotation",
|
||||||
|
Property = "Property",
|
||||||
|
Settings = "Settings",
|
||||||
|
Compared = "Compared",
|
||||||
|
QuitCompare = "QuitCompare",
|
||||||
|
Fullscreen = "FullScreen",
|
||||||
|
SceneClear = "SceneClear",
|
||||||
|
Layers = "Layers",
|
||||||
|
ZoomToRectangle = "ZoomToRectangle"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ToolbarConfig
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ToolbarMenuConfig<T extends BaseViewer> {
|
||||||
|
menuName: string;
|
||||||
|
icon: IconClass;
|
||||||
|
children?: ToolbarConfig<T>;
|
||||||
|
visible?: boolean;
|
||||||
|
mutexIds?: ToolbarMenuId[];
|
||||||
|
defaultActive?: boolean;
|
||||||
|
type: MenuTypeEnums;
|
||||||
|
customElement?: (bimViewer: T, menuId: string, cfg: ToolbarMenuConfig<T>) => HTMLDivElement;
|
||||||
|
onActive?: (bimViewer: T) => void;
|
||||||
|
onDeactive?: (bimViewer: T) => void;
|
||||||
|
onClick?: (bimViewer: T, toolbar: Toolbar<T>, event: MouseEvent) => void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export type ToolbarConfig<T extends BaseViewer> = {
|
||||||
|
[key in ToolbarMenuId]?: ToolbarMenuConfig<T>;
|
||||||
|
};
|
99
public/demo/libs/types/src/components/toolbar/Toolbar.d.ts
vendored
Normal file
99
public/demo/libs/types/src/components/toolbar/Toolbar.d.ts
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
import { ToolbarConfig, ToolbarMenuConfig, ToolbarMenuId } from "./Toolbar.constants";
|
||||||
|
import type { BaseViewer } from "../../core/viewers";
|
||||||
|
/**
|
||||||
|
* @class Toolbar
|
||||||
|
* @description A customized toolbar.
|
||||||
|
*
|
||||||
|
* For example:
|
||||||
|
* #### Example 1:
|
||||||
|
* Using {@link updateMenu} to modify the toolbar configuration
|
||||||
|
* ```typescript
|
||||||
|
* const toolbar = this.bimViewer.toolbar;
|
||||||
|
* toolbar.updateMenu(ToolbarMenuId.Viewpoint, { onActive: this.handleActive });
|
||||||
|
* toolbar.updateMenu(ToolbarMenuId.Annotation, { visible: false });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### Example 2:
|
||||||
|
* Using {@link addMenu} to add a new menu to the toolbar with specific position.
|
||||||
|
* ```typescript
|
||||||
|
* const toolbar = this.bimViewer.toolbar;
|
||||||
|
* toolbar.addMenu(
|
||||||
|
* "newMenu",
|
||||||
|
* { icon: { default: "icon-new" }, menuName: "新菜单", controller: BimTreeController },
|
||||||
|
* [2, 5]
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### Example 3:
|
||||||
|
* Modify the configuration in to custmize the toolbar directly, and then {@link refresh} the whole toolbar.
|
||||||
|
* ```typescript
|
||||||
|
* const toolbar = this.bimViewer.toolbar;
|
||||||
|
* const toolbarGroupConfig = [
|
||||||
|
* [ToolbarMenuId.OrthoMode, ToolbarMenuId.FullScreen],
|
||||||
|
* [ToolbarMenuId.Measure, ToolbarMenuId.Section],
|
||||||
|
* [ToolbarMenuId.BimTree, ToolbarMenuId.Viewpoint, ToolbarMenuId.Annotation, ToolbarMenuId.Property],
|
||||||
|
* [ToolbarMenuId.Setting, "newMenu"],
|
||||||
|
* ];
|
||||||
|
* toolbar.toolbarGroupConfig = toolbarGroupConfig;
|
||||||
|
* toolbar.refresh();
|
||||||
|
* ```
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
declare class Toolbar<T extends BaseViewer> {
|
||||||
|
private readonly bimViewer;
|
||||||
|
readonly menuConfig: ToolbarConfig<T>;
|
||||||
|
groupConfig: ToolbarMenuId[][] | string[][];
|
||||||
|
private element;
|
||||||
|
menuList: Map<string, ToolbarMenu<T>>;
|
||||||
|
constructor(bimViewer: T, menuConfig: ToolbarConfig<T>, groupConfig?: ToolbarMenuId[][] | string[][]);
|
||||||
|
private init;
|
||||||
|
private createToolbarMenu;
|
||||||
|
/**
|
||||||
|
* @description Modify the menu configuration and update the toolbar.
|
||||||
|
* @param {ToolbarMenuId} menuId
|
||||||
|
* @param {Partial<ToolbarMenuConfig>} config
|
||||||
|
* @memberof Toolbar
|
||||||
|
*/
|
||||||
|
updateMenu(menuId: ToolbarMenuId, config: Partial<ToolbarMenuConfig<T>>): void;
|
||||||
|
/**
|
||||||
|
* @description Modify the menu configuration and update the toolbar.
|
||||||
|
* @param {{ menuId: ToolbarMenuId; config: Partial<ToolbarMenuConfig> }[]} configs
|
||||||
|
* @memberof Toolbar
|
||||||
|
*/
|
||||||
|
updateMenus(configs: {
|
||||||
|
menuId: ToolbarMenuId;
|
||||||
|
config: Partial<ToolbarMenuConfig<T>>;
|
||||||
|
}[]): void;
|
||||||
|
/**
|
||||||
|
* @description Add a custmized menu to toolbar.
|
||||||
|
* @param {string} menuId
|
||||||
|
* @param {ToolbarMenuConfig} config
|
||||||
|
* @param {[number, number]} [insertPosition]
|
||||||
|
* @return {*}
|
||||||
|
* @memberof Toolbar
|
||||||
|
*/
|
||||||
|
addMenu(menuId: string, config: ToolbarMenuConfig<T>, insertPosition?: [number, number]): void;
|
||||||
|
/**
|
||||||
|
* @description Update the whole toolbar element with the current configuration.
|
||||||
|
* @memberof Toolbar
|
||||||
|
*/
|
||||||
|
refresh(): void;
|
||||||
|
show(): void;
|
||||||
|
hide(): void;
|
||||||
|
destroy(): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class ToolbarMenu<T extends BaseViewer> {
|
||||||
|
private readonly bimViewer;
|
||||||
|
private readonly toolbar;
|
||||||
|
private readonly menuId;
|
||||||
|
private eventBus;
|
||||||
|
active: boolean;
|
||||||
|
element: HTMLDivElement;
|
||||||
|
constructor(bimViewer: T, toolbar: Toolbar<T>, menuId: string, cfg: ToolbarMenuConfig<T>, parent?: ToolbarMenu<T>);
|
||||||
|
private createButton;
|
||||||
|
setActive(active: boolean): void;
|
||||||
|
}
|
||||||
|
export { Toolbar };
|
4
public/demo/libs/types/src/components/toolbar/index.d.ts
vendored
Normal file
4
public/demo/libs/types/src/components/toolbar/index.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from "./Toolbar.config";
|
||||||
|
export * from "./Toolbar.constants";
|
||||||
|
export * from "./Toolbar";
|
||||||
|
export * from "./MarkupToolbar";
|
320
public/demo/libs/types/src/core/Configs.d.ts
vendored
Normal file
320
public/demo/libs/types/src/core/Configs.d.ts
vendored
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
import type { BimViewer, DxfViewer, VRViewer } from "./viewers";
|
||||||
|
import { ToolbarMenuConfig, ToolbarMenuId } from "../components/toolbar";
|
||||||
|
/**
|
||||||
|
* Camera config
|
||||||
|
*/
|
||||||
|
export interface CameraConfig {
|
||||||
|
/**
|
||||||
|
* The camera location
|
||||||
|
*/
|
||||||
|
eye: number[];
|
||||||
|
/**
|
||||||
|
* The location that the camera looks to
|
||||||
|
*/
|
||||||
|
look: number[];
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
up?: number[];
|
||||||
|
/**
|
||||||
|
* The camera's near clip plane
|
||||||
|
*/
|
||||||
|
near?: number;
|
||||||
|
/**
|
||||||
|
* The camera's far clip plane
|
||||||
|
*/
|
||||||
|
far?: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Model config
|
||||||
|
*/
|
||||||
|
export interface ModelConfig {
|
||||||
|
/**
|
||||||
|
* Unique id of the model
|
||||||
|
*/
|
||||||
|
modelId?: string;
|
||||||
|
/**
|
||||||
|
* Model name
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
/**
|
||||||
|
* Source url of the model
|
||||||
|
*/
|
||||||
|
src: string;
|
||||||
|
/**
|
||||||
|
* Used to distinguish format, because it may be hard to know the format by src!
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
fileFormat?: string;
|
||||||
|
/**
|
||||||
|
* A float array of length 16, definds model's position, rotation and scale
|
||||||
|
*/
|
||||||
|
matrix?: number[];
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @deprecated Uses matrix instead
|
||||||
|
*/
|
||||||
|
position?: number[];
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @deprecated Uses matrix instead
|
||||||
|
*/
|
||||||
|
rotation?: number[];
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @deprecated Uses matrix instead
|
||||||
|
*/
|
||||||
|
scale?: number[];
|
||||||
|
/**
|
||||||
|
* If we want to do instantiate to the model
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
instantiate?: boolean;
|
||||||
|
/**
|
||||||
|
* If we want to merge meshes/lines/points with the same material
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
merge?: boolean;
|
||||||
|
/**
|
||||||
|
* If we want to generate and show edges/outlines to the modle.
|
||||||
|
* It is useful for BimViewer.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
edges?: boolean;
|
||||||
|
/**
|
||||||
|
* If this model is visible by default.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
visible?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Dxf model config
|
||||||
|
*/
|
||||||
|
export interface DxfModelConfig extends ModelConfig {
|
||||||
|
/**
|
||||||
|
* If to ignore anything of paper space.
|
||||||
|
* There are some scenarios to ignore paper space by default, includes:
|
||||||
|
* - Dxf overlay, aka, loading more than one dxf files into a viewer. We'll only load model space for the first file.
|
||||||
|
* - Dxf compare. Since we'll only compare model space, it won't load paper space at all.
|
||||||
|
*
|
||||||
|
* This option is useful when user want to explicitly ignore paper space.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
ignorePaperSpace?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Context for ContextMenu
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface Context {
|
||||||
|
bimViewer: BimViewer;
|
||||||
|
hit?: any;
|
||||||
|
instanceId?: number;
|
||||||
|
batchId?: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ContextMenuConfig {
|
||||||
|
context: Context;
|
||||||
|
id?: string;
|
||||||
|
container?: HTMLElement;
|
||||||
|
items?: ContextMenuItem[][];
|
||||||
|
hideOnMouseDown?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ContextMenuItem {
|
||||||
|
title?: string;
|
||||||
|
enabled?: boolean;
|
||||||
|
shown?: boolean;
|
||||||
|
getTitle?: (context: Context) => string;
|
||||||
|
getEnabled?: (context: Context) => boolean;
|
||||||
|
getShown?: (context: Context) => boolean;
|
||||||
|
doAction?: (context: Context) => void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Common viewer config
|
||||||
|
*/
|
||||||
|
export interface BaseViewerConfig {
|
||||||
|
/**
|
||||||
|
* @description canvas id to contain the viewer.
|
||||||
|
*/
|
||||||
|
containerId: string;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
language?: "cn" | "en";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This wrappers most config for BimViewer
|
||||||
|
*/
|
||||||
|
export interface BimViewerConfig extends BaseViewerConfig {
|
||||||
|
/**
|
||||||
|
* Shows the NavCube.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
enableNavCube?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows the AxisGizmo.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
enableAxisGizmo?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows the stats output.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
enableStats?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows the stats output.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
enableDatGui?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows the toolbar.
|
||||||
|
* @description Default is `true`.
|
||||||
|
*/
|
||||||
|
enableToolbar?: boolean;
|
||||||
|
/**
|
||||||
|
* shows the bottom-bar.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
enableBottomBar?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows the context-menu.
|
||||||
|
*/
|
||||||
|
enableContextMenu?: boolean;
|
||||||
|
/**
|
||||||
|
* Enables spinner
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
enableSpinner?: boolean;
|
||||||
|
/**
|
||||||
|
* Default is `meters`
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
units?: string;
|
||||||
|
/**
|
||||||
|
* Sets the default locale
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
locale?: "cn" | "en";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
toolbarMenuConfig?: {
|
||||||
|
[key in ToolbarMenuId]?: ToolbarMenuConfig<BimViewer>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This wrappers most config for DxfViewer
|
||||||
|
*/
|
||||||
|
export interface DxfViewerConfig extends BaseViewerConfig {
|
||||||
|
enableAxisGizmo?: boolean;
|
||||||
|
enableLayoutBar?: boolean;
|
||||||
|
enableStats?: boolean;
|
||||||
|
enableToolbar?: boolean;
|
||||||
|
enableSpinner?: boolean;
|
||||||
|
enableProgressBar?: boolean;
|
||||||
|
enableBottomBar?: boolean;
|
||||||
|
/**
|
||||||
|
* If to cache model into indexeddb (or maybe local storage in future).
|
||||||
|
* If enabled, it will get model data from cache the next time model is loaded.
|
||||||
|
* @internal
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
enableLocalCache?: boolean;
|
||||||
|
/**
|
||||||
|
* If user can select an entity by mouse click
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
enableSelection?: boolean;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
toolbarMenuConfig?: {
|
||||||
|
[key in ToolbarMenuId]?: ToolbarMenuConfig<DxfViewer>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This wrappers most config for VRViewer
|
||||||
|
*/
|
||||||
|
export interface VRViewerConfig extends BaseViewerConfig {
|
||||||
|
autoRotateSpeed?: number;
|
||||||
|
enableAxisGizmo?: boolean;
|
||||||
|
enableToolbar?: boolean;
|
||||||
|
enableBottomBar?: boolean;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
toolbarMenuConfig?: {
|
||||||
|
[key in ToolbarMenuId]?: ToolbarMenuConfig<VRViewer>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* VR Viewpoint's hotpoint, which can be a user defined html element.
|
||||||
|
* A hotpoint can be clicked, then caller can do their own operation,
|
||||||
|
* e.g. open a description panel, jump to another viewpoint, etc.
|
||||||
|
*/
|
||||||
|
export interface Hotpoint {
|
||||||
|
hotpointId: string;
|
||||||
|
anchorPosition: number[];
|
||||||
|
visible?: boolean;
|
||||||
|
html: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A VRViewpointPlan contains 1 or more panor
|
||||||
|
* A viewpoint may contain more than one plans
|
||||||
|
*/
|
||||||
|
export interface Panorama {
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* 1, 6 or 24 image urls in order of right, left, up, down, front, back.
|
||||||
|
* When there is 1 image, caller should also put it into array!
|
||||||
|
*/
|
||||||
|
images: string[];
|
||||||
|
/**
|
||||||
|
* 6 image urls in order of right, left, up, down, front, back
|
||||||
|
*/
|
||||||
|
thumbnails?: string[];
|
||||||
|
}
|
||||||
|
export interface VRViewpoint {
|
||||||
|
/**
|
||||||
|
* @deprecated moved to VRViewpointPlan
|
||||||
|
*/
|
||||||
|
imageOrImages?: string | string[];
|
||||||
|
/**
|
||||||
|
* @deprecated moved to VRViewpointPlan
|
||||||
|
*/
|
||||||
|
thumbnailImages?: string[];
|
||||||
|
panoramas: Panorama[];
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
position?: number[];
|
||||||
|
initialDirection?: number[];
|
||||||
|
hotpoints?: Hotpoint[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A default BimViewerConfig as a template, which enables most plugins.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const DEFAULT_BIM_VIEWER_CONFIG: BimViewerConfig;
|
||||||
|
/**
|
||||||
|
* A simple BimViewerConfig as a template, which disables most plugins.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const SIMPLE_BIM_VIEWER_CONFIG: BimViewerConfig;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IsolateObjectsParam {
|
||||||
|
id: string;
|
||||||
|
modelId: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IsolateObjectsParams {
|
||||||
|
familyInstanceIds: IsolateObjectsParam[];
|
||||||
|
}
|
119
public/demo/libs/types/src/core/Constants.d.ts
vendored
Normal file
119
public/demo/libs/types/src/core/Constants.d.ts
vendored
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
* To improve performance, we can set object.matrixAutoUpdate = false for static or rarely moving objects and
|
||||||
|
* manually call object.updateMatrix() whenever their position/rotation/quaternion/scale are updated.
|
||||||
|
* Add a constrant here, so developer can change it here easily for debugging.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const matrixAutoUpdate = false;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const sceneAutoUpdate = false;
|
||||||
|
/**
|
||||||
|
* These concept can be complex: hitable, snapable, selectable, visible
|
||||||
|
* Mesh Y Y Y Y
|
||||||
|
* text in DxfViewer Y N Y Y
|
||||||
|
* ground plan Y N N Y
|
||||||
|
* outline N N N Y
|
||||||
|
*
|
||||||
|
* So, we must handle them properly. We'll try to put them into different layers.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* In some scenarios, we don't want some objects to be snap-able.
|
||||||
|
* E.g. texts in DxfViewer.
|
||||||
|
* We'll put them into this layer, so they are visible but not snap-able.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const layerForNonSnapableObjects = 10;
|
||||||
|
/**
|
||||||
|
* In some scenarios, we don't want some objects to be select-able.
|
||||||
|
* E.g. outlines in BimViewer
|
||||||
|
* We'll put them into this layer, so they are visible but not select-able.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const layerForUnselectableObjects = 11;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const ICON_FONT_CLASS = "gemini-viewer-icon";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const KEYDOWN_EVENT = "keydown";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const KEYUP_EVENT = "keyup";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const MOUSEMOVE_EVENT = "mousemove";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const MOUSEUP_EVENT = "mouseup";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const MOUSEDOWN_EVENT = "mousedown";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const ESC_KEY = "Escape";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const ENTER_KEY = "Enter";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const AXIS_SECTION_PLANE_ID = "axis-section-plane";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const AXIS_SECTION_PLANE_CONTROL_ID = "axis-section-plane-control";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const SECTION_PLANE_ID = "section-plane";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const SECTION_PLANE_CONTROL_ID = "section-plane-control";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const SECTION_BOX_ID = "section-box";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const SECTION_PLANE_NAME = "plane-section-boxface";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const GROUND_PLANE_RENDER_ORDER = -1000;
|
||||||
|
/**
|
||||||
|
* Section type
|
||||||
|
*/
|
||||||
|
export declare enum SectionType {
|
||||||
|
ObjectsBoxSection = "ObjectsBoxSection",
|
||||||
|
PickPlaneSection = "PickPlaneSection",
|
||||||
|
AxisPlaneSection = "AxisPlaneSection"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated Use SectionType instead
|
||||||
|
*/
|
||||||
|
export declare enum SectionMode {
|
||||||
|
ObjectsBoxSection = "ObjectsBoxSection",
|
||||||
|
PickPlaneSection = "PickPlaneSection",
|
||||||
|
AxisPlaneSection = "AxisPlaneSection"
|
||||||
|
}
|
||||||
|
export interface Vector3 {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
z: number;
|
||||||
|
}
|
||||||
|
export interface Vector2 {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
16
public/demo/libs/types/src/core/Units.d.ts
vendored
Normal file
16
public/demo/libs/types/src/core/Units.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Units are defined the same order as to Dxf format
|
||||||
|
*/
|
||||||
|
export declare enum Units {
|
||||||
|
Unitless = "Unitless",
|
||||||
|
Inches = "Inches",
|
||||||
|
Feet = "Feet",
|
||||||
|
Millimeters = "Millimeters",
|
||||||
|
Centimeters = "Centimeters",
|
||||||
|
Meters = "Meters"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets the unit scale when converting to meter
|
||||||
|
*/
|
||||||
|
export declare const unitScaleToMeter: (srcUnit: Units) => number;
|
||||||
|
export declare const unitScaleConversion: (srcUnit: Units, destUnit: Units) => number;
|
3
public/demo/libs/types/src/core/VersionManager.d.ts
vendored
Normal file
3
public/demo/libs/types/src/core/VersionManager.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export declare const getVersionFromLocalStorage: () => string | null;
|
||||||
|
export declare const setVersionToLocalStorage: () => void;
|
||||||
|
export declare const checkIsNewVersion: () => boolean;
|
12
public/demo/libs/types/src/core/axes/CoordinateAxes.d.ts
vendored
Normal file
12
public/demo/libs/types/src/core/axes/CoordinateAxes.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
import { CSS2DObject } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
||||||
|
export declare class CoordinateAxes extends THREE.Object3D {
|
||||||
|
name: string;
|
||||||
|
private readonly AXIS_LENGTH;
|
||||||
|
private readonly AXIS_COLOR_X;
|
||||||
|
private readonly AXIS_COLOR_Y;
|
||||||
|
private readonly AXIS_COLOR_Z;
|
||||||
|
constructor(addTexts?: boolean, ignoreZAxis?: boolean);
|
||||||
|
addTexts(ignoreZAxis?: boolean): void;
|
||||||
|
createText(text: string, color: string, size?: number): CSS2DObject;
|
||||||
|
}
|
36
public/demo/libs/types/src/core/axes/CoordinateAxesViewport.d.ts
vendored
Normal file
36
public/demo/libs/types/src/core/axes/CoordinateAxesViewport.d.ts
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
/**
|
||||||
|
* This renderer monitors the host renderer's camera, and keeps a coordinate axes
|
||||||
|
* the same direction as host renderer's
|
||||||
|
*/
|
||||||
|
export declare class CoordinateAxesViewport {
|
||||||
|
private hostCamera?;
|
||||||
|
private container;
|
||||||
|
private coordinateAxes?;
|
||||||
|
private ignoreZAxis;
|
||||||
|
private camera?;
|
||||||
|
private scene?;
|
||||||
|
private renderer?;
|
||||||
|
private css2dRenderer?;
|
||||||
|
private height;
|
||||||
|
private width;
|
||||||
|
constructor(container: HTMLDivElement, hostCamera: THREE.Camera, ignoreZAxis?: boolean);
|
||||||
|
init(): void;
|
||||||
|
initRenderer(): void;
|
||||||
|
initScene(): void;
|
||||||
|
/**
|
||||||
|
* Sets hostCamera in case it is changed.
|
||||||
|
* It is possible for a viewer to switch camera between a OrthographicCamera and a PerspectiveCamera.
|
||||||
|
*/
|
||||||
|
setHostCamera(hostCamera: THREE.Camera): void;
|
||||||
|
render(): void;
|
||||||
|
animate(): void;
|
||||||
|
update(): void;
|
||||||
|
/**
|
||||||
|
* Update axes according to camera direction.
|
||||||
|
* Camera's direction is the only input factor for this class. It always look at the origin.
|
||||||
|
* @param direction
|
||||||
|
*/
|
||||||
|
updateCameraDirection(direction: THREE.Vector3, up: THREE.Vector3): void;
|
||||||
|
dispose(): void;
|
||||||
|
}
|
2
public/demo/libs/types/src/core/axes/index.d.ts
vendored
Normal file
2
public/demo/libs/types/src/core/axes/index.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from "./CoordinateAxes";
|
||||||
|
export * from "./CoordinateAxesViewport";
|
37
public/demo/libs/types/src/core/canvas/CanvasRender.d.ts
vendored
Normal file
37
public/demo/libs/types/src/core/canvas/CanvasRender.d.ts
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
import { DrawableData } from "./Constants";
|
||||||
|
import { Drawable } from "./Drawable";
|
||||||
|
import { DrawableList } from "./DrawableList";
|
||||||
|
import { Event } from "../utils";
|
||||||
|
import type { BimViewer, DxfViewer } from "../viewers";
|
||||||
|
export type constructorReturnType<T> = new (...arg: any) => T;
|
||||||
|
export declare class CanvasRender extends Event {
|
||||||
|
private viewer;
|
||||||
|
private drawableLists;
|
||||||
|
private canvas?;
|
||||||
|
context?: CanvasRenderingContext2D;
|
||||||
|
private frustum;
|
||||||
|
private projScreenMatrix;
|
||||||
|
static _registerDrawableClass(drawable: constructorReturnType<Drawable>): void;
|
||||||
|
static createDrawable(data: DrawableData): Drawable;
|
||||||
|
constructor(viewer: BimViewer | DxfViewer);
|
||||||
|
get container(): HTMLElement;
|
||||||
|
get camera(): THREE.Camera;
|
||||||
|
get raycaster(): THREE.Raycaster;
|
||||||
|
getPixelSize(scale: number, camera: THREE.Camera): number;
|
||||||
|
private init;
|
||||||
|
private initCanvas;
|
||||||
|
private toHighDpr;
|
||||||
|
clearCanvas(): void;
|
||||||
|
addDrawableList(drawableList: DrawableList): void;
|
||||||
|
render(): void;
|
||||||
|
setSize(width: number, height: number): void;
|
||||||
|
getSortedDrawables(): Drawable[];
|
||||||
|
getDrawablesByPosition(p: THREE.Vector3, raycaster?: THREE.Raycaster): Drawable[];
|
||||||
|
measureTextLength(text: string, font: string): number;
|
||||||
|
screenshot(option?: {
|
||||||
|
type: string;
|
||||||
|
quality: number;
|
||||||
|
}): Promise<string | undefined>;
|
||||||
|
destroy(): void;
|
||||||
|
}
|
21
public/demo/libs/types/src/core/canvas/Constants.d.ts
vendored
Normal file
21
public/demo/libs/types/src/core/canvas/Constants.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Markup data
|
||||||
|
*/
|
||||||
|
export interface DrawableData {
|
||||||
|
/**
|
||||||
|
* id is used by business logic to manage(find, delete, etc.) markups
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Two dimension float array stores 2d points.
|
||||||
|
* e.g. [[1, 1], [2.5, 3]]
|
||||||
|
*/
|
||||||
|
points: number[][];
|
||||||
|
lineWidth?: number;
|
||||||
|
lineColor?: string;
|
||||||
|
fillColor?: string;
|
||||||
|
/**
|
||||||
|
* is class type for serialize
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
}
|
79
public/demo/libs/types/src/core/canvas/Drawable.d.ts
vendored
Normal file
79
public/demo/libs/types/src/core/canvas/Drawable.d.ts
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
import { DrawableData } from "./Constants";
|
||||||
|
import { Event } from "../utils";
|
||||||
|
export declare abstract class Drawable extends Event {
|
||||||
|
protected readonly DEFAULT_LINE_WIDTH = 1;
|
||||||
|
protected readonly DEFAULT_STROKE_STYLE = "#000000";
|
||||||
|
protected readonly DEFAULT_FILL_STYLE = "#000000";
|
||||||
|
id: string;
|
||||||
|
protected lineWidth: number;
|
||||||
|
protected lineColor: string;
|
||||||
|
protected fillColor: string;
|
||||||
|
protected x: number;
|
||||||
|
protected y: number;
|
||||||
|
protected points: THREE.Vector3[];
|
||||||
|
userData: Record<any, any>;
|
||||||
|
protected width: number;
|
||||||
|
protected height: number;
|
||||||
|
protected tolerance: number;
|
||||||
|
visible: boolean;
|
||||||
|
selected: boolean;
|
||||||
|
needsFrustumCulled: boolean;
|
||||||
|
protected editPointSize: number;
|
||||||
|
protected editPointColor: string;
|
||||||
|
protected matrix: THREE.Matrix4;
|
||||||
|
protected ctx?: CanvasRenderingContext2D;
|
||||||
|
constructor(id: string);
|
||||||
|
setTolerance(t: number): void;
|
||||||
|
render(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
||||||
|
getData(): DrawableData;
|
||||||
|
setData(data: DrawableData): void;
|
||||||
|
getVertexs(): THREE.Vector3[];
|
||||||
|
setLineWidth(lineWidth?: number): void;
|
||||||
|
setLineColor(color?: string): void;
|
||||||
|
setFillColor(color?: string): void;
|
||||||
|
isSelected(): boolean;
|
||||||
|
getCenter(): THREE.Vector3;
|
||||||
|
transToScreenCoord(vector: THREE.Vector3, camera: THREE.Camera): THREE.Vector2;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param camera
|
||||||
|
* @describe just for debug bounds
|
||||||
|
*/
|
||||||
|
private drawBounds;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param camera
|
||||||
|
* @describe just for debug
|
||||||
|
*/
|
||||||
|
drawCenter(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param p is world position
|
||||||
|
* @param raycaster just for 3d intersect
|
||||||
|
* @returns boolean
|
||||||
|
* @describe is point interact drawable, use to select drawable, the same as threejs object raycast
|
||||||
|
*/
|
||||||
|
abstract isPointInPath(p: THREE.Vector3, raycaster?: THREE.Raycaster): boolean;
|
||||||
|
getBounds(): THREE.Box3;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param camera
|
||||||
|
* @describe abstract draw method
|
||||||
|
*/
|
||||||
|
abstract draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param camera
|
||||||
|
* @describe abstract drawSelect method
|
||||||
|
*/
|
||||||
|
abstract drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
||||||
|
/**
|
||||||
|
* @describe class type for serialize
|
||||||
|
*/
|
||||||
|
abstract getClassType(): string;
|
||||||
|
}
|
19
public/demo/libs/types/src/core/canvas/DrawableList.d.ts
vendored
Normal file
19
public/demo/libs/types/src/core/canvas/DrawableList.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { DrawableData } from "./Constants";
|
||||||
|
import { Drawable } from "./Drawable";
|
||||||
|
/**
|
||||||
|
* A group of Drawlables for a certain category
|
||||||
|
*/
|
||||||
|
export declare class DrawableList {
|
||||||
|
private category;
|
||||||
|
private drawableMap;
|
||||||
|
constructor(category: string);
|
||||||
|
addDrawable(drawable: Drawable): void;
|
||||||
|
updateDrawable(drawable: Drawable, newData: DrawableData): void;
|
||||||
|
removeDrawable(drawable: Drawable): void;
|
||||||
|
getDrawableById(id: string): Drawable | undefined;
|
||||||
|
clear(): void;
|
||||||
|
getDrawables(): Map<string, Drawable>;
|
||||||
|
getDrawableDatas(): DrawableData[];
|
||||||
|
setDrawableDatas(drawableDatas: DrawableData[]): void;
|
||||||
|
getDrawableByPosition(p: THREE.Vector3, raycaster?: THREE.Raycaster): Drawable | undefined;
|
||||||
|
}
|
4
public/demo/libs/types/src/core/canvas/index.d.ts
vendored
Normal file
4
public/demo/libs/types/src/core/canvas/index.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from "./CanvasRender";
|
||||||
|
export { DrawableList } from "./DrawableList";
|
||||||
|
export { Drawable } from "./Drawable";
|
||||||
|
export * from "./Constants";
|
17
public/demo/libs/types/src/core/compare/CompareDrawable.d.ts
vendored
Normal file
17
public/demo/libs/types/src/core/compare/CompareDrawable.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
import { Drawable } from "../canvas";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class CompareDrawable extends Drawable {
|
||||||
|
boxes: THREE.Box3[];
|
||||||
|
lineSegments: THREE.Vector3[][];
|
||||||
|
constructor(id: string, boxes: THREE.Box3[]);
|
||||||
|
private calculateCloudLineSegments;
|
||||||
|
draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
||||||
|
private drawBox;
|
||||||
|
drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
|
||||||
|
isPointInPath(p: THREE.Vector3): boolean;
|
||||||
|
getBounds(): THREE.Box3;
|
||||||
|
getClassType(): string;
|
||||||
|
}
|
12
public/demo/libs/types/src/core/compare/DxfCompareMarkupManager.d.ts
vendored
Normal file
12
public/demo/libs/types/src/core/compare/DxfCompareMarkupManager.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { DxfChange } from "../dxf";
|
||||||
|
import { Event } from "../utils";
|
||||||
|
import type { DxfViewer } from "../viewers";
|
||||||
|
export declare class DxfCompareMarkupManager extends Event {
|
||||||
|
private viewer;
|
||||||
|
private overlayRender?;
|
||||||
|
private drawableList;
|
||||||
|
constructor(viewer: DxfViewer);
|
||||||
|
render(): void;
|
||||||
|
drawCompareDrawable(changes: Record<string, DxfChange>): void;
|
||||||
|
setCompareDrawableVisible(visilbe: boolean): void;
|
||||||
|
}
|
117
public/demo/libs/types/src/core/controls/OrbitControls.d.ts
vendored
Normal file
117
public/demo/libs/types/src/core/controls/OrbitControls.d.ts
vendored
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import type { CameraControlsEventMap } from "camera-controls/dist/types";
|
||||||
|
import * as THREE from "three";
|
||||||
|
export declare function isPerspectiveCamera(camera: THREE.Camera): camera is THREE.PerspectiveCamera;
|
||||||
|
export declare function isOrthographicCamera(camera: THREE.Camera): camera is THREE.OrthographicCamera;
|
||||||
|
export declare class OrbitControls {
|
||||||
|
private cameraControls;
|
||||||
|
object: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
||||||
|
domElement: HTMLElement;
|
||||||
|
center: THREE.Vector3;
|
||||||
|
private _enableDamping;
|
||||||
|
private dampingFactorValue?;
|
||||||
|
private _enableZoom;
|
||||||
|
private dollySpeedValue?;
|
||||||
|
private _enableRotate;
|
||||||
|
private rotateSpeedValue?;
|
||||||
|
private _enablePan;
|
||||||
|
private panSpeedValue?;
|
||||||
|
private _rotateToCursor;
|
||||||
|
private _mouseButtons;
|
||||||
|
private _touches;
|
||||||
|
private domElementKeyEvents?;
|
||||||
|
private clock;
|
||||||
|
keyPanSpeed: number;
|
||||||
|
autoRotate: boolean;
|
||||||
|
autoRotateSpeed: number;
|
||||||
|
keys: {
|
||||||
|
LEFT: string;
|
||||||
|
UP: string;
|
||||||
|
RIGHT: string;
|
||||||
|
BOTTOM: string;
|
||||||
|
};
|
||||||
|
constructor(object: THREE.PerspectiveCamera | THREE.OrthographicCamera, domElement: HTMLElement);
|
||||||
|
get minDistance(): number;
|
||||||
|
set minDistance(value: number);
|
||||||
|
get maxDistance(): number;
|
||||||
|
set maxDistance(value: number);
|
||||||
|
get minZoom(): number;
|
||||||
|
set minZoom(value: number);
|
||||||
|
get maxZoom(): number;
|
||||||
|
set maxZoom(value: number);
|
||||||
|
get minPolarAngle(): number;
|
||||||
|
set minPolarAngle(value: number);
|
||||||
|
get maxPolarAngle(): number;
|
||||||
|
set maxPolarAngle(value: number);
|
||||||
|
get minAzimuthAngle(): number;
|
||||||
|
set minAzimuthAngle(value: number);
|
||||||
|
get maxAzimuthAngle(): number;
|
||||||
|
set maxAzimuthAngle(value: number);
|
||||||
|
get enabled(): boolean;
|
||||||
|
set enabled(value: boolean);
|
||||||
|
get position(): THREE.Vector3;
|
||||||
|
set position(value: THREE.Vector3);
|
||||||
|
get target(): THREE.Vector3;
|
||||||
|
set target(value: THREE.Vector3);
|
||||||
|
get enableDamping(): boolean;
|
||||||
|
set enableDamping(value: boolean);
|
||||||
|
get dampingFactor(): number;
|
||||||
|
set dampingFactor(value: number);
|
||||||
|
get enableZoom(): boolean;
|
||||||
|
set enableZoom(value: boolean);
|
||||||
|
get zoomSpeed(): number;
|
||||||
|
set zoomSpeed(value: number);
|
||||||
|
get enableRotate(): boolean;
|
||||||
|
set enableRotate(value: boolean);
|
||||||
|
get rotateSpeed(): number;
|
||||||
|
set rotateSpeed(value: number);
|
||||||
|
get enablePan(): boolean;
|
||||||
|
set enablePan(value: boolean);
|
||||||
|
get panSpeed(): number;
|
||||||
|
set panSpeed(value: number);
|
||||||
|
get dollyToCursor(): boolean;
|
||||||
|
set dollyToCursor(value: boolean);
|
||||||
|
get screenSpacePanning(): boolean;
|
||||||
|
set screenSpacePanning(value: boolean);
|
||||||
|
get mouseButtons(): Partial<{
|
||||||
|
LEFT: THREE.MOUSE;
|
||||||
|
MIDDLE: THREE.MOUSE;
|
||||||
|
RIGHT: THREE.MOUSE;
|
||||||
|
}>;
|
||||||
|
set mouseButtons(value: Partial<{
|
||||||
|
LEFT: THREE.MOUSE;
|
||||||
|
MIDDLE: THREE.MOUSE;
|
||||||
|
RIGHT: THREE.MOUSE;
|
||||||
|
}>);
|
||||||
|
get touches(): Partial<{
|
||||||
|
ONE: THREE.TOUCH;
|
||||||
|
TWO: THREE.TOUCH;
|
||||||
|
}>;
|
||||||
|
set touches(value: Partial<{
|
||||||
|
ONE: THREE.TOUCH;
|
||||||
|
TWO: THREE.TOUCH;
|
||||||
|
}>);
|
||||||
|
get target0(): THREE.Vector3;
|
||||||
|
set target0(value: THREE.Vector3);
|
||||||
|
get position0(): THREE.Vector3;
|
||||||
|
set position0(value: THREE.Vector3);
|
||||||
|
get zoom0(): number;
|
||||||
|
set zoom0(value: number);
|
||||||
|
private handleKeyDown;
|
||||||
|
private onKeyDown;
|
||||||
|
private getAutoRotationAngle;
|
||||||
|
listenToKeyEvents(domElement: HTMLElement): void;
|
||||||
|
update(): void;
|
||||||
|
saveState(): void;
|
||||||
|
reset(): void;
|
||||||
|
dispose(): void;
|
||||||
|
getPolarAngle(): number;
|
||||||
|
getAzimuthalAngle(): number;
|
||||||
|
getDistance(): number;
|
||||||
|
addEventListener(type: keyof CameraControlsEventMap, listener: (event: CameraControlsEventMap[keyof CameraControlsEventMap]) => void): void;
|
||||||
|
removeEventListener(type: keyof CameraControlsEventMap, listener: (event: CameraControlsEventMap[keyof CameraControlsEventMap]) => void): void;
|
||||||
|
dispatchEvent(event: {
|
||||||
|
type: keyof CameraControlsEventMap;
|
||||||
|
}): void;
|
||||||
|
setLookAt(position: THREE.Vector3, target: THREE.Vector3): void;
|
||||||
|
setOrbitPoint(vector3: THREE.Vector3): void;
|
||||||
|
}
|
131
public/demo/libs/types/src/core/controls/VRControls.d.ts
vendored
Normal file
131
public/demo/libs/types/src/core/controls/VRControls.d.ts
vendored
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
import { EventDispatcher, PerspectiveCamera, Vector3 } from "three";
|
||||||
|
import { ControlsHelper } from "../helpers/ControlsHelper";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare enum STATE {
|
||||||
|
NONE = -1,
|
||||||
|
ROTATE = 0,
|
||||||
|
DOLLY = 1,
|
||||||
|
PAN = 2,
|
||||||
|
TOUCH_ROTATE = 3,
|
||||||
|
TOUCH_DOLLY = 4
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare enum Keys {
|
||||||
|
LEFT = "ArrowLeft",
|
||||||
|
UP = "ArrowUp",
|
||||||
|
RIGHT = "ArrowRight",
|
||||||
|
BOTTOM = "ArrowDown"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class VRControls extends EventDispatcher {
|
||||||
|
object: PerspectiveCamera;
|
||||||
|
domElement: HTMLCanvasElement;
|
||||||
|
isVRMode: boolean;
|
||||||
|
enabled: boolean;
|
||||||
|
target: Vector3;
|
||||||
|
enableZoom: boolean;
|
||||||
|
enablePan: boolean;
|
||||||
|
enableRotate: boolean;
|
||||||
|
state: STATE;
|
||||||
|
rotateSpeed: number;
|
||||||
|
zoomSpeed: number;
|
||||||
|
panSpeed: number;
|
||||||
|
scale: number;
|
||||||
|
minZoom: number;
|
||||||
|
maxZoom: number;
|
||||||
|
screenSpacePanning: boolean;
|
||||||
|
autoRotate: boolean;
|
||||||
|
controlsHelper?: ControlsHelper;
|
||||||
|
autoRotateSpeed: number;
|
||||||
|
enableDamping: boolean;
|
||||||
|
dampingFactor: number;
|
||||||
|
minAzimuthAngle: number;
|
||||||
|
maxAzimuthAngle: number;
|
||||||
|
minPolarAngle: number;
|
||||||
|
maxPolarAngle: number;
|
||||||
|
minDistance: number;
|
||||||
|
maxDistance: number;
|
||||||
|
keyPanSpeed: number;
|
||||||
|
minFov: number;
|
||||||
|
maxFov: number;
|
||||||
|
private zoomChanged;
|
||||||
|
private panOffset;
|
||||||
|
private pointerPositions;
|
||||||
|
private rotateStart;
|
||||||
|
private rotateEnd;
|
||||||
|
private rotateDelta;
|
||||||
|
private dollyStart;
|
||||||
|
private dollyEnd;
|
||||||
|
private dollyDelta;
|
||||||
|
private panStart;
|
||||||
|
private panEnd;
|
||||||
|
private panDelta;
|
||||||
|
private pointers;
|
||||||
|
private spherical;
|
||||||
|
private sphericalDelta;
|
||||||
|
private domElementKeyEvents?;
|
||||||
|
private quat;
|
||||||
|
constructor(object: PerspectiveCamera, domElement: HTMLCanvasElement, isVRMode?: boolean);
|
||||||
|
dispose(): void;
|
||||||
|
update: () => boolean;
|
||||||
|
private addPointer;
|
||||||
|
private removePointer;
|
||||||
|
private onContextMenu;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Get the distance between two points
|
||||||
|
* @param {number[]} p1
|
||||||
|
* @param {number[]} p2
|
||||||
|
* @return {*}
|
||||||
|
* @memberof VRControls
|
||||||
|
*/
|
||||||
|
getDist(p1: number[], p2: number[]): number;
|
||||||
|
private trackPointer;
|
||||||
|
/**************************PointerDown Event*************************/
|
||||||
|
private onTouchStart;
|
||||||
|
private onMouseDown;
|
||||||
|
private onPointerDown;
|
||||||
|
/**************************PointerMove Event*************************/
|
||||||
|
private onTouchMove;
|
||||||
|
private onMouseMove;
|
||||||
|
private onPointerMove;
|
||||||
|
/**************************PointerUp Event*************************/
|
||||||
|
handlerTouchEnd(event: PointerEvent): void;
|
||||||
|
private onPointerUp;
|
||||||
|
private onPointerCancel;
|
||||||
|
handleMouseWheel(event: WheelEvent): void;
|
||||||
|
private onMouseWheel;
|
||||||
|
/**************************Ponter down event handling*************************/
|
||||||
|
handleMouseDownRotate(event: PointerEvent): void;
|
||||||
|
handleMouseDownDolly(event: PointerEvent): void;
|
||||||
|
handleMouseDownPan(event: PointerEvent): void;
|
||||||
|
handleTouchStartRotate(): void;
|
||||||
|
handleTouchStartDolly(pointers: PointerEvent[]): void;
|
||||||
|
/**************************Mouse move rotate event handling*************************/
|
||||||
|
private updateRotate;
|
||||||
|
handleMouseMoveRotate(event: PointerEvent): void;
|
||||||
|
/**************************Mouse move zoom event handling*************************/
|
||||||
|
private dollyOut;
|
||||||
|
private dollyIn;
|
||||||
|
handleMouseMoveDolly(event: PointerEvent): void;
|
||||||
|
/**************************Mouse move pan event handling*************************/
|
||||||
|
private pan;
|
||||||
|
private panLeft;
|
||||||
|
private panUp;
|
||||||
|
handleMouseMovePan(event: PointerEvent): void;
|
||||||
|
/**************************One-finger or Two-finger rotate event handling*************************/
|
||||||
|
private getSecondPointerPosition;
|
||||||
|
handleTouchMoveRotate(event: PointerEvent): void;
|
||||||
|
/**************************Two-finger zoom event handling*************************/
|
||||||
|
private updateFov;
|
||||||
|
handleTouchMoveDolly(event: PointerEvent): void;
|
||||||
|
private handleKeyDown;
|
||||||
|
private onKeyDown;
|
||||||
|
listenToKeyEvents(domElement: HTMLElement): void;
|
||||||
|
}
|
1
public/demo/libs/types/src/core/controls/index.d.ts
vendored
Normal file
1
public/demo/libs/types/src/core/controls/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./VRControls";
|
8
public/demo/libs/types/src/core/dxf-parser/AutoCadColorIndex.d.ts
vendored
Normal file
8
public/demo/libs/types/src/core/dxf-parser/AutoCadColorIndex.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* AutoCad files sometimes use an indexed color value between 1 and 255 inclusive.
|
||||||
|
* Each value corresponds to a color. index 1 is red, that is 16711680 or 0xFF0000.
|
||||||
|
* index 0 and 256, while included in this array, are actually reserved for inheritance
|
||||||
|
* values in AutoCad so they should not be used for index color lookups.
|
||||||
|
*/
|
||||||
|
declare const _default: number[];
|
||||||
|
export default _default;
|
12
public/demo/libs/types/src/core/dxf-parser/DxfBaseReader.d.ts
vendored
Normal file
12
public/demo/libs/types/src/core/dxf-parser/DxfBaseReader.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export interface IGroup {
|
||||||
|
code: number;
|
||||||
|
value: number | string | boolean;
|
||||||
|
}
|
||||||
|
export declare abstract class DxfBaseReader {
|
||||||
|
protected pointer: number;
|
||||||
|
protected eof: boolean;
|
||||||
|
lastReadGroup: IGroup | undefined;
|
||||||
|
abstract next(): IGroup;
|
||||||
|
abstract hasNext(): boolean;
|
||||||
|
abstract isEOF(): boolean;
|
||||||
|
}
|
14
public/demo/libs/types/src/core/dxf-parser/DxfBinaryReader.d.ts
vendored
Normal file
14
public/demo/libs/types/src/core/dxf-parser/DxfBinaryReader.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "./DxfBaseReader";
|
||||||
|
export default class DxfBinaryReader extends DxfBaseReader {
|
||||||
|
private reader;
|
||||||
|
private decoder;
|
||||||
|
private int8Array;
|
||||||
|
private caches;
|
||||||
|
constructor(data: ArrayBuffer);
|
||||||
|
next(): IGroup;
|
||||||
|
hasNext(): boolean;
|
||||||
|
isEOF(): boolean;
|
||||||
|
private parseGroupValue;
|
||||||
|
private readNullTerminatedString;
|
||||||
|
private ReadBinaryData;
|
||||||
|
}
|
305
public/demo/libs/types/src/core/dxf-parser/DxfParser.d.ts
vendored
Normal file
305
public/demo/libs/types/src/core/dxf-parser/DxfParser.d.ts
vendored
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import { Readable } from "stream";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./entities/geomtry";
|
||||||
|
import { IObject, IObjectParser } from "./objects/common";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare enum BlockTypeFlags {
|
||||||
|
None = 0,
|
||||||
|
AnonymousBlock = 1,
|
||||||
|
NonConstantAttributeDefinitions = 2,
|
||||||
|
XRef = 4,
|
||||||
|
XRefOverlay = 8,
|
||||||
|
ExternallyDependent = 16,
|
||||||
|
ResolvedExternalReference = 32,
|
||||||
|
DefinitionExternalReference = 64
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IBlock {
|
||||||
|
entities: IEntity[];
|
||||||
|
ownerHandle: string;
|
||||||
|
xrefPath: string;
|
||||||
|
name: string;
|
||||||
|
name2: string;
|
||||||
|
handle: string;
|
||||||
|
layer: string;
|
||||||
|
position: IPoint;
|
||||||
|
paperSpace: boolean;
|
||||||
|
blockType: BlockTypeFlags;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IViewPort {
|
||||||
|
name: string;
|
||||||
|
lowerLeftCorner: IPoint;
|
||||||
|
upperRightCorner: IPoint;
|
||||||
|
center: IPoint;
|
||||||
|
snapBasePoint: IPoint;
|
||||||
|
snapSpacing: IPoint;
|
||||||
|
gridSpacing: IPoint;
|
||||||
|
viewDirectionFromTarget: IPoint;
|
||||||
|
viewTarget: IPoint;
|
||||||
|
aspectRatio: number;
|
||||||
|
lensLength: number;
|
||||||
|
frontClippingPlane: string | number | boolean;
|
||||||
|
backClippingPlane: string | number | boolean;
|
||||||
|
viewHeight: number;
|
||||||
|
snapRotationAngle: number;
|
||||||
|
viewTwistAngle: number;
|
||||||
|
orthographicType: string;
|
||||||
|
ucsOrigin: IPoint;
|
||||||
|
ucsXAxis: IPoint;
|
||||||
|
ucsYAxis: IPoint;
|
||||||
|
renderMode: string;
|
||||||
|
defaultLightingType: string;
|
||||||
|
defaultLightingOn: string;
|
||||||
|
ownerHandle: string;
|
||||||
|
ambientColor: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IViewPortTableDefinition {
|
||||||
|
tableRecordsProperty: "viewPorts";
|
||||||
|
tableName: "viewPort";
|
||||||
|
dxfSymbolName: "VPORT";
|
||||||
|
parseTableRecords(): IViewPort[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILineType {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
pattern: number[];
|
||||||
|
patternLength: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILineTypeTableDefinition {
|
||||||
|
tableRecordsProperty: "lineTypes";
|
||||||
|
tableName: "lineType";
|
||||||
|
dxfSymbolName: "LTYPE";
|
||||||
|
parseTableRecords(): Record<string, ILineType>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILayer {
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
handle: string;
|
||||||
|
visible: boolean;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
colorIndex: number;
|
||||||
|
/**
|
||||||
|
* color in decimal
|
||||||
|
*/
|
||||||
|
color: number;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
frozen: boolean;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
flag: number;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
lineType: string;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
lineweight: 0 | 5 | 9 | 13 | 15 | 18 | 20 | 25 | 30 | 35 | 40 | 50 | 53 | 60 | 70 | 80 | 90 | 100 | 106 | 120 | 140 | 158 | 200 | 211 | -3 | -2 | -1;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILayerTableDefinition {
|
||||||
|
tableRecordsProperty: "layers";
|
||||||
|
tableName: "layer";
|
||||||
|
dxfSymbolName: "LAYER";
|
||||||
|
parseTableRecords(): Record<string, ILayer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IBlockRecord {
|
||||||
|
handle: string;
|
||||||
|
ownerHandle: string;
|
||||||
|
blockName: string;
|
||||||
|
layoutHandle: string;
|
||||||
|
blockInsertUnits: number;
|
||||||
|
blockExplodability: number;
|
||||||
|
blockScalability: number;
|
||||||
|
bitmap?: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IBlockRecordTableDefinition {
|
||||||
|
tableRecordsProperty: "blockRecords";
|
||||||
|
tableName: "blockRecord";
|
||||||
|
dxfSymbolName: "BLOCK_RECORD";
|
||||||
|
parseTableRecords(): Record<string, IBlockRecord>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IStyle {
|
||||||
|
handle: string;
|
||||||
|
ownerHandle: string;
|
||||||
|
styleName: string;
|
||||||
|
priorTextHeight: number;
|
||||||
|
textHeight: number;
|
||||||
|
xScale: number;
|
||||||
|
rotation: number;
|
||||||
|
textStyle: string;
|
||||||
|
mirroreType: number;
|
||||||
|
fontFile: string;
|
||||||
|
bigFontFile: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IStyleTableDefinition {
|
||||||
|
tableRecordsProperty: "styles";
|
||||||
|
tableName: "style";
|
||||||
|
dxfSymbolName: "STYLE";
|
||||||
|
parseTableRecords(): Record<string, IStyle>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IDimStyle {
|
||||||
|
styleName: string;
|
||||||
|
DIMSCALE: number;
|
||||||
|
DIMASZ: number;
|
||||||
|
DIMEXO: string;
|
||||||
|
DIMEXE: string;
|
||||||
|
DIMSE1: string;
|
||||||
|
DIMSE2: string;
|
||||||
|
DIMTAD: string;
|
||||||
|
DIMTXT: string;
|
||||||
|
DIMGAP: number;
|
||||||
|
DIMCLRD: number;
|
||||||
|
DIMCLRT: number;
|
||||||
|
DIMLFAC: number;
|
||||||
|
DIMDEC: string;
|
||||||
|
DIMLDRBLK: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IDimStyleTableDefinition {
|
||||||
|
tableRecordsProperty: "dimStyles";
|
||||||
|
tableName: "dimStyle";
|
||||||
|
dxfSymbolName: "DIMSTYLE";
|
||||||
|
parseTableRecords(): Record<string, IDimStyle>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ITableDefinitions {
|
||||||
|
VPORT: IViewPortTableDefinition;
|
||||||
|
LTYPE: ILineTypeTableDefinition;
|
||||||
|
LAYER: ILayerTableDefinition;
|
||||||
|
BLOCK_RECORD: IBlockRecordTableDefinition;
|
||||||
|
STYLE: IStyleTableDefinition;
|
||||||
|
DIMSTYLE: IDimStyleTableDefinition;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IBaseTable {
|
||||||
|
handle: string;
|
||||||
|
ownerHandle: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IViewPortTable extends IBaseTable {
|
||||||
|
viewPorts: IViewPort[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILayerTypesTable extends IBaseTable {
|
||||||
|
lineTypes: Record<string, ILineType>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILayersTable extends IBaseTable {
|
||||||
|
layers: Record<string, ILayer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IStylesTable extends IBaseTable {
|
||||||
|
styles: Record<string, IStyle>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IDimStyleTable extends IBaseTable {
|
||||||
|
dimStyles: Record<string, IDimStyle>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IBlockRecordsTable extends IBaseTable {
|
||||||
|
blockRecords: Record<string, IBlockRecord>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ITables {
|
||||||
|
viewPort: IViewPortTable;
|
||||||
|
lineType: ILayerTypesTable;
|
||||||
|
layer: ILayersTable;
|
||||||
|
blockRecord: IBlockRecordsTable;
|
||||||
|
style: IStylesTable;
|
||||||
|
dimStyle: IDimStyleTable;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export type ITable = IViewPortTable | ILayerTypesTable | ILayersTable | IBlockRecordsTable | IStylesTable | IDimStyleTable;
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IDxf {
|
||||||
|
header: Record<string, IPoint | number>;
|
||||||
|
entities: IEntity[];
|
||||||
|
blocks: Record<string, IBlock>;
|
||||||
|
tables: ITables;
|
||||||
|
objects: Record<string, IObject[]>;
|
||||||
|
}
|
||||||
|
export default class DxfParser {
|
||||||
|
private _entityHandlers;
|
||||||
|
private _objectHandlers;
|
||||||
|
private _layoutBlocks;
|
||||||
|
private unhandledSections;
|
||||||
|
private unhandledObjects;
|
||||||
|
private unhandledEntities;
|
||||||
|
private unsupportedLineTypes;
|
||||||
|
constructor();
|
||||||
|
parse(source: string | ArrayBuffer): IDxf;
|
||||||
|
registerEntityHandler(handlerType: new () => IGeometry): void;
|
||||||
|
registerObjectHandler(handlerType: new () => IObjectParser): void;
|
||||||
|
parseSync(source: string | ArrayBuffer): IDxf;
|
||||||
|
parseStream(stream: Readable): Promise<IDxf>;
|
||||||
|
private _parse;
|
||||||
|
}
|
31
public/demo/libs/types/src/core/dxf-parser/DxfTextReader.d.ts
vendored
Normal file
31
public/demo/libs/types/src/core/dxf-parser/DxfTextReader.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { IGroup, DxfBaseReader } from './DxfBaseReader';
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Based off the AutoCad 2012 DXF Reference
|
||||||
|
* http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf
|
||||||
|
*
|
||||||
|
* Reads through an array representing lines of a dxf file. Takes an array and
|
||||||
|
* provides an easy interface to extract group code and value pairs.
|
||||||
|
* @param data - an array where each element represents a line in the dxf file
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
export default class DxfTextRender extends DxfBaseReader {
|
||||||
|
private data;
|
||||||
|
constructor(data: string[]);
|
||||||
|
/**
|
||||||
|
* Gets the next group (code, value) from the array. A group is two consecutive elements
|
||||||
|
* in the array. The first is the code, the second is the value.
|
||||||
|
* @returns {{code: Number}|*}
|
||||||
|
*/
|
||||||
|
next(): IGroup;
|
||||||
|
/**
|
||||||
|
* Returns true if there is another code/value pair (2 elements in the array).
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasNext(): boolean;
|
||||||
|
/**
|
||||||
|
* Returns true if the scanner is at the end of the array
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isEOF(): boolean;
|
||||||
|
}
|
36
public/demo/libs/types/src/core/dxf-parser/ParseHelpers.d.ts
vendored
Normal file
36
public/demo/libs/types/src/core/dxf-parser/ParseHelpers.d.ts
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "./DxfBaseReader";
|
||||||
|
import { IEntity, IPoint } from "./entities/geomtry";
|
||||||
|
import { IObject } from "./objects/common";
|
||||||
|
export declare const originalTypes: string[];
|
||||||
|
/**
|
||||||
|
* Returns the truecolor value of the given AutoCad color index value
|
||||||
|
* @return {Number} truecolor value as a number
|
||||||
|
*/
|
||||||
|
export declare function getAcadColor(index: number): number;
|
||||||
|
/**
|
||||||
|
* Parses the 2D or 3D coordinate, vector, or point. When complete,
|
||||||
|
* the scanner remains on the last group of the coordinate.
|
||||||
|
* @param {*} scanner
|
||||||
|
*/
|
||||||
|
export declare function parsePoint(scanner: DxfBaseReader): IPoint;
|
||||||
|
/**
|
||||||
|
* Parses 16 numbers as an array. When complete,
|
||||||
|
* the scanner remains on the last group of the value.
|
||||||
|
* @param {*} scanner
|
||||||
|
* @param {*} groupCode
|
||||||
|
*/
|
||||||
|
export declare function parseMatrix(scanner: DxfBaseReader, groupCode: number): number[];
|
||||||
|
/**
|
||||||
|
* Attempts to parse codes common to all entities. Returns true if the group
|
||||||
|
* was handled by this function.
|
||||||
|
* @param {*} entity - the entity currently being parsed
|
||||||
|
* @param {*} curr - the current group being parsed
|
||||||
|
*/
|
||||||
|
export declare function checkCommonEntityProperties(entity: IEntity, curr: IGroup): boolean;
|
||||||
|
/**
|
||||||
|
* Attempts to parse codes common to all objects. Returns true if the group
|
||||||
|
* was handled by this function.
|
||||||
|
* @param {*} object - the object currently being parsed
|
||||||
|
* @param {*} curr - the current group being parsed
|
||||||
|
*/
|
||||||
|
export declare function checkCommonObjectProperties(object: IObject, curr: IGroup): boolean;
|
11
public/demo/libs/types/src/core/dxf-parser/entities/3dface.d.ts
vendored
Normal file
11
public/demo/libs/types/src/core/dxf-parser/entities/3dface.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface I3DfaceEntity extends IEntity {
|
||||||
|
shape: boolean;
|
||||||
|
hasContinuousLinetypePattern: boolean;
|
||||||
|
vertices: IPoint[];
|
||||||
|
}
|
||||||
|
export default class ThreeDface implements IGeometry {
|
||||||
|
ForEntityName: "3DFACE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): I3DfaceEntity;
|
||||||
|
}
|
16
public/demo/libs/types/src/core/dxf-parser/entities/arc.d.ts
vendored
Normal file
16
public/demo/libs/types/src/core/dxf-parser/entities/arc.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
export interface IArcEntity extends IEntity {
|
||||||
|
center: IPoint;
|
||||||
|
radius: number;
|
||||||
|
startAngle: number;
|
||||||
|
endAngle: number;
|
||||||
|
angleLength: number;
|
||||||
|
extrusionDirectionX: number;
|
||||||
|
extrusionDirectionY: number;
|
||||||
|
extrusionDirectionZ: number;
|
||||||
|
}
|
||||||
|
export default class Arc implements IGeometry {
|
||||||
|
ForEntityName: "ARC";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IArcEntity;
|
||||||
|
}
|
31
public/demo/libs/types/src/core/dxf-parser/entities/attdef.d.ts
vendored
Normal file
31
public/demo/libs/types/src/core/dxf-parser/entities/attdef.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IAttdefEntity extends IEntity {
|
||||||
|
xScale: number;
|
||||||
|
textStyle: "STANDARD" | string;
|
||||||
|
text: string;
|
||||||
|
tag: string;
|
||||||
|
prompt: string;
|
||||||
|
startPoint: IPoint;
|
||||||
|
endPoint: IPoint;
|
||||||
|
thickness: number;
|
||||||
|
textHeight: number;
|
||||||
|
rotation: number;
|
||||||
|
obliqueAngle: number;
|
||||||
|
invisible: boolean;
|
||||||
|
constant: boolean;
|
||||||
|
verificationRequired: boolean;
|
||||||
|
preset: boolean;
|
||||||
|
backwards: boolean;
|
||||||
|
mirrored: boolean;
|
||||||
|
horizontalJustification: number;
|
||||||
|
fieldLength: number;
|
||||||
|
verticalJustification: number;
|
||||||
|
extrusionDirectionX: number;
|
||||||
|
extrusionDirectionY: number;
|
||||||
|
extrusionDirectionZ: number;
|
||||||
|
}
|
||||||
|
export default class Attdef implements IGeometry {
|
||||||
|
ForEntityName: "ATTDEF";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IAttdefEntity;
|
||||||
|
}
|
31
public/demo/libs/types/src/core/dxf-parser/entities/attrib.d.ts
vendored
Normal file
31
public/demo/libs/types/src/core/dxf-parser/entities/attrib.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IAttribEntity extends IEntity {
|
||||||
|
xScale: number;
|
||||||
|
textStyle: "STANDARD" | string;
|
||||||
|
text: string;
|
||||||
|
tag: string;
|
||||||
|
prompt: string;
|
||||||
|
startPoint: IPoint;
|
||||||
|
endPoint: IPoint;
|
||||||
|
thickness: number;
|
||||||
|
textHeight: number;
|
||||||
|
rotation: number;
|
||||||
|
obliqueAngle: number;
|
||||||
|
invisible: boolean;
|
||||||
|
constant: boolean;
|
||||||
|
verificationRequired: boolean;
|
||||||
|
preset: boolean;
|
||||||
|
backwards: boolean;
|
||||||
|
mirrored: boolean;
|
||||||
|
horizontalJustification: number;
|
||||||
|
fieldLength: number;
|
||||||
|
verticalJustification: number;
|
||||||
|
extrusionDirectionX: number;
|
||||||
|
extrusionDirectionY: number;
|
||||||
|
extrusionDirectionZ: number;
|
||||||
|
}
|
||||||
|
export default class Attrib implements IGeometry {
|
||||||
|
ForEntityName: "ATTRIB";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IAttribEntity;
|
||||||
|
}
|
13
public/demo/libs/types/src/core/dxf-parser/entities/circle.d.ts
vendored
Normal file
13
public/demo/libs/types/src/core/dxf-parser/entities/circle.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface ICircleEntity extends IEntity {
|
||||||
|
center: IPoint;
|
||||||
|
radius: number;
|
||||||
|
startAngle: number;
|
||||||
|
endAngle: number;
|
||||||
|
angleLength: number;
|
||||||
|
}
|
||||||
|
export default class Circle implements IGeometry {
|
||||||
|
ForEntityName: "CIRCLE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ICircleEntity;
|
||||||
|
}
|
22
public/demo/libs/types/src/core/dxf-parser/entities/dimension.d.ts
vendored
Normal file
22
public/demo/libs/types/src/core/dxf-parser/entities/dimension.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IDimensionEntity extends IEntity {
|
||||||
|
block: string;
|
||||||
|
dimStyleName: string;
|
||||||
|
anchorPoint: IPoint;
|
||||||
|
middleOfText: IPoint;
|
||||||
|
insertionPoint: IPoint;
|
||||||
|
linearOrAngularPoint1: IPoint;
|
||||||
|
linearOrAngularPoint2: IPoint;
|
||||||
|
diameterOrRadiusPoint: IPoint;
|
||||||
|
arcPoint: IPoint;
|
||||||
|
dimensionType: number;
|
||||||
|
attachmentPoint: number;
|
||||||
|
actualMeasurement: number;
|
||||||
|
text: string;
|
||||||
|
angle: number;
|
||||||
|
}
|
||||||
|
export default class Dimension implements IGeometry {
|
||||||
|
ForEntityName: "DIMENSION";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IDimensionEntity;
|
||||||
|
}
|
15
public/demo/libs/types/src/core/dxf-parser/entities/ellipse.d.ts
vendored
Normal file
15
public/demo/libs/types/src/core/dxf-parser/entities/ellipse.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IEllipseEntity extends IEntity {
|
||||||
|
center: IPoint;
|
||||||
|
majorAxisEndPoint: IPoint;
|
||||||
|
axisRatio: number;
|
||||||
|
startAngle: number;
|
||||||
|
endAngle: number;
|
||||||
|
name: string;
|
||||||
|
extrusionDirection: IPoint;
|
||||||
|
}
|
||||||
|
export default class Ellipse implements IGeometry {
|
||||||
|
ForEntityName: "ELLIPSE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IEllipseEntity;
|
||||||
|
}
|
40
public/demo/libs/types/src/core/dxf-parser/entities/geomtry.d.ts
vendored
Normal file
40
public/demo/libs/types/src/core/dxf-parser/entities/geomtry.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface IPoint {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
z?: number;
|
||||||
|
bulge?: number;
|
||||||
|
}
|
||||||
|
export interface IEntity {
|
||||||
|
lineType: string;
|
||||||
|
layer: string;
|
||||||
|
lineTypeScale: number;
|
||||||
|
visible: boolean;
|
||||||
|
colorIndex: number;
|
||||||
|
color: number;
|
||||||
|
isTrueColor: boolean;
|
||||||
|
inPaperSpace: boolean;
|
||||||
|
layoutName: string;
|
||||||
|
ownerHandle: string;
|
||||||
|
materialObjectHandle: number;
|
||||||
|
lineweight: 0 | 5 | 9 | 13 | 15 | 18 | 20 | 25 | 30 | 35 | 40 | 50 | 53 | 60 | 70 | 80 | 90 | 100 | 106 | 120 | 140 | 158 | 200 | 211 | -3 | -2 | -1;
|
||||||
|
extendedData?: {
|
||||||
|
customStrings?: string[];
|
||||||
|
applicationName?: string;
|
||||||
|
originalHandle?: string;
|
||||||
|
originalType?: string;
|
||||||
|
outlines?: number[][][];
|
||||||
|
};
|
||||||
|
type: string;
|
||||||
|
handle: string;
|
||||||
|
blockPosition?: IPoint;
|
||||||
|
attributesFollow?: boolean;
|
||||||
|
}
|
||||||
|
export type EntityName = "POINT" | "3DFACE" | "ARC" | "ATTDEF" | "ATTRIB" | "CIRCLE" | "DIMENSION" | "MULTILEADER" | "ELLIPSE" | "HATCH" | "INSERT" | "LEADER" | "LINE" | "LWPOLYLINE" | "MTEXT" | "OLE2FRAME" | "POLYLINE" | "REGION" | "RAY" | "SEQEND" | "SOLID" | "SPLINE" | "TEXT" | "VERTEX" | "VIEWPORT" | "XLINE";
|
||||||
|
export default interface IGeometry {
|
||||||
|
ForEntityName: EntityName;
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IEntity;
|
||||||
|
}
|
108
public/demo/libs/types/src/core/dxf-parser/entities/hatch.d.ts
vendored
Normal file
108
public/demo/libs/types/src/core/dxf-parser/entities/hatch.d.ts
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export declare enum HatchBoundaryPathTypeFlag {
|
||||||
|
Default = 0,
|
||||||
|
External = 1,
|
||||||
|
Polyline = 2,
|
||||||
|
Derived = 4,
|
||||||
|
Textbox = 8,
|
||||||
|
Outermost = 16,
|
||||||
|
MaxFlags = 31
|
||||||
|
}
|
||||||
|
export declare enum HatchEdgeType {
|
||||||
|
Polyline = 0,
|
||||||
|
Line = 1,
|
||||||
|
Arc = 2,
|
||||||
|
Ellipse = 3,
|
||||||
|
Spline = 4
|
||||||
|
}
|
||||||
|
export declare abstract class HatchEdge {
|
||||||
|
readonly type: HatchEdgeType;
|
||||||
|
constructor(type: HatchEdgeType);
|
||||||
|
}
|
||||||
|
export declare class HatchPolyline extends HatchEdge {
|
||||||
|
points: IPoint[];
|
||||||
|
isClosed: boolean;
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export declare class HatchLine extends HatchEdge {
|
||||||
|
startPoint: IPoint;
|
||||||
|
endPoint: IPoint;
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export declare class HatchArc extends HatchEdge {
|
||||||
|
center: IPoint;
|
||||||
|
radius: number;
|
||||||
|
startAngle: number;
|
||||||
|
endAngle: number;
|
||||||
|
bCounterclockwise: boolean;
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export declare class HatchEllipse extends HatchEdge {
|
||||||
|
center: IPoint;
|
||||||
|
majorAxisEndPoint: IPoint;
|
||||||
|
minorRatio: number;
|
||||||
|
startAngle: number;
|
||||||
|
endAngle: number;
|
||||||
|
bCounterclockwise: boolean;
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export declare class HatchSpline extends HatchEdge {
|
||||||
|
controlPoints: IPoint[];
|
||||||
|
numControlPoints: number;
|
||||||
|
knotValues: number[];
|
||||||
|
numKnots: number;
|
||||||
|
bPeriodic: boolean;
|
||||||
|
bRational: boolean;
|
||||||
|
degreeOfSplineCurve: number;
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
export interface IHatchBoundaryPath {
|
||||||
|
edges: HatchEdge[];
|
||||||
|
pathTypeFlag: HatchBoundaryPathTypeFlag;
|
||||||
|
}
|
||||||
|
export declare enum HatchStyle {
|
||||||
|
Normal = 0,
|
||||||
|
Outer = 1,
|
||||||
|
Ignore = 2
|
||||||
|
}
|
||||||
|
export declare enum HatchType {
|
||||||
|
UserDefined = 0,
|
||||||
|
Predefined = 1,
|
||||||
|
Custom = 2
|
||||||
|
}
|
||||||
|
export interface IHatchPatternLine {
|
||||||
|
angle: number;
|
||||||
|
origin: IPoint;
|
||||||
|
delta: IPoint;
|
||||||
|
dashPattern: number[];
|
||||||
|
}
|
||||||
|
export interface IHatchEntity extends IEntity {
|
||||||
|
elevationX: number;
|
||||||
|
elevationY: number;
|
||||||
|
elevationZ: number;
|
||||||
|
pixelSize: number;
|
||||||
|
associativity: boolean;
|
||||||
|
annotatedBoundary: boolean;
|
||||||
|
boundaryPathsCount: number;
|
||||||
|
boundaryPaths: IHatchBoundaryPath[];
|
||||||
|
seedPointsCount: number;
|
||||||
|
extrusionDirectionX: number;
|
||||||
|
extrusionDirectionY: number;
|
||||||
|
extrusionDirectionZ: number;
|
||||||
|
patternName: string;
|
||||||
|
solidFill: boolean;
|
||||||
|
patternFillColor: number;
|
||||||
|
style: HatchStyle;
|
||||||
|
patternType: HatchType;
|
||||||
|
patternAngle: number;
|
||||||
|
patternScale: number;
|
||||||
|
patternLines?: IHatchPatternLine[];
|
||||||
|
isGradientColor?: boolean;
|
||||||
|
gradientColorCount?: number;
|
||||||
|
gradientColors?: number[];
|
||||||
|
}
|
||||||
|
export default class Hatch implements IGeometry {
|
||||||
|
readonly ForEntityName = "HATCH";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IHatchEntity;
|
||||||
|
}
|
20
public/demo/libs/types/src/core/dxf-parser/entities/insert.d.ts
vendored
Normal file
20
public/demo/libs/types/src/core/dxf-parser/entities/insert.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
export interface IInsertEntity extends IEntity {
|
||||||
|
block: string;
|
||||||
|
attributesFollow: boolean;
|
||||||
|
xScale: number;
|
||||||
|
yScale: number;
|
||||||
|
zScale: number;
|
||||||
|
position: IPoint;
|
||||||
|
rotation: number;
|
||||||
|
columnCount: number;
|
||||||
|
rowCount: number;
|
||||||
|
columnSpacing: number;
|
||||||
|
rowSpacing: number;
|
||||||
|
extrusionDirection: IPoint;
|
||||||
|
}
|
||||||
|
export default class Insert implements IGeometry {
|
||||||
|
ForEntityName: "INSERT";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IInsertEntity;
|
||||||
|
}
|
23
public/demo/libs/types/src/core/dxf-parser/entities/leader.d.ts
vendored
Normal file
23
public/demo/libs/types/src/core/dxf-parser/entities/leader.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
export interface ILeaderEntity extends IEntity {
|
||||||
|
dimensionStyle: string;
|
||||||
|
position: IPoint;
|
||||||
|
textHeight: number;
|
||||||
|
textWidth: number;
|
||||||
|
rotation: number;
|
||||||
|
arrowFlag: number;
|
||||||
|
pathType: number;
|
||||||
|
arrowHeight: number;
|
||||||
|
arrowHeadScale: number;
|
||||||
|
creationFlag: number;
|
||||||
|
direction: number;
|
||||||
|
hasHookline: boolean;
|
||||||
|
block: string;
|
||||||
|
arrowHeadBlockHandle: string;
|
||||||
|
vertices: IPoint[];
|
||||||
|
}
|
||||||
|
export default class Leader implements IGeometry {
|
||||||
|
ForEntityName: "LEADER";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ILeaderEntity;
|
||||||
|
}
|
10
public/demo/libs/types/src/core/dxf-parser/entities/line.d.ts
vendored
Normal file
10
public/demo/libs/types/src/core/dxf-parser/entities/line.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from './geomtry';
|
||||||
|
export interface ILineEntity extends IEntity {
|
||||||
|
vertices: IPoint[];
|
||||||
|
extrusionDirection: IPoint;
|
||||||
|
}
|
||||||
|
export default class Line implements IGeometry {
|
||||||
|
ForEntityName: "LINE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ILineEntity;
|
||||||
|
}
|
21
public/demo/libs/types/src/core/dxf-parser/entities/lwpolyline.d.ts
vendored
Normal file
21
public/demo/libs/types/src/core/dxf-parser/entities/lwpolyline.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
export interface IVertex extends IPoint {
|
||||||
|
startWidth?: number;
|
||||||
|
endWidth?: number;
|
||||||
|
}
|
||||||
|
export interface ILwpolylineEntity extends IEntity {
|
||||||
|
vertices: IVertex[];
|
||||||
|
elevation?: number;
|
||||||
|
thickness?: number;
|
||||||
|
shape: boolean;
|
||||||
|
hasContinuousLinetypePattern: boolean;
|
||||||
|
constantWidth?: number;
|
||||||
|
extrusionDirectionX?: number;
|
||||||
|
extrusionDirectionY?: number;
|
||||||
|
extrusionDirectionZ?: number;
|
||||||
|
}
|
||||||
|
export default class Lwpolyline implements IGeometry {
|
||||||
|
ForEntityName: "LWPOLYLINE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ILwpolylineEntity;
|
||||||
|
}
|
101
public/demo/libs/types/src/core/dxf-parser/entities/mleader.d.ts
vendored
Normal file
101
public/demo/libs/types/src/core/dxf-parser/entities/mleader.d.ts
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface ILeaderEntity extends IEntity {
|
||||||
|
leaderStyleId: number;
|
||||||
|
leaderLineType: number;
|
||||||
|
leaderLineColor: number;
|
||||||
|
leaderLineTypeId: number;
|
||||||
|
leaderLineWeight: number;
|
||||||
|
enableLanding: boolean;
|
||||||
|
enableDogLeg: boolean;
|
||||||
|
doglegLength: number;
|
||||||
|
arrowHeadId: number;
|
||||||
|
arrowHeadSize: number;
|
||||||
|
contentType: number;
|
||||||
|
textStyleId: number;
|
||||||
|
textLeftAttachmentType: number;
|
||||||
|
textRightAttachmentType: number;
|
||||||
|
textAngleType: number;
|
||||||
|
textAlignmentType: number;
|
||||||
|
textColor: number;
|
||||||
|
enableFrameText: boolean;
|
||||||
|
blockContentId: number;
|
||||||
|
blockContentColor: number;
|
||||||
|
blockContentScale: IPoint;
|
||||||
|
blockContentRotation: number;
|
||||||
|
blockContentConnectionType: number;
|
||||||
|
enableAnotationScale: boolean;
|
||||||
|
arrowHeadIndex: number;
|
||||||
|
blockAttributeId: number;
|
||||||
|
blockAttributeIndex: number;
|
||||||
|
blockAttributeWidth: number;
|
||||||
|
blockAttributeTextString: string;
|
||||||
|
textDirectionNegative: boolean;
|
||||||
|
textAlignInIPE: number;
|
||||||
|
textAttachmentPoint: number;
|
||||||
|
textAttachmentDirectionMText: number;
|
||||||
|
textAttachmentDirectionBottom: number;
|
||||||
|
textAttachmentDirectionTop: number;
|
||||||
|
contextData: IMLeaderContextData;
|
||||||
|
}
|
||||||
|
export interface IMLeaderContextData {
|
||||||
|
contentScale: number;
|
||||||
|
contentBasePosition: IPoint;
|
||||||
|
textHeight: number;
|
||||||
|
arrowHeadSize: number;
|
||||||
|
landingGap: number;
|
||||||
|
hasMText: boolean;
|
||||||
|
defaultTextContents: string;
|
||||||
|
textNormalDirection: IPoint;
|
||||||
|
textLocation: IPoint;
|
||||||
|
textDirection: IPoint;
|
||||||
|
textRotation: number;
|
||||||
|
textWidth: number;
|
||||||
|
textLineSpacingFactor: number;
|
||||||
|
textLineSpacingStyle: number;
|
||||||
|
textColor: number;
|
||||||
|
textAttachment: number;
|
||||||
|
textFlowDirection: number;
|
||||||
|
textBackgroundColor: number;
|
||||||
|
textBackgroundScaleFactor: number;
|
||||||
|
textBackgroundTransparency: number;
|
||||||
|
textBackgroundColorOn: boolean;
|
||||||
|
textBackgroundFillOn: boolean;
|
||||||
|
textColumnType: number;
|
||||||
|
textUseAutoHeight: boolean;
|
||||||
|
textColumnWidth: number;
|
||||||
|
textColumnGutterWidth: number;
|
||||||
|
textColumnFlowReversed: boolean;
|
||||||
|
textColumnHeight: number;
|
||||||
|
textUseWordBreak: boolean;
|
||||||
|
hasBlock: boolean;
|
||||||
|
blockContentId: number;
|
||||||
|
blockContentNormalDirection: IPoint;
|
||||||
|
blockContentPosition: IPoint;
|
||||||
|
blockContentScale: number;
|
||||||
|
blockContentRotation: number;
|
||||||
|
blockContentColor: number;
|
||||||
|
blockTransformationMatrix: number[];
|
||||||
|
planeOriginPoint: IPoint;
|
||||||
|
planeXAxisDirection: IPoint;
|
||||||
|
planeYAxisDirection: IPoint;
|
||||||
|
planeNormalReversed: boolean;
|
||||||
|
leaders: IMLeaderLeader[];
|
||||||
|
}
|
||||||
|
export interface IMLeaderLeader {
|
||||||
|
hasSetLastLeaderLinePoint: boolean;
|
||||||
|
hasSetDoglegVector: boolean;
|
||||||
|
lastLeaderLinePoint: IPoint;
|
||||||
|
doglegVector: IPoint;
|
||||||
|
leaderBranchIndex: number;
|
||||||
|
doglegLength: number;
|
||||||
|
leaderLines: IMLeaderLine[];
|
||||||
|
}
|
||||||
|
export interface IMLeaderLine {
|
||||||
|
vertices: IPoint[][];
|
||||||
|
leaderLineIndex: number;
|
||||||
|
}
|
||||||
|
export default class MLeader implements IGeometry {
|
||||||
|
ForEntityName: "MULTILEADER";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ILeaderEntity;
|
||||||
|
}
|
18
public/demo/libs/types/src/core/dxf-parser/entities/mtext.d.ts
vendored
Normal file
18
public/demo/libs/types/src/core/dxf-parser/entities/mtext.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
export interface IMtextEntity extends IEntity {
|
||||||
|
text: string;
|
||||||
|
position: IPoint;
|
||||||
|
directionVector: IPoint;
|
||||||
|
height: number;
|
||||||
|
width: number;
|
||||||
|
rotation: number;
|
||||||
|
attachmentPoint: number;
|
||||||
|
drawingDirection: number;
|
||||||
|
textStyle?: string;
|
||||||
|
lineSpaceFactor?: number;
|
||||||
|
}
|
||||||
|
export default class Mtext implements IGeometry {
|
||||||
|
ForEntityName: "MTEXT";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IMtextEntity;
|
||||||
|
}
|
20
public/demo/libs/types/src/core/dxf-parser/entities/ole2frame.d.ts
vendored
Normal file
20
public/demo/libs/types/src/core/dxf-parser/entities/ole2frame.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import IGeometry, { IEntity } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IOleEntity extends IEntity {
|
||||||
|
documentType: string;
|
||||||
|
version: number;
|
||||||
|
leftUpX: number;
|
||||||
|
leftUpY: number;
|
||||||
|
leftUpZ: number;
|
||||||
|
rightDownX: number;
|
||||||
|
rightDownY: number;
|
||||||
|
rightDownZ: number;
|
||||||
|
type: string;
|
||||||
|
tileModeDescriptor: number;
|
||||||
|
binaryData: string;
|
||||||
|
lengthOfBinaryData: number;
|
||||||
|
}
|
||||||
|
export default class Ole implements IGeometry {
|
||||||
|
readonly ForEntityName = "OLE2FRAME";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IOleEntity;
|
||||||
|
}
|
11
public/demo/libs/types/src/core/dxf-parser/entities/point.d.ts
vendored
Normal file
11
public/demo/libs/types/src/core/dxf-parser/entities/point.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from './geomtry';
|
||||||
|
export interface IPointEntity extends IEntity {
|
||||||
|
position: IPoint;
|
||||||
|
thickness: number;
|
||||||
|
extrusionDirection: IPoint;
|
||||||
|
}
|
||||||
|
export default class Point implements IGeometry {
|
||||||
|
ForEntityName: "POINT";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IPointEntity;
|
||||||
|
}
|
20
public/demo/libs/types/src/core/dxf-parser/entities/polyline.d.ts
vendored
Normal file
20
public/demo/libs/types/src/core/dxf-parser/entities/polyline.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { IVertexEntity } from "./vertex";
|
||||||
|
export interface IPolylineEntity extends IEntity {
|
||||||
|
vertices: IVertexEntity[];
|
||||||
|
thickness: number;
|
||||||
|
shape: boolean;
|
||||||
|
includesCurveFitVertices: boolean;
|
||||||
|
includesSplineFitVertices: boolean;
|
||||||
|
is3dPolyline: boolean;
|
||||||
|
is3dPolygonMesh: boolean;
|
||||||
|
is3dPolygonMeshClosed: boolean;
|
||||||
|
isPolyfaceMesh: boolean;
|
||||||
|
hasContinuousLinetypePattern: boolean;
|
||||||
|
extrusionDirection: IPoint;
|
||||||
|
}
|
||||||
|
export default class Polyline implements IGeometry {
|
||||||
|
ForEntityName: "POLYLINE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IPolylineEntity;
|
||||||
|
}
|
10
public/demo/libs/types/src/core/dxf-parser/entities/ray.d.ts
vendored
Normal file
10
public/demo/libs/types/src/core/dxf-parser/entities/ray.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from './geomtry';
|
||||||
|
export interface IRayEntity extends IEntity {
|
||||||
|
vertices: IPoint[];
|
||||||
|
directionVector: IPoint;
|
||||||
|
}
|
||||||
|
export default class Ray implements IGeometry {
|
||||||
|
ForEntityName: "RAY";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IRayEntity;
|
||||||
|
}
|
10
public/demo/libs/types/src/core/dxf-parser/entities/region.d.ts
vendored
Normal file
10
public/demo/libs/types/src/core/dxf-parser/entities/region.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import IGeometry, { IEntity } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IRegionEntity extends IEntity {
|
||||||
|
modelerVersion?: number;
|
||||||
|
proprietaryData?: string;
|
||||||
|
}
|
||||||
|
export default class Region implements IGeometry {
|
||||||
|
ForEntityName: "REGION";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IRegionEntity;
|
||||||
|
}
|
8
public/demo/libs/types/src/core/dxf-parser/entities/seqend.d.ts
vendored
Normal file
8
public/demo/libs/types/src/core/dxf-parser/entities/seqend.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity } from './geomtry';
|
||||||
|
export interface ISeqendEntity extends IEntity {
|
||||||
|
}
|
||||||
|
export default class Seqend implements IGeometry {
|
||||||
|
ForEntityName: "SEQEND";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ISeqendEntity;
|
||||||
|
}
|
10
public/demo/libs/types/src/core/dxf-parser/entities/solid.d.ts
vendored
Normal file
10
public/demo/libs/types/src/core/dxf-parser/entities/solid.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface ISolidEntity extends IEntity {
|
||||||
|
points: IPoint[];
|
||||||
|
extrusionDirection: IPoint;
|
||||||
|
}
|
||||||
|
export default class Solid implements IGeometry {
|
||||||
|
ForEntityName: "SOLID";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ISolidEntity;
|
||||||
|
}
|
23
public/demo/libs/types/src/core/dxf-parser/entities/spline.d.ts
vendored
Normal file
23
public/demo/libs/types/src/core/dxf-parser/entities/spline.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface ISplineEntity extends IEntity {
|
||||||
|
controlPoints?: IPoint[];
|
||||||
|
fitPoints?: IPoint[];
|
||||||
|
startTangent: IPoint;
|
||||||
|
endTangent: IPoint;
|
||||||
|
knotValues: number[];
|
||||||
|
closed: boolean;
|
||||||
|
periodic: boolean;
|
||||||
|
rational: boolean;
|
||||||
|
planar: boolean;
|
||||||
|
linear: boolean;
|
||||||
|
degreeOfSplineCurve: number;
|
||||||
|
numberOfKnots: number;
|
||||||
|
numberOfControlPoints: number;
|
||||||
|
numberOfFitPoints: number;
|
||||||
|
normalVector: IPoint;
|
||||||
|
}
|
||||||
|
export default class Spline implements IGeometry {
|
||||||
|
ForEntityName: "SPLINE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ISplineEntity;
|
||||||
|
}
|
18
public/demo/libs/types/src/core/dxf-parser/entities/text.d.ts
vendored
Normal file
18
public/demo/libs/types/src/core/dxf-parser/entities/text.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface ITextEntity extends IEntity {
|
||||||
|
startPoint: IPoint;
|
||||||
|
endPoint: IPoint;
|
||||||
|
textHeight: number;
|
||||||
|
xScale: number;
|
||||||
|
rotation: number;
|
||||||
|
text: string;
|
||||||
|
textStyle: string;
|
||||||
|
mirrored: number;
|
||||||
|
halign: number;
|
||||||
|
valign: number;
|
||||||
|
}
|
||||||
|
export default class Text implements IGeometry {
|
||||||
|
ForEntityName: "TEXT";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): ITextEntity;
|
||||||
|
}
|
20
public/demo/libs/types/src/core/dxf-parser/entities/vertex.d.ts
vendored
Normal file
20
public/demo/libs/types/src/core/dxf-parser/entities/vertex.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from './geomtry';
|
||||||
|
export interface IVertexEntity extends IEntity, IPoint {
|
||||||
|
bulge: number;
|
||||||
|
curveFittingVertex: boolean;
|
||||||
|
curveFitTangent: boolean;
|
||||||
|
splineVertex: boolean;
|
||||||
|
splineControlPoint: boolean;
|
||||||
|
threeDPolylineVertex: boolean;
|
||||||
|
threeDPolylineMesh: boolean;
|
||||||
|
polyfaceMeshVertex: boolean;
|
||||||
|
faceA: number;
|
||||||
|
faceB: number;
|
||||||
|
faceC: number;
|
||||||
|
faceD: number;
|
||||||
|
}
|
||||||
|
export default class Vertex implements IGeometry {
|
||||||
|
ForEntityName: "VERTEX";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IVertexEntity;
|
||||||
|
}
|
46
public/demo/libs/types/src/core/dxf-parser/entities/viewport.d.ts
vendored
Normal file
46
public/demo/libs/types/src/core/dxf-parser/entities/viewport.d.ts
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import IGeometry, { IEntity, IPoint } from "./geomtry";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IViewportEntity extends IEntity {
|
||||||
|
centerPoint: IPoint;
|
||||||
|
width_paperSpace: number;
|
||||||
|
height_paperSpace: number;
|
||||||
|
viewportStatus: number;
|
||||||
|
viewportId: string;
|
||||||
|
centerPoint_dcs: IPoint;
|
||||||
|
snapBasePoint_dcs: IPoint;
|
||||||
|
snapSpacing_dcs: IPoint;
|
||||||
|
gridSpacing_dcs: IPoint;
|
||||||
|
viewDirection: IPoint;
|
||||||
|
viewTarget: IPoint;
|
||||||
|
perspectiveLens: number;
|
||||||
|
frontClippingPlaneZ: number;
|
||||||
|
backClippingPlaneZ: number;
|
||||||
|
viewHeight: number;
|
||||||
|
snapAngle: number;
|
||||||
|
viewTwistAngle: number;
|
||||||
|
circleZoomPercent: number;
|
||||||
|
frozenLayerHandles: string[];
|
||||||
|
viewportStatusFlags: number;
|
||||||
|
viewportClippingBoundaryhandleId: string;
|
||||||
|
plotStyleSheetName: string;
|
||||||
|
renderMode: number;
|
||||||
|
viewportFlag_ucs: number;
|
||||||
|
ucsIcon: string;
|
||||||
|
ucsOrigin: IPoint;
|
||||||
|
ucsXAxis: IPoint;
|
||||||
|
ucsYAxis: IPoint;
|
||||||
|
ucsTableRecordHandle: string;
|
||||||
|
baseUcsTableRecordHandle: string;
|
||||||
|
orthographicType: number;
|
||||||
|
elevation: number;
|
||||||
|
shadePlotMode: number;
|
||||||
|
frequency: number;
|
||||||
|
lightingFlag: number;
|
||||||
|
lightingType: number;
|
||||||
|
viewBrightness: number;
|
||||||
|
viewContrast: number;
|
||||||
|
}
|
||||||
|
export default class Viewport implements IGeometry {
|
||||||
|
ForEntityName: "VIEWPORT";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IViewportEntity;
|
||||||
|
}
|
10
public/demo/libs/types/src/core/dxf-parser/entities/xline.d.ts
vendored
Normal file
10
public/demo/libs/types/src/core/dxf-parser/entities/xline.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import IGeometry, { IEntity, IPoint } from './geomtry';
|
||||||
|
export interface IXLineEntity extends IEntity {
|
||||||
|
vertices: IPoint[];
|
||||||
|
directionVector: IPoint;
|
||||||
|
}
|
||||||
|
export default class XLine implements IGeometry {
|
||||||
|
ForEntityName: "XLINE";
|
||||||
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IXLineEntity;
|
||||||
|
}
|
25
public/demo/libs/types/src/core/dxf-parser/index.d.ts
vendored
Normal file
25
public/demo/libs/types/src/core/dxf-parser/index.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
export { default, default as DxfParser } from "./DxfParser";
|
||||||
|
export type { IDxf, IBlock, ILayerTypesTable, ILayersTable, ITables, IViewPortTable, IBaseTable, ILayer, ILayerTableDefinition, ILineType, ILineTypeTableDefinition, ITable, ITableDefinitions, IViewPort, IViewPortTableDefinition, } from "./DxfParser";
|
||||||
|
export type { IEntity, IPoint } from "./entities/geomtry";
|
||||||
|
export type { I3DfaceEntity } from "./entities/3dface";
|
||||||
|
export type { IArcEntity } from "./entities/arc";
|
||||||
|
export type { IAttdefEntity } from "./entities/attdef";
|
||||||
|
export type { ICircleEntity } from "./entities/circle";
|
||||||
|
export type { IDimensionEntity } from "./entities/dimension";
|
||||||
|
export type { ILeaderEntity } from "./entities/mleader";
|
||||||
|
export type { IEllipseEntity } from "./entities/ellipse";
|
||||||
|
export type { IHatchEntity } from "./entities/hatch";
|
||||||
|
export type { IInsertEntity } from "./entities/insert";
|
||||||
|
export type { ILineEntity } from "./entities/line";
|
||||||
|
export type { ILwpolylineEntity } from "./entities/lwpolyline";
|
||||||
|
export type { IMtextEntity } from "./entities/mtext";
|
||||||
|
export type { IPointEntity } from "./entities/point";
|
||||||
|
export type { IPolylineEntity } from "./entities/polyline";
|
||||||
|
export type { ISolidEntity } from "./entities/solid";
|
||||||
|
export type { ISplineEntity } from "./entities/spline";
|
||||||
|
export type { ITextEntity } from "./entities/text";
|
||||||
|
export type { IVertexEntity } from "./entities/vertex";
|
||||||
|
export type { IViewportEntity } from "./entities/viewport";
|
||||||
|
export type { IObject } from "./objects/common";
|
||||||
|
export type { ILayoutObject } from "./objects/layout";
|
||||||
|
export type { ISortEntsObject, ISortEntsTableObject } from "./objects/sortentstable";
|
15
public/demo/libs/types/src/core/dxf-parser/objects/common.d.ts
vendored
Normal file
15
public/demo/libs/types/src/core/dxf-parser/objects/common.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IObject {
|
||||||
|
type: string;
|
||||||
|
handle: string;
|
||||||
|
ownerHandle: string;
|
||||||
|
extendedData?: {
|
||||||
|
customStrings?: string[];
|
||||||
|
applicationName?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export type ObjectName = "ACAD_PROXY_OBJECT" | "ACDBDICTIONARYWDFLT" | "ACDBPLACEHOLDER" | "DATATABLE" | "DICTIONARY" | "DICTIONARYVAR" | "DIMASSOC" | "FIELD" | "GEODATA" | "IDBUFFER" | "IMAGEDEF" | "IMAGEDEF_REACTOR" | "LAYER_INDEX" | "LAYER_FILTER" | "LAYOUT" | "LIGHTLIST" | "MATERIAL" | "MLINESTYLE" | "OBJECT_PTR" | "PLOTSETTINGS" | "RASTERVARIABLES" | "RENDER" | "SECTION" | "SPATIAL_INDEX" | "SPATIAL_FILTER" | "SORTENTSTABLE" | "TABLESTYLE" | "UNDERLAYDEFINITION" | "VISUALSTYLE" | "VBA_PROJECT" | "WIPEOUTVARIABLES" | "XRECORD";
|
||||||
|
export interface IObjectParser {
|
||||||
|
ForObjectName: ObjectName;
|
||||||
|
parseObject(scanner: DxfBaseReader, curr: IGroup): IObject;
|
||||||
|
}
|
19
public/demo/libs/types/src/core/dxf-parser/objects/dictionary.d.ts
vendored
Normal file
19
public/demo/libs/types/src/core/dxf-parser/objects/dictionary.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { IObject, IObjectParser } from "./common";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export declare enum DictionaryCloningFlags {
|
||||||
|
NotApplicable = 0,
|
||||||
|
KeepExisting = 1,
|
||||||
|
UseClone = 2,
|
||||||
|
XrefName = 3,
|
||||||
|
Name = 4,
|
||||||
|
UnmangleName = 5
|
||||||
|
}
|
||||||
|
export interface IDictionaryObject extends IObject {
|
||||||
|
entries: Record<string, string>;
|
||||||
|
isHardOwner: boolean;
|
||||||
|
cloningFlag: DictionaryCloningFlags;
|
||||||
|
}
|
||||||
|
export declare class Dictionary implements IObjectParser {
|
||||||
|
ForObjectName: "DICTIONARY";
|
||||||
|
parseObject(scanner: DxfBaseReader, curr: IGroup): IDictionaryObject;
|
||||||
|
}
|
29
public/demo/libs/types/src/core/dxf-parser/objects/layout.d.ts
vendored
Normal file
29
public/demo/libs/types/src/core/dxf-parser/objects/layout.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { IObject, IObjectParser } from './common';
|
||||||
|
import { DxfBaseReader, IGroup } from '../DxfBaseReader';
|
||||||
|
import { IPoint } from '../entities/geomtry';
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface ILayoutObject extends IObject {
|
||||||
|
plotSettings?: object;
|
||||||
|
layoutName: string;
|
||||||
|
flag: number;
|
||||||
|
tabOrder: number;
|
||||||
|
minLimit: IPoint;
|
||||||
|
maxLimit: IPoint;
|
||||||
|
basePoint: IPoint;
|
||||||
|
minExtent: IPoint;
|
||||||
|
maxExtent: IPoint;
|
||||||
|
elevation: number;
|
||||||
|
origin: IPoint;
|
||||||
|
XAxis: IPoint;
|
||||||
|
YAxis: IPoint;
|
||||||
|
orthographicType: number;
|
||||||
|
blockTableHandle: string;
|
||||||
|
viewportHandle: string;
|
||||||
|
associatedBlockName: string;
|
||||||
|
}
|
||||||
|
export declare class Layout implements IObjectParser {
|
||||||
|
ForObjectName: "LAYOUT";
|
||||||
|
parseObject(scanner: DxfBaseReader, curr: IGroup): ILayoutObject;
|
||||||
|
}
|
12
public/demo/libs/types/src/core/dxf-parser/objects/sortentstable.d.ts
vendored
Normal file
12
public/demo/libs/types/src/core/dxf-parser/objects/sortentstable.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { IObject, IObjectParser } from "./common";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface ISortEntsObject extends IObject {
|
||||||
|
entityHandles: string[][];
|
||||||
|
}
|
||||||
|
export interface ISortEntsTableObject extends IObject {
|
||||||
|
sortEntsObject: ISortEntsObject;
|
||||||
|
}
|
||||||
|
export declare class SortEntsTable implements IObjectParser {
|
||||||
|
ForObjectName: "SORTENTSTABLE";
|
||||||
|
parseObject(scanner: DxfBaseReader, curr: IGroup): ISortEntsTableObject;
|
||||||
|
}
|
22
public/demo/libs/types/src/core/dxf-parser/objects/spatialfilter.d.ts
vendored
Normal file
22
public/demo/libs/types/src/core/dxf-parser/objects/spatialfilter.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { IObject, IObjectParser } from "./common";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
import { IPoint } from "../entities/geomtry";
|
||||||
|
export interface ISpatialFilterObject extends IObject {
|
||||||
|
origin: IPoint;
|
||||||
|
numberOfPointsOnClipBoundary: number;
|
||||||
|
vertices: IPoint[];
|
||||||
|
extrusionDirectionX: number;
|
||||||
|
extrusionDirectionY: number;
|
||||||
|
extrusionDirectionZ: number;
|
||||||
|
clipBoundaryVisible: boolean;
|
||||||
|
frontClippingPlaneFlag: boolean;
|
||||||
|
frontClippingPlaneDistance: number;
|
||||||
|
backClippingPlaneFlag: boolean;
|
||||||
|
backClippingPlaneDistance: number;
|
||||||
|
matrix: number[];
|
||||||
|
invertBlockMatrix: number[];
|
||||||
|
}
|
||||||
|
export declare class SpatialFilter implements IObjectParser {
|
||||||
|
ForObjectName: "SPATIAL_FILTER";
|
||||||
|
parseObject(scanner: DxfBaseReader, curr: IGroup): ISpatialFilterObject;
|
||||||
|
}
|
11
public/demo/libs/types/src/core/dxf-parser/objects/xrecord.d.ts
vendored
Normal file
11
public/demo/libs/types/src/core/dxf-parser/objects/xrecord.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { IObject, IObjectParser } from "./common";
|
||||||
|
import { DictionaryCloningFlags } from "./dictionary";
|
||||||
|
import { DxfBaseReader, IGroup } from "../DxfBaseReader";
|
||||||
|
export interface IXRecord extends IObject {
|
||||||
|
binaryData: string | undefined;
|
||||||
|
cloningFlag: DictionaryCloningFlags;
|
||||||
|
}
|
||||||
|
export declare class XRecord implements IObjectParser {
|
||||||
|
ForObjectName: "XRECORD";
|
||||||
|
parseObject(scanner: DxfBaseReader, curr: IGroup): IXRecord;
|
||||||
|
}
|
15
public/demo/libs/types/src/core/dxf/DXFConstants.d.ts
vendored
Normal file
15
public/demo/libs/types/src/core/dxf/DXFConstants.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Constants used by dxf
|
||||||
|
*/
|
||||||
|
export declare const BYLAYER = "BYLAYER";
|
||||||
|
export declare const BYBLOCK = "BYBLOCK";
|
||||||
|
export declare enum DxfRenderOrder {
|
||||||
|
Mesh = -1,
|
||||||
|
MeshWithPattern = 0,
|
||||||
|
LineWithWidth = 1,
|
||||||
|
Line = 2,
|
||||||
|
LineWithPattern = 3,
|
||||||
|
Point = 4,
|
||||||
|
Text = 5
|
||||||
|
}
|
||||||
|
export declare const NestCompareTypes: string[];
|
425
public/demo/libs/types/src/core/dxf/DXFLoader.d.ts
vendored
Normal file
425
public/demo/libs/types/src/core/dxf/DXFLoader.d.ts
vendored
Normal file
@ -0,0 +1,425 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
import { Font } from "three/examples/jsm/loaders/FontLoader.js";
|
||||||
|
import { DxfChange, DxfChangeType } from "./DxfCompare";
|
||||||
|
import { Units } from "../Units";
|
||||||
|
import { IBlock, IDxf, IEntity, ILayer, ILayoutObject, IPoint, IViewPort, IViewportEntity } from "../dxf-parser";
|
||||||
|
import { IMLeaderContextData } from "../dxf-parser/entities/mleader";
|
||||||
|
import { ISpatialFilterObject } from "../dxf-parser/objects/spatialfilter";
|
||||||
|
import { ShxFont } from "../shx-parser/ShxFont";
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DxfData extends IDxf {
|
||||||
|
threejsObject: THREE.Group;
|
||||||
|
layersAndThreejsObjects: Record<string, THREE.Object3D[]>;
|
||||||
|
loadedEntityCount: number;
|
||||||
|
layoutViewportsMap: Record<string, IViewportEntity[]>;
|
||||||
|
}
|
||||||
|
export interface DxfLayer extends ILayer {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DxfEntity extends IEntity {
|
||||||
|
threejsObject?: THREE.Object3D;
|
||||||
|
dimStyleName: string;
|
||||||
|
dimensionType?: number;
|
||||||
|
anchorPoint?: THREE.Vector3;
|
||||||
|
block?: string;
|
||||||
|
majorAxisEndPoint?: THREE.Vector2 | THREE.Vector3;
|
||||||
|
axisRatio?: number;
|
||||||
|
center?: THREE.Vector3;
|
||||||
|
startAngle?: number;
|
||||||
|
endAngle?: number;
|
||||||
|
style?: number;
|
||||||
|
text?: string;
|
||||||
|
height?: number;
|
||||||
|
width?: number;
|
||||||
|
position?: THREE.Vector3;
|
||||||
|
blockPosition?: IPoint;
|
||||||
|
rotation?: number;
|
||||||
|
directionVector?: THREE.Vector3;
|
||||||
|
attachmentPoint?: number;
|
||||||
|
drawingDirection?: number;
|
||||||
|
controlPoints?: IPoint[];
|
||||||
|
degreeOfSplineCurve?: number;
|
||||||
|
knotValues?: number[];
|
||||||
|
numberOfControlPoints: number;
|
||||||
|
vertices?: IPoint[];
|
||||||
|
shape: boolean;
|
||||||
|
isPolyfaceMesh: boolean;
|
||||||
|
pathType: number;
|
||||||
|
direction: number;
|
||||||
|
hasHookline: boolean;
|
||||||
|
textWidth: number;
|
||||||
|
dimensionStyle: string;
|
||||||
|
arrowFlag: number;
|
||||||
|
arrowHeight: number;
|
||||||
|
arrowHeadScale: number;
|
||||||
|
arrowHeadBlockHandle: string;
|
||||||
|
contextData?: IMLeaderContextData;
|
||||||
|
enableDogLeg: boolean;
|
||||||
|
leaderLineType: number;
|
||||||
|
arrowHeadId: string;
|
||||||
|
arrowHeadSize: number;
|
||||||
|
radius?: number;
|
||||||
|
points?: THREE.Vector3[];
|
||||||
|
startPoint?: THREE.Vector3;
|
||||||
|
endPoint?: THREE.Vector3;
|
||||||
|
textHeight: number;
|
||||||
|
halign?: number;
|
||||||
|
valign?: number;
|
||||||
|
mirrored?: number;
|
||||||
|
textStyle?: string;
|
||||||
|
lineSpaceFactor?: number;
|
||||||
|
name?: string;
|
||||||
|
xScale?: number;
|
||||||
|
yScale?: number;
|
||||||
|
zScale?: number;
|
||||||
|
elevation?: number;
|
||||||
|
extrusionDirectionX?: number;
|
||||||
|
extrusionDirectionY?: number;
|
||||||
|
extrusionDirectionZ?: number;
|
||||||
|
extrusionDirection?: {
|
||||||
|
z: number;
|
||||||
|
};
|
||||||
|
entities?: IEntity[];
|
||||||
|
tag?: string;
|
||||||
|
prompt?: string;
|
||||||
|
scale?: number;
|
||||||
|
preset: boolean;
|
||||||
|
invisible: boolean;
|
||||||
|
documentType?: string;
|
||||||
|
version?: number;
|
||||||
|
leftUpX?: number;
|
||||||
|
leftUpY?: number;
|
||||||
|
leftUpZ?: number;
|
||||||
|
rightDownX?: number;
|
||||||
|
rightDownY?: number;
|
||||||
|
rightDownZ?: number;
|
||||||
|
tileModeDescriptor?: number;
|
||||||
|
binaryData?: string;
|
||||||
|
lengthOfBinaryData?: number;
|
||||||
|
image: string;
|
||||||
|
psBBox?: THREE.Box3;
|
||||||
|
msToPsMatrix?: THREE.Matrix4;
|
||||||
|
viewportThreejsObject?: THREE.Object3D;
|
||||||
|
associatedLeafObjectSet?: Set<THREE.Object3D>;
|
||||||
|
associatedSpatialFilter?: DxfSpatialFilter;
|
||||||
|
compareChangeType?: DxfChangeType;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DxfBlock extends IBlock {
|
||||||
|
threejsObject?: THREE.Object3D;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DxfLayout extends ILayoutObject {
|
||||||
|
directAssociatedLeafObjectSet?: Set<THREE.Object3D>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DxfSpatialFilterClipPolyline {
|
||||||
|
polyline: THREE.Vector3[];
|
||||||
|
bConcave: boolean;
|
||||||
|
bReversed: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DxfSpatialFilter extends ISpatialFilterObject {
|
||||||
|
threejsObject?: THREE.Object3D;
|
||||||
|
localMatrix?: THREE.Matrix4;
|
||||||
|
clipPolylines: DxfSpatialFilterClipPolyline[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* THREE.Loader implementation for DXF files
|
||||||
|
*
|
||||||
|
* @param {*} manager THREE.LoadingManager
|
||||||
|
*
|
||||||
|
* @see https://threejs.org/docs/#api/en/loaders/Loader
|
||||||
|
* @author Sourabh Soni / https://www.prolincur.com
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class DXFLoader extends THREE.Loader {
|
||||||
|
static readonly MODEL_LAYOUT_NAME = "Model";
|
||||||
|
private timer;
|
||||||
|
private ignorePaperSpace;
|
||||||
|
font?: Font | ShxFont;
|
||||||
|
angBase: number | IPoint;
|
||||||
|
angDir: number | IPoint;
|
||||||
|
private header;
|
||||||
|
private pointsMaterials;
|
||||||
|
private lineBasicMaterials;
|
||||||
|
private lineShaderMaterials;
|
||||||
|
private meshBasicMaterials;
|
||||||
|
private meshTextureMaterials;
|
||||||
|
private hatchShaderMaterials;
|
||||||
|
private entityCount;
|
||||||
|
private curveCount;
|
||||||
|
private averageCurveSize;
|
||||||
|
private enableRenderOrder;
|
||||||
|
private enableLocalCache;
|
||||||
|
private enableReleaseData;
|
||||||
|
private enableMerge;
|
||||||
|
private enableSimplify;
|
||||||
|
private enableRTC;
|
||||||
|
private enableWidthLine;
|
||||||
|
private dxfDataId;
|
||||||
|
/**
|
||||||
|
* Use a context in order to easily know if it is compare mode,
|
||||||
|
* and, get compare result from it.
|
||||||
|
*/
|
||||||
|
private compareContext?;
|
||||||
|
private statsInfo;
|
||||||
|
private blockReferencesCache;
|
||||||
|
/**
|
||||||
|
* Adds this data member just in order to improve the performence of getLayoutName.
|
||||||
|
* Its key is blockrecord's handle, value is its layoutHandle.
|
||||||
|
*/
|
||||||
|
private blockRecordsCache;
|
||||||
|
/**
|
||||||
|
* Adds this data member just in order to improve the performence of getLayoutName.
|
||||||
|
* Its key is entity's handle, value is itself.
|
||||||
|
*/
|
||||||
|
private entitiesCache;
|
||||||
|
/**
|
||||||
|
* Adds this data member just in order to improve the performence of getBlockByHandle.
|
||||||
|
* Its key is block's ownerHandle, value is IBlock.
|
||||||
|
*/
|
||||||
|
private blocksCache;
|
||||||
|
/**
|
||||||
|
* Adds this in order to improve performance of findSpatialFilterByHandle.
|
||||||
|
* Key is dictionaryObject's ownerHandle(entity's handle), value is spatial filter's ownerHandle
|
||||||
|
*/
|
||||||
|
private dictionaryOwnerHandleAndSpatialFilterHandlesCache;
|
||||||
|
/**
|
||||||
|
* Adds this in order to improve performance of findSpatialFilterByHandle.
|
||||||
|
* Key is ISpatialFilterObject's ownerHandle, value is ISpatialFilterObject
|
||||||
|
*/
|
||||||
|
private spatialFiltersCache;
|
||||||
|
/**
|
||||||
|
* Adds this in order to improve performance of creating threejs object
|
||||||
|
* Key is entity's handle, value is threejs object.
|
||||||
|
*/
|
||||||
|
private entityThreejsCache;
|
||||||
|
private entityTypesAndTimes;
|
||||||
|
private nonSnapableTypes;
|
||||||
|
static cameraZoomUniform: {
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
static viewportScaleUniform: {
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
|
static transformMatrixUniform: {
|
||||||
|
value: THREE.Matrix4;
|
||||||
|
};
|
||||||
|
static resolutionUniform: {
|
||||||
|
value: THREE.Vector2;
|
||||||
|
};
|
||||||
|
static maxFragmentUniforms: number;
|
||||||
|
static abortJobs: boolean;
|
||||||
|
/**
|
||||||
|
* @param ignorePaperSpace if true, only load model space
|
||||||
|
*/
|
||||||
|
constructor(ignorePaperSpace?: boolean, enableLocalCache?: boolean);
|
||||||
|
setFont(font: Font | ShxFont): this;
|
||||||
|
/**
|
||||||
|
* Downloads dxf file content
|
||||||
|
*/
|
||||||
|
private download;
|
||||||
|
load(url: string, dxfDataId?: string, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
||||||
|
/**
|
||||||
|
* Loads dxf asynchronously. It mainly contains 2 steps:
|
||||||
|
* 1. parses file content
|
||||||
|
* 2. generates/load threejs objects
|
||||||
|
* @param url url of the dxf file
|
||||||
|
* @param onProgress on progress callback
|
||||||
|
*/
|
||||||
|
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
||||||
|
/**
|
||||||
|
* Parses dxf contents
|
||||||
|
*/
|
||||||
|
parse(url: string, onProgress?: (event: ProgressEvent) => void): Promise<IDxf>;
|
||||||
|
private parseHeader;
|
||||||
|
/**
|
||||||
|
* Generates/load threejs objects according to dxf data.
|
||||||
|
* @param data
|
||||||
|
* @param onProgress
|
||||||
|
* @returns
|
||||||
|
* @describe load dxf entities
|
||||||
|
*/
|
||||||
|
loadEntities(data: IDxf, onProgress?: (event: ProgressEvent) => void): Promise<DxfData>;
|
||||||
|
/**
|
||||||
|
* Loads entities from two dxf data for comparing.
|
||||||
|
* It also creates markup for each change.
|
||||||
|
*/
|
||||||
|
loadEntitiesForCompare(data1: IDxf, data2: IDxf, changes: Record<string, DxfChange>, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
||||||
|
private setObjectColorByChange;
|
||||||
|
private releaseCachedData;
|
||||||
|
/**
|
||||||
|
* Releases memory-costy elements of an entity
|
||||||
|
*/
|
||||||
|
private releaseEntity;
|
||||||
|
/**
|
||||||
|
* Releases memory-costy elements of dxf data
|
||||||
|
*/
|
||||||
|
private releaseDxfData;
|
||||||
|
/**
|
||||||
|
* We'll need to pass in the blockEntity when drawEntity is called from a block.
|
||||||
|
* So that, when an entity's color is ByLayer, and its layer is "0", it should use block's layer,
|
||||||
|
* rather than the layer of the entity itself!
|
||||||
|
* We don't know if there is other similar case in future, so pass in blockEntity here.
|
||||||
|
*/
|
||||||
|
drawEntity(entity: DxfEntity, data: IDxf, parentEntity?: IEntity, isParentChanged?: boolean): THREE.Object3D | undefined;
|
||||||
|
drawEllipse(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Line | undefined;
|
||||||
|
drawMText(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Object3D | undefined;
|
||||||
|
private getMTextGroup;
|
||||||
|
mtextContentAndFormattingToTextAndStyle(textAndControlChars: any, // eslint-disable-line
|
||||||
|
entity: DxfEntity): {
|
||||||
|
text: any[];
|
||||||
|
lineLength: number;
|
||||||
|
style: {
|
||||||
|
horizontalAlignment: string;
|
||||||
|
textHeight: number | undefined;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
private getTextLineNum;
|
||||||
|
draw3DFace(entity: DxfEntity): THREE.Line<THREE.BufferGeometry, THREE.LineBasicMaterial> | undefined;
|
||||||
|
drawSpline(entity: DxfEntity): THREE.Line | undefined;
|
||||||
|
/**
|
||||||
|
* Interpolate a b-spline. The algorithm examins the knot vector
|
||||||
|
* to create segments for interpolation. The parameterisation value
|
||||||
|
* is re-normalised back to [0,1] as that is what the lib expects (
|
||||||
|
* and t i de-normalised in the b-spline library)
|
||||||
|
*
|
||||||
|
* @param controlPoints the control points
|
||||||
|
* @param degree the b-spline degree
|
||||||
|
* @param knots the knot vector
|
||||||
|
* @returns the polyline
|
||||||
|
*/
|
||||||
|
getBSplinePolyline(controlPoints: IPoint[], degree: number, knots: number[], interpolationsPerSplineSegment?: number, weights?: number[]): THREE.Vector3[];
|
||||||
|
drawXLine(entity: DxfEntity): THREE.Line | undefined;
|
||||||
|
drawRay(entity: DxfEntity): THREE.Line | undefined;
|
||||||
|
drawLine(entity: DxfEntity): THREE.LineSegments | THREE.Points | undefined;
|
||||||
|
drawLWPolyline(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Object3D | undefined;
|
||||||
|
drawMLeader(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Object3D | undefined;
|
||||||
|
drawLeader(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Object3D | undefined;
|
||||||
|
private drawDefaultLeadArrow;
|
||||||
|
private getBlockByHandle;
|
||||||
|
static transformAngleByOcsMatrix(ocsMatrix: THREE.Matrix4, angle: number): number;
|
||||||
|
static getArcAnglesByOcsMatrix(ocsMatrix: THREE.Matrix4, startAngle: number, endAngle: number): number[];
|
||||||
|
drawArc(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Line | undefined;
|
||||||
|
addTriangleFacingCamera(verts: THREE.Vector3[], p0: THREE.Vector3, p1: THREE.Vector3, p2: THREE.Vector3): void;
|
||||||
|
drawSolid(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Mesh | undefined;
|
||||||
|
private getDefaultTextStyle;
|
||||||
|
private getDefaultDimensionStyle;
|
||||||
|
private getTextEncoding;
|
||||||
|
private getTextMesh;
|
||||||
|
private transformTextMesh;
|
||||||
|
drawText(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.LineSegments | THREE.Mesh | undefined;
|
||||||
|
drawAttDef(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.LineSegments | THREE.Mesh | undefined;
|
||||||
|
drawAttrib(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.LineSegments | THREE.Mesh | undefined;
|
||||||
|
drawPoint(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Points | undefined;
|
||||||
|
drawDimension(entity: DxfEntity, data: IDxf): THREE.Object3D | undefined;
|
||||||
|
drawInsert(entity: DxfEntity, data: IDxf, isParentChanged?: boolean): THREE.Object3D | undefined;
|
||||||
|
drawSpatialFilter(sfObject: ISpatialFilterObject): THREE.Object3D | undefined;
|
||||||
|
drawLayout(block: IBlock, data: IDxf, layout: ILayoutObject, threejsObject: THREE.Object3D, layersAndThreejsObjects: Record<string, THREE.Object3D[]>, // the key is layer name
|
||||||
|
layoutViewportsMap: Record<string, IViewportEntity[]>): void;
|
||||||
|
private convertEdgeToPoints;
|
||||||
|
drawHatch(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Object3D | undefined;
|
||||||
|
drawOle2frame(entity: DxfEntity, data: IDxf): THREE.Object3D | undefined;
|
||||||
|
static getOcsMatrix(extrusion: THREE.Vector3): THREE.Matrix4;
|
||||||
|
static getDcs2WcsMatrix(viewportEntity: IViewportEntity | IViewPort, angDir: number): THREE.Matrix4;
|
||||||
|
private getViewportMsToPsMatrix;
|
||||||
|
drawViewport(entity: DxfEntity, data: IDxf, blockEntity?: IEntity): THREE.Object3D | undefined;
|
||||||
|
private getColor;
|
||||||
|
private getLineType;
|
||||||
|
/**
|
||||||
|
* Gets entity's layer name.
|
||||||
|
* Note that, when entity is in layer "0", it tries to get its parent blockEntity's layer name.
|
||||||
|
*/
|
||||||
|
private getLayerName;
|
||||||
|
private setMaterial;
|
||||||
|
private setHatchMaterial;
|
||||||
|
private setRenderOrderByObjectType;
|
||||||
|
private getPointsMaterial;
|
||||||
|
private getLineBasicMaterial;
|
||||||
|
private getLineShaderMaterial;
|
||||||
|
private getMeshBasicMaterial;
|
||||||
|
/**
|
||||||
|
* Gets shader material for drawing a hatch with pattern
|
||||||
|
*/
|
||||||
|
private getHatchShaderMaterial;
|
||||||
|
/**
|
||||||
|
* Gets a proper division for curve by entity count, entity size and theta angle, etc.
|
||||||
|
* @param size may not be accurate, can be the radius, long size of bbox, etc.
|
||||||
|
*/
|
||||||
|
getDivision(startAngle: number, endAngle: number, size: number): number;
|
||||||
|
/**
|
||||||
|
* Gets proper simplify tolerance.
|
||||||
|
* If tolerance is bigger, more points are simpified.
|
||||||
|
*/
|
||||||
|
getSimplifyTolerance(): number;
|
||||||
|
/**
|
||||||
|
* Catches dxf data into indexedDb
|
||||||
|
*/
|
||||||
|
setDxfDataToIndexedDb(dxfDataId: string, dxf: IDxf): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Gets dxf data into indexedDb
|
||||||
|
*/
|
||||||
|
getDxfDataFromIndexedDb(modelId: string): Promise<IDxf | undefined>;
|
||||||
|
private buildContainHierarchyTree;
|
||||||
|
private buildHatchGeometry;
|
||||||
|
private findIntersectHole;
|
||||||
|
/**
|
||||||
|
* Checks if we should rebase points in case their values are big, and do rebase if necessary
|
||||||
|
*/
|
||||||
|
private checkAndRebasePolygonsOnRTC;
|
||||||
|
/**
|
||||||
|
* Adds "relativeToCenter" flag to indicate an object has been rebased
|
||||||
|
*/
|
||||||
|
private setRTCUserData;
|
||||||
|
private IsfilteredByPathTypeFlag;
|
||||||
|
/**
|
||||||
|
* Finds spatial filter by entity handle.
|
||||||
|
*/
|
||||||
|
private findSpatialFilterByHandle;
|
||||||
|
private entityHandlesWithRenderOrder;
|
||||||
|
/**
|
||||||
|
* Find out render order info from SortEntsTable.
|
||||||
|
*/
|
||||||
|
private initRenderOrderInfo;
|
||||||
|
private findMatchedHatchShaderMaterial;
|
||||||
|
private addViewport;
|
||||||
|
/**
|
||||||
|
* Gets the layout that entity belongs to.
|
||||||
|
* Entities resident in two places:
|
||||||
|
* 1) IDxf.entities
|
||||||
|
* 2) IDxf.blocks[<blockName>].entities
|
||||||
|
*/
|
||||||
|
private getLayout;
|
||||||
|
private getLayerVisible;
|
||||||
|
private getLayerFrozen;
|
||||||
|
private updateMaterialUniforms;
|
||||||
|
private cloneMaterialsForSpatialFilter;
|
||||||
|
private getLineTypeScales;
|
||||||
|
static getDxfUnits(unitValue: number): Units;
|
||||||
|
static computeLineDistance(line: THREE.Line): void;
|
||||||
|
static computeLineDistances(object: THREE.Object3D): void;
|
||||||
|
/**
|
||||||
|
* Merges objects by layer and layout.
|
||||||
|
*/
|
||||||
|
static merge(dxfData: DxfData): void;
|
||||||
|
private static statLayoutAndLayerObjects;
|
||||||
|
/**
|
||||||
|
* First marks the objects to be removed from bottom to top,
|
||||||
|
* and then removes empty objects from top to bottom
|
||||||
|
*/
|
||||||
|
private static removeEmptyObjectsFromRemovingMarkedObjects;
|
||||||
|
private static removeEmptyObjectsFromMark;
|
||||||
|
}
|
105
public/demo/libs/types/src/core/dxf/DxfCompare.d.ts
vendored
Normal file
105
public/demo/libs/types/src/core/dxf/DxfCompare.d.ts
vendored
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
import { DxfEntity } from "./DXFLoader";
|
||||||
|
import { IDxf } from "../dxf-parser";
|
||||||
|
/**
|
||||||
|
* Dxf change type
|
||||||
|
*/
|
||||||
|
export declare enum DxfChangeType {
|
||||||
|
Added = "Added",
|
||||||
|
Removed = "Removed",
|
||||||
|
Modified = "Modified",
|
||||||
|
NoChange = "NoChange"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Dxf change
|
||||||
|
*/
|
||||||
|
export interface DxfChange {
|
||||||
|
id: number;
|
||||||
|
type: DxfChangeType;
|
||||||
|
handle: string;
|
||||||
|
parentHandles?: string[];
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
box?: THREE.Box3;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Used to compare two drawings/dxfs.
|
||||||
|
* - Consider model space only.
|
||||||
|
* - Consider entity's geometry, position, scale, etc.
|
||||||
|
* - Ignore layer's visibility, freeze settings.
|
||||||
|
* - Ignore entity's properties like linetype, fill pattern, font, color, etc.
|
||||||
|
* - Ignore spatial filter (xclip) of block reference.
|
||||||
|
* - We compare entities with the same handle and type. e.g.
|
||||||
|
* - if line A from dxf1 has the same handle with arc A from dxf2, then line A is "Removed", arc A is "Added".
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class DxfCompare {
|
||||||
|
static readonly ENTITY_COLOR_ADDED = 65280;
|
||||||
|
static readonly ENTITY_COLOR_REMOVED = 16711680;
|
||||||
|
static readonly ENTITY_COLOR_NO_CHANGE = 10066329;
|
||||||
|
static readonly ENTITY_COLOR_MARKUP = 16744231;
|
||||||
|
private dxf1;
|
||||||
|
private dxf2;
|
||||||
|
private changes;
|
||||||
|
private comparedBlocks;
|
||||||
|
private isComparingBlock;
|
||||||
|
private isComparingDimension;
|
||||||
|
static readonly ignoreEntityTypes: string[];
|
||||||
|
constructor(dxf1: IDxf, dxf2: IDxf);
|
||||||
|
private getLayerFrozen;
|
||||||
|
/**
|
||||||
|
* Compares model spaces of two dxf files.
|
||||||
|
* Returns DxfChange map, the key is entity handle.
|
||||||
|
*/
|
||||||
|
compare(onProgress?: (event: ProgressEvent) => void): Promise<Record<string, DxfChange>>;
|
||||||
|
private isDimensionBlock;
|
||||||
|
compareInsertOrDemensionEntities(a: DxfEntity, b: DxfEntity, parentHandle1?: string, parentHandle2?: string): {
|
||||||
|
type: DxfChangeType;
|
||||||
|
handle: string;
|
||||||
|
parentHandles?: string[] | undefined;
|
||||||
|
}[] | undefined;
|
||||||
|
private compareBlock;
|
||||||
|
private compareEntities;
|
||||||
|
private bIgnoreChildEntitiesOriginalType;
|
||||||
|
private entitiesEqual;
|
||||||
|
private baseEntitiesEqual;
|
||||||
|
private arcsEqual;
|
||||||
|
private linesEqual;
|
||||||
|
private polylinesEqual;
|
||||||
|
private textsEqual;
|
||||||
|
private solidsEqual;
|
||||||
|
private pointEntitiesEqual;
|
||||||
|
private splinesEqual;
|
||||||
|
private mtextsEqual;
|
||||||
|
private ellipsesEqual;
|
||||||
|
private attDefsEqual;
|
||||||
|
private attribsEqual;
|
||||||
|
private hatchesEqual;
|
||||||
|
private viewportsEqual;
|
||||||
|
private leadersEqual;
|
||||||
|
private mleadersEqual;
|
||||||
|
private ole2framesEqual;
|
||||||
|
private insertsEqual;
|
||||||
|
private dimensionsEqual;
|
||||||
|
private regionsEqual;
|
||||||
|
private vectorsEqual;
|
||||||
|
private pointsEqual;
|
||||||
|
private vertexEntityEqual;
|
||||||
|
private numbersEqual;
|
||||||
|
private numberEqual;
|
||||||
|
private vectorArraysEqual;
|
||||||
|
private verticesEqual;
|
||||||
|
private verticesArrayEqual;
|
||||||
|
private vertexEntitiesEqual;
|
||||||
|
private hatchEdgesEqual;
|
||||||
|
private hatchEdgeArraysEqual;
|
||||||
|
private hatchBoundaryPathsEqual;
|
||||||
|
private hatchBoundaryPathArraysEqual;
|
||||||
|
private mleaderLineEqual;
|
||||||
|
private mleaderLinesEqual;
|
||||||
|
private mleaderLeaderEqual;
|
||||||
|
private mleaderLeadersEqual;
|
||||||
|
private mleaderContextEqual;
|
||||||
|
private compareHexStrings;
|
||||||
|
}
|
12
public/demo/libs/types/src/core/dxf/HatchPatternShaders.d.ts
vendored
Normal file
12
public/demo/libs/types/src/core/dxf/HatchPatternShaders.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
export interface PatternLine {
|
||||||
|
origin: THREE.Vector2;
|
||||||
|
delta: THREE.Vector2;
|
||||||
|
angle: number;
|
||||||
|
pattern: number[];
|
||||||
|
patternSum: number[];
|
||||||
|
patternLength: number;
|
||||||
|
}
|
||||||
|
export declare function createHatchPatternShaderMaterial(patternLines: PatternLine[], patternAngle: number, cameraZoomUniform: {
|
||||||
|
value: number;
|
||||||
|
}, color: THREE.Color): THREE.Material;
|
12
public/demo/libs/types/src/core/dxf/LinePatternShaders.d.ts
vendored
Normal file
12
public/demo/libs/types/src/core/dxf/LinePatternShaders.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
export declare class LinePatternShaders {
|
||||||
|
/**
|
||||||
|
* Creates line shader by given pattern.
|
||||||
|
* Note: remember to call line.computeLineDistances() in order to make it work!
|
||||||
|
*/
|
||||||
|
static createLineShaderMaterial(pattern: number[], color: number, scale: number, viewportScaleUniform: {
|
||||||
|
value: number;
|
||||||
|
}, cameraZoomUniform: {
|
||||||
|
value: number;
|
||||||
|
}): THREE.Material;
|
||||||
|
}
|
8
public/demo/libs/types/src/core/dxf/bspline.d.ts
vendored
Normal file
8
public/demo/libs/types/src/core/dxf/bspline.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Copied and ported to code standard as the b-spline library is not maintained any longer.
|
||||||
|
* Source:
|
||||||
|
* https://github.com/thibauts/b-spline
|
||||||
|
* Copyright (c) 2015 Thibaut Séguy <thibaut.seguy@gmail.com>
|
||||||
|
*/
|
||||||
|
declare const _default: (t: number, degree: number, points: number[][], knots: number[], weights?: number[]) => number[];
|
||||||
|
export default _default;
|
41
public/demo/libs/types/src/core/dxf/dxfom-mtext.d.ts
vendored
Normal file
41
public/demo/libs/types/src/core/dxf/dxfom-mtext.d.ts
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export type DxfMTextContentElement = DxfMTextContentElement[] | string | {
|
||||||
|
/** font family */
|
||||||
|
f?: string;
|
||||||
|
/** bold */
|
||||||
|
b?: 0 | 1;
|
||||||
|
/** italic */
|
||||||
|
i?: 0 | 1;
|
||||||
|
/** code page */
|
||||||
|
c?: number;
|
||||||
|
/** pitch */
|
||||||
|
p?: number;
|
||||||
|
/** angle in degrees */
|
||||||
|
Q?: number;
|
||||||
|
/** character height (with unit) */
|
||||||
|
H?: [number, string];
|
||||||
|
/** character width (with unit) */
|
||||||
|
W?: [number, string];
|
||||||
|
/** stacking */
|
||||||
|
S?: [string, '^' | '/' | '#', string];
|
||||||
|
/** alignment (0: bottom, 1: center, 2: top) */
|
||||||
|
A?: 0 | 1 | 2;
|
||||||
|
/** color index */
|
||||||
|
C?: number;
|
||||||
|
/** character spacing */
|
||||||
|
T?: number;
|
||||||
|
/** underscore */
|
||||||
|
L?: 0 | 1;
|
||||||
|
/** overscore */
|
||||||
|
O?: 0 | 1;
|
||||||
|
/** strike through */
|
||||||
|
K?: 0 | 1;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare const parseDxfMTextContent: (s: string, options?: {
|
||||||
|
readonly encoding?: string | TextDecoder | undefined;
|
||||||
|
} | undefined) => DxfMTextContentElement[];
|
16
public/demo/libs/types/src/core/dxf/dxfom-text.d.ts
vendored
Normal file
16
public/demo/libs/types/src/core/dxf/dxfom-text.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
export interface DxfTextContentElement {
|
||||||
|
/** text content */
|
||||||
|
text: string;
|
||||||
|
/** strike-through */
|
||||||
|
k?: 1;
|
||||||
|
/** overscore */
|
||||||
|
o?: 1;
|
||||||
|
/** underscore */
|
||||||
|
u?: 1;
|
||||||
|
}
|
||||||
|
export declare const decodeDxfTextCharacterCodes: (text: string, mbcsEncoding?: string | TextDecoder) => string;
|
||||||
|
export declare const decodeDxfTextUnicodeCodePoints: (text: string) => string;
|
||||||
|
export declare const decodeDxfTextMbcsCharacterCodes: (text: string, encoding: string | TextDecoder) => string;
|
||||||
|
export declare const parseDxfTextContent: (text: string, options?: {
|
||||||
|
readonly encoding?: string | TextDecoder;
|
||||||
|
}) => DxfTextContentElement[];
|
5
public/demo/libs/types/src/core/dxf/index.d.ts
vendored
Normal file
5
public/demo/libs/types/src/core/dxf/index.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export * from "./DxfCompare";
|
||||||
|
export * from "./DXFLoader";
|
||||||
|
export * from "./bspline";
|
||||||
|
export * from "./dxfom-mtext";
|
||||||
|
export * from "./round10";
|
2
public/demo/libs/types/src/core/dxf/round10.d.ts
vendored
Normal file
2
public/demo/libs/types/src/core/dxf/round10.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
declare const _default: (value: any, exp: any) => number;
|
||||||
|
export default _default;
|
46
public/demo/libs/types/src/core/exploder/Exploder.d.ts
vendored
Normal file
46
public/demo/libs/types/src/core/exploder/Exploder.d.ts
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import * as THREE from "three";
|
||||||
|
/**
|
||||||
|
* Exploder class is used to explode an object
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export declare class Exploder {
|
||||||
|
static DEFAULT_SCALE: number;
|
||||||
|
private scene;
|
||||||
|
private objectId;
|
||||||
|
position: THREE.Vector3;
|
||||||
|
private scale;
|
||||||
|
private isExplodeUp;
|
||||||
|
/**
|
||||||
|
* Constructor of Explode
|
||||||
|
* @param objectId target object id, that is going to be exploded
|
||||||
|
* @param position if undefined, will explode object by its center
|
||||||
|
* @param scale scale factor, 1 means 1 time farer away from exploder's position
|
||||||
|
*/
|
||||||
|
constructor(scene: THREE.Scene, objectId: number, position?: THREE.Vector3 | undefined, scale?: number);
|
||||||
|
/**
|
||||||
|
* Explode the object
|
||||||
|
*/
|
||||||
|
explode(): void;
|
||||||
|
/**
|
||||||
|
* Explodes a parent or leaf object
|
||||||
|
*/
|
||||||
|
private explodeObject;
|
||||||
|
/**
|
||||||
|
* Explodes a leaf object (that has geometry, and ususally no children)
|
||||||
|
*/
|
||||||
|
private explodeLeafObject;
|
||||||
|
/**
|
||||||
|
* Unexplode the object
|
||||||
|
*/
|
||||||
|
unexplode(): void;
|
||||||
|
/**
|
||||||
|
* Unexplodes a parent or leaf object
|
||||||
|
*/
|
||||||
|
private unexplodeObject;
|
||||||
|
/**
|
||||||
|
* Unexplodes a leaf object
|
||||||
|
*/
|
||||||
|
private unexplodeLeafObject;
|
||||||
|
setOnlyExplodeUp(onlyExplodeUp: boolean): void;
|
||||||
|
private getObjectCenter;
|
||||||
|
}
|
1
public/demo/libs/types/src/core/exploder/index.d.ts
vendored
Normal file
1
public/demo/libs/types/src/core/exploder/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./Exploder";
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user