Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ca18547
Merge pull request #1 from MapWindow/develop
sweco-sedahd Oct 16, 2023
2f4f3c1
Fixed OgrConverter to correctly handle Z and M values.
sweco-sedahd Oct 21, 2023
c1c6aa6
Fixed opening/creating shapefile with åäö in path/filename.
sweco-sedahd Jun 1, 2026
34e3876
Merge branch 'develop' of https://github.com/sweco-sedahd/MapWinGIS i…
sweco-sedahd Jun 1, 2026
965aa69
IK-82 - try to convert from GCP to GeoTransform, with looser toleranc…
sweco-sedahd Jun 1, 2026
1f6ca14
Added edit support for geometry with X and M.
sweco-sedahd Jun 1, 2026
f7e0ad4
Added IPlacedLabels
sweco-sedahd Jun 1, 2026
a76557e
Filter out logging of: "The method isn't applicable to the in-memory …
sweco-sedahd Jun 1, 2026
00315c8
Debug code, better error logging and some cleanup.
sweco-sedahd Jun 1, 2026
1db557c
Reduced logging of: "Writing .shx file" to now log every 10 %.
sweco-sedahd Jun 1, 2026
c47d3ab
Added CorrectAxisOrder to fix proejction handling.
sweco-sedahd Jun 1, 2026
aa23c80
Fixed CField::Clone() whas not setting alias.
sweco-sedahd Jun 1, 2026
fb4ac9c
Changed to use square tiles (from WMS)
sweco-sedahd Jun 1, 2026
b965c6f
Added function PlaceLabels.
sweco-sedahd Jun 1, 2026
f592b28
Support for building under Visual Studio 2022 and update GDAL to 3.10.3
sweco-sedahd Jun 1, 2026
7cd49d4
Fixed selection (IK-384) allow selection of inner shape.
sweco-sedahd Jun 1, 2026
4f9c54d
Fixed memory leak i selection.
sweco-sedahd Jun 1, 2026
5a5fe72
Fixed preserving selection during update from OGR source.
sweco-sedahd Jun 1, 2026
711ec1f
Added error handling in SaveToFile if DBFAddField() fails.
sweco-sedahd Jun 1, 2026
bdb0162
Added functions PlaceLabels, PlaceAllMapLabels and GetLabelExtents.
sweco-sedahd Jun 1, 2026
c4eb7e4
ZoomOut fix.
sweco-sedahd Jun 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MapWinGisTests-net6/MapWinGisTests-net6.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Polyline/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ public void Progress(string keyOfSender, int percent, string message)

public void Error(string keyOfSender, string errorMsg)
{
_testOutputHelper.WriteLine($"Error of {keyOfSender}: {errorMsg}");
}
try {
_testOutputHelper.WriteLine($"Error of {keyOfSender}: {errorMsg}");
} catch {
// ignore
}
}
#pragma warning restore xUnit1013
#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ public void IsEmptyTest()
[Fact]
public void IsSameTest()
{
// Setup:
var geoProjection3857 = new GeoProjection();
System.Diagnostics.Debug.WriteLine("IsSameTest() start");

// Setup:
var geoProjection3857 = new GeoProjection();
geoProjection3857.ShouldNotBeNull();

var geoProjection28992 = new GeoProjection();
Expand Down Expand Up @@ -113,7 +115,9 @@ public void IsSameTest()
geoProjection3857.IsSame[geoProjectionPrj].ShouldBeFalse("GeoProjections should not be the same.");
geoProjection28992.IsSame[geoProjectionPrj].ShouldBeTrue("GeoProjections should be the same.");
geoProjectionPrj.IsSame[geoProjection28992].ShouldBeTrue("GeoProjections should be the same.");
}

System.Diagnostics.Debug.WriteLine("IsSameTest() end");
}

[Fact]
public void ImportFromAutoDetectTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ public UtilsProjectionTests(ITestOutputHelper testOutputHelper)
[Fact]
public void UtilsReprojectShapefileTest()
{
// RD (Amersfoort, The Neterlands) to WGS84:
// https://geodata.nationaalgeoregister.nl/locatieserver/v3/free?q=a325
// "centroide_rd": "POINT(187816.756 433912.801)",
// "centroide_ll": "POINT(5.86394184 51.89276528)"
System.Diagnostics.Debug.WriteLine("UtilsReprojectShapefileTest() start");
// RD (Amersfoort, The Neterlands) to WGS84:
// https://geodata.nationaalgeoregister.nl/locatieserver/v3/free?q=a325
// "centroide_rd": "POINT(187816.756 433912.801)",
// "centroide_ll": "POINT(5.86394184 51.89276528)"

UtilsReprojectPointShapefile(187816.756, 433912.801, 5.86394184, 51.89276528, 0.0000001, 28992, 4326);
UtilsReprojectPointShapefile(187816.756, 433912.801, 5.86394184, 51.89276528, 0.0000001, 28992, 4326);
// The other way round:
UtilsReprojectPointShapefile(5.86394184, 51.89276528, 187816.756, 433912.801, 0.05, 4326, 28992);

// Amersfoort Geodetic to ETRS89 (EPSG:4258)
UtilsReprojectPointShapefile(4.5703125, 51.944265, 4.5706292, 51.945227, 0.000001, 4258, 4289);
// Swap:
UtilsReprojectPointShapefile(4.5706292, 51.945227, 4.5703125, 51.944265, 0.000001, 4289, 4258);
System.Diagnostics.Debug.WriteLine("UtilsReprojectShapefileTest() end");
}

private void UtilsReprojectPointShapefile(double srcX, double srcY, double dstX, double dstY, double tolerance, int srcEpsgCode, int dstEpsgCode)
Expand Down
22 changes: 21 additions & 1 deletion MapWinGisTests-net6/MapWinGisTests/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ internal static Shapefile LoadSfUsingFileManager(string filename)
return sf;
}

internal static Shapefile CreateTestPolylineShapefile()
{
var sfPolyline = MakeShapefile(ShpfileType.SHP_POLYLINE);
AddShape(sfPolyline, "LINESTRING (330695.973322992 5914896.16305817, 330711.986129861 5914867.19586245, 330713.350435287 5914867.56644015, 330716.510827627 5914862.28973662, 330715.632568651 5914860.60107999, 330652.234582712 5914803.80510632, 330553.749382483 5914715.80328169, 330551.979355848 5914714.83347535, 330549.911988583 5914715.86502807, 330545.027807355 5914724.05916443, 330544.592985976 5914725.93531509, 330544.30963704 5914726.72754692, 330543.612620707 5914726.14904553, 330543.271515787 5914727.06633931, 330542.234090059 5914729.85597723, 330542.959654761 5914730.50411962, 330530.319252794 5914765.86064153, 330505.294840402 5914836.7930124, 330471.411812074 5914931.61558331, 330486.074748666 5914941.33795239, 330585.983154737 5915010.32749106, 330618.427962455 5915031.20447119, 330653.234601917 5914970.37328093, 330695.973322992 5914896.16305817)");

sfPolyline.NumShapes.ShouldBe(1);

// Set projection:
sfPolyline.GeoProjection = MakeProjection(28992);

return sfPolyline;
}

internal static Shapefile CreateTestPolygonShapefile()
{
var sfPolygon = MakeShapefile(ShpfileType.SHP_POLYGON);
Expand Down Expand Up @@ -153,7 +166,14 @@ internal static Shape MakeShape(ShpfileType shpType)
return shp;
}

internal static void AddShape(Shapefile sf, string wktSting)
internal static Shape MakeShape(Point pt)
{
var shape = MakeShape(ShpfileType.SHP_POINT);
shape.AddPoint(pt.x, pt.y);
return shape;
}

internal static void AddShape(Shapefile sf, string wktSting)
{
// Create shape
var shp = new Shape();
Expand Down
17 changes: 10 additions & 7 deletions MapWinGisTests-net6/MapWinGisTests/MapWinGisTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows8.0</TargetFramework>
<TargetFramework>net8.0-windows8.0</TargetFramework>
<RootNamespace>MapWinGisTests</RootNamespace>
<Nullable>enable</Nullable>

Expand Down Expand Up @@ -35,15 +35,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Shouldly" Version="4.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.analyzers" Version="1.1.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.analyzers" Version="1.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
22 changes: 22 additions & 0 deletions MapWinGisTests-net6/MapWinGisTests/ShouldBeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JetBrains.Annotations;

namespace Shouldly
{
public static class ShouldBeExtensions
{
//ContractAnnotation("actual:notnull => halt")]
public static void ShouldBeEqualWithin(this double? actual, double expected, double withinAmount, string? customMessage = null)
{
if(!actual.HasValue)
throw new ShouldAssertException("actual value is null");

if(Math.Abs(actual.Value - expected) > withinAmount)
throw new ShouldAssertException($"{actual.Value} is not equal to {expected} withing {withinAmount}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public CodeCoverageTests(ITestOutputHelper testOutputHelper)
_testOutputHelper = testOutputHelper;
}

[Fact(Skip = "Unit test is not yet implemented")]
//[Fact(Skip = "Unit test is not yet implemented")]
public void CheckShapefileClass()
{
CheckTests(typeof(ShapefileClass), "Shapefile");
Expand Down
Loading