简体   繁体   English

Forge Viewer - 标记 - 我们可以获得当前选择的 xy 坐标吗?

[英]Forge Viewer - Markups - can we get xy coordinates of the current selection?

I am using markup extension to draw on my viewer, after drawing, on selection of markup event, can I get its center coordinates of current selection or any coordinates inside of it?我正在使用标记扩展在我的查看器上绘制,绘制后,在选择标记事件时,我可以获得当前选择的中心坐标或其中的任何坐标吗? if not, at least can I get dbId behind current selection?如果没有,至少我可以在当前选择之后获得 dbId 吗?

Thanks in advance提前致谢

Yelp~ it's the case, and see also: Yelp~原来如此,另见:

// Get the markup's position in browser pixel space. the (0,0) is top left
Markup#getClientPosition()
// Get the markup's bounding rect in browser pixel space.

Markup#getClientSize()
// get the markup's bounding rect in browser pixel space, including the stroke width

Markup#getBoundingRect()

BTW, to obtain dbId within the markup boundary, you can do this:顺便说一句,要在标记边界内获得 dbId,您可以这样做:

  1. Get markup's BoundingRect in browser's pixel space在浏览器的像素空间中获取标记的 BoundingRect
  2. Convert coordinates of the rect's vertices into viewer's 3d space via Viewer3D#clientToWorld通过Viewer3D#clientToWorld将矩形顶点的坐标转换为查看者的 3d 空间
  3. Do bounding box collision to find out intersected mesh for the dbId, see here for the example: https://forge.autodesk.com/blog/custom-window-selection-forge-viewer-simpler-extension执行边界框碰撞以找出 dbId 的相交网格,示例见此处: https ://forge.autodesk.com/blog/custom-window-selection-forge-viewer-simler-extension

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

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