涩的发甜
路人甲
路人甲
  • 注册日期2006-05-06
  • 发帖数35
  • QQ
  • 铜币304枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2045回复:2

[求助]请教scenegraph.Locate方法

楼主#
更多 发布于:2007-12-29 01:26
<P>public void Locate (<BR>    ISceneViewer pViewer,<BR>    int x,<BR>    int y,<BR>    esriScenePickMode mode,<BR>    bool bGetTransformed,<BR>    ref IPoint ppPt,<BR>    ref object ppOwner,<BR>    ref object ppObject<BR>);</P>

<P><BR>下面是我用c#+AO写程序。</P>
<P>ISceneGraph scenegraph = axSceneControl1.SceneGraph;<BR>            ISceneViewer pviewer = scenegraph.ActiveViewer;</P>
<P>            IPoint ppoint;<BR>            object  powner;<BR>            object pobject;<BR>            int  xpos=0;<BR>            int ypos=0;<BR>        </P>
<P>            scenegraph.Locate(pviewer, xpos, ypos, esriScenePickAll,true, ref  ppoint, ref   powner, ref  pobject);</P>

<P>请问一下这里面的这个esriScenePickMode mode,,怎么来定义呢?好像有<STRONG>esriScenePickAll等六个值可以取,为什么我输上这个值就说不存在名称“esriScenePickAll”呢?使用之前因该怎么定义呢?谢谢。</STRONG></P><img src="images/post/smile/dvbbs/em04.gif" />
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15945
  • QQ554730525
  • 铜币25337枚
  • 威望15352点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2007-12-29 09:13
Locate Example
<P>这个是帮助里的一个例子,vb写的</P>
<H1>Locate Example</H1><CODE><PRE>'<br>' In ArcScene, create a new UIControl via the<br>' Tools | Customize | Commands | UIControl menu.<br>' Drag the new tool to a toolbar and choose 'View Source' from<br>' its context menu when you right-click it.<br>' Enter this code for the MouseDown event, as well as<br>' the 'LocatePointInScene' function.<br>' Use the tool to click on a feature in the scene, and a message<br>' box will display the x, y, and z coordinates of the location clicked,<br>' after being converted from the screen coordinates.<br>'<br>Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)<br>  Dim pScene As IScene<br>  Dim pSxDoc As ISxDocument<br>  Set pSxDoc = ThisDocument<br>  Set pScene = pSxDoc.Scene<br>  <br>  Dim pPt As IPoint<br>  Set pPt = LocatePointInScene(pScene, x, y, esriScenePickAll)<br>  <br>  If Not pPt Is Nothing Then<br>    MsgBox "Location clicked: " ; Format(pPt.x, "#####.###") ; ", " ; Format(pPt.y, "#####.###") ; ", " ; Format(pPt.Z, "#####.###")<br>  End If<br>  <br>End Sub<br>'<br>'  use the designated Scene to return an IPoint at the given location<br>'<br>Public Function LocatePointInScene(pScene As IScene, x As Long, y As Long, nMode As esriScenePickMode, Optional pOutLayer As ILayer, Optional pOutFeature As IFeature) As IPoint<br>  On Error GoTo err<br>  ' point to the scene's scene graph object:<br>  Dim pSG As ISceneGraph<br>  Set pSG = pScene.SceneGraph<br>  <br>  ' point to the scene viewer:<br>  Dim pViewer As ISceneViewer<br>  Set pViewer = pSG.ActiveViewer<br>  <br>  ' declare return objects for the Locate command:<br>  Dim pOwner As stdole.IUnknown<br>  Dim pObject As stdole.IUnknown</PRE><PRE><FONT color=#ff0000>  ' call the locate method of the scene graph.<br>  ' (the output point is set to be returned automatically<br>  ' as the function name below):<br>  pSG.Locate pViewer, x, y, nMode, True, LocatePointInScene, pOwner, pObject</FONT></PRE><PRE>  ' optionally return the found feature:<br>  If Not IsMissing(pOutFeature) Then<br>    If Not pObject Is Nothing Then<br>      If TypeOf pObject Is IFeature Then<br>         Set pOutFeature = pObject<br>      End If<br>    End If<br>  End If<br>  <br>  '  optionally return the found layer:<br>  If Not IsMissing(pOutLayer) Then<br>    If Not pOwner Is Nothing Then<br>      If TypeOf pOwner Is ILayer Then<br>        Set pOutLayer = pOwner<br>      End If<br>    End If<br>  End If<br>    <br>  ' free objects:<br>  Set pOwner = Nothing<br>  Set pObject = Nothing<br>  Exit Function<br>    <br>err:<br>    <br>End Function</PRE></CODE>
[此贴子已经被作者于2007-12-29 9:13:47编辑过]
举报 回复(0) 喜欢(0)     评分
涩的发甜
路人甲
路人甲
  • 注册日期2006-05-06
  • 发帖数35
  • QQ
  • 铜币304枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2007-12-29 11:25
这个例子我看了,里面的esriScenePickMode只是简单的nMode As esriScenePickMode了一下,但是在c #里这样不行
举报 回复(0) 喜欢(0)     评分
游客

返回顶部