public void RouteMaker_CreateRoutePoint_CreatesRoute() { if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) { throw new ThreadStateException("The current threads apartment state is not STA"); } DataProvider data = Factories.GetRouteData(); RouteMaker maker = new RouteMaker(); var testData = maker.CreateRoute(data, 3); List <Microsoft.Maps.MapControl.WPF.MapPolyline> locations = new List <Microsoft.Maps.MapControl.WPF.MapPolyline>(); MapPolyline arrow = new Microsoft.Maps.MapControl.WPF.MapPolyline(); MapPolyline line = new Microsoft.Maps.MapControl.WPF.MapPolyline(); Setup(line); line.Locations = new LocationCollection(); for (int i = 0; i < 3; i++) { var loc = data.Route.ElementAt(i); line.Locations.Add(new Location(loc)); } arrow = GetArrow(data.Route.First(), data.Route.ElementAt(1)); locations.Add(line); locations.Add(arrow); Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(0), testData.ElementAt(0))); Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(1), testData.ElementAt(1))); }
public void MapTimedViewModel_Initialize_CorrectRoute() { var data = Factories.GetRouteData(); var model = new MapTimedViewModel(data); model.Initialize(); model.SliderValueChanged(2); List <Microsoft.Maps.MapControl.WPF.MapPolyline> locations = new List <Microsoft.Maps.MapControl.WPF.MapPolyline>(); var arrow = new Microsoft.Maps.MapControl.WPF.MapPolyline(); var line = new Microsoft.Maps.MapControl.WPF.MapPolyline(); Setup(line); line.Locations = new LocationCollection(); for (int i = 0; i < 2; i++) { var loc = data.Route.ElementAt(i); line.Locations.Add(new Location(loc)); } arrow = GetArrow(data.Route.First(), data.Route.ElementAt(1)); locations.Add(line); locations.Add(arrow); Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(0), model.MapPolylines.ElementAt(0))); Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(1), model.MapPolylines.ElementAt(1))); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.myMap = ((Microsoft.Maps.MapControl.WPF.Map)(target)); return; case 2: this.theEstimatePin = ((Microsoft.Maps.MapControl.WPF.Pushpin)(target)); return; case 3: this.realFallPin = ((Microsoft.Maps.MapControl.WPF.Pushpin)(target)); return; case 4: this.MapPolyline = ((Microsoft.Maps.MapControl.WPF.MapPolyline)(target)); return; case 5: #line 49 "..\..\..\View\MapsUC.xaml" ((System.Windows.Controls.DatePicker)(target)).SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.DatePicker_SelectedDateChanged); #line default #line hidden return; case 6: this.FallsComboBox = ((System.Windows.Controls.ComboBox)(target)); #line 50 "..\..\..\View\MapsUC.xaml" this.FallsComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.FallsComboBox_SelectionChanged); #line default #line hidden return; case 7: this.NoReprtTxt = ((System.Windows.Controls.TextBox)(target)); return; case 8: this.buttonHow = ((System.Windows.Controls.Button)(target)); #line 52 "..\..\..\View\MapsUC.xaml" this.buttonHow.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 9: this.page = ((System.Windows.Controls.ContentControl)(target)); return; } this._contentLoaded = true; }
private void mapViewMouseMove(object sender, MouseEventArgs e) { //isFirstPress = true; if (e.RightButton == MouseButtonState.Pressed) { //e.Handled = true; if (isFirstPress == false) { Debug.WriteLine("draw"); Microsoft.Maps.MapControl.WPF.MapPolyline line = new Microsoft.Maps.MapControl.WPF.MapPolyline(); line.Locations = new Microsoft.Maps.MapControl.WPF.LocationCollection(); line.Locations.Add(mapView.ViewportPointToLocation(currentPoint)); line.Locations.Add(mapView.ViewportPointToLocation(e.GetPosition(this))); SolidColorBrush redBrush = new SolidColorBrush(); redBrush.Color = Colors.Red; line.Stroke = redBrush; line.Opacity = 0.5; line.Visibility = Visibility.Visible; line.StrokeThickness = 4; otherViewModel.Layer.Children.Add(line); } currentPoint = e.GetPosition(this); isFirstPress = false; } }
public void MapRouteViewModel_Initialize_CorrectRoute() { var data = Factories.GetRouteData(); var model = new MapRouteViewModel(data); model.Initialize(); List <Microsoft.Maps.MapControl.WPF.MapPolyline> locations = new List <Microsoft.Maps.MapControl.WPF.MapPolyline>(); var arrow = new Microsoft.Maps.MapControl.WPF.MapPolyline(); var line = new Microsoft.Maps.MapControl.WPF.MapPolyline(); Setup(line); line.Locations = data.Route; arrow = GetArrow(data.Route.First(), data.Route.ElementAt(1)); locations.Add(line); locations.Add(arrow); Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(0), model.MapPolylines.ElementAt(0))); Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(1), model.MapPolylines.ElementAt(1))); }
private static void Setup(Microsoft.Maps.MapControl.WPF.MapPolyline polyline) { polyline.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Orange); polyline.StrokeThickness = 3.5; polyline.Opacity = 0.9; }