Esempio n. 1
0
        public DirectionsResultView(MapWidget mapWidget, FindCloseFacilityResultView fcfResultView, RouteResult routeResult, FindClosestResourceToolbar fcrToolbar)
        {
            InitializeComponent();
            base.DataContext = this;

            // Store a reference to the MapWidget that the toolbar has been installed to.
            _mapWidget = mapWidget;

            _closestFaculityResult      = fcfResultView;
            _findClosestFacilityToolbar = fcrToolbar;


            RouteName = routeResult.Directions.RouteName;
            Summary   = string.Format("{0:F1} {1}, {2}", routeResult.Directions.TotalLength, "miles", FormatTime(routeResult.Directions.TotalTime));

            List <Graphic> features = new List <Graphic>(routeResult.Directions.Features);

            features.RemoveAt(0);

            List <ManeuverViewModel> directionElements = new List <ManeuverViewModel>();
            Graphic previous = null;
            int     i        = 1;

            foreach (var next in features)
            {
                ManeuverViewModel maneuver = new ManeuverViewModel(previous, next, i++);
                maneuver.Graphic.MouseLeftButtonDown += Graphic_MouseLeftButtonDown;

                directionElements.Add(maneuver);
                previous = next;
            }

            Maneuvers = directionElements;
        }
Esempio n. 2
0
        private void lbManuever_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _findClosestFacilityToolbar.HiglightRouteLayer.Graphics.Clear();
            ManeuverViewModel selectedManuever = (ManeuverViewModel)lbManuever.SelectedItems[0];

            _findClosestFacilityToolbar._mapWidget.Map.ZoomTo(selectedManuever.SegmentGraphic.Geometry.Extent.Expand(1.2));

            _findClosestFacilityToolbar.HiglightRouteLayer.Graphics.Add(selectedManuever.SegmentGraphic);
        }
Esempio n. 3
0
        void Graphic_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var graphic = sender as Graphic;

            foreach (var m in Maneuvers)
            {
                if (m.Graphic == graphic)
                {
                    CurrentManeuver = m;
                    return;
                }
            }
        }
        public DirectionsResultView(MapWidget mapWidget, FindCloseFacilityResultView fcfResultView, RouteResult routeResult, FindClosestResourceToolbar fcrToolbar)
        {
            InitializeComponent();
            base.DataContext = this;

            // Store a reference to the MapWidget that the toolbar has been installed to.
            _mapWidget = mapWidget;

            _closestFaculityResult = fcfResultView;
            _findClosestFacilityToolbar = fcrToolbar;

            RouteName = routeResult.Directions.RouteName;
            Summary = string.Format("{0:F1} {1}, {2}", routeResult.Directions.TotalLength, "miles", FormatTime(routeResult.Directions.TotalTime));

            List<Graphic> features = new List<Graphic>(routeResult.Directions.Features);
            features.RemoveAt(0);

            List<ManeuverViewModel> directionElements = new List<ManeuverViewModel>();
            Graphic previous = null;
            int i = 1;

            foreach (var next in features)
            {
                ManeuverViewModel maneuver = new ManeuverViewModel(previous, next, i++);
                maneuver.Graphic.MouseLeftButtonDown += Graphic_MouseLeftButtonDown;

                directionElements.Add(maneuver);
                previous = next;
            }

            Maneuvers = directionElements;
        }