DimensionAnalysis enables the creation and display of measurement annotations for lengths and distances in a 3D SceneView.
The analysis can contain multiple dimensions. These can be created interactively or programmatically, and the analysis can be added directly to either SceneView.analyses or to the DimensionLayer.source in a SceneView.map.
// create analysis with dimensions
const dimensionAnalysis = new DimensionAnalysis({
dimensions: [
new LengthDimension({
startPoint: new Point({ }),
endPoint: new Point({ })
})
],
style: new DimensionSimpleStyle({
color: "white"
}),
});
// add the analysis to the view
view.analyses.push(dimensionAnalysis);
Use the DimensionAnalysisView3D to retrieve the analysis results.
// retrieve measured results from the analysis view
const analysisView = await view.whenAnalysisView(dimensionAnalysis);
const results = dimensionAnalysisView.results;
To place a length dimension interactively, use the DimensionAnalysisView3D.place() method.
const abortController = new AbortController();
try {
await analysisView.place({ signal: abortController.signal });
} catch (error) {
if (error.name === "AbortError") {
console.log("Placement operation was cancelled.");
}
}
// cancel the placement operation at some later point
abortController.abort();
To edit existing dimensions interactively, set the DimensionAnalysisView3D.interactive property true
and select a dimension by hovering and clicking on their offset manipulator.
// allow existing dimensions in the analysis to be selected and edited
analysisView.interactive = true;
DimensionAnalysis can be saved to a WebScene as part of a DimensionLayer.
Known Limitations
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4