shjko 发表于 2010-5-8 14:25:00

【求教】检测两个图形的形状是否一致如何实现,十万火急!!

正在做的一个课题是不同期矢量地图的变化检测,已经解决了投影变换问题,但是地物的变化至今没有头绪,听说明经通道的高手多,特来求教,希望高手能够帮助我解决这个问题

AndyliuCAD 发表于 2010-5-18 16:09:00

<p>可以获得图形的点的坐标序列,判断是否相等。</p>

henanlypl 发表于 2010-6-5 14:43:00

<font face="Verdana">Sub Test()<br/>&nbsp;&nbsp;&nbsp; Dim Pt As Variant<br/>&nbsp;&nbsp;&nbsp; Dim i As Integer<br/>&nbsp;&nbsp;&nbsp; Dim Objlw1 As AcadLWPolyline<br/>&nbsp;&nbsp;&nbsp; Dim Objlw2 As AcadLWPolyline<br/>&nbsp;&nbsp;&nbsp; ThisDrawing.Utility.GetEntity Objlw1, Pt, "选择多段线"<br/>&nbsp;&nbsp;&nbsp; ThisDrawing.Utility.GetEntity Objlw2, Pt, "选择多段线"<br/>&nbsp;&nbsp;&nbsp; Dim Cor1 As Variant<br/>&nbsp;&nbsp;&nbsp; Dim Cor2 As Variant<br/>&nbsp;&nbsp;&nbsp; Cor1 = Objlw1.Coordinates<br/>&nbsp;&nbsp;&nbsp; Cor2 = Objlw2.Coordinates<br/>&nbsp;&nbsp;&nbsp; If UBound(Cor1) &lt;&gt; UBound(Cor2) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox "形状不同,顶点数不一致,第一条多线段顶点为" &amp; (UBound(Cor1) + 1) / 2 &amp; "第二条多线段顶点数为:" &amp; (UBound(Cor2) + 1) / 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<br/>&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; For i = 2 To UBound(Cor1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Cor1(i) - Cor1(i - 2) &lt;&gt; Cor2(i) - Cor2(i - 2) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox "形状不同,不同的顶点为:" &amp; (CInt(i / 2) - 1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print i<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp; MsgBox "形状相同"<br/>End Sub</font>

学至于行 发表于 2010-6-6 11:24:00

读dxf 可判断 坐标,图层,线形等是否一致
页: [1]
查看完整版本: 【求教】检测两个图形的形状是否一致如何实现,十万火急!!