-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't write extent in header for single point and empty geometries
refers to #11
- Loading branch information
1 parent
2370d8f
commit ce67971
Showing
3 changed files
with
65 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using NetTopologySuite; | ||
using NetTopologySuite.Geometries; | ||
using NetTopologySuite.IO; | ||
using NUnit.Framework; | ||
|
||
namespace NetTopologySuite.IO.SpatiaLite.Test; | ||
|
||
class Issue11 | ||
{ | ||
[TestCase("POINT EMPTY", 17)] | ||
[TestCase("POINT(10 10)", 1)] | ||
[TestCase("POINT Z(10 10 1)", 1)] | ||
[TestCase("POINT M(10 10 2)", 1)] | ||
[TestCase("POINT ZM(10 10 1 2)", 1)] | ||
[TestCase("POINT(10 10)", 1)] | ||
[TestCase("LINESTRING EMPTY", 17)] | ||
[TestCase("LINESTRING(10 10, 10 20)", 3)] | ||
[TestCase("LINESTRING Z(10 10 1, 10 20 1)", 3)] | ||
[TestCase("LINESTRING M(10 10 2, 10 20 2)", 3)] | ||
[TestCase("LINESTRING ZM(10 10 1 2, 10 20 1 2)", 3)] | ||
public void TestHeaderFlags(string wkt, byte expectedFlags) | ||
{ | ||
var factory = NtsGeometryServices.Instance.CreateGeometryFactory(); | ||
var wktReader = new WKTReader() { IsOldNtsCoordinateSyntaxAllowed = false }; | ||
var geom = wktReader.Read(wkt); | ||
var writer = new GeoPackageGeoWriter | ||
{ | ||
HandleOrdinates = Ordinates.None | ||
}; | ||
byte[] s = writer.Write(geom); | ||
|
||
Assert.That(s[3], Is.EqualTo(expectedFlags)); | ||
|
||
var reader = new GeoPackageGeoReader(factory.CoordinateSequenceFactory, factory.PrecisionModel); | ||
var dgeom = reader.Read(s); | ||
Assert.That(dgeom, Is.EqualTo(geom)); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
test/NetTopologySuite.IO.SpatiaLite.Test/NetTopologySuite.IO.SpatiaLite.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters