翻譯|使用教程|編輯:況魚杰|2019-12-05 09:31:17.723|閱讀 269 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見(jiàn)問(wèn)題,教程整理的很齊全,非常適合新手學(xué)習(xí)。本文將會(huì)展示單擊折線的某處時(shí)如何獲取折線的線段的操作。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問(wèn):
單擊折線的某處時(shí)如何獲取折線的線段?
答:
在版本7012.0.7中,已導(dǎo)出新方法vdgeo.GetPlineSegmentIndexFromPoint(對(duì)象點(diǎn),對(duì)象[]頂點(diǎn),bool isClosed,對(duì)象trusionVector)。
點(diǎn):世界坐標(biāo)中的通過(guò)點(diǎn)。
頂點(diǎn):通常從pline.VertexList.Items獲取的折線頂點(diǎn)數(shù)組。
isClosed:如果關(guān)閉則為True,打開(kāi)則為False,不通過(guò)為False。
trusionVector:[X,Y,Z]的數(shù)組,它是一個(gè)垂直于折線平面的向量。通常我們從折線中獲取它。如果不通過(guò),它將獲得[0,0,1]值。
下面是一個(gè)示例,其中當(dāng)我們單擊折線附近的某個(gè)位置時(shí),我們可以在鼠標(biāo)按下事件中找到帶有折線的起點(diǎn)和終點(diǎn)的線段,它更接近我們單擊的點(diǎn)。
function _vdmousedown(e) { if (e.target.ActiveAction().IsStarted()) return; //no user waiting action is active var entity = e.target.GetEntityFromPoint(e.xPix, e.yPix); //scan for an entity under the pick point if (!entity || entity._t !== vdConst.vdPolyline_code) return; //check if entity exist and is a polyline type var index = vdgeo.GetPlineSegmentIndexFromPoint([e.x, e.y, e.z], entity.VertexList.Items, entity.Flag == 1, entity.ExtrusionVector); //get the picked index near the pick point if (index == -1) return; //an index was found.Print the result var sp, ep; sp = entity.VertexList.Items[index]; if (index == entity.VertexList.Items.length - 1) ep = entity.VertexList.Items[0];//in case passed polyline is closed else ep = entity.VertexList.Items[index + 1]; alert("Segment " + index + "\nbetween first point X=" + sp[0].toFixed(3).toString() + " Y=" + sp[1].toFixed(3).toString() + " Z=" + sp[2].toFixed(3).toString() + " Bulge=" + sp[3].toFixed(3).toString() + "\nand second point X=" + ep[0].toFixed(3).toString() + " Y=" + ep[1].toFixed(3).toString() + " Z=" + ep[2].toFixed(3).toString() + " Bulge=" + ep[3].toFixed(3).toString()); }
對(duì)于以上問(wèn)答,如果您有任何的疑惑都可以在評(píng)論區(qū)留言,我們會(huì)及時(shí)回復(fù)。此系列的問(wèn)答教程我們會(huì)持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門文章推薦:
如果您對(duì)想要購(gòu)買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guān)問(wèn)題。
關(guān)注慧聚IT微信公眾號(hào) ???,了解產(chǎn)品的最新動(dòng)態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: