コード例 #1
0
        protected override void InitMap()
        {
            base.InitMap();
            c1Map1.Viewport.Zoom = 1;
            var layer = MapReader.LoadKmlFile("Resources\\2.5_day_depth.kml", (vector, data) =>
            {
                var placemark = vector as C1.Win.Map.VectorPlacemark;
                if (placemark == null)
                {
                    return;
                }

                var name                       = data["name"] as string;
                placemark.Tag                  = name;
                placemark.Marker.Caption       = name;
                placemark.Marker.Shape         = MarkerShape.Custom;
                placemark.Marker.CustomShape   = new EarthquakeShape();
                placemark.Marker.LabelPosition = LabelPosition.Right;
                placemark.Marker.Size          = new SizeF(10, 6);
                placemark.LabelStyle.BackColor = Color.FromArgb(0x70, Color.White);
                placemark.LabelWidth           = 150;
            });

            layer.Style.Stroke.Color = Color.FromArgb(0x90, 0xff, 0x00, 0x00);
            layer.Style.Stroke.Width = 2;
            layer.LabelVisibility    = LabelVisibility.AutoHide;

            c1Map1.Layers.Add(layer);
        }
コード例 #2
0
        private void CreateWorldMap()
        {
            var layerWorld = MapReader.LoadKmlFile("Resources\\WorldMap.kmz", (vector, data) =>
            {
                var name               = data["name"] as string;
                vector.Tag             = name;
                vector.Style.BackColor = MapReader.GetKmlStyleColor(data[KmlReader.StyleFillColor] as string);

                var placemark = vector as VectorPlacemark;
                if (placemark != null)
                {
                    placemark.Marker.Caption = name;
                    placemark.Lod            = new LOD(0, 0, 2, 20);
                }
            });

            layerWorld.LabelVisibility      = LabelVisibility.AutoHide;
            layerWorld.LabelStyle.ForeColor = Color.FromArgb(0x97, 0x35, 0x35);
            c1Map1.Layers.Add(layerWorld);
        }
コード例 #3
0
        protected override void InitMap()
        {
            base.InitMap();
            c1Map1.Viewport.Zoom = 1;
            // read text data from resources
            foreach (var s in File.ReadAllLines("Resources\\gdp-ppp.txt"))
            {
                var ss = s.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);

                _countries.Add(new Country
                {
                    Name  = ss[1].Trim(),
                    Value = double.Parse(ss[2], CultureInfo.InvariantCulture)
                });
            }

            // create palette
            var cvals = new ColorValues
            {
                new ColorValue {
                    Color = Color.FromArgb(255, 241, 244, 255), Value = 0
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 241, 244, 255), Value = 5000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 224, 224, 246), Value = 10000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 203, 205, 255), Value = 20000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 179, 182, 230), Value = 50000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 156, 160, 240), Value = 100000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 127, 132, 243), Value = 200000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 89, 97, 230), Value = 500000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 56, 64, 217), Value = 1000000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 19, 26, 148), Value = 2000000
                },
                new ColorValue {
                    Color = Color.FromArgb(255, 0, 3, 74), Value = 1.001 * _countries.GetMax()
                }
            };

            _countries.Converter = cvals;

            // read world map from resources
            var layerWorld = MapReader.LoadKmlFile("Resources\\WorldMap.kmz", (vector, data) =>
            {
                var name   = data["name"] as string;
                vector.Tag = name;

                var country = _countries[name];
                if (country != null)
                {
                    vector.Style.BackColor = country.Fill;
                }

                var placemark = vector as C1.Win.Map.VectorPlacemark;
                if (placemark != null)
                {
                    placemark.Marker.Caption = name;
                    placemark.Lod            = new LOD(0, 0, 2, 20);
                }
            });

            layerWorld.LabelVisibility      = LabelVisibility.AutoHide;
            layerWorld.LabelStyle.ForeColor = Color.FromArgb(0x97, 0x35, 0x35);
            c1Map1.Layers.Add(layerWorld);

            // reserve space for legend
            c1Map1.Viewport.Margin = new Padding(0, 0, 100, 0);

            InitKmlLegend();
        }