public static PolyShape Create(MapShape shape) { if (shape.Primitive is PrimitiveLine line) { return(PolyshapeBuilder.Create(line)); } else if (shape.Primitive is PrimitivePolygon polygon) { return(PolyshapeBuilder.Create(polygon)); } else { throw new NotImplementedException("Something is missing yo."); } }
/// <summary> /// Gets the map data. /// </summary> /// <param name="type">The type.</param> /// <param name="lowBound">The low bound.</param> /// <param name="highBound">The high bound.</param> /// <returns>The map data.</returns> public MapData GetMapData(string type, Vector2 lowBound, Vector2 highBound) { var mapref = this.provider; if (mapref == null || false == mapref.Providers.TryGetValue(type, out var mapProv)) { return(new MapData(new List <PolyShape>(), new Coordinate(lowBound), new Coordinate(highBound))); } var lines = new List <PolyShape>(); foreach (var line in mapProv.GetWays(lowBound, highBound)) { lines.Add(PolyshapeBuilder.Create(line)); } return(new MapData(lines, new Coordinate(Vector2.Max(mapref.LowBound, lowBound)), new Coordinate(Vector2.Min(mapref.HighBound, highBound)))); }