ziliujiang
路人甲
路人甲
  • 注册日期2004-08-11
  • 发帖数15
  • QQ
  • 铜币158枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:3697回复:13

用AO或者AE做地物编辑的时候...........

楼主#
更多 发布于:2005-03-08 09:55
请问用AO或者AE做地物编辑的时候,想让选中的目标线条上的节点vertex用小方框高亮显示出来怎么做啊?请教了 谢谢啊
[此贴子已经被作者于2005-3-8 9:58:05编辑过]
喜欢0 评分0
waterblue
路人甲
路人甲
  • 注册日期2004-09-02
  • 发帖数72
  • QQ
  • 铜币387枚
  • 威望0点
  • 贡献值0点
  • 银元0个
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编辑过]
http://www.geostar.com.cn(吉奥 公司) http://www.waterblue.com.cn(水之灵,蓝之静 个人)
举报 回复(0) 喜欢(0)     评分
万里云
路人甲
路人甲
  • 注册日期2005-01-14
  • 发帖数114
  • QQ
  • 铜币414枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-03-10 12:17
但是在AfterDraw中显示出节点以后,每次编辑,选中的图形都会闪好多次,为什么呢?
女口果人尔能看日月白这段言舌,那言兑日月人尔白勺目艮目青有严重白勺散光 
举报 回复(0) 喜欢(0)     评分
ziliujiang
路人甲
路人甲
  • 注册日期2004-08-11
  • 发帖数15
  • QQ
  • 铜币158枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-03-09 16:08
yeah!!谢了 关于这个问题 我估计以后大家都好办了 谢谢楼上的 谢谢斑竹<img src="images/post/smile/dvbbs/em04.gif" />
举报 回复(0) 喜欢(0)     评分
xxwwdd
路人甲
路人甲
  • 注册日期2003-08-19
  • 发帖数88
  • QQ
  • 铜币230枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2005-03-08 19:03
ShowAllVertex需要在MapControl的AfterDraw来做
举报 回复(0) 喜欢(0)     评分
万里云
路人甲
路人甲
  • 注册日期2005-01-14
  • 发帖数114
  • QQ
  • 铜币414枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-03-08 17:17
<P>老大就是老大,我冥思苦想一下午也没思路</P><P>总算有了思路方向哈</P>
女口果人尔能看日月白这段言舌,那言兑日月人尔白勺目艮目青有严重白勺散光 
举报 回复(0) 喜欢(0)     评分
ziliujiang
路人甲
路人甲
  • 注册日期2004-08-11
  • 发帖数15
  • QQ
  • 铜币158枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2005-03-08 15:51
修改之后 测试了一下 发现选中某Polyline之后,其vertex and endpoints确实能够draw出来 但是只是一闪而过了 之后又回复了简单的选择状态   如何能够保持这些节点的突出显示状态呢?
举报 回复(0) 喜欢(0)     评分
ziliujiang
路人甲
路人甲
  • 注册日期2004-08-11
  • 发帖数15
  • QQ
  • 铜币158枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2005-03-08 15:10
谢谢老大啊 的确是很多接口还没有熟悉 也多谢指点<img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
8楼#
发布于:2005-03-08 14:38
<P>这个只能是给你一些帮助</P><P>具体还需要你自己改,AO的接口比较多,关键是要你对接口了解了</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
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>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
上一页
游客

返回顶部