-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
110 additions
and
0 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
52 changes: 52 additions & 0 deletions
52
modules/core/src/test/java/org/locationtech/jts/noding/SegmentStringTest.java
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,52 @@ | ||
/* | ||
* Copyright (c) 2024 Martin Davis. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* and Eclipse Distribution License v. 1.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html | ||
* and the Eclipse Distribution License is available at | ||
* | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
*/ | ||
package org.locationtech.jts.noding; | ||
|
||
import org.locationtech.jts.geom.Coordinate; | ||
import org.locationtech.jts.geom.Geometry; | ||
|
||
import test.jts.GeometryTestCase; | ||
|
||
public class SegmentStringTest extends GeometryTestCase { | ||
|
||
public static void main(String[] args) { | ||
junit.textui.TestRunner.run(SegmentStringTest.class); | ||
} | ||
|
||
public SegmentStringTest(String name) { | ||
super(name); | ||
} | ||
|
||
public void testNextInRing() { | ||
SegmentString ss = create("LINESTRING(0 0, 1 2, 3 1, 0 0)"); | ||
assertTrue(ss.isClosed()); | ||
checkEqualXY(ss.nextInRing(0), new Coordinate(1, 2)); | ||
checkEqualXY(ss.nextInRing(1), new Coordinate(3, 1)); | ||
checkEqualXY(ss.nextInRing(2), new Coordinate(0, 0)); | ||
checkEqualXY(ss.nextInRing(3), new Coordinate(1, 2)); | ||
} | ||
|
||
public void testPrevInRing() { | ||
SegmentString ss = create("LINESTRING(0 0, 1 2, 3 1, 0 0)"); | ||
assertTrue(ss.isClosed()); | ||
checkEqualXY(ss.prevInRing(0), new Coordinate(3, 1)); | ||
checkEqualXY(ss.prevInRing(1), new Coordinate(0, 0)); | ||
checkEqualXY(ss.prevInRing(2), new Coordinate(1, 2)); | ||
checkEqualXY(ss.prevInRing(3), new Coordinate(3, 1)); | ||
} | ||
|
||
private SegmentString create(String wkt) { | ||
Geometry geom = read(wkt); | ||
return new BasicSegmentString(geom.getCoordinates(), null); | ||
} | ||
|
||
} |