Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapPolygonDataConverter.cs =================================================================== diff -u -r84f485ecc4a35c79575db43f9c083974965dde7d -rb15175de54a009121f0d2f7775cb5b3e2e24e885 --- Core/Components/src/Core.Components.DotSpatial/Converter/MapPolygonDataConverter.cs (.../MapPolygonDataConverter.cs) (revision 84f485ecc4a35c79575db43f9c083974965dde7d) +++ Core/Components/src/Core.Components.DotSpatial/Converter/MapPolygonDataConverter.cs (.../MapPolygonDataConverter.cs) (revision b15175de54a009121f0d2f7775cb5b3e2e24e885) @@ -47,11 +47,9 @@ foreach (MapGeometry mapGeometry in mapFeature.MapGeometries) { - IEnumerable[] pointCollections = mapGeometry.PointCollections.ToArray(); + IEnumerable[] pointCollections = mapGeometry.PointCollections.Select(CreateClosedRingIfNecessary).ToArray(); - CreateClosedRingIfNecessary(pointCollections); - - Coordinate[] outerRingCoordinates = ConvertPoint2DElementsToCoordinates(pointCollections[0]).ToArray(); + Coordinate[] outerRingCoordinates = ConvertPoint2DElementsToCoordinates(pointCollections[0]); ILinearRing outerRing = new LinearRing(outerRingCoordinates); var innerRings = new ILinearRing[pointCollections.Length - 1]; @@ -68,24 +66,6 @@ yield return new Feature(GetGeometry(geometryList)); } - private static void CreateClosedRingIfNecessary(IEnumerable[] pointCollections) - { - if (!FirstPointEqualsLastPoint(pointCollections[0].ToArray())) - { - pointCollections[0] = pointCollections[0].Concat(new[] - { - pointCollections[0].First() - }).ToArray(); - } - } - - private static bool FirstPointEqualsLastPoint(Point2D[] pointCollection) - { - return pointCollection.First().X.Equals(pointCollection.Last().X) || - pointCollection.First().Y.Equals(pointCollection.Last().Y); - - } - protected override IFeatureSymbolizer CreateSymbolizer(MapPolygonData mapData) { PolygonStyle polygonStyle = mapData.Style; @@ -109,6 +89,23 @@ return CreateCategory(mapData.Style); } + private static IEnumerable CreateClosedRingIfNecessary(IEnumerable pointCollection) + { + var newCollection = new List(pointCollection); + if (!FirstPointEqualsLastPoint(pointCollection)) + { + newCollection.Add(pointCollection.First()); + } + + return newCollection; + } + + private static bool FirstPointEqualsLastPoint(IEnumerable pointCollection) + { + return pointCollection.First().X.Equals(pointCollection.Last().X) || + pointCollection.First().Y.Equals(pointCollection.Last().Y); + } + private static Color GetStrokeColor(PolygonStyle style) { Color strokeColor = style.StrokeColor; Index: Core/Components/src/Core.Components.DotSpatial/Projections/WorldFile.cs =================================================================== diff -u -r62d14ea31186ae19a344c4562ddf0e048f49d44a -rb15175de54a009121f0d2f7775cb5b3e2e24e885 --- Core/Components/src/Core.Components.DotSpatial/Projections/WorldFile.cs (.../WorldFile.cs) (revision 62d14ea31186ae19a344c4562ddf0e048f49d44a) +++ Core/Components/src/Core.Components.DotSpatial/Projections/WorldFile.cs (.../WorldFile.cs) (revision b15175de54a009121f0d2f7775cb5b3e2e24e885) @@ -182,8 +182,7 @@ public IPolygon BoundingOrdinatesToWorldCoordinates(int width, int height) { Coordinate leftTop = ToWorldCoordinates(0, 0); - Coordinate[] ringCoordinates = new[] - { + Coordinate[] ringCoordinates = { leftTop, ToWorldCoordinates(0, height), ToWorldCoordinates(width, 0),