简体   繁体   English

在Autodesk Forge Viewer中使用measure.js从现有点创建度量

[英]Creating a measurement from existing points using measure.js in the Autodesk Forge Viewer

I am currently writing an extension app for the Autodesk Forge Viewer , and I need to be able to create a measurement from existing points. 我目前正在为Autodesk Forge Viewer编写扩展应用程序,并且需要能够从现有点创建度量。

To elaborate, I have been able to save the XYZ coordinate data for each point of a measurement to a JSON which is then stored locally. 详细地说,我已经能够将测量的每个点的XYZ坐标数据保存到JSON,然后将其存储在本地。

For example , if you create an angle measurement, it will save the coordinate data for each of the three points needed to make the angle measurement. 例如 ,如果创建角度测量,它将保存进行角度测量所需的三个点中每个点的坐标数据。

The part I am now stuck at is that I am struggling to be able to recreate this measurement when the viewer is reloaded. 我现在停留的部分是,当重新加载查看器时,我正在努力重新创建此度量。 I can get the coordinate points into measure.js , but there seems to be no easy way to instantiate a new measurement from these points, seemingly because the measurement is created from SnapResults that are returned from click events. 我可以将坐标点输入到measure.js中 ,但是似乎没有简单的方法从这些点实例化新的度量,这似乎是因为该度量是根据单击事件返回的SnapResults创建的。

Is there any way I can achieve this functionality? 有什么办法可以实现此功能? I need the new measurement to appear as it was when it was created, with labels and with editable points, but using only the coordinate points to create it. 我需要新的度量以创建时的样子显示,带有标签和可编辑的点,但是仅使用坐标点来创建它。 Any help from the Forge team would be greatly appreciated. Forge团队的任何帮助将不胜感激。

While not exactly supported, There is a modified version of the area measurement tool with source-code and details on how to save and restore measurements. 虽然不完全支持,但存在面积测量工具的修改版本,其中包含源代码以及有关如何保存和恢复测量的详细信息。

Blog and video: https://forge.autodesk.com/blog/area-planning-tool-forge-viewer-and-mysql 博客和视频: https : //forge.autodesk.com/blog/area-planning-tool-forge-viewer-and-mysql

Live demo: https://wallabyway.github.io/area-markup/ (note: click measurement tool before you start) 现场演示: https//wallabyway.github.io/area-markup/ (注意:在开始之前单击测量工具)

source code - GitHub: https://github.com/wallabyway/area-markup 源代码-GitHub: https//github.com/wallabyway/area-markup

Let me know if this has what you are looking for. 让我知道这是否符合您的需求。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM