private void LayerLoaded(BikeTouringGISLayer layer) { if (layer != null) { BikeTouringGISLayers = new ObservableCollection <BikeTouringGISLayer>(_map.GetBikeTouringGISLayers()); } }
public void SelectedLayer_Is_Null_With_PoiLayer() { var layer = new BikeTouringGISLayer("poi"); _vm.SelectedLayer = layer; _vm.SelectedLayer.Should().BeNull(); }
private void SaveLayer(BikeTouringGISLayer obj) { if (obj != null) { obj.Save(GetWayPoints(obj)); } }
public void SelectedLayer_Is_Not_Null_With_SplitRouteLayer() { var layer = new BikeTouringGISLayer("test", _route); _vm.SelectedLayer = layer.SplitLayer; _vm.SelectedLayer.Type.Should().Be(LayerType.SplitRoutes); }
public void SelectedLayer_Is_Not_Null_With_GPXLayer() { _route = _fixture.Build <Route>().OmitAutoProperties().Create(); var layer = new BikeTouringGISLayer("test", _route); _vm.SelectedLayer = layer; _vm.SelectedLayer.Type.Should().Be(LayerType.GPXRoute); }
private void CenterMap(BikeTouringGISLayer obj) { var message = obj == null ? new ExtentChangedMessage(ExtentChangedReason.CenterMap) : new ExtentChangedMessage(ExtentChangedReason.CenterLayer) { Extent = obj?.Extent }; MessengerInstance.Send(message); }
private IEnumerable <wptType> GetWayPoints(BikeTouringGISLayer layer) { var source = layer.FileName; var selection = _pointsOfInterestLayer.WayPoints.Where(x => x.Source.Equals(source)); var result = new List <wptType>(); selection.ForEach(x => result.Add(x)); return(result); }
private void RemovePointsOfInterestOfRemovedLayer(BikeTouringGISLayer obj) { var source = obj.FileName; var layersWithSameSource = BikeTouringGISLayers.Any(x => x.FileName.Equals(source) && x.Type == LayerType.GPXRoute); if (!layersWithSameSource) { var wayPointsToRemove = _pointsOfInterestLayer.WayPoints.Where(x => x.Source.Equals(source)).ToList(); _pointsOfInterestLayer.RemovePoIs(wayPointsToRemove); } }
internal List <BikeTouringGISLayer> CreateRoutes(string fileName, List <Route> routes) { var result = new List <BikeTouringGISLayer>(); foreach (Route route in routes) { var layer = new BikeTouringGISLayer(fileName, route); layer.SetExtentToFitWithWaypoints(_wayPointsExtent); result.Add(layer); } return(result); }
// bug #34 public void LoadFile_Check_If_All_Have_Length() { var gpxInfo = LoadGPXData("Sample.gpx"); gpxInfo.Tracks.ForEach(x => x.IsConvertedToRoute = true); _geometryFactory.CreateGeometries(); foreach (var route in gpxInfo.Routes) { var layer = new BikeTouringGISLayer("testroute", route); layer.Extent.Should().NotBeNull($"route, {route.Name}"); } }
internal List <BikeTouringGISLayer> CreateTracks(string fileName, List <Track> tracks) { var result = new List <BikeTouringGISLayer>(); foreach (Track track in tracks) { var layer = new BikeTouringGISLayer(fileName, track); layer.SetExtentToFitWithWaypoints(_wayPointsExtent); result.Add(layer); } return(result); }
private void SaveLayerAs(BikeTouringGISLayer obj) { if (obj != null) { Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog(); saveFileDialog.Filter = "GPX files (*.gpx)|*.gpx"; saveFileDialog.InitialDirectory = DropBoxHelper.GetDropBoxFolder(); if (saveFileDialog.ShowDialog() == true) { obj.Save(GetWayPoints(obj), saveFileDialog.FileName); } } }
private BikeTouringGISLayer CreateLayer(string fileName) { var path = Path.Combine(UnitTestDirectory, fileName); var gpxInfo = new GpxFileReader().LoadFile(path); gpxInfo.Tracks.ForEach(x => x.IsConvertedToRoute = true); var factory = new GeometryFactory(gpxInfo); factory.CreateGeometries(); var layer = new BikeTouringGISLayer("testroute", gpxInfo.Routes.First()); layer.SetExtentToFitWithWaypoints(gpxInfo.WayPointsExtent); return(layer); }
private void RemoveLayer(BikeTouringGISLayer obj) { var splitLayer = obj.SplitLayer; _map.Layers.Remove(obj); _map.Layers.Remove(splitLayer); BikeTouringGISLayers.Remove(obj); RemovePointsOfInterestOfRemovedLayer(obj); SetExtent(); CalculateTotalLength(); PlacePointsOfInterestLayerOnTop(); MessengerInstance.Send(new LayerRemovedMessage() { Layer = obj }); }
private void SaveSplitRoute(BikeTouringGISLayer obj) { var baseDirectory = Path.GetDirectoryName(obj.FileName); int i = 1; foreach (var splitRoute in obj.SplitRoutes) { var filename = string.Format(@"{0}\{1}_{2}.gpx", baseDirectory, obj.SplitPrefix, i); var gpxFile = new GPXFile(); var gpx = new gpxType(); var rte = new rteType(); rte.name = $"{i}_{obj.SplitPrefix}"; rte.rtept = splitRoute.Points.ToArray(); gpx.rte = new List <rteType>() { rte }.ToArray(); gpxFile.Save(filename, gpx); i++; } }
private void FlipDirection(BikeTouringGISLayer obj) { obj.FlipDirection(); }
private void RemoveSplitRoute(BikeTouringGISLayer obj) { obj.RemoveSplitRoutes(); }