첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.

728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainForm.cs

using System;

using DevExpress.XtraEditors;
using DevExpress.XtraMap;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : XtraForm
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region Field

        /// <summary>
        /// 빙 맵 키
        /// </summary>
        private string bingKey = "INPUT YOUR BING KEY";

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            Load += Form_Load;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region 폼 로드시 처리하기 - Form_Load(sender, e)

        /// <summary>
        /// 폼 로드시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void Form_Load(object sender, EventArgs e)
        {
            this.bingMapDataProvider.BingKey = this.bingKey;

            BingElevationDataProvider bingElevationDataProvider = new BingElevationDataProvider();
            
            bingElevationDataProvider.BingKey            = this.bingKey;
            bingElevationDataProvider.ProcessMouseEvents = true;

            this.informationLayer.DataProvider = bingElevationDataProvider;

            bingElevationDataProvider.ElevationsCalculated += bingElevationDataProvider_ElevationsCalculated;
        }

        #endregion
        #region 빙 고도 데이터 공급자 고도 계산시 처리하기 - bingElevationDataProvider_ElevationsCalculated(sender, e)

        /// <summary>
        /// 빙 고도 데이터 공급자 고도 계산시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void bingElevationDataProvider_ElevationsCalculated(object sender, ElevationsCalculatedEventArgs e)
        {
            if(e.Cancelled == true || e.Error != null)
            {
                return;
            }

            if(e.Result.ResultCode != RequestResultCode.Success)
            {
                return;
            }

            this.informationLayer.Data.Items.Clear();

            foreach(ElevationInformation information in e.Result.Locations)
            {
                this.informationLayer.Data.Items.Insert
                (
                    0,
                    new MapCallout
                    {
                        Location = information.Location,
                        Text     = string.Format(" 고도 : {0}m", information.Elevation)
                    }
                );
            }
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요