xiaolinzi
路人甲
路人甲
  • 注册日期2004-03-29
  • 发帖数35
  • QQ
  • 铜币149枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1532回复:1

[求助]帮忙看下选择元素的代码?谢谢

楼主#
更多 发布于:2007-12-24 10:29
帮忙看下选择元素的代码?谢谢<BR><BR>
<DIV>void CTestAeView::SelectElement(long x,long y) <BR>{<BR>  pActiveView = m_ipmap;<BR>IEnumElementPtr pEnumElem;<BR>IGraphicsContainerPtr pGraphicsContainer(m_ipmap);<BR>IGraphicsContainerSelectPtr pGraphicsContainerSelect(m_ipmap);<BR>IRubberBandPtr pRubberBand(CLSID_RubberEnvelope);<BR>IScreenDisplayPtr  pScreenDisplay;<BR>IEnvelope2Ptr pEnvelop(CLSID_Envelope);<BR>IGeometry2Ptr pGeom(pEnvelop);<BR>    pActiveView->get_ScreenDisplay(;pScreenDisplay);<BR>pRubberBand->TrackNew(pScreenDisplay,NULL,NULL);<BR>pGraphicsContainerSelect->UnselectAllElements();<BR>if (pEnvelop == NULL)<BR>{<BR>  IDisplayTransformationPtr pDisplayTransformation;<BR>  pScreenDisplay->get_DisplayTransformation(;pDisplayTransformation);<BR>  IPointPtr pPoint(CLSID_Point);<BR>  pDisplayTransformation->ToMapPoint(x,y,;pPoint);<BR>  double w;<BR>  pEnvelop->get_Width(;w);<BR>  pActiveView->put_Extent(pEnvelop);<BR>  pGraphicsContainer->LocateElements(pPoint,w/200,;pEnumElem);<BR>}<BR>else<BR>{<BR>        pGraphicsContainer->LocateElementsByEnvelope(pEnvelop,;pEnumElem);<BR>}<BR>if (pEnumElem != NULL)<BR>{<BR>  pGraphicsContainerSelect->UnselectAllElements();<BR>  pEnumElem->Reset();<BR>  pGraphicsContainerSelect->SelectElements(;pEnumElem);<BR>  IElementPtr pElement;<BR>  pEnumElem->Next(;pElement);<BR>}<BR>   pActiveView->PartialRefresh(esriViewGraphicSelection,NULL,NULL);<BR>}<BR>为什么选不中元素?问题出在哪里?</DIV>
喜欢0 评分0
wavvylia
路人甲
路人甲
  • 注册日期2003-07-28
  • 发帖数384
  • QQ
  • 铜币555枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2007-12-26 10:12
你用pActiveView.Refresh()刷新一下试试。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部