Esempio n. 1
0
        public virtual void RegeneratePolygonShape(MapControl map)
        {
            this.map = map;

            if (map != null && Polygon.Count > 1)
            {
                var localPath = new List <System.Windows.Point>();
                var offset    = Map.FromLatLngToLocal(Polygon[0]);
                foreach (var i in Polygon)
                {
                    var p = Map.FromLatLngToLocal(new PointLatLng(i.Lat, i.Lng));
                    localPath.Add(new System.Windows.Point(p.X - offset.X, p.Y - offset.Y));
                }

                var shape = map.CreatePolygonPath(localPath);

                if (this.Shape != null && this.Shape is Path)
                {
                    (this.Shape as Path).Data = shape.Data;
                }
                else
                {
                    this.Shape = shape;
                }
            }
        }