private CodeValuePair HandlePolyline() { var codeValue = GetPair(); var polyline = new Polyline(); while (!Ended) { switch (codeValue.Code) { case 0: if (codeValue.Value != VERTEX) { Polylines.Add(polyline); return(codeValue); } else { HandleVertexSegment(polyline); } break; default: polyline.ParseCode(codeValue); break; } codeValue = GetPair(); } return(codeValue); }
private void showRoute() { var routePoints = GooglePolylineCoder.DecodeGooglePolyline(webOrder.RouteMetrics); var polyline = new Polyline(); polyline.StrokeColor = Color.Blue; polyline.StrokeWidth = 5f; //polyline.Tag = "POLYLINE"; // Can set any object foreach (var point in routePoints) { polyline.Positions.Add(new Position(point.Lat, point.Lon)); } var positions = routePoints.Select(rp => new Position(rp.Lat, rp.Lon)).ToList(); CenterMapFromPositions = positions; Polylines.Clear(); Polylines.Add(polyline); var startPoint = routePoints.FirstOrDefault(); var endPin = routePoints.LastOrDefault(); var startPin = new Pin { Position = new Position(startPoint.Lat, startPoint.Lon), IsDraggable = false, IsVisible = true, Label = "Старт", Address = webOrder.SrcAddress.StreetOrPlace + ", " + webOrder.SrcAddress.House, Type = PinType.Place }; var assembly = typeof(ConfirmOrderPage).GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream($"taxi.Images.start_s.png"); startPin.Icon = BitmapDescriptorFactory.FromStream(stream); var finishPin = new Pin { Position = new Position(endPin.Lat, endPin.Lon), IsDraggable = false, IsVisible = true, Label = "Финиш", Type = PinType.Place, Address = webOrder.DstAddresses[0].StreetOrPlace + ", " + webOrder.DstAddresses[0].House }; stream = assembly.GetManifestResourceStream($"taxi.Images.finish_s.png"); finishPin.Icon = BitmapDescriptorFactory.FromStream(stream); Pins.Add(startPin); Pins.Add(finishPin); }
void UpdateRoute() { if (RouteCoordinates.Count > 2) { polyline = new Polyline(); foreach (GeoPosition p in RouteCoordinates) { polyline.Positions.Add(new Position(p.Latitude, p.Longitude)); } Polylines.Add(polyline); CenterMap(); } }
private void DesenharRota(List <Position> lista) { if (lista.Count > 1) { var polyline = new Polyline(); foreach (Position posi in lista) { polyline.Positions.Add(posi); } polyline.IsClickable = true; polyline.StrokeColor = Color.Blue; polyline.StrokeWidth = 2f; Polylines.Add(polyline); } }
private void ParsePolylines(XmlReader r) { r.ReadStartElement(); while (r.NodeType == XmlNodeType.Element) { if (r.Name == "Polyline") { Polylines.Add(new GenericPosturePolyline(r)); } else { string outerXml = r.ReadOuterXml(); log.DebugFormat("Unparsed content in XML: {0}", outerXml); } } r.ReadEndElement(); }
private void AddTappedLocationAndRaise(Position position) { if (!_allowedToAddPoint) { return; } Pins.Add(new TKCustomMapPin { Position = position, DefaultPinColor = Color.Teal }); if (Pins.Count <= 1) { return; // can't make a line with 1 pin } var previous = Pins.Reverse().Skip(1).First(); Polylines.Add(new TKPolyline { LineCoordinates = new List <Position> { previous.Position, position }, Color = Color.Teal, LineWidth = 2 }); }
void Calculate(List <Xamarin.Forms.GoogleMaps.Position> list) { OnCalculate?.Invoke(this, default(EventArgs)); Polylines.Clear(); var polyline = new Xamarin.Forms.GoogleMaps.Polyline(); foreach (var p in list) { polyline.Positions.Add(p); } Polylines.Add(polyline); MoveToRegion(MapSpan.FromCenterAndRadius(new Position(polyline.Positions[0].Latitude, polyline.Positions[0].Longitude), Xamarin.Forms.GoogleMaps.Distance.FromMiles(0.50f))); var pin = new Xamarin.Forms.GoogleMaps.Pin { Type = PinType.Place, Position = new Position(polyline.Positions.First().Latitude, polyline.Positions.First().Longitude), Label = "First", Address = "First", Tag = string.Empty, Icon = (Device.RuntimePlatform == Device.Android) ? BitmapDescriptorFactory.FromBundle("ic_taxi.png") : BitmapDescriptorFactory.FromView(new Image() { Source = "ic_taxi.png", WidthRequest = 25, HeightRequest = 25 }) }; Pins.Add(pin); var pin1 = new Xamarin.Forms.GoogleMaps.Pin { Type = PinType.Place, Position = new Position(polyline.Positions.Last().Latitude, polyline.Positions.Last().Longitude), Label = "Last", Address = "Last", Tag = string.Empty }; Pins.Add(pin1); }
public MapViewModel() { Points.Add(new PointItem { Name = "Steinbake Leitdamm", Location = new Location(53.51217, 8.16603) }); Points.Add(new PointItem { Name = "Buhne 2", Location = new Location(53.50926, 8.15815) }); Points.Add(new PointItem { Name = "Buhne 4", Location = new Location(53.50468, 8.15343) }); Points.Add(new PointItem { Name = "Buhne 6", Location = new Location(53.50092, 8.15267) }); Points.Add(new PointItem { Name = "Buhne 8", Location = new Location(53.49871, 8.15321) }); Points.Add(new PointItem { Name = "Buhne 10", Location = new Location(53.49350, 8.15563) }); Pushpins.Add(new PointItem { Name = "WHV - Eckwarderhörne", Location = new Location(53.5495, 8.1877) }); Pushpins.Add(new PointItem { Name = "JadeWeserPort", Location = new Location(53.5914, 8.14) }); Pushpins.Add(new PointItem { Name = "Kurhaus Dangast", Location = new Location(53.447, 8.1114) }); Pushpins.Add(new PointItem { Name = "Eckwarderhörne", Location = new Location(53.5207, 8.2323) }); Polylines.Add(new Polyline { Locations = LocationCollection.Parse("53.5140,8.1451 53.5123,8.1506 53.5156,8.1623 53.5276,8.1757 53.5491,8.1852 53.5495,8.1877 53.5426,8.1993 53.5184,8.2219 53.5182,8.2386 53.5195,8.2387") }); Polylines.Add(new Polyline { Locations = LocationCollection.Parse("53.5978,8.1212 53.6018,8.1494 53.5859,8.1554 53.5852,8.1531 53.5841,8.1539 53.5802,8.1392 53.5826,8.1309 53.5867,8.1317 53.5978,8.1212") }); }
/// <summary> /// Read and parse the DXF file /// </summary> public void Read() { bool entitysection = false; CodePair code = this.ReadPair(); while ((code.Value != "EOF") && (!dxfReader.EndOfStream)) { if (code.Code == 0) { //Have we reached the entities section yet? if (!entitysection) { //No, so keep going until we find the ENTIIES section (and since we are here, let's try to read the layers) switch (code.Value) { case "SECTION": string sec = ReadSection(ref code); if (sec == "ENTITIES") { entitysection = true; } break; case "LAYER": Layer layer = ReadLayer(ref code); Layers.Add(layer); break; default: code = this.ReadPair(); break; } } else { //Yes, so let's read the entities switch (code.Value) { case "LINE": Line line = ReadLine(ref code); Lines.Add(line); break; case "CIRCLE": Circle circle = ReadCircle(ref code); Circles.Add(circle); break; case "ARC": Arc arc = ReadArc(ref code); Arcs.Add(arc); break; case "POINT": Point point = ReadPoint(ref code); Points.Add(point); break; case "TEXT": Text text = ReadText(ref code); Texts.Add(text); break; case "POLYLINE": Polyline polyline = ReadPolyline(ref code); Polylines.Add(polyline); break; case "LWPOLYLINE": Polyline lwpolyline = ReadLwPolyline(ref code); Polylines.Add(lwpolyline); break; default: code = this.ReadPair(); break; } } } else { code = this.ReadPair(); } } }