private void ShowMapSegment(MapSegment r)
 {
     _gMap.Markers.Insert(LastElementIndex, r.Route);
     r.IsVisible = true;
     _count++;
     LastElementIndex++;
 }
 private void HideMapElement(MapSegment r)
 {
     if (_gMap.Markers.Remove(r.Route))
     {
         r.IsVisible = false;
         _count--;
         LastElementIndex--;
     }
 }
        public void Add(object obj, IEnumerable <PointLatLng> points, Brush brush)
        {
            var r = new GMapRoute(points);
            var s = new MapSegment(r, brush);

            _routes.Add(obj, s);

            if (_gMap == null)
            {
                return;
            }

            ShowMapSegment(s);

            CreateShape(r, brush);

            if (!LayerIsVisible)
            {
                HideMapElement(s);
            }
        }