阅读:1512回复:2
新手求助
我现在想利用VC6.0对mapX二次开发对CAD转换过来的一幅图(也可以是mapinfo画的图)进行编辑计算,比如说对一幅图进行最短路径计算,或者生成最小二叉树等。请大家提供一下具体思路。对于图中的元素(比如线段)怎么获取和设置它的始点坐标,终点坐标,以及其它的附加属性 。可以设置节点与线段的关系吗?怎么设置? <BR>请各位大虾指点,不甚感激!
|
|
1楼#
发布于:2008-09-06 19:02
<P><B><FONT size=4>Feature.Nodes属性(Feature对象)</FONT></B><BR><B>目标</B><BR> 该只读属性得到节点数据的方法是这样的,用户通过一条途径查询对象的所有节点,然后将它们返回给单个的临近内存块。<BR><B>语法</B><BR> [ SafeArray= ] OBJECT.Nodes ([CSys]) </P>
<TABLE height=71 width="97%" border=1> <TR> <TD width="12%" height=19><B>部件</B></TD> <TD width="88%" height=19><B> 描述 </B></TD></TR> <TR> <TD width="12%" height=15>OBJECT</TD> <TD width="88%" height=15>Feature对象的所有者。</TD></TR> <TR> <TD width="12%" height=19>Csys</TD> <TD width="88%" height=19>Coordsys对象,定义节点数据返回的坐标系,默认值为Map.NumericCoordSys。 </TD></TR></TABLE> <P><B><FONT size=4>假设节点数组示例</FONT></B></P> <P><FONT face="Times New Roman"> </FONT>下列示例试图说明安全数组的布局。假设<FONT face="Times New Roman">Arr</FONT>为对某图元节点调用而返回的数组,此图元为一条两段的多折线,第一段含有<FONT face="Times New Roman">3</FONT>个节点,第二段含有<FONT face="Times New Roman">2</FONT>个节点。<BR><FONT face="Times New Roman">// Arr is a 7 × 2 array<BR>Arr(1,1) = # of nodes in the segment 1 (in this case 3)<BR>Arr(2,1) = X Coord of segment 1, node 1<BR>Arr(3,1) = Y Coord of segment 1, node 1<BR>Arr(4,1) = X Coord of segment 1, node 2<BR>Arr(5,1) = Y Coord of segment 1, node 2<BR>Art(6,1) = X Coord of segment I, node 3<BR>Arr(7,1) = Y Coord of segment 1, node 3<BR>Arr(1,2) = # of nodes in the segment 2 (in this case 2)<BR>Arr(2,2) = X Coord of segment 2, node 1<BR>Arr(3,2) = Y Coord of segment 2, node 1 <BR>Arr(4,2) = X Coord of segment 2, node 2<BR>Arr(5,2) = Y Coord of segment 2, node 2<BR>Arr(6,2) = Undefined<BR>Arr(7,2) = Undefined</FONT></P> |
|
2楼#
发布于:2008-09-06 19:03
<P>可以先全选图层中的线段,再用上面的方法获取起点和终点</P>
|
|