private void LoadEntireNmeaTrack(string filename) { var layer = mapView.Map.Layers.OfType <GraphicsLayer>().First(); layer.Graphics.Clear(); if (currentNmeaFile == null) { return; } List <MapPoint> vertices = new List <MapPoint>(); using (var sr = System.IO.File.OpenText(filename)) { while (!sr.EndOfStream) { var line = sr.ReadLine(); if (line.StartsWith("$")) { try { var msg = NmeaParser.Nmea.NmeaMessage.Parse(line); if (msg is NmeaParser.Nmea.Gps.Gprmc) { var rmc = (NmeaParser.Nmea.Gps.Gprmc)msg; if (!double.IsNaN(rmc.Longitude)) { vertices.Add(new MapPoint(rmc.Longitude, rmc.Latitude)); } } } catch { } } } } var pline = new Esri.ArcGISRuntime.Geometry.Polyline(vertices, SpatialReferences.Wgs84); var linesymbol = new SimpleLineSymbol() { Width = 4, Color = Colors.CornflowerBlue }; var symbol = new CompositeSymbol(); symbol.Symbols.Add(linesymbol); symbol.Symbols.Add(new SimpleMarkerSymbol() { Size = 5, Color = Colors.Black }); Esri.ArcGISRuntime.Layers.Graphic g = new Esri.ArcGISRuntime.Layers.Graphic(pline, symbol); layer.Graphics.Add(g); }
private async void AddGraphics(string p_parameters, string p_textLabel ) { // check if there is a previous pinpoint //The constructor takes two arguments: the URI for the geocode service and a token (required for secured services). var uri = new Uri("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"); var token = String.Empty; var locator = new OnlineLocatorTask(uri, token); // OnlineLocatorFindParameters object, which holds all relevant information for the address search. var findParams = new OnlineLocatorFindParameters(p_parameters); findParams.OutSpatialReference = MyMapView.SpatialReference; findParams.SourceCountry = "US"; // var results = await locator.FindAsync(findParams, new System.Threading.CancellationToken()); if (results.Count > 0) { var firstMatch = results[0].Feature; var matchLocation = firstMatch.Geometry as MapPoint; //Add a point graphic at the address location var matchSym = new PictureMarkerSymbol(); var pictureUri = new Uri("http://static.arcgis.com/images/Symbols/Animated/EnlargeGradientSymbol.png"); await matchSym.SetSourceAsync(pictureUri); var matchGraphic = new Graphic(matchLocation, matchSym); // Get a reference to the graphic layer you defined for the map, and add the new graphic. var graphicsLayer = MyMap.Layers["MyGraphics"] as GraphicsLayer; graphicsLayer.Graphics.Add(matchGraphic); // create a text symbol: define color, font, size, and text for the label var textSym = new Esri.ArcGISRuntime.Symbology.TextSymbol(); textSym.Color = Colors.DarkRed; textSym.Font = new Esri.ArcGISRuntime.Symbology.SymbolFont("Arial", 12); textSym.BackgroundColor = Colors.White; textSym.Text = p_textLabel; //textSym.Angle = -60; // create a graphic for the text (apply TextSymbol) var textGraphic = new Esri.ArcGISRuntime.Layers.Graphic(matchLocation, textSym); graphicsLayer.Graphics.Add(textGraphic); } }
private void LoadEntireNmeaTrack(string filename) { var layer = mapView.Map.Layers.OfType<GraphicsLayer>().First(); layer.Graphics.Clear(); if (currentNmeaFile == null) return; List<MapPoint> vertices = new List<MapPoint>(); using (var sr = System.IO.File.OpenText(filename)) { while (!sr.EndOfStream) { var line = sr.ReadLine(); if (line.StartsWith("$")) { try { var msg = NmeaParser.Nmea.NmeaMessage.Parse(line); if (msg is NmeaParser.Nmea.Gps.Gprmc) { var rmc = (NmeaParser.Nmea.Gps.Gprmc)msg; if (!double.IsNaN(rmc.Longitude)) vertices.Add(new MapPoint(rmc.Longitude, rmc.Latitude)); } } catch { } } } } var pline = new Esri.ArcGISRuntime.Geometry.Polyline(vertices, SpatialReferences.Wgs84); var linesymbol = new SimpleLineSymbol() { Width = 4, Color = Colors.CornflowerBlue }; var symbol = new CompositeSymbol(); symbol.Symbols.Add(linesymbol); symbol.Symbols.Add(new SimpleMarkerSymbol() { Size = 5, Color = Colors.Black }); Esri.ArcGISRuntime.Layers.Graphic g = new Esri.ArcGISRuntime.Layers.Graphic(pline, symbol); layer.Graphics.Add(g); }