ArcGIS三维入门(6-7)ArcGIS三维C/S开发一体化

本文目录
  • 正文

构建系统人们常常希望在一个系统中能够同时包含二维和三维 GIS 的功能,能够实现二三维联动。利用ArcGIS Engine 提供的二维控件MapContronl 和三维控件GlobeControl能够快速实现二三维联动。三维显示组件与二维显示组件可以集成使用,可以共享同一个工作空间和数据库连接,基于相同的数据集,既可以二维显示,也可以三维显示;使用空间分析组件,其分析的结果,既可以在二维组件显示,也可以在三维组件显示;二三维联动演示,如图

核心实现代码:

#region  维向二维同步代码
void m_pGlobeDisplayEvents_AfterDraw( ESRI.ArcGIS.Analyst3D.ISceneViewer pViewer )
{
  m_globeViewUtil.QueryVisibleGeographicExtent( m_pCurMapExt );
  if ( m_pCurMapExt == null )
  {
    return;
  }
  /* 'Obtain the locations of the observer and target of the camera */
  IPoint    ObsPoint    = null;
  IPoint    TgtPoint    = null;
  GetObserverTarget( out ObsPoint, out TgtPoint );

  /* //缩小范围 */
  m_pCurMapExt.CenterAt( TgtPoint );
  m_MapActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds = m_pCurMapExt;

  m_MapActiveView.PartialRefresh( esriViewDrawPhase.esriViewGeography, null, null );
}


void GetObserverTarget( out IPoint ObsPoint, out IPoint TgtPoint )
{
  /* Obtain the locations of the observer and target of the camera */
  ObsPoint = null;             TgtPoint = null;
  if ( m_GlobeDisplay == null )
    return;
  if ( m_GlobeDisplay.ActiveViewer == null )
    return;
  IGlobeCamera  pGlobeCamera = m_GlobeDisplay.ActiveViewer.Camera as IGlobeCamera;
  double        obsLat, obsLon, obsAltKms;
  pGlobeCamera.GetObserverLatLonAlt( out obsLat, out obsLon, out obsAltKms );
  double tgtLat, tgtLon, tgtAltKms;
  pGlobeCamera.GetTargetLatLonAlt( out tgtLat, out tgtLon, out tgtAltKms );
  ObsPoint  = new ESRI.ArcGIS.Geometry.Point();             IZAware pZAware = ObsPoint as IZAware;
  pZAware.ZAware    = true;
  ObsPoint.PutCoords( obsLon, obsLat );
  ObsPoint.Z = obsAltKms;

  TgtPoint  = new ESRI.ArcGIS.Geometry.Point();
  pZAware       = TgtPoint as IZAware;
  pZAware.ZAware    = true;
  TgtPoint.PutCoords( tgtLon, tgtLat );
  TgtPoint.Z = tgtAltKms;
}


#endregion
#region 二维向三维同步代码

void m_pActiveViewEvents_AfterDraw( ESRI.ArcGIS.Display.IDisplay Display, esriViewDrawPhase phase )
{
  IActiveView pActiveView = m_Globe as IActiveView;

  pActiveView.Extent = m_MapActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds;
  pActiveView.Refresh();
}


#endregion

ArcGIS C/S 开发一体化的优势:

无缝二三维开发体系,系统开发集成更加方便,有助于开发出更加面向业务需求的应用系统。

手册目录

本手册的全部内容: ArcGIS三维入门手册

如您有疑问,可在文末留言,或到QQ群提问。
本站QQ群:291616564 麻辣GIS
微信公众号:malagis,扫描二维码直接关注。

打赏¥1

作者:,地理小学生。
分享本文,请您带上本文链接
分享到:

发表评论