internal void AppendPoint(PointViewModel newPoint)
 {
     if (newPoint != null)
     {
         Model.Append(newPoint.Model);
     }
 }
        //public bool DrawLabels { get; set; }


        internal void RemovePoint(PointViewModel selected)
        {
            if (selected != null)
            {
                var index = selected.Parent.Children.IndexOf(selected);
                if (index >= 0)
                {
                    selected.Parent.Children.RemoveAt(index);
                    Model.RemoveAt(index);
                }
            }
        }
        public EditPointWindow(PointViewModel point)
        {
            InitializeComponent();
            this.Point = point;
            if (point != null)
            {
                txtLatitude.Text  = point.Latitude.ToString();
                txtLongitude.Text = point.Longitude.ToString();
            }

            Loaded += new RoutedEventHandler(EditPointWindow_Loaded);
        }
        private void AddNewPoint()
        {
            var pointSet = GetSelectedPointSet();

            if (pointSet != null)
            {
                var newPoint  = new MapPoint();
                var viewModel = new PointViewModel(newPoint);
                var frm       = new EditPointWindow(viewModel);
                frm.Owner = this.FindParentWindow();
                frm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                if (frm.ShowDialog() == true)
                {
                    pointSet.Children.Add(viewModel);
                    pointSet.AppendPoint(viewModel);
                    viewModel.Parent     = pointSet;
                    viewModel.IsSelected = true;
                }
            }
        }
        private void AddPointSet(MapPointSet set)
        {
            var viewModel = new PointSetViewModel(set);

            _model.Add(viewModel);
            var killlist = new List <PointViewModel>();

            foreach (MapPoint p in set)
            {
                var childVM = new PointViewModel(p);
                childVM.Parent = viewModel;
                viewModel.Children.Add(childVM);
                if (p.Latitude == 0 && p.Longitude == 0)
                {
                    killlist.Add(childVM);
                }
            }

            foreach (PointViewModel p in killlist)
            {
                viewModel.RemovePoint(p);
            }
        }
 private void RemovePoint(PointViewModel point, MapPointSet set)
 {
 }