浪花闪闪
路人甲
路人甲
  • 注册日期2005-10-12
  • 发帖数28
  • QQ
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1964回复:5

SceneControl控件里实现实现Identify

楼主#
更多 发布于:2006-01-04 10:45
<P>如何SceneControl控件里实现实现Identify 功能,MapControl我会,斑竹求救!</P>
喜欢0 评分0
siddy
路人甲
路人甲
  • 注册日期2006-12-18
  • 发帖数9
  • QQ
  • 铜币136枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-05-14 16:32
正好需要,我也看看!!
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2006-02-18 18:44
<P>楼上所言极是</P>
<P>偶只是给楼主一个思路</P><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
JIALAN
路人甲
路人甲
  • 注册日期2005-12-20
  • 发帖数24
  • QQ
  • 铜币193枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-02-18 10:26
<P>这个还不全啊 还有ITinLayer都没有做判断 而且RasterLayer的语句里面也有不对的, 'if not found, try first band of raster:<BR>        If pSurf Is Nothing Then<BR>            Exit Function<BR>        End If<BR>在判断出pSurf 为空时不能直接退出,应该if(pRSurf==null)<BR>    {<BR>     if(pRLayer.Raster!=null)<BR>     {<BR>      pSurf =new RasterSurfaceClass();<BR>      pBands = (IRasterBandCollection)pRLayer.Raster;<BR>      pRSurf.RasterBand = pBands.Item(0);</P>
<P>     }<BR>    }才完善</P>
举报 回复(0) 喜欢(0)     评分
浪花闪闪
路人甲
路人甲
  • 注册日期2005-10-12
  • 发帖数28
  • QQ
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-01-18 21:33
谢谢总统先生!
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
5楼#
发布于:2006-01-04 17:21
<P>原理是差不多的,接口有点不同了,下面的例子你可以看看</P>

<P>'Identifies point in scene using x,y coordinates and returns ID of selected point<BR>'The function was used by taking the x/y coordinates from the Scen1_OnMouseDown </P>
<P>event and passing into the functrion as newY and newY<BR>Public Function IdentifyPointXY(newX As Double, newY As Double) As Double<BR>    Dim pActiveView As IActiveView<BR>    Dim pMap As IMap<BR>    Dim pIdentify As IIdentify<BR>    Dim pPoint As IPoint<BR>    Dim pEnvelope As IEnvelope<BR>    Dim pIDArray As IArray<BR>    Dim pIdObj As IIdentifyObj<BR>    Dim pFeatIdObj As IFeatureIdentifyObj<BR>    Dim pRowObj As IRowIdentifyObject<BR>    Dim pIdentifyDialog As IIdentifyDialog<BR>    Dim pLayer As ILayer<BR>    Dim pFeature As IFeature<BR>        <BR>    Set pLayer = MainForm.Scene1.SceneGraph.Scene.Layer(0)<BR>    Set pScene = MainForm.Scene1.SceneGraph.Scene<BR>    <BR>    'Identify a shapefile point<BR>    If TypeOf pLayer Is IFeatureLayer Then<BR>        Set pIdentify = pLayer 'topmost layer<BR>        Set pPoint = New Point<BR>        pPoint.PutCoords newX, newY<BR>          <BR>        Set pEnvelope = pPoint.Envelope<BR>        pEnvelope.Expand 0.01, 0.01, False<BR>          <BR>        Set pIDArray = pIdentify.Identify(pEnvelope)<BR>          <BR>        'Get the FeatureIdentifyObject<BR>        If Not pIDArray Is Nothing Then<BR>            'tempLength = pIDArray.Element(0)<BR>            Set pFeatIdObj = pIDArray.Element(0)<BR>            a = pIDArray.Count<BR>            'Form1.Text4.Text = CStr(tempLength)<BR>            Set pIdObj = pFeatIdObj<BR>            'Set pIdObj = pIDArray.Count<BR>    <BR>            Set pRowObj = pFeatIdObj<BR>            Set pFeature = pRowObj.Row<BR>            'MainForm.SceneIDText.Text = CStr(pFeature.OID)<BR>            <BR>            Set pScene = MainForm.Scene1.SceneGraph.Scene<BR>            <BR>            Dim pGeom As IGeometry<BR>            Set pGeom = pFeature.Shape<BR>            Dim bJustOne As Boolean<BR>            pScene.SelectByShape pGeom, Nothing, bJustOne<BR>            <BR>            'Output ID of selected feature<BR>            IdentifyPointXY = pFeature.OID<BR>        Else<BR>            MsgBox "No feature identified.", vbCritical<BR>            'Stop<BR>        End If<BR>    'Identify a raster point<BR>    ElseIf TypeOf pLayer Is IRasterLayer Then<BR>        '<BR>        Dim pRLayer As IRasterLayer<BR>        Set pRLayer = pLayer<BR>        Dim pSurf As IRasterSurface<BR>        Dim p3DProp As I3DProperties<BR>        Dim pLE As ILayerExtensions<BR>        Set pLE = pLayer<BR>        <BR>        Dim i As Integer<BR>        'look for 3D properties of layer:<BR>        For i = 0 To pLE.ExtensionCount - 1<BR>            If TypeOf pLE.Extension(i) Is I3DProperties Then<BR>                Set p3DProp = pLE.Extension(i)<BR>                Exit For<BR>            End If<BR>        Next<BR>        <BR>        'look first for base surface of layer:<BR>        Set pSurf = p3DProp.BaseSurface<BR>        <BR>        'look first for base surface of layer:<BR>        Set pSurf = p3DProp.BaseSurface<BR>        <BR>        'if not found, try first band of raster:<BR>        If pSurf Is Nothing Then<BR>            Exit Function<BR>        End If<BR>        <BR>        Dim nSurf As ISurface<BR>        Set nSurf = pSurf<BR>        Dim nDoub As Double<BR>        'Create point to feed into GetElevation<BR>        Dim getElevationPoint As IPoint<BR>        Set getElevationPoint = New Point<BR>        getElevationPoint.X = newX<BR>        getElevationPoint.Y = newY<BR>        IdentifyPointXY = nSurf.GetElevation(getElevationPoint)<BR>    End If<BR>End Function<BR></P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部