[ArcObjects]Move Center
ArcObjects 사용시 선택/검색/사용자가 그린 도형(IGeometry)을 지도의 중앙으로 이동하고자 할때 사용하는 코드이다.
public static void MoveCenter(IMap focusMap, IGeometry targetGeometry) { if (targetGeometry == null || targetGeometry.IsEmpty) return; IActiveView activeView = (IActiveView)focusMap; IEnvelope mapExtent = activeView.Extent; IPoint centerPoint = new PointClass(); centerPoint.X = (targetGeometry.Envelope.XMin + targetGeometry.Envelope.XMax) / 2.0; centerPoint.Y = (targetGeometry.Envelope.YMin + targetGeometry.Envelope.YMax) / 2.0; mapExtent.CenterAt(centerPoint); activeView.Extent = mapExtent; activeView.Refresh(); }
댓글
댓글 쓰기