internal static Map Default() { string currdir = Directory.GetCurrentDirectory(); Trace.WriteLine(String.Format("Current directory: {0}", currdir)); Map map = new Map(new Size(1, 1)); IDictionary <string, LayerData> dict = Nyc; foreach (string layer in dict.Keys) { string format = String.Format(@"WMS\Server\data\{0}", layer); string path = Path.Combine(currdir, format); if (!File.Exists(path)) { throw new FileNotFoundException("file not found", path); } string name = Path.GetFileNameWithoutExtension(layer); LayerData data = dict[layer]; ShapeFile source = new ShapeFile(path, true); VectorLayer item = new VectorLayer(name, source) { SRID = 4326, Style = (VectorStyle)data.Style, SmoothingMode = SmoothingMode.AntiAlias }; map.Layers.Add(item); } return(map); }
static Helper() { LayerData landmarks = new LayerData { LabelColumn = "LANAME", Style = new VectorStyle { EnableOutline = true, Fill = new SolidBrush(Color.FromArgb(192, Color.LightBlue)) } }; LayerData roads = new LayerData { LabelColumn = "NAME", Style = new VectorStyle { EnableOutline = false, Fill = new SolidBrush(Color.FromArgb(192, Color.LightGray)), Line = new Pen(Color.FromArgb(200, Color.DarkBlue), 0.5f) } }; LayerData pois = new LayerData { LabelColumn = "NAME", Style = new VectorStyle { PointColor = new SolidBrush(Color.FromArgb(200, Color.DarkGreen)), PointSize = 10 } }; Nyc = new Dictionary <string, LayerData> { { "nyc/poly_landmarks.shp", landmarks }, { "nyc/tiger_roads.shp", roads }, { "nyc/poi.shp", pois } }; }
static Helper() { LayerData landmarks = new LayerData { LabelColumn = "LANAME", Style = new VectorStyle { EnableOutline = true, Fill = new SolidBrush(Color.FromArgb(192, Color.LightBlue)) } }; LayerData roads = new LayerData { LabelColumn = "NAME", Style = new VectorStyle { EnableOutline = false, Fill = new SolidBrush(Color.FromArgb(192, Color.LightGray)), Line = new Pen(Color.FromArgb(200, Color.DarkBlue), 0.5f) } }; LayerData pois = new LayerData { LabelColumn = "NAME", Style = new VectorStyle { PointColor = new SolidBrush(Color.FromArgb(200, Color.DarkGreen)), PointSize = 10 } }; Nyc = new Dictionary<string, LayerData> { { "nyc/poly_landmarks.shp", landmarks }, { "nyc/tiger_roads.shp", roads }, { "nyc/poi.shp", pois } }; }