阅读:3697回复:13
用AO或者AE做地物编辑的时候...........
请问用AO或者AE做地物编辑的时候,想让选中的目标线条上的节点vertex用小方框高亮显示出来怎么做啊?请教了 谢谢啊
[此贴子已经被作者于2005-3-8 9:58:05编辑过]
|
|
1楼#
发布于:2005-03-10 15:57
<P>Modify Polygon</P>
<P>这是两个编辑Polygon的例子,一个是编辑顶点,一个是编辑线段。</P> <P>请问怎么样做到象arcmap里面那么爽的编辑节点效果,请指点一二或谈一下心得体会</P> <P> modifyOneVertexOfAPolygon shows how to modify a polygon vertex using Hittest.</P> <P>modifyOneSegmentOfAPolygon shows how to modify a polygon segment using Hittest.</P> <P>'************************************************************************* '* NAME: modifyOneVertexOfAPolygon '* DESCRIPTION: Modify a vertex of a multipart polygon using hittest to identify the vertex, '* move it and set the point back in the polygon.'* NOTE: '************************************************************************* Sub modifyOneVertexOfAPolygon() Dim pPolColl As IGeometryCollection, pPol As IPolygon, pHitTest As IHitTest, pTrans2D As ITransform2D, pPathColl As IPointCollection Dim pqpt As IPoint, dr As Double, pHit As IPoint, dht As Double, lPart As Long, lVertex As Long, bright As Boolean Set pPolColl = FunctionCreateMultiPartPolygonViaIGeometryCollection 'Here the polygon to be modified Set pPol = pPolColl Set pHitTest = pPolColl Set pqpt = pPol.FromPoint 'This could be an user input point (Ex: Mouse click etc.) dr = 1 Set pHit = New esriGeometry.Point 'Create the output point pHitTest.HitTest pqpt, dr, esriGeometryPartVertex, pHit, dht, lPart, lVertex, bright Set pPathColl = pPolColl.Geometry(lPart) 'Get the ring where the point is Set pTrans2D = pPathColl.Point(lVertex) 'Get the vertex that got hit pTrans2D.Move -10, 0 'Move the point pPathColl.UpdatePoint lVertex, pTrans2D 'Update the point via IPointCollection pPolColl.GeometriesChanged 'To let the polygon knows its geometry changed'User should call ITopologicalOperator::Simplify at this pointEnd Sub End Sub</P> <P>'************************************************************************* '* NAME: modifyOneSegmentOfAPolygon() '* DESCRIPTION: Modify a segment of a multipart polygon using hittest to identify the segment and '* move it.'* NOTE: '************************************************************************* Sub modifyOneSegmentOfAPolygon()</P> <P> Dim pPolColl As IGeometryCollection, pPol As IPolyline, pHitTest As IHitTest, pTrans2D As ITransform2D, pPathColl As ISegmentCollection Dim pqpt As IPoint, dr As Double, pHit As IPoint, dht As Double, lPart As Long, lSeg As Long, bright As Boolean Set pPolColl = FunctionCreateMultiPartPolygonViaIGeometryCollection 'Here the polygon to be modified Set pPol = pPolColl Set pHitTest = pPolColl Set pqpt = pPol.FromPoint 'This could be an user input point (Ex: Mouse click etc.) dr = 1 Set pHit = New esriGeometry.Point pHitTest.HitTest pqpt, dr, esriGeometryPartBoundary, pHit, dht, lPart, lSeg, bright Set pPathColl = pPolColl.Geometry(lPart) 'Get the ring where the point is Set pTrans2D = pPathColl.Segment(lSeg) 'Get the segment that got hit pTrans2D.Move -10, 0 'In this case the segment doesn't have to be set back in the geometry, since the segment'was returned by reference by pPathColl.Segment(lSeg) pPolColl.GeometriesChanged 'To let the polygon knows its geometry changed'User should call ITopologicalOperator::Simplify at this pointEnd Sub</P> <P>End Sub </P> [此贴子已经被作者于2005-3-10 16:04:31编辑过]
|
|
|
2楼#
发布于:2005-03-10 12:17
但是在AfterDraw中显示出节点以后,每次编辑,选中的图形都会闪好多次,为什么呢?
|
|
|
3楼#
发布于:2005-03-09 16:08
yeah!!谢了 关于这个问题 我估计以后大家都好办了 谢谢楼上的 谢谢斑竹<img src="images/post/smile/dvbbs/em04.gif" />
|
|
4楼#
发布于:2005-03-08 19:03
ShowAllVertex需要在MapControl的AfterDraw来做
|
|
5楼#
发布于:2005-03-08 17:17
<P>老大就是老大,我冥思苦想一下午也没思路</P><P>总算有了思路方向哈</P>
|
|
|
6楼#
发布于:2005-03-08 15:51
修改之后 测试了一下 发现选中某Polyline之后,其vertex and endpoints确实能够draw出来 但是只是一闪而过了 之后又回复了简单的选择状态 如何能够保持这些节点的突出显示状态呢?
|
|
7楼#
发布于:2005-03-08 15:10
谢谢老大啊 的确是很多接口还没有熟悉 也多谢指点<img src="images/post/smile/dvbbs/em02.gif" />
|
|
8楼#
发布于:2005-03-08 14:38
<P>这个只能是给你一些帮助</P><P>具体还需要你自己改,AO的接口比较多,关键是要你对接口了解了</P>
|
|
|
9楼#
发布于:2005-03-08 14:37
<P>'功能:在地图上显示所画图形
Public Sub displayGraphic(pGeometry As IGeometry, Optional pColor As IColor = Nothing, _ Optional pSymbol As ISymbol = Nothing) On Error GoTo errHandle: Dim pActiveView As IActiveView Set pActiveView = ff_m_Map</P><P> If Not pColor Is Nothing Then Dim pMSym As ISimpleMarkerSymbol Set pMSym = New SimpleMarkerSymbol pMSym.Style = esriSMSCircle pMSym.Color = pColor Dim pLSym As ISimpleLineSymbol Set pLSym = New SimpleLineSymbol pLSym.Color = pColor Dim pSFSym As ISimpleFillSymbol Set pSFSym = New SimpleFillSymbol pSFSym.Color = pColor pSFSym.Style = esriSFSSolid End If pActiveView.ScreenDisplay.StartDrawing pActiveView.ScreenDisplay.hDC, -1 Select Case pGeometry.GeometryType Case 1 If Not pColor Is Nothing Then pActiveView.ScreenDisplay.SetSymbol pMSym ElseIf Not pSymbol Is Nothing Then pActiveView.ScreenDisplay.SetSymbol pSymbol Else pActiveView.ScreenDisplay.SetSymbol m_MarkerSym End If pActiveView.ScreenDisplay.DrawPoint pGeometry Case 3 If Not pColor Is Nothing Then pActiveView.ScreenDisplay.SetSymbol pLSym ElseIf Not pSymbol Is Nothing Then pActiveView.ScreenDisplay.SetSymbol pSymbol Else pActiveView.ScreenDisplay.SetSymbol m_LineSym End If pActiveView.ScreenDisplay.DrawPolyline pGeometry Case 4 If Not pColor Is Nothing Then pActiveView.ScreenDisplay.SetSymbol pSFSym ElseIf Not pSymbol Is Nothing Then pActiveView.ScreenDisplay.SetSymbol pSymbol Else pActiveView.ScreenDisplay.SetSymbol m_FillSym End If pActiveView.ScreenDisplay.DrawPolygon pGeometry End Select pActiveView.ScreenDisplay.FinishDrawing Exit Sub errHandle: MsgBox Err.Description, vbOKOnly, "错误"</P><P>End Sub</P> |
|
|
上一页
下一页