■ GraphColorizer 클래스를 사용해 윤곽선 색상을 표시하는 방법을 보여준다.
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
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 } } |