첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainForm.cs

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;

using DevExpress.XtraMap;
using DevExpress.XtraEditors;

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

        #region 생성자 - MainForm()

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

            #region 맵 컨트롤을 설정한다.

            MapControl mapControl = new MapControl();

            mapControl.Parent      = this;
            mapControl.Dock        = DockStyle.Fill;
            mapControl.CenterPoint = new GeoPoint(38, -100);
            mapControl.ZoomLevel   = 2;

            #endregion
            #region 도형 파일 데이터 어댑터를 설정한다.

            ShapefileDataAdapter shapefileDataAdapter = new ShapefileDataAdapter();

            Uri baseURI = new Uri(Assembly.GetEntryAssembly().Location);

            string filePath = "DATA/Countries.shp";

            shapefileDataAdapter.FileUri = new Uri(baseURI, filePath);

            #endregion
            #region 그래프 색상화기를 설정한다.

            GraphColorizer graphColorizer = new GraphColorizer();

            graphColorizer.ColorItems.AddRange
            (
                new List<ColorizerColorItem>
                { 
                    new ColorizerColorItem(Color.FromArgb(0xf1, 0xc1, 0x49)), 
                    new ColorizerColorItem(Color.FromArgb(0xe5, 0xa8, 0x4d)),
                    new ColorizerColorItem(Color.FromArgb(0xc5, 0x64, 0x50)),
                    new ColorizerColorItem(Color.FromArgb(0xd6, 0x86, 0x4e)),
                    new ColorizerColorItem(Color.FromArgb(0x79, 0x96, 0x89)), 
                    new ColorizerColorItem(Color.FromArgb(0xa2, 0xa8, 0x75))
                }
            );

            #endregion
            #region 벡터 항목 레이어를 설정한다.

            VectorItemsLayer vectorItemsLayer = new VectorItemsLayer();

            vectorItemsLayer.Data      = shapefileDataAdapter;
            vectorItemsLayer.Colorizer = graphColorizer;

            mapControl.Layers.Add(vectorItemsLayer);

            #endregion
        }

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

댓글을 달아 주세요