Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed saving and loading multipoint geometry with only one point #16

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions src/NetTopologySuite.IO.Oracle/OracleGeometryReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public Geometry Read(SdoGeometry geom)
var factory = _services.CreateGeometryFactory(srid);

var retVal = Create(factory, gType, point, geom.ElemArray, geom.OrdinatesArray);

if (retVal == null)
{
return null;
}
retVal.SRID = srid;

return retVal;
Expand Down Expand Up @@ -271,7 +276,6 @@ private GeometryCollection CreateCollection(GeometryFactory factory, int dim, in
}

break;

case SdoEType.Line:
geom = CreateLine(factory, dim, lrs, elemInfo, i, coords);

Expand Down Expand Up @@ -405,7 +409,7 @@ private MultiPoint CreateMultiPoint(GeometryFactory factory, int dim, int lrs, d
" inconsistent with ORDINATES length " + coords.Count);
if (etype != SdoEType.Coordinate)
throw new ArgumentException("ETYPE " + etype + " inconsistent with expected POINT");
if (!(interpretation > 1))
if (interpretation == 0)
{
return null;
}
Expand Down
4 changes: 3 additions & 1 deletion test/NetTopologySuite.IO.Oracle.Test/OracleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,20 @@ public void CCWTestsOnPolygon()
[TestCase("POINT(10 10)", 4326)]
[TestCase("POINT Z(10 10 0)", -1)]
[TestCase("POINT Z(10 10 20)", -1)]
[TestCase("MULTIPOINT(11 12)", -1)]
[TestCase("MULTIPOINT(11 12, 20 20)", -1)]
[TestCase("MULTIPOINT Z(11 12 12, 20 20 20)", -1)]
[TestCase("LINESTRING(10 10,20 20,50 50,34 34)", -1)]
[TestCase("LINESTRING Z(10 10 20,20 20 20,50 50 50,34 34 34)", -1)]
[TestCase("POLYGON((10 10,20 10,20 20,10 20,10 10))", -1)]
[TestCase("POLYGON((10 10,20 10,20 20,10 20,10 10),(5 5,5 6,6 6,6 5,5 5))", -1)]
[TestCase("POLYGON Z((10 10 0,20 10 0,20 20 0,10 20 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))", -1)]
[TestCase("MULTIPOLYGON(((10 10,20 10,20 20,20 10,10 10)))", -1)]
[TestCase("MULTIPOLYGON(((10 10,20 10,20 20,20 10,10 10)),((10 10,20 10,20 20,20 10,10 10)))", -1)]
[TestCase("MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10),(5 5,5 6,6 6,6 5,5 5)),((10 10,20 10,20 20,20 10,10 10)))", -1)]
[TestCase("MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10),(5 5,5 6,6 6,6 5,5 5)),((10 10,20 10,20 20,20 10,10 10),(5 5,5 6,6 6,6 5,5 5)))", -1)]
[TestCase("MULTIPOLYGON Z(((10 10 0,20 10 0,20 20 0,10 20 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)),((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)))", -1)]
[TestCase("MULTILINESTRING((10 10,20 10,20 20,20 10),(5 5,5 6,6 6,6 5))", -1)]
[TestCase("MULTILINESTRING((10 10,20 10,20 20,20 10))", -1)]
[TestCase("MULTILINESTRING((1 1, 2 1, 3 1), (1 2, 2 2, 3 2, 4 2), (1 3, 1 3, 3 3, 4 3))", -1)]
[TestCase("MULTILINESTRING((1 1, 2 1, 3 1), (1 2, 2 2, 3 2, 4 2), (1 3, 1 3, 3 3, 4 3),(1 5, 2 5, 3 5),(1 6, 2 6, 3 6, 4 6))", -1)]
[TestCase("MULTILINESTRING Z((10 10 5,20 10 5,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))", -1)]
Expand Down
Loading