diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..dce49879
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,39 @@
+name: Maven Build
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
+ - name: Upload geom.zip
+ uses: actions/upload-artifact@v2
+ with:
+ name: geom.zip
+ path: target/geometrycommands-*-app.zip
+ - name: Upload geom.jar
+ uses: actions/upload-artifact@v2
+ with:
+ name: geom.jar
+ path: target/geom-*.jar
+ - name: Sphinx build
+ uses: ammaraskar/sphinx-action@0.4
+ with:
+ docs-folder: "src/website"
+ pre-build-command: "apt-get update -y && apt-get install -y gcc"
+ - name: Deploy website
+ uses: JamesIves/github-pages-deploy-action@3.7.1
+ with:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ BRANCH: gh-pages
+ FOLDER: src/website/build/html
+ CLEAN: false
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index e9563dfa..601dea6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,8 @@ geometrycommands.iml
dependency-reduced-pom.xml
src/website/build
src/website/source/commands/*.rst
+.DS_Store
+.classpath
+.project
+.settings
+.vscode
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index be4fea70..23bf328c 100755
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 3b5b4daf..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-dist: bionic
-language: java
-jdk: openjdk8
-before_install:
- - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
- - sudo apt-get update
- - sudo apt-get install python3
- - sudo apt-get install python3-pip
-script:
- - pip3 install --upgrade -r src/website/requirements.txt
- - ./mvnw clean install -P website
- - touch src/website/build/html/.nojekyll
-deploy:
- provider: pages
- skip_cleanup: true
- github_token: $GEOM_GITHUB_OAUTH_TOKEN
- keep-history: true
- on:
- branch: master
- local_dir: src/website/build/html
\ No newline at end of file
diff --git a/README.rst b/README.rst
index e64fdd69..8b348ac8 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
-.. image:: https://travis-ci.org/jericks/geometrycommands.svg?branch=master
- :target: https://travis-ci.org/jericks/geometrycommands
+.. image:: https://github.com/jericks/geometrycommands/workflows/Maven%20Build/badge.svg
+ :target: https://github.com/jericks/geometrycommands/actions
Geometry command line library.
==============================
@@ -97,13 +97,13 @@ Build Native App
----------------
You can build a native app using Graalvm for MacOS or Linux. Download `Graalvm `_ and export a GRAALVM_HOME variable::
- export GRAALVM_HOME=/Users/you/Applications/graalvm-ce-1.0.0-rc6/Contents/Home
+ export GRAALVM_HOME=/Users/you/Applications/graalvm-ce-21.3.0/Contents/Home
Then you can run::
- ./build.sh
+ ./mvnw clean install -DskipTests -Pnative
-This will create a native geom executable. Currently, the geom draw command does not work because Java2D is not supported by GraalVM.
+This will create a native geom executable.
Presentations
-------------
diff --git a/build.sh b/build.sh
deleted file mode 100755
index cd57a695..00000000
--- a/build.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-$GRAALVM_HOME/bin/native-image --verbose \
- -jar target/geom-0.6-SNAPSHOT.jar \
- -H:+ReportUnsupportedElementsAtRuntime \
- -H:ReflectionConfigurationFiles=src/config/config_geom.json \
- -H:ReflectionConfigurationFiles=src/config/config_args4j.json \
- -H:IncludeResources=META-INF/services/*.* \
- -H:IncludeResources=application.properties \
- -H:IncludeResourceBundles=org.kohsuke.args4j.Messages \
- -H:IncludeResourceBundles=org.kohsuke.args4j.spi.Messages \
- -H:+JNI \
- -H:Name=geom
diff --git a/geom_zsh_comp.sh b/geom_zsh_comp.sh
new file mode 100644
index 00000000..7a812890
--- /dev/null
+++ b/geom_zsh_comp.sh
@@ -0,0 +1,36 @@
+function _geom(){
+
+ local line
+
+ _arguments -C \
+ "-h[Show help information]" \
+ "--h[Show help information]" \
+ "1: :(buffer centroid)" \
+ "*::arg:->args"
+
+ case $line[1] in
+ buffer)
+ _buffer
+ ;;
+ centroid)
+ _centroid
+ ;;
+ esac
+
+# _describe 'command' "('buffer:Buffer a geometry' 'centroid:Calculate the centroid')"
+
+ return 0
+}
+
+function _buffer {
+ _arguments \
+ '(-g --geometry)'{-g,--geometry}'[The input geometry]' \
+ '(-d --distance)'{-d,--distance}'[The buffer distance]:float:'
+}
+
+function _centroid {
+ _arguments \
+ "--geometry[The input geometry]"
+}
+
+compdef _geom geom
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 745833d3..46066760 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,22 +5,27 @@
4.0.0
org.geometrycommands
geometrycommands
- 0.7-SNAPSHOT
+ 0.9-SNAPSHOT
org.locationtech.jts
jts-core
- 1.17.0
+ 1.19.0
- org.osgeo
+ org.locationtech.proj4j
proj4j
- 0.1.0
+ 1.3.0
+
+
+ org.locationtech.proj4j
+ proj4j-epsg
+ 1.3.0
commons-codec
commons-codec
- 1.9
+ 1.16.0
args4j
@@ -28,12 +33,19 @@
2.33
- junit
- junit
- 4.12
+ org.junit.jupiter
+ junit-jupiter
+ 5.10.1
test
+
+
+ github
+ GitHub Packages
+ https://maven.pkg.github.com/jericks/geometrycommands
+
+
@@ -45,21 +57,40 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.0
+ 3.11.0
1.8
1.8
- org.codehaus.mojo
- cobertura-maven-plugin
- 2.7
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.1
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.8
+
+
+
+ prepare-agent
+
+
+
+ report
+ test
+
+ report
+
+
+
org.apache.maven.plugins
maven-shade-plugin
- 3.2.0
+ 3.5.1
package
@@ -80,7 +111,7 @@
maven-assembly-plugin
- 3.1.0
+ 3.6.0
src/assembly/dir.xml
@@ -97,8 +128,39 @@
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 3.12.1
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 3.0.0-M7
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.8
+
+
+
+ report
+
+
+
+
+
+ org.codehaus.mojo
+ versions-maven-plugin
+ 2.16.1
+
+
+
website
@@ -127,5 +189,38 @@
+
+ native
+
+
+
+ org.graalvm.buildtools
+ native-maven-plugin
+ 0.9.19
+ true
+
+
+ build-native
+
+ build
+
+ package
+
+
+ test-native
+
+ test
+
+ test
+
+
+
+ geom
+ org.geometrycommands.App
+
+
+
+
+
diff --git a/src/main/java/org/geometrycommands/App.java b/src/main/java/org/geometrycommands/App.java
index 80cefa31..dd83e520 100644
--- a/src/main/java/org/geometrycommands/App.java
+++ b/src/main/java/org/geometrycommands/App.java
@@ -1,15 +1,6 @@
package org.geometrycommands;
-import org.kohsuke.args4j.CmdLineParser;
-
-import java.awt.*;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ServiceLoader;
+import java.io.*;
/**
* The command line application
@@ -23,87 +14,15 @@ public class App {
* @param args The arguments from the command line
*/
public static void main(String[] args) {
-
- // The usage
- final String usage = "Usage: geom ";
-
- // Check for an argument (the command name is required)
- if (args.length == 0) {
- System.err.println("Please enter a geometry command!");
- System.err.println(usage);
- System.exit(-1);
- }
-
- // Get the command name
- String name = args[0];
-
- // Lookup the Command by name
- Command command = null;
- final ServiceLoader commandServiceLoader = ServiceLoader.load(Command.class);
- for (Command cmd : commandServiceLoader) {
- if (cmd.getName().equalsIgnoreCase(name)) {
- command = cmd;
- break;
- }
- }
-
- // If we couldn't find the Command error out
- if (command == null) {
- System.err.println("Unknown geometry command: '" + name + "'!");
- System.err.println(usage);
- System.exit(-1);
- }
-
- // Get the empty command line POJO
- Options options = command.getOptions();
-
- // Fill the command line POJO using args4j's CmdLineParser
- CmdLineParser cmdLineParser = new CmdLineParser(options);
try {
- // Parse the arguments
- cmdLineParser.parseArgument(args);
- // Print help for the command
- if (options.isHelp()) {
- System.out.println("geom " + command.getName() + ": " + command.getDescription());
- cmdLineParser.printUsage(System.out);
- }
- else if (options.isWebHelp()) {
- URI uri = new URI("http://jericks.github.io/geometrycommands/commands/" + name + ".html");
- Desktop.getDesktop().browse(uri);
- }
- else {
- // If there are no errors, execute the command
- Reader reader = new InputStreamReader(System.in);
- Writer writer = new StringWriter();
- command.execute(options, reader, writer);
- writer.flush();
- String output = ((StringWriter) writer).getBuffer().toString();
- if (!output.isEmpty()) {
- System.out.println(output);
- }
- }
- } catch (Exception e) {
- // Print help for the command (if required options are not present)
- if (options.isHelp()) {
- System.out.println("geom " + command.getName() + ": " + command.getDescription());
- cmdLineParser.printUsage(System.out);
- }
- // Open help in a browser
- else if (options.isWebHelp()) {
- try {
- URI uri = new URI("http://jericks.github.io/geometrycommands/commands/" + name + ".html");
- Desktop.getDesktop().browse(uri);
- } catch(Exception ex) {
- System.err.println("Unable to open help in web browser!");
- }
- }
- else {
- // Oops, display the error messages to the user
- System.err.println(e.getMessage());
- System.err.println("Usage: geom ");
- cmdLineParser.printUsage(System.err);
- }
-
+ Commands.execute(
+ args,
+ new InputStreamReader(System.in),
+ new OutputStreamWriter(System.out),
+ new OutputStreamWriter(System.err)
+ );
+ } catch (Commands.CommandException e) {
+ System.exit(-1);
}
}
}
diff --git a/src/main/java/org/geometrycommands/BufferCommand.java b/src/main/java/org/geometrycommands/BufferCommand.java
index aa3d8c99..840cdb51 100644
--- a/src/main/java/org/geometrycommands/BufferCommand.java
+++ b/src/main/java/org/geometrycommands/BufferCommand.java
@@ -51,6 +51,14 @@ public BufferOptions getOptions() {
*/
@Override
protected void processGeometry(Geometry geometry, BufferOptions options, Reader reader, Writer writer) throws Exception {
+ BufferParameters params = getBufferParametersg(options);
+ BufferOp bufferOp = new BufferOp(geometry, params);
+ Geometry bufferedGeometry = bufferOp.getResultGeometry(options.getDistance());
+
+ writer.write(writeGeometry(bufferedGeometry, options));
+ }
+
+ protected static BufferParameters getBufferParametersg(BufferOptions options) {
int capStyle;
if (options.getEndCapStyle().equalsIgnoreCase("butt")
|| options.getEndCapStyle().equalsIgnoreCase("flat")) {
@@ -77,11 +85,8 @@ protected void processGeometry(Geometry geometry, BufferOptions options, Reader
params.setSimplifyFactor(options.getSimplifyFactor());
params.setMitreLimit(options.getMitreLimit());
params.setJoinStyle(joinStyle);
-
- BufferOp bufferOp = new BufferOp(geometry, params);
- Geometry bufferedGeometry = bufferOp.getResultGeometry(options.getDistance());
- writer.write(writeGeometry(bufferedGeometry, options));
+ return params;
}
/**
diff --git a/src/main/java/org/geometrycommands/Commands.java b/src/main/java/org/geometrycommands/Commands.java
new file mode 100644
index 00000000..2b23c627
--- /dev/null
+++ b/src/main/java/org/geometrycommands/Commands.java
@@ -0,0 +1,138 @@
+package org.geometrycommands;
+
+import org.kohsuke.args4j.CmdLineParser;
+
+import java.awt.*;
+import java.io.*;
+import java.net.URI;
+import java.util.*;
+import java.util.List;
+
+public class Commands {
+
+ public static Optional find(String name) {
+ final ServiceLoader commandServiceLoader = ServiceLoader.load(Command.class);
+ for (Command cmd : commandServiceLoader) {
+ if (cmd.getName().equalsIgnoreCase(name)) {
+ return Optional.of(cmd);
+ }
+ }
+ return Optional.empty();
+ }
+
+ public static List getAll() {
+ // Find all of the registered Commands
+ final ServiceLoader commandServiceLoader = ServiceLoader.load(Command.class);
+ // Collect the Commands
+ List commands = new ArrayList();
+ for (Iterator it = commandServiceLoader.iterator(); it.hasNext(); ) {
+ Command cmd = it.next();
+ commands.add(cmd);
+ }
+ // Sort the Commands by name
+ Collections.sort(commands, new Comparator() {
+ @Override
+ public int compare(Command c1, Command c2) {
+ return c1.getName().compareTo(c2.getName());
+ }
+ });
+ return commands;
+ }
+
+ public static class CommandException extends Exception {
+ }
+
+ public static void execute(String[] args, Reader inputReader, Writer outputWriter, Writer errorWriter) throws CommandException {
+
+ // The usage
+ final String usage = "Usage: geom ";
+
+ // Check for an argument (the command name is required)
+ if (args.length == 0) {
+ println(errorWriter,"Please enter a geometry command!");
+ println(errorWriter, usage);
+ flushSilently(errorWriter);
+ throw new CommandException();
+ }
+
+ // Get the command name
+ String name = args[0];
+
+ // Lookup the Command by name
+ Optional optionalCommand = find(name);
+
+ // If we couldn't find the Command error out
+ if (!optionalCommand.isPresent()) {
+ println(errorWriter,"Unknown geometry command: '" + name + "'!");
+ println(errorWriter,usage);
+ flushSilently(errorWriter);
+ throw new CommandException();
+ }
+ Command command = optionalCommand.get();
+
+ // Get the empty command line POJO
+ Options options = command.getOptions();
+
+ // Fill the command line POJO using args4j's CmdLineParser
+ CmdLineParser cmdLineParser = new CmdLineParser(options);
+ try {
+ // Parse the arguments
+ cmdLineParser.parseArgument(args);
+ // Print help for the command
+ if (options.isHelp()) {
+ println(outputWriter,"geom " + command.getName() + ": " + command.getDescription());
+ cmdLineParser.printUsage(outputWriter, null);
+ }
+ else if (options.isWebHelp()) {
+ URI uri = new URI("http://jericks.github.io/geometrycommands/commands/" + name + ".html");
+ Desktop.getDesktop().browse(uri);
+ }
+ else {
+ // If there are no errors, execute the command
+ Writer writer = new StringWriter();
+ command.execute(options, inputReader, writer);
+ writer.flush();
+ outputWriter.write(writer.toString());
+ outputWriter.flush();
+ }
+ } catch (Exception e) {
+ // Print help for the command (if required options are not present)
+ if (options.isHelp()) {
+ println(outputWriter,"geom " + command.getName() + ": " + command.getDescription());
+ cmdLineParser.printUsage(outputWriter, null);
+ }
+ // Open help in a browser
+ else if (options.isWebHelp()) {
+ try {
+ URI uri = new URI("http://jericks.github.io/geometrycommands/commands/" + name + ".html");
+ Desktop.getDesktop().browse(uri);
+ } catch(Exception ex) {
+ println(errorWriter,"Unable to open help in web browser!");
+ }
+ }
+ else {
+ // Oops, display the error messages to the user
+ println(errorWriter,e.getMessage());
+ println(errorWriter,"Usage: geom ");
+ cmdLineParser.printUsage(errorWriter, null);
+ }
+
+ }
+ }
+
+ private static void println(Writer writer, String message) {
+ try {
+ writer.write(message);
+ writer.write("\n");
+ } catch (IOException e) {
+ }
+ }
+
+ private static void flushSilently(Writer writer) {
+ try {
+ writer.flush();
+ }
+ catch (IOException e) {
+ }
+ }
+}
diff --git a/src/main/java/org/geometrycommands/ConcaveHullCommand.java b/src/main/java/org/geometrycommands/ConcaveHullCommand.java
new file mode 100644
index 00000000..dcf06af8
--- /dev/null
+++ b/src/main/java/org/geometrycommands/ConcaveHullCommand.java
@@ -0,0 +1,88 @@
+package org.geometrycommands;
+
+import org.geometrycommands.ConcaveHullCommand.ConcaveHullOptions;
+import org.kohsuke.args4j.Option;
+import org.locationtech.jts.algorithm.hull.ConcaveHull;
+import org.locationtech.jts.geom.Geometry;
+
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * A Command to calculate the concave hull of the input geometry
+ * @author Jared Erickson
+ */
+public class ConcaveHullCommand extends GeometryCommand {
+
+ /**
+ * Get the name of the Command
+ * @return The name of the Command
+ */
+ @Override
+ public String getName() {
+ return "concaveHull";
+ }
+
+ /**
+ * Get the description of what the Command does
+ * @return The description of what the Command does
+ */
+ @Override
+ public String getDescription() {
+ return "Calculate the concave hull of a Geometry.";
+ }
+
+ /**
+ * Get the new ConcaveHullOptions
+ * @return A new ConcaveHullOptions
+ */
+ @Override
+ public ConcaveHullOptions getOptions() {
+ return new ConcaveHullOptions();
+ }
+
+ /**
+ * Calculate the concave hull of the input geometry
+ * @param geometry The input geometry
+ * @param options The ConcaveHullOptions
+ * @param reader The java.io.Reader
+ * @param writer The java.io.Writer
+ * @throws Exception if an error occurs
+ */
+ @Override
+ protected void processGeometry(Geometry geometry, ConcaveHullOptions options, Reader reader, Writer writer) throws Exception {
+ ConcaveHull concaveHull = new ConcaveHull(geometry);
+ concaveHull.setHolesAllowed(options.isHolesAllowed());
+ concaveHull.setMaximumEdgeLength(options.getMaximumEdgeLength());
+ Geometry outputGeometry = concaveHull.getHull();
+ writer.write(writeGeometry(outputGeometry, options));
+ }
+
+ /**
+ * The ConcaveHullOptions
+ */
+ public static class ConcaveHullOptions extends GeometryOptions {
+
+ @Option(name = "-m", aliases = "--max-edge-length", usage = "The maximum edge length", required = false)
+ private double maximumEdgeLength = 0.0;
+
+ @Option(name = "-a", aliases = "--holes-allowed", usage = "Whether holes are allowed or not", required = false)
+ private boolean holesAllowed = false;
+
+ public double getMaximumEdgeLength() {
+ return maximumEdgeLength;
+ }
+
+ public void setMaximumEdgeLength(double maximumEdgeLength) {
+ this.maximumEdgeLength = maximumEdgeLength;
+ }
+
+ public boolean isHolesAllowed() {
+ return holesAllowed;
+ }
+
+ public void setHolesAllowed(boolean holesAllowed) {
+ this.holesAllowed = holesAllowed;
+ }
+ }
+}
diff --git a/src/main/java/org/geometrycommands/ConcaveHullOfPolygonsCommand.java b/src/main/java/org/geometrycommands/ConcaveHullOfPolygonsCommand.java
new file mode 100644
index 00000000..a95b43f6
--- /dev/null
+++ b/src/main/java/org/geometrycommands/ConcaveHullOfPolygonsCommand.java
@@ -0,0 +1,100 @@
+package org.geometrycommands;
+
+import org.geometrycommands.ConcaveHullOfPolygonsCommand.ConcaveHullOfPolygonsOptions;
+import org.kohsuke.args4j.Option;
+import org.locationtech.jts.algorithm.hull.ConcaveHullOfPolygons;
+import org.locationtech.jts.geom.Geometry;
+
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * A Command to calculate the concave hull of the input geometry
+ * @author Jared Erickson
+ */
+public class ConcaveHullOfPolygonsCommand extends GeometryCommand {
+
+ /**
+ * Get the name of the Command
+ * @return The name of the Command
+ */
+ @Override
+ public String getName() {
+ return "concaveHullOfPolygons";
+ }
+
+ /**
+ * Get the description of what the Command does
+ * @return The description of what the Command does
+ */
+ @Override
+ public String getDescription() {
+ return "Calculate the concave hull of Polygons.";
+ }
+
+ /**
+ * Get the new ConcaveHullOfPolygonsOptions
+ * @return A new ConcaveHullOfPolygonsOptions
+ */
+ @Override
+ public ConcaveHullOfPolygonsOptions getOptions() {
+ return new ConcaveHullOfPolygonsOptions();
+ }
+
+ /**
+ * Calculate the concave hull of the input geometry
+ * @param geometry The input geometry
+ * @param options The ConcaveHullOfPolygonsOptions
+ * @param reader The java.io.Reader
+ * @param writer The java.io.Writer
+ * @throws Exception if an error occurs
+ */
+ @Override
+ protected void processGeometry(Geometry geometry, ConcaveHullOfPolygonsOptions options, Reader reader, Writer writer) throws Exception {
+ ConcaveHullOfPolygons concaveHull = new ConcaveHullOfPolygons(geometry);
+ concaveHull.setHolesAllowed(options.isHolesAllowed());
+ concaveHull.setTight(options.isTight());
+ concaveHull.setMaximumEdgeLength(options.getMaximumEdgeLength());
+ Geometry outputGeometry = concaveHull.getHull();
+ writer.write(writeGeometry(outputGeometry, options));
+ }
+
+ /**
+ * The ConcaveHullOfPolygonsOptions
+ */
+ public static class ConcaveHullOfPolygonsOptions extends GeometryOptions {
+
+ @Option(name = "-l", aliases = "--max-edge-length", usage = "The maximum edge length", required = false)
+ private double maximumEdgeLength = 0.0;
+
+ @Option(name = "-a", aliases = "--holes-allowed", usage = "Whether holes are allowed or not", required = false)
+ private boolean holesAllowed = false;
+
+ @Option(name = "-t", aliases = "--tight", usage = "Whether it should be tight or now", required = false)
+ private boolean isTight = false;
+
+ public double getMaximumEdgeLength() {
+ return maximumEdgeLength;
+ }
+
+ public void setMaximumEdgeLength(double maximumEdgeLength) {
+ this.maximumEdgeLength = maximumEdgeLength;
+ }
+
+ public boolean isHolesAllowed() {
+ return holesAllowed;
+ }
+
+ public void setHolesAllowed(boolean holesAllowed) {
+ this.holesAllowed = holesAllowed;
+ }
+
+ public boolean isTight() {
+ return isTight;
+ }
+
+ public void setTight(boolean tight) {
+ isTight = tight;
+ }
+ }
+}
diff --git a/src/main/java/org/geometrycommands/FixCommand.java b/src/main/java/org/geometrycommands/FixCommand.java
new file mode 100644
index 00000000..48c00b74
--- /dev/null
+++ b/src/main/java/org/geometrycommands/FixCommand.java
@@ -0,0 +1,62 @@
+package org.geometrycommands;
+
+import org.geometrycommands.FixCommand.FixOptions;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.util.GeometryFixer;
+
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * A Command to fix an invalid geometry
+ * @author Jared Erickson
+ */
+public class FixCommand extends GeometryCommand {
+
+ /**
+ * Get the name of the Command
+ * @return The name of the Command
+ */
+ @Override
+ public String getName() {
+ return "fix";
+ }
+
+ /**
+ * Get the description of what the Command does
+ * @return The description of what the Command does
+ */
+ @Override
+ public String getDescription() {
+ return "Fix an invalid Geometry.";
+ }
+
+ /**
+ * Get the new FixOptions
+ * @return A new FixOptions
+ */
+ @Override
+ public FixOptions getOptions() {
+ return new FixOptions();
+ }
+
+ /**
+ * Calculate the convex hull of the input geometry
+ * @param geometry The input geometry
+ * @param options The FixOptions
+ * @param reader The java.io.Reader
+ * @param writer The java.io.Writer
+ * @throws Exception if an error occurs
+ */
+ @Override
+ protected void processGeometry(Geometry geometry, FixOptions options, Reader reader, Writer writer) throws Exception {
+ Geometry outputGeometry = GeometryFixer.fix(geometry);
+ writer.write(writeGeometry(outputGeometry, options));
+ }
+
+ /**
+ * The FixOptions
+ */
+ public static class FixOptions extends GeometryOptions {
+ }
+}
diff --git a/src/main/java/org/geometrycommands/OffsetCurveCommand.java b/src/main/java/org/geometrycommands/OffsetCurveCommand.java
new file mode 100644
index 00000000..8b64bca4
--- /dev/null
+++ b/src/main/java/org/geometrycommands/OffsetCurveCommand.java
@@ -0,0 +1,65 @@
+package org.geometrycommands;
+
+import org.geometrycommands.OffsetCurveCommand.OffsetCurveOptions;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.operation.buffer.BufferParameters;
+import org.locationtech.jts.operation.buffer.OffsetCurve;
+
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * A Command for calculating the offsetCurve of a Geometry.
+ * @author Jared Erickson
+ */
+public class OffsetCurveCommand extends GeometryCommand {
+
+ /**
+ * Get the command name
+ * @return The command name
+ */
+ @Override
+ public String getName() {
+ return "offsetCurve";
+ }
+
+ /**
+ * Get the description of what the Command does
+ * @return The description of what the Command does
+ */
+ @Override
+ public String getDescription() {
+ return "Calculate the offsetCurve of a Geometry.";
+ }
+
+ /**
+ * Get a new OffsetCurveOptions
+ * @return A new OffsetCurveOptions
+ */
+ @Override
+ public OffsetCurveOptions getOptions() {
+ return new OffsetCurveOptions();
+ }
+
+ /**
+ * Calculate the offsetCurve of the input geometry
+ * @param geometry The input geometry
+ * @param options The OffsetCurveOptions
+ * @param reader The java.io.Reader
+ * @param writer The java.io.Writer
+ * @throws Exception if an error occurs
+ */
+ @Override
+ protected void processGeometry(Geometry geometry, OffsetCurveOptions options, Reader reader, Writer writer) throws Exception {
+ BufferParameters params = BufferCommand.getBufferParametersg(options);
+ OffsetCurve offsetCurve = new OffsetCurve(geometry, options.getDistance(), params);
+ Geometry outputGeometry = offsetCurve.getCurve();
+ writer.write(writeGeometry(outputGeometry, options));
+ }
+
+ /**
+ * The OffsetCurveOptions
+ */
+ public static class OffsetCurveOptions extends BufferCommand.BufferOptions {
+ }
+}
diff --git a/src/main/java/org/geometrycommands/PipeCommand.java b/src/main/java/org/geometrycommands/PipeCommand.java
new file mode 100644
index 00000000..f492860f
--- /dev/null
+++ b/src/main/java/org/geometrycommands/PipeCommand.java
@@ -0,0 +1,129 @@
+package org.geometrycommands;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import org.geometrycommands.PipeCommand.PipeOptions;
+import org.kohsuke.args4j.Option;
+
+public class PipeCommand implements Command {
+
+ @Override
+ public String getName() {
+ return "pipe";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Combine multiple commands together with a pipe.";
+ }
+
+ @Override
+ public PipeOptions getOptions() {
+ return new PipeOptions();
+ }
+
+ @Override
+ public void execute(PipeOptions options, Reader reader, Writer writer) throws Exception {
+
+ String[] commands = options.getCommands().split("\\|");
+
+ Reader subReader = reader;
+ StringWriter subWriter = new StringWriter();
+ StringWriter errorWriter = new StringWriter();
+ String output = "";
+
+ for(String command : commands) {
+ String[] subArgs = translateCommandline(command.trim());
+ Commands.execute(subArgs, subReader, subWriter, errorWriter);
+ String errorMessage = errorWriter.toString().trim();
+ if (!errorMessage.isEmpty()) {
+ throw new Exception(errorMessage);
+ }
+ output = subWriter.toString();
+ subReader = new StringReader(output);
+ subWriter = new StringWriter();
+ errorWriter = new StringWriter();
+ }
+ writer.write(output);
+ writer.write("\n");
+ }
+
+ /**
+ * From Ant
+ */
+ private String[] translateCommandline(String toProcess) {
+ if (toProcess == null || toProcess.isEmpty()) {
+ return new String[0];
+ }
+
+ final int normal = 0;
+ final int inQuote = 1;
+ final int inDoubleQuote = 2;
+ int state = normal;
+ final StringTokenizer tok = new StringTokenizer(toProcess, "\"' ", true);
+ final ArrayList result = new ArrayList<>();
+ final StringBuilder current = new StringBuilder();
+ boolean lastTokenHasBeenQuoted = false;
+
+ while (tok.hasMoreTokens()) {
+ String nextTok = tok.nextToken();
+ switch (state) {
+ case inQuote:
+ if ("'".equals(nextTok)) {
+ lastTokenHasBeenQuoted = true;
+ state = normal;
+ } else {
+ current.append(nextTok);
+ }
+ break;
+ case inDoubleQuote:
+ if ("\"".equals(nextTok)) {
+ lastTokenHasBeenQuoted = true;
+ state = normal;
+ } else {
+ current.append(nextTok);
+ }
+ break;
+ default:
+ if ("'".equals(nextTok)) {
+ state = inQuote;
+ } else if ("\"".equals(nextTok)) {
+ state = inDoubleQuote;
+ } else if (" ".equals(nextTok)) {
+ if (lastTokenHasBeenQuoted || current.length() > 0) {
+ result.add(current.toString());
+ current.setLength(0);
+ }
+ } else {
+ current.append(nextTok);
+ }
+ lastTokenHasBeenQuoted = false;
+ break;
+ }
+ }
+ if (lastTokenHasBeenQuoted || current.length() > 0) {
+ result.add(current.toString());
+ }
+ if (state == inQuote || state == inDoubleQuote) {
+ throw new IllegalArgumentException("unbalanced quotes in " + toProcess);
+ }
+ return result.toArray(new String[result.size()]);
+ }
+
+ public static class PipeOptions extends Options {
+
+ @Option(name = "-c", aliases = "--commands", usage="Commands separate by pipe", required = true)
+ private String commands;
+
+ public String getCommands() {
+ return commands;
+ }
+
+ public void setCommands(String commands) {
+ this.commands = commands;
+ }
+ }
+
+}
diff --git a/src/main/java/org/geometrycommands/ProjectCommand.java b/src/main/java/org/geometrycommands/ProjectCommand.java
index 8885f9b9..0b5712fb 100644
--- a/src/main/java/org/geometrycommands/ProjectCommand.java
+++ b/src/main/java/org/geometrycommands/ProjectCommand.java
@@ -18,11 +18,11 @@
import java.util.List;
import org.geometrycommands.ProjectCommand.ProjectOptions;
import org.kohsuke.args4j.Option;
-import org.osgeo.proj4j.CRSFactory;
-import org.osgeo.proj4j.CoordinateReferenceSystem;
-import org.osgeo.proj4j.CoordinateTransform;
-import org.osgeo.proj4j.CoordinateTransformFactory;
-import org.osgeo.proj4j.ProjCoordinate;
+import org.locationtech.proj4j.CRSFactory;
+import org.locationtech.proj4j.CoordinateReferenceSystem;
+import org.locationtech.proj4j.CoordinateTransform;
+import org.locationtech.proj4j.CoordinateTransformFactory;
+import org.locationtech.proj4j.ProjCoordinate;
/**
* A Command to project the input Geometry from one coordinate system to another
diff --git a/src/main/resources/META-INF/services/org.geometrycommands.Command b/src/main/resources/META-INF/services/org.geometrycommands.Command
index 42220299..ecdcef5f 100644
--- a/src/main/resources/META-INF/services/org.geometrycommands.Command
+++ b/src/main/resources/META-INF/services/org.geometrycommands.Command
@@ -104,3 +104,8 @@ org.geometrycommands.PointsAlongLineCommand
org.geometrycommands.LargestEmptyCircleCommand
org.geometrycommands.MaximumInscribedCircleCommand
org.geometrycommands.VariableBufferCommand
+org.geometrycommands.PipeCommand
+org.geometrycommands.FixCommand
+org.geometrycommands.ConcaveHullCommand
+org.geometrycommands.OffsetCurveCommand
+org.geometrycommands.ConcaveHullOfPolygonsCommand
\ No newline at end of file
diff --git a/src/man/geom-concaveHull.1 b/src/man/geom-concaveHull.1
new file mode 100644
index 00000000..05372650
--- /dev/null
+++ b/src/man/geom-concaveHull.1
@@ -0,0 +1,18 @@
+.TH "geom-concaveHull" "1" "4 May 2012" "version 0.1"
+.SH NAME
+geom concaveHull
+.SH DESCRIPTION
+Calculate the concave hull of a Geometry.
+.SH USAGE
+geom concavehull -g "MULTIPOINT ((-122.38657951354979 47.58451555263637),(-122.38649368286131 47.5772205307505),(-122.39078521728516 47.58167872046887),(-122.38177299499512 47.5823155737249),(-122.3876953125 47.5828366297174),(-122.38494873046875 47.58301031389572),(-122.3876953125 47.58121554959838),(-122.38486289978027 47.5812734461813))"
+.SH OPTIONS
+-m --max-edge-length: The maximum edge length
+.PP
+-a --holes-allowed: Whether holes are allowed or not
+.PP
+-g --geometry: The input geometry
+.PP
+--help: Print help message
+.PP
+--web-help: Open help in a web browser
+.PP
diff --git a/src/man/geom-concaveHullOfPolygons.1 b/src/man/geom-concaveHullOfPolygons.1
new file mode 100644
index 00000000..8969eb80
--- /dev/null
+++ b/src/man/geom-concaveHullOfPolygons.1
@@ -0,0 +1,20 @@
+.TH "geom-concaveHullOfPolygons" "1" "4 May 2012" "version 0.1"
+.SH NAME
+geom concaveHullOfPolygons
+.SH DESCRIPTION
+Calculate the concave hull of Polygons.
+.SH USAGE
+geom concaveHullOfPolygons -l 0.5 -g "MULTIPOLYGON (((-122.38889694213867 47.57595031143529, -122.3895299434662 47.57526633442543, -122.38845705986023 47.57515414686724, -122.38857507705688 47.57558480102301, -122.38889694213867 47.57595031143529)),((-122.38868772983551 47.57478501191467, -122.38879501819609 47.574224066564, -122.38778114318846 47.5742566377487, -122.38817274570465 47.574600443462614, -122.38868772983551 47.57478501191467)),((-122.3868852853775 47.57554137387374, -122.38756120204926 47.57528442917038, -122.38598942756653 47.575132433118526, -122.38690674304961 47.57534957020037, -122.3868852853775 47.57554137387374)))"
+.SH OPTIONS
+-l --max-edge-length: The maximum edge length
+.PP
+-a --holes-allowed: Whether holes are allowed or not
+.PP
+-t --tight: Whether it should be tight or now
+.PP
+-g --geometry: The input geometry
+.PP
+--help: Print help message
+.PP
+--web-help: Open help in a web browser
+.PP
diff --git a/src/man/geom-fix.1 b/src/man/geom-fix.1
new file mode 100644
index 00000000..86151d93
--- /dev/null
+++ b/src/man/geom-fix.1
@@ -0,0 +1,14 @@
+.TH "geom-fix" "1" "4 May 2012" "version 0.1"
+.SH NAME
+geom fix
+.SH DESCRIPTION
+Fix an invalid Geometry.
+.SH USAGE
+geom fix -g "LINESTRING (0 0, 0 0, 0 0, 0 0, 1 1)"
+.SH OPTIONS
+-g --geometry: The input geometry
+.PP
+--help: Print help message
+.PP
+--web-help: Open help in a web browser
+.PP
diff --git a/src/man/geom-offsetCurve.1 b/src/man/geom-offsetCurve.1
new file mode 100644
index 00000000..4b5743ad
--- /dev/null
+++ b/src/man/geom-offsetCurve.1
@@ -0,0 +1,28 @@
+.TH "geom-offsetCurve" "1" "4 May 2012" "version 0.1"
+.SH NAME
+geom offsetCurve
+.SH DESCRIPTION
+Calculate the offsetCurve of a Geometry.
+.SH USAGE
+geom offsetcurve -g "LINESTRING (-122.38774895668028 47.579341113135314, -122.38665461540221 47.57931940112287, -122.38654732704164 47.58122278667477, -122.38340377807616 47.58118660128292, -122.38322138786316 47.581939252282744)" -d 0.001
+.SH OPTIONS
+-d --distance: The buffer distance
+.PP
+-q --quadrantSegments: The number of quadrant segments
+.PP
+-c --endCapStyle: The end cap style (round, flat/butt, square)
+.PP
+-s --singleSided: The flag for whether the buffer should be single sided
+.PP
+-f --simplifyFactor: The simplify factor
+.PP
+-m --mitreLimit: The mitre limit
+.PP
+-j --joinStyle: The join style (round, mitre, bevel)
+.PP
+-g --geometry: The input geometry
+.PP
+--help: Print help message
+.PP
+--web-help: Open help in a web browser
+.PP
diff --git a/src/man/geom-pipe.1 b/src/man/geom-pipe.1
new file mode 100644
index 00000000..329d8fa6
--- /dev/null
+++ b/src/man/geom-pipe.1
@@ -0,0 +1,14 @@
+.TH "geom-pipe" "1" "4 May 2012" "version 0.1"
+.SH NAME
+geom pipe
+.SH DESCRIPTION
+Combine multiple commands together with a pipe.
+.SH USAGE
+geom pipe -c "buffer -g 'POINT(1 1)' -d 10 | centroid"
+.SH OPTIONS
+-c --commands: Commands separate by pipe
+.PP
+--help: Print help message
+.PP
+--web-help: Open help in a web browser
+.PP
diff --git a/src/shell/geom_bash_comp b/src/shell/geom_bash_comp
index 1903c888..a3d28df7 100644
--- a/src/shell/geom_bash_comp
+++ b/src/shell/geom_bash_comp
@@ -5,7 +5,7 @@ _geom()
local line=${COMP_LINE}
COMPREPLY=()
if [[ "$line" == *"geom " ]]; then
- COMPREPLY=($(compgen -W 'angle arc arcpoly area asciiart boundary buffer centroid closelinestring combine contains convexHull coordinates count countpoints coveredby covers crosses delaunay densify difference dimension disjoint distance distanceline draw drawbase64 dump ellipse endpoint envelope equals fromwkb get grid hausdorffdistance help hilbertcurve interiorpoint interpolatepoint intersection intersects isccw isclosed isempty isrectangle isring issimple isvalid iswithindistance kochsnowflake largestemptycircle linedissolve linemerge list locatepoint maximuminscribedcircle mincircle minclearance mindiameter minrect mortoncurve narrow nearestpoints node normalize octagonalenvelope overlaps placepoint pointatangle pointsalong polygonize project random randomwalk rectangle reduceprecision reflect relate reverse rotate scale shear sierpinskicarpet similarity simplify sinestar slice snap split spoke squircle startpoint subline supercircle symdifference text touches towkb translate type union variablebuffer version voronoi within' -- $cur))
+ COMPREPLY=($(compgen -W 'angle arc arcpoly area asciiart boundary buffer centroid closelinestring combine concaveHull concaveHullOfPolygons contains convexHull coordinates count countpoints coveredby covers crosses delaunay densify difference dimension disjoint distance distanceline draw drawbase64 dump ellipse endpoint envelope equals fix fromwkb get grid hausdorffdistance help hilbertcurve interiorpoint interpolatepoint intersection intersects isccw isclosed isempty isrectangle isring issimple isvalid iswithindistance kochsnowflake largestemptycircle linedissolve linemerge list locatepoint maximuminscribedcircle mincircle minclearance mindiameter minrect mortoncurve narrow nearestpoints node normalize octagonalenvelope offsetCurve overlaps pipe placepoint pointatangle pointsalong polygonize project random randomwalk rectangle reduceprecision reflect relate reverse rotate scale shear sierpinskicarpet similarity simplify sinestar slice snap split spoke squircle startpoint subline supercircle symdifference text touches towkb translate type union variablebuffer version voronoi within' -- $cur))
elif [[ "$line" == *"geom angle "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -g --geometry -o --otherGeometry -t --type' -- $cur))
elif [[ "$line" == *"geom arc "* ]]; then
@@ -26,6 +26,10 @@ _geom()
COMPREPLY=($(compgen -W '--help --web-help -g --geometry' -- $cur))
elif [[ "$line" == *"geom combine "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help' -- $cur))
+ elif [[ "$line" == *"geom concaveHull "* ]]; then
+ COMPREPLY=($(compgen -W '--help --web-help -a --holes-allowed -g --geometry -m --max-edge-length' -- $cur))
+ elif [[ "$line" == *"geom concaveHullOfPolygons "* ]]; then
+ COMPREPLY=($(compgen -W '--help --web-help -a --holes-allowed -g --geometry -l --max-edge-length -t --tight' -- $cur))
elif [[ "$line" == *"geom contains "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -g --geometry -o --otherGeometry' -- $cur))
elif [[ "$line" == *"geom convexHull "* ]]; then
@@ -70,6 +74,8 @@ _geom()
COMPREPLY=($(compgen -W '--help --web-help -e --expandBy -g --geometry' -- $cur))
elif [[ "$line" == *"geom equals "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -g --geometry -l --tolerance -o --otherGeometry -t --type' -- $cur))
+ elif [[ "$line" == *"geom fix "* ]]; then
+ COMPREPLY=($(compgen -W '--help --web-help -g --geometry' -- $cur))
elif [[ "$line" == *"geom fromwkb "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -b --wkb' -- $cur))
elif [[ "$line" == *"geom get "* ]]; then
@@ -140,8 +146,12 @@ _geom()
COMPREPLY=($(compgen -W '--help --web-help -g --geometry' -- $cur))
elif [[ "$line" == *"geom octagonalenvelope "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -g --geometry' -- $cur))
+ elif [[ "$line" == *"geom offsetCurve "* ]]; then
+ COMPREPLY=($(compgen -W '--help --web-help -c --endCapStyle -d --distance -f --simplifyFactor -g --geometry -j --joinStyle -m --mitreLimit -q --quadrantSegments -s --singleSided' -- $cur))
elif [[ "$line" == *"geom overlaps "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -g --geometry -o --otherGeometry' -- $cur))
+ elif [[ "$line" == *"geom pipe "* ]]; then
+ COMPREPLY=($(compgen -W '--help --web-help -c --commands' -- $cur))
elif [[ "$line" == *"geom placepoint "* ]]; then
COMPREPLY=($(compgen -W '--help --web-help -g --geometry -o --otherGeometry' -- $cur))
elif [[ "$line" == *"geom pointatangle "* ]]; then
@@ -250,6 +260,12 @@ _geom()
if [[ "combine" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'combine'))
fi
+ if [[ "concaveHull" == "$nm"* ]]; then
+ COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'concaveHull'))
+ fi
+ if [[ "concaveHullOfPolygons" == "$nm"* ]]; then
+ COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'concaveHullOfPolygons'))
+ fi
if [[ "contains" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'contains'))
fi
@@ -316,6 +332,9 @@ _geom()
if [[ "equals" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'equals'))
fi
+ if [[ "fix" == "$nm"* ]]; then
+ COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'fix'))
+ fi
if [[ "fromwkb" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'fromwkb'))
fi
@@ -421,9 +440,15 @@ _geom()
if [[ "octagonalenvelope" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'octagonalenvelope'))
fi
+ if [[ "offsetCurve" == "$nm"* ]]; then
+ COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'offsetCurve'))
+ fi
if [[ "overlaps" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'overlaps'))
fi
+ if [[ "pipe" == "$nm"* ]]; then
+ COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'pipe'))
+ fi
if [[ "placepoint" == "$nm"* ]]; then
COMPREPLY=("${COMPREPLY[@]}" $(compgen -W 'placepoint'))
fi
diff --git a/src/test/java/org/geometrycommands/AngleCommandTest.java b/src/test/java/org/geometrycommands/AngleCommandTest.java
index e73415fa..ea2113e0 100644
--- a/src/test/java/org/geometrycommands/AngleCommandTest.java
+++ b/src/test/java/org/geometrycommands/AngleCommandTest.java
@@ -1,6 +1,6 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
@@ -9,7 +9,7 @@
import org.geometrycommands.AngleCommand.AngleOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The AngleCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/AppTest.java b/src/test/java/org/geometrycommands/AppTest.java
index 3d942443..33407fc9 100644
--- a/src/test/java/org/geometrycommands/AppTest.java
+++ b/src/test/java/org/geometrycommands/AppTest.java
@@ -1,11 +1,12 @@
package org.geometrycommands;
-import org.junit.After;
-import org.junit.Before;
import java.security.Permission;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.*;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The App UnitTest
@@ -15,12 +16,12 @@ public class AppTest {
private static final String NEW_LINE = System.getProperty("line.separator");
- @Before
+ @BeforeEach
public void before() throws Exception {
System.setSecurityManager(new OverrideExitSecurityManager());
}
- @After
+ @AfterEach
public void after() throws Exception {
System.setSecurityManager(null);
}
diff --git a/src/test/java/org/geometrycommands/ArcCommandTest.java b/src/test/java/org/geometrycommands/ArcCommandTest.java
index cd8728eb..efce2887 100644
--- a/src/test/java/org/geometrycommands/ArcCommandTest.java
+++ b/src/test/java/org/geometrycommands/ArcCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ArcCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ArcPolygonCommandTest.java b/src/test/java/org/geometrycommands/ArcPolygonCommandTest.java
index 0a63d69b..3e5e6a91 100644
--- a/src/test/java/org/geometrycommands/ArcPolygonCommandTest.java
+++ b/src/test/java/org/geometrycommands/ArcPolygonCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ArcPolygonCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/AreaCommandTest.java b/src/test/java/org/geometrycommands/AreaCommandTest.java
index 69cdaf01..59326d08 100644
--- a/src/test/java/org/geometrycommands/AreaCommandTest.java
+++ b/src/test/java/org/geometrycommands/AreaCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The AreaCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/AsciiArtCommandTest.java b/src/test/java/org/geometrycommands/AsciiArtCommandTest.java
index 6279d7a6..74aeab09 100644
--- a/src/test/java/org/geometrycommands/AsciiArtCommandTest.java
+++ b/src/test/java/org/geometrycommands/AsciiArtCommandTest.java
@@ -1,12 +1,12 @@
package org.geometrycommands;
import org.geometrycommands.AsciiArtCommand.AsciiArtOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The AsciiArtCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/BaseTest.java b/src/test/java/org/geometrycommands/BaseTest.java
index 17ee6890..dd0b3373 100644
--- a/src/test/java/org/geometrycommands/BaseTest.java
+++ b/src/test/java/org/geometrycommands/BaseTest.java
@@ -1,9 +1,17 @@
package org.geometrycommands;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.PrecisionModel;
+import org.locationtech.jts.io.ParseException;
+import org.locationtech.jts.io.WKTReader;
+import org.locationtech.jts.precision.GeometryPrecisionReducer;
+
import java.io.*;
import java.util.HashMap;
import java.util.Map;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* The Base Test class
* @author Jared Erickson
@@ -61,4 +69,13 @@ public Map runAppWithOutAndErr(String[] args, String input) throw
outputs.put("err", err.toString("UTF-8").trim());
return outputs;
}
+
+ public void assertGeometriesSimilar(String expectedWKT, String actualWKT) throws ParseException {
+ WKTReader reader = new WKTReader();
+ PrecisionModel precisionModel = new PrecisionModel(100000);
+ GeometryPrecisionReducer precisionReducer = new GeometryPrecisionReducer(precisionModel);
+ Geometry expected = precisionReducer.reduce(reader.read(expectedWKT));
+ Geometry actual = precisionReducer.reduce(reader.read(actualWKT));
+ assertEquals(expected, actual);
+ }
}
diff --git a/src/test/java/org/geometrycommands/BoundaryCommandTest.java b/src/test/java/org/geometrycommands/BoundaryCommandTest.java
index e990df7e..feeee317 100644
--- a/src/test/java/org/geometrycommands/BoundaryCommandTest.java
+++ b/src/test/java/org/geometrycommands/BoundaryCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The BoundaryCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/BufferCommandTest.java b/src/test/java/org/geometrycommands/BufferCommandTest.java
index 502c2576..557e1d04 100644
--- a/src/test/java/org/geometrycommands/BufferCommandTest.java
+++ b/src/test/java/org/geometrycommands/BufferCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.BufferCommand.BufferOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The BufferCommand UnitTest
@@ -131,7 +131,7 @@ public void run() throws Exception {
"-d", "10",
"-j", "mitre"
}, "LINESTRING (0 1, 2 3, 4 5)");
- assertEquals("POLYGON ((-3.0710678118654746 12.071067811865476, -1.55570233019602 13.314696123025453, " +
+ assertGeometriesSimilar("POLYGON ((-3.0710678118654746 12.071067811865476, -1.55570233019602 13.314696123025453, " +
"0.173165676349103 14.238795325112868, 2.049096779838718 14.807852804032304, 4.000000000000001 15, " +
"5.950903220161283 14.807852804032304, 7.826834323650898 14.238795325112868, 9.555702330196024 13.314696123025453, " +
"11.071067811865476 12.071067811865476, 12.314696123025453 10.555702330196022, " +
@@ -153,7 +153,7 @@ public void run() throws Exception {
"-d", "10",
"-j", "bevel"
}, "LINESTRING (0 1, 2 3, 4 5)");
- assertEquals("POLYGON ((-3.0710678118654746 12.071067811865476, -1.55570233019602 13.314696123025453, " +
+ assertGeometriesSimilar("POLYGON ((-3.0710678118654746 12.071067811865476, -1.55570233019602 13.314696123025453, " +
"0.173165676349103 14.238795325112868, 2.049096779838718 14.807852804032304, 4.000000000000001 15, " +
"5.950903220161283 14.807852804032304, 7.826834323650898 14.238795325112868, " +
"9.555702330196024 13.314696123025453, 11.071067811865476 12.071067811865476, " +
diff --git a/src/test/java/org/geometrycommands/CentroidCommandTest.java b/src/test/java/org/geometrycommands/CentroidCommandTest.java
index e7e69f1c..c4cfeebe 100644
--- a/src/test/java/org/geometrycommands/CentroidCommandTest.java
+++ b/src/test/java/org/geometrycommands/CentroidCommandTest.java
@@ -4,8 +4,8 @@
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.CentroidCommand.CentroidOptions;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The CentroidCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CloseLineStringCommandTest.java b/src/test/java/org/geometrycommands/CloseLineStringCommandTest.java
index 06b6b7de..2340f4e0 100644
--- a/src/test/java/org/geometrycommands/CloseLineStringCommandTest.java
+++ b/src/test/java/org/geometrycommands/CloseLineStringCommandTest.java
@@ -1,6 +1,6 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
@@ -8,7 +8,7 @@
import java.util.Map;
import org.geometrycommands.CloseLineStringCommand.CloseLineStringOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The CloseLineStringCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/CombineCommandTest.java b/src/test/java/org/geometrycommands/CombineCommandTest.java
index 0477ce4f..e5062e0a 100644
--- a/src/test/java/org/geometrycommands/CombineCommandTest.java
+++ b/src/test/java/org/geometrycommands/CombineCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The CombineCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CommandsTest.java b/src/test/java/org/geometrycommands/CommandsTest.java
new file mode 100644
index 00000000..e4b3169b
--- /dev/null
+++ b/src/test/java/org/geometrycommands/CommandsTest.java
@@ -0,0 +1,24 @@
+package org.geometrycommands;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class CommandsTest {
+
+ @Test
+ public void find() {
+ assertTrue(Commands.find("buffer").isPresent());
+ assertTrue(Commands.find("centroid").isPresent());
+ assertFalse(Commands.find("asdfasd").isPresent());
+ }
+
+ @Test
+ public void getAll() {
+ List commands = Commands.getAll();
+ assertFalse(commands.isEmpty());
+ }
+
+}
diff --git a/src/test/java/org/geometrycommands/ConcaveHullCommandTest.java b/src/test/java/org/geometrycommands/ConcaveHullCommandTest.java
new file mode 100644
index 00000000..74794d9b
--- /dev/null
+++ b/src/test/java/org/geometrycommands/ConcaveHullCommandTest.java
@@ -0,0 +1,87 @@
+package org.geometrycommands;
+
+import org.geometrycommands.ConcaveHullCommand.ConcaveHullOptions;
+import org.junit.jupiter.api.Test;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * The ConcaveHullCommand UnitTest
+ * @author Jared Erickson
+ */
+public class ConcaveHullCommandTest extends BaseTest {
+
+ @Test
+ public void execute() throws Exception {
+
+ String inputGeometry = "MULTIPOINT (" +
+ "(-122.38657951354979 47.58451555263637), "+
+ "(-122.38649368286131 47.5772205307505), "+
+ "(-122.39078521728516 47.58167872046887), "+
+ "(-122.38177299499512 47.5823155737249), "+
+ "(-122.3876953125 47.5828366297174), "+
+ "(-122.38494873046875 47.58301031389572), "+
+ "(-122.3876953125 47.58121554959838), "+
+ "(-122.38486289978027 47.5812734461813)"+
+ ")";
+ ConcaveHullOptions options = new ConcaveHullOptions();
+ options.setGeometry(inputGeometry);
+
+ Reader reader = new StringReader(inputGeometry);
+ StringWriter writer = new StringWriter();
+
+ ConcaveHullCommand command = new ConcaveHullCommand();
+ command.execute(options, reader, writer);
+ assertEquals("POLYGON ((-122.3876953125 47.58121554959838, -122.39078521728516 47.58167872046887, " +
+ "-122.3876953125 47.5828366297174, -122.38657951354979 47.58451555263637, " +
+ "-122.38494873046875 47.58301031389572, -122.38177299499512 47.5823155737249, " +
+ "-122.38486289978027 47.5812734461813, -122.38649368286131 47.5772205307505, " +
+ "-122.3876953125 47.58121554959838))", writer.getBuffer().toString());
+ }
+
+ @Test
+ public void run() throws Exception {
+ // Geometry from options
+ String result = runApp(new String[]{
+ "concavehull",
+ "-g", "MULTIPOINT (" +
+ "(-122.38657951354979 47.58451555263637), "+
+ "(-122.38649368286131 47.5772205307505), "+
+ "(-122.39078521728516 47.58167872046887), "+
+ "(-122.38177299499512 47.5823155737249), "+
+ "(-122.3876953125 47.5828366297174), "+
+ "(-122.38494873046875 47.58301031389572), "+
+ "(-122.3876953125 47.58121554959838), "+
+ "(-122.38486289978027 47.5812734461813)"+
+ ")"
+ }, null);
+ assertEquals("POLYGON ((-122.3876953125 47.58121554959838, -122.39078521728516 47.58167872046887, " +
+ "-122.3876953125 47.5828366297174, -122.38657951354979 47.58451555263637, " +
+ "-122.38494873046875 47.58301031389572, -122.38177299499512 47.5823155737249, " +
+ "-122.38486289978027 47.5812734461813, -122.38649368286131 47.5772205307505, " +
+ "-122.3876953125 47.58121554959838))", result);
+
+ // Geometry from input stream
+ result = runApp(new String[]{
+ "concavehull"
+ }, "MULTIPOINT (" +
+ "(-122.38657951354979 47.58451555263637), "+
+ "(-122.38649368286131 47.5772205307505), "+
+ "(-122.39078521728516 47.58167872046887), "+
+ "(-122.38177299499512 47.5823155737249), "+
+ "(-122.3876953125 47.5828366297174), "+
+ "(-122.38494873046875 47.58301031389572), "+
+ "(-122.3876953125 47.58121554959838), "+
+ "(-122.38486289978027 47.5812734461813)"+
+ ")");
+ assertEquals("POLYGON ((-122.3876953125 47.58121554959838, -122.39078521728516 47.58167872046887, " +
+ "-122.3876953125 47.5828366297174, -122.38657951354979 47.58451555263637, " +
+ "-122.38494873046875 47.58301031389572, -122.38177299499512 47.5823155737249, " +
+ "-122.38486289978027 47.5812734461813, -122.38649368286131 47.5772205307505, " +
+ "-122.3876953125 47.58121554959838))", result);
+ }
+}
diff --git a/src/test/java/org/geometrycommands/ConcaveHullOfPolygonsCommandTest.java b/src/test/java/org/geometrycommands/ConcaveHullOfPolygonsCommandTest.java
new file mode 100644
index 00000000..8d60cb04
--- /dev/null
+++ b/src/test/java/org/geometrycommands/ConcaveHullOfPolygonsCommandTest.java
@@ -0,0 +1,66 @@
+package org.geometrycommands;
+
+import org.geometrycommands.ConcaveHullOfPolygonsCommand.ConcaveHullOfPolygonsOptions;
+import org.junit.jupiter.api.Test;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.Polygon;
+import org.locationtech.jts.io.WKTReader;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * The ConcaveHullOfPolygonsCommand UnitTest
+ * @author Jared Erickson
+ */
+public class ConcaveHullOfPolygonsCommandTest extends BaseTest {
+
+ private final String polygonsWkt = "MULTIPOLYGON (" +
+ "((-122.38889694213867 47.57595031143529, -122.3895299434662 47.57526633442543, -122.38845705986023 47.57515414686724, -122.38857507705688 47.57558480102301, -122.38889694213867 47.57595031143529))," +
+ "((-122.38868772983551 47.57478501191467, -122.38879501819609 47.574224066564, -122.38778114318846 47.5742566377487, -122.38817274570465 47.574600443462614, -122.38868772983551 47.57478501191467))," +
+ "((-122.3868852853775 47.57554137387374, -122.38756120204926 47.57528442917038, -122.38598942756653 47.575132433118526, -122.38690674304961 47.57534957020037, -122.3868852853775 47.57554137387374))" +
+ ")";
+
+ @Test
+ public void execute() throws Exception {
+
+ ConcaveHullOfPolygonsOptions options = new ConcaveHullOfPolygonsOptions();
+ options.setGeometry(polygonsWkt);
+ options.setMaximumEdgeLength(0.5);
+
+ Reader reader = new StringReader("");
+ StringWriter writer = new StringWriter();
+
+ ConcaveHullOfPolygonsCommand command = new ConcaveHullOfPolygonsCommand();
+ command.execute(options, reader, writer);
+ Geometry concaveHullPolygon = new WKTReader().read(writer.toString());
+ assertTrue(concaveHullPolygon instanceof Polygon);
+ assertFalse(concaveHullPolygon.isEmpty());
+ }
+
+ @Test
+ public void run() throws Exception {
+ // Geometry from options
+ String result = runApp(new String[]{
+ "concavehullofpolygons",
+ "-g", polygonsWkt,
+ "-l", "0.5"
+ }, null);
+ Geometry concaveHullPolygon = new WKTReader().read(result);
+ assertTrue(concaveHullPolygon instanceof Polygon);
+ assertFalse(concaveHullPolygon.isEmpty());
+
+ // Geometry from input stream
+ result = runApp(new String[]{
+ "concavehullofpolygons",
+ "-l", "0.5"
+ }, polygonsWkt);
+ concaveHullPolygon = new WKTReader().read(result);
+ assertTrue(concaveHullPolygon instanceof Polygon);
+ assertFalse(concaveHullPolygon.isEmpty());
+
+ }
+}
diff --git a/src/test/java/org/geometrycommands/ContainsCommandTest.java b/src/test/java/org/geometrycommands/ContainsCommandTest.java
index 8a52408b..854d6407 100644
--- a/src/test/java/org/geometrycommands/ContainsCommandTest.java
+++ b/src/test/java/org/geometrycommands/ContainsCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The ContainsCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ConvexHullCommandTest.java b/src/test/java/org/geometrycommands/ConvexHullCommandTest.java
index 031c402a..0bc0ce89 100644
--- a/src/test/java/org/geometrycommands/ConvexHullCommandTest.java
+++ b/src/test/java/org/geometrycommands/ConvexHullCommandTest.java
@@ -4,8 +4,8 @@
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.ConvexHullCommand.ConvexHullOptions;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ConvexHullCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CoordinatesCommandTest.java b/src/test/java/org/geometrycommands/CoordinatesCommandTest.java
index 89a3315c..19ecc34f 100644
--- a/src/test/java/org/geometrycommands/CoordinatesCommandTest.java
+++ b/src/test/java/org/geometrycommands/CoordinatesCommandTest.java
@@ -4,8 +4,8 @@
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.CoordinatesCommand.CoordinatesOptions;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The CoordinatesCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CountGeometriesCommandTest.java b/src/test/java/org/geometrycommands/CountGeometriesCommandTest.java
index 1b34aa16..f39af9f0 100644
--- a/src/test/java/org/geometrycommands/CountGeometriesCommandTest.java
+++ b/src/test/java/org/geometrycommands/CountGeometriesCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The CountGeometriesCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CountPointsCommandTest.java b/src/test/java/org/geometrycommands/CountPointsCommandTest.java
index bca1958b..33716036 100644
--- a/src/test/java/org/geometrycommands/CountPointsCommandTest.java
+++ b/src/test/java/org/geometrycommands/CountPointsCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The CountPointsCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CoveredByCommandTest.java b/src/test/java/org/geometrycommands/CoveredByCommandTest.java
index cbd6a8bc..79979b07 100644
--- a/src/test/java/org/geometrycommands/CoveredByCommandTest.java
+++ b/src/test/java/org/geometrycommands/CoveredByCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The CoveredByCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CoversCommandTest.java b/src/test/java/org/geometrycommands/CoversCommandTest.java
index edcc0136..1b012aaa 100644
--- a/src/test/java/org/geometrycommands/CoversCommandTest.java
+++ b/src/test/java/org/geometrycommands/CoversCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The CoversCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/CreateBashCompleteTest.java b/src/test/java/org/geometrycommands/CreateBashCompleteTest.java
index 245da326..e3c8c2e1 100644
--- a/src/test/java/org/geometrycommands/CreateBashCompleteTest.java
+++ b/src/test/java/org/geometrycommands/CreateBashCompleteTest.java
@@ -1,6 +1,6 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.ExampleMode;
diff --git a/src/test/java/org/geometrycommands/CreateDocsTest.java b/src/test/java/org/geometrycommands/CreateDocsTest.java
index 6461c1e5..f9fd15c8 100644
--- a/src/test/java/org/geometrycommands/CreateDocsTest.java
+++ b/src/test/java/org/geometrycommands/CreateDocsTest.java
@@ -1,6 +1,6 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.kohsuke.args4j.Option;
import java.io.File;
diff --git a/src/test/java/org/geometrycommands/CreateManPagesTest.java b/src/test/java/org/geometrycommands/CreateManPagesTest.java
index 8d684cfe..8fe36eb7 100644
--- a/src/test/java/org/geometrycommands/CreateManPagesTest.java
+++ b/src/test/java/org/geometrycommands/CreateManPagesTest.java
@@ -1,6 +1,6 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.kohsuke.args4j.Option;
import java.io.File;
@@ -43,7 +43,7 @@ public void createDocs() throws Exception {
DateFormat dateFormat = new SimpleDateFormat("d MMMM yyyy");
String date = dateFormat.format(new Date());
- String version = "0.7.0";
+ String version = "0.9.0";
boolean overwrite = false;
diff --git a/src/test/java/org/geometrycommands/CrossesCommandTest.java b/src/test/java/org/geometrycommands/CrossesCommandTest.java
index dde0d72c..1de04a44 100644
--- a/src/test/java/org/geometrycommands/CrossesCommandTest.java
+++ b/src/test/java/org/geometrycommands/CrossesCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The CrossesCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/DelaunayTriangulationCommandTest.java b/src/test/java/org/geometrycommands/DelaunayTriangulationCommandTest.java
index 8224c81d..37a8e4f6 100644
--- a/src/test/java/org/geometrycommands/DelaunayTriangulationCommandTest.java
+++ b/src/test/java/org/geometrycommands/DelaunayTriangulationCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The DelaunayTriangulationCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/DensifyCommandTest.java b/src/test/java/org/geometrycommands/DensifyCommandTest.java
index 55c35c95..431f6c60 100644
--- a/src/test/java/org/geometrycommands/DensifyCommandTest.java
+++ b/src/test/java/org/geometrycommands/DensifyCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The DensifyCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/DifferenceCommandTest.java b/src/test/java/org/geometrycommands/DifferenceCommandTest.java
index f182ccf1..4cfeb35a 100644
--- a/src/test/java/org/geometrycommands/DifferenceCommandTest.java
+++ b/src/test/java/org/geometrycommands/DifferenceCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The DifferenceCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/DimensionCommandTest.java b/src/test/java/org/geometrycommands/DimensionCommandTest.java
index e518fc57..94e6d9ef 100644
--- a/src/test/java/org/geometrycommands/DimensionCommandTest.java
+++ b/src/test/java/org/geometrycommands/DimensionCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.DimensionCommand.DimensionOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The DimensionCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/DiscreteHausdorffDistanceCommandTest.java b/src/test/java/org/geometrycommands/DiscreteHausdorffDistanceCommandTest.java
index e12c85a4..cd0bc616 100644
--- a/src/test/java/org/geometrycommands/DiscreteHausdorffDistanceCommandTest.java
+++ b/src/test/java/org/geometrycommands/DiscreteHausdorffDistanceCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The DiscreteHausdorffDistanceCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/DisjointCommandTest.java b/src/test/java/org/geometrycommands/DisjointCommandTest.java
index aecc56b4..5a728ffc 100644
--- a/src/test/java/org/geometrycommands/DisjointCommandTest.java
+++ b/src/test/java/org/geometrycommands/DisjointCommandTest.java
@@ -1,10 +1,10 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.DisjointCommand.DisjointOptions;
/**
diff --git a/src/test/java/org/geometrycommands/DistanceCommandTest.java b/src/test/java/org/geometrycommands/DistanceCommandTest.java
index 52e0c77a..a793863d 100644
--- a/src/test/java/org/geometrycommands/DistanceCommandTest.java
+++ b/src/test/java/org/geometrycommands/DistanceCommandTest.java
@@ -1,10 +1,10 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.DistanceCommand.DistanceOptions;
/**
diff --git a/src/test/java/org/geometrycommands/DistanceLineStringCommandTest.java b/src/test/java/org/geometrycommands/DistanceLineStringCommandTest.java
index 54d9e92e..739801ca 100644
--- a/src/test/java/org/geometrycommands/DistanceLineStringCommandTest.java
+++ b/src/test/java/org/geometrycommands/DistanceLineStringCommandTest.java
@@ -1,10 +1,10 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.DistanceLineStringCommand.DistanceLineStringOptions;
/**
diff --git a/src/test/java/org/geometrycommands/DrawBase64CommandTest.java b/src/test/java/org/geometrycommands/DrawBase64CommandTest.java
index 481eb997..b87c3484 100644
--- a/src/test/java/org/geometrycommands/DrawBase64CommandTest.java
+++ b/src/test/java/org/geometrycommands/DrawBase64CommandTest.java
@@ -1,14 +1,14 @@
package org.geometrycommands;
import org.geometrycommands.DrawBase64Command.DrawOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The DrawBase64Command UnitTest
diff --git a/src/test/java/org/geometrycommands/DrawCommandTest.java b/src/test/java/org/geometrycommands/DrawCommandTest.java
index 596ff9d0..7d96d81b 100644
--- a/src/test/java/org/geometrycommands/DrawCommandTest.java
+++ b/src/test/java/org/geometrycommands/DrawCommandTest.java
@@ -5,9 +5,9 @@
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.DrawCommand.DrawOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The DrawCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/DumpCommandTest.java b/src/test/java/org/geometrycommands/DumpCommandTest.java
index 0291bf97..39561eb9 100644
--- a/src/test/java/org/geometrycommands/DumpCommandTest.java
+++ b/src/test/java/org/geometrycommands/DumpCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.DumpCommand.DumpOptions;
/**
diff --git a/src/test/java/org/geometrycommands/EllipseCommandTest.java b/src/test/java/org/geometrycommands/EllipseCommandTest.java
index 93491abd..b0690996 100644
--- a/src/test/java/org/geometrycommands/EllipseCommandTest.java
+++ b/src/test/java/org/geometrycommands/EllipseCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.EllipseCommand.EllipseOptions;
/**
diff --git a/src/test/java/org/geometrycommands/EnvelopeCommandTest.java b/src/test/java/org/geometrycommands/EnvelopeCommandTest.java
index a469608a..baf59c12 100644
--- a/src/test/java/org/geometrycommands/EnvelopeCommandTest.java
+++ b/src/test/java/org/geometrycommands/EnvelopeCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The EnvelopeCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/EqualsCommandTest.java b/src/test/java/org/geometrycommands/EqualsCommandTest.java
index 7c89e9b7..e36f2107 100644
--- a/src/test/java/org/geometrycommands/EqualsCommandTest.java
+++ b/src/test/java/org/geometrycommands/EqualsCommandTest.java
@@ -4,10 +4,10 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The EqualsCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/FixCommandTest.java b/src/test/java/org/geometrycommands/FixCommandTest.java
new file mode 100644
index 00000000..c73e0bdb
--- /dev/null
+++ b/src/test/java/org/geometrycommands/FixCommandTest.java
@@ -0,0 +1,48 @@
+package org.geometrycommands;
+
+import org.geometrycommands.FixCommand.FixOptions;
+import org.junit.jupiter.api.Test;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * The FixCommand UnitTest
+ * @author Jared Erickson
+ */
+public class FixCommandTest extends BaseTest {
+
+ @Test
+ public void execute() throws Exception {
+
+ String inputGeometry = "LINESTRING (0 0, 0 0, 0 0, 1 1)";
+ FixOptions options = new FixOptions();
+ options.setGeometry(inputGeometry);
+
+ Reader reader = new StringReader(inputGeometry);
+ StringWriter writer = new StringWriter();
+
+ FixCommand command = new FixCommand();
+ command.execute(options, reader, writer);
+ assertEquals("LINESTRING (0 0, 1 1)", writer.getBuffer().toString());
+ }
+
+ @Test
+ public void run() throws Exception {
+ // Geometry from options
+ String result = runApp(new String[]{
+ "fix",
+ "-g", "LINESTRING (0 0, 0 0, 0 0, 1 1)"
+ }, null);
+ assertEquals("LINESTRING (0 0, 1 1)", result);
+
+ // Geometry from input stream
+ result = runApp(new String[]{
+ "fix"
+ }, "LINESTRING (0 0, 0 0, 0 0, 1 1)");
+ assertEquals("LINESTRING (0 0, 1 1)", result);
+ }
+}
diff --git a/src/test/java/org/geometrycommands/FromWkbCommandTest.java b/src/test/java/org/geometrycommands/FromWkbCommandTest.java
index 7b797a37..673046e0 100644
--- a/src/test/java/org/geometrycommands/FromWkbCommandTest.java
+++ b/src/test/java/org/geometrycommands/FromWkbCommandTest.java
@@ -1,12 +1,12 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.FromWkbCommand.FromWkbOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The FromWkbCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/GeometryTypeCommandTest.java b/src/test/java/org/geometrycommands/GeometryTypeCommandTest.java
index d3f86248..9f7a42f0 100644
--- a/src/test/java/org/geometrycommands/GeometryTypeCommandTest.java
+++ b/src/test/java/org/geometrycommands/GeometryTypeCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.GeometryTypeCommand.GeometryTypeOptions;
/**
diff --git a/src/test/java/org/geometrycommands/GetEndPointCommandTest.java b/src/test/java/org/geometrycommands/GetEndPointCommandTest.java
index 54af4e20..9cc0d271 100644
--- a/src/test/java/org/geometrycommands/GetEndPointCommandTest.java
+++ b/src/test/java/org/geometrycommands/GetEndPointCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.GetEndPointCommand.GetEndPointOptions;
/**
diff --git a/src/test/java/org/geometrycommands/GetGeometryCommandTest.java b/src/test/java/org/geometrycommands/GetGeometryCommandTest.java
index ba979551..28d46865 100644
--- a/src/test/java/org/geometrycommands/GetGeometryCommandTest.java
+++ b/src/test/java/org/geometrycommands/GetGeometryCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The GetGeometryCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/GetStartPointCommandTest.java b/src/test/java/org/geometrycommands/GetStartPointCommandTest.java
index 6a02ef01..c8bf753c 100644
--- a/src/test/java/org/geometrycommands/GetStartPointCommandTest.java
+++ b/src/test/java/org/geometrycommands/GetStartPointCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.GetStartPointCommand.GetStartPointOptions;
/**
diff --git a/src/test/java/org/geometrycommands/GridCommandTest.java b/src/test/java/org/geometrycommands/GridCommandTest.java
index 8f3cc8a3..bd6a4af5 100644
--- a/src/test/java/org/geometrycommands/GridCommandTest.java
+++ b/src/test/java/org/geometrycommands/GridCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The GridCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/HelpCommandTest.java b/src/test/java/org/geometrycommands/HelpCommandTest.java
index 8365a015..a2c70745 100644
--- a/src/test/java/org/geometrycommands/HelpCommandTest.java
+++ b/src/test/java/org/geometrycommands/HelpCommandTest.java
@@ -1,12 +1,12 @@
package org.geometrycommands;
import org.geometrycommands.HelpCommand.HelpOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.*;
import java.util.Properties;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class HelpCommandTest extends BaseTest {
diff --git a/src/test/java/org/geometrycommands/HilbertCurveCommandTest.java b/src/test/java/org/geometrycommands/HilbertCurveCommandTest.java
index 04d388dd..ef41089e 100644
--- a/src/test/java/org/geometrycommands/HilbertCurveCommandTest.java
+++ b/src/test/java/org/geometrycommands/HilbertCurveCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.HilbertCurveCommand.HilbertCurveOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The HilbertCurveCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/InteriorPointCommandTest.java b/src/test/java/org/geometrycommands/InteriorPointCommandTest.java
index 18660ed5..3bd2182f 100644
--- a/src/test/java/org/geometrycommands/InteriorPointCommandTest.java
+++ b/src/test/java/org/geometrycommands/InteriorPointCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.InteriorPointCommand.InteriorPointOptions;
/**
diff --git a/src/test/java/org/geometrycommands/InterpolatePointCommandTest.java b/src/test/java/org/geometrycommands/InterpolatePointCommandTest.java
index acb6acee..e87e63f9 100644
--- a/src/test/java/org/geometrycommands/InterpolatePointCommandTest.java
+++ b/src/test/java/org/geometrycommands/InterpolatePointCommandTest.java
@@ -6,8 +6,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The InterpolatePointCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/IntersectionCommandTest.java b/src/test/java/org/geometrycommands/IntersectionCommandTest.java
index 7e504420..9d58788c 100644
--- a/src/test/java/org/geometrycommands/IntersectionCommandTest.java
+++ b/src/test/java/org/geometrycommands/IntersectionCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.IntersectionCommand.IntersectionOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IntersectsCommandTest.java b/src/test/java/org/geometrycommands/IntersectsCommandTest.java
index 3281f609..61c769d6 100644
--- a/src/test/java/org/geometrycommands/IntersectsCommandTest.java
+++ b/src/test/java/org/geometrycommands/IntersectsCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.IntersectsCommand.IntersectsOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IsClosedCommandTest.java b/src/test/java/org/geometrycommands/IsClosedCommandTest.java
index c8367d85..1fda24e2 100644
--- a/src/test/java/org/geometrycommands/IsClosedCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsClosedCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.IsClosedCommand.IsClosedOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IsCounterClockwiseCommandTest.java b/src/test/java/org/geometrycommands/IsCounterClockwiseCommandTest.java
index 723619ab..a42b44de 100644
--- a/src/test/java/org/geometrycommands/IsCounterClockwiseCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsCounterClockwiseCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.IsCounterClockwiseCommand.IsCounterClockwiseOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The IsCounterClockwiseCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/IsEmptyCommandTest.java b/src/test/java/org/geometrycommands/IsEmptyCommandTest.java
index 8098e7b5..52210491 100644
--- a/src/test/java/org/geometrycommands/IsEmptyCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsEmptyCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.IsEmptyCommand.IsEmptyOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IsRectangleCommandTest.java b/src/test/java/org/geometrycommands/IsRectangleCommandTest.java
index 708535c8..b0eb21b9 100644
--- a/src/test/java/org/geometrycommands/IsRectangleCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsRectangleCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.IsRectangleCommand.IsRectangleOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IsRingCommandTest.java b/src/test/java/org/geometrycommands/IsRingCommandTest.java
index 10d73c62..b9f32252 100644
--- a/src/test/java/org/geometrycommands/IsRingCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsRingCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.IsRingCommand.IsRingOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IsSimpleCommandTest.java b/src/test/java/org/geometrycommands/IsSimpleCommandTest.java
index 4f1c4a44..107f794f 100644
--- a/src/test/java/org/geometrycommands/IsSimpleCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsSimpleCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.IsSimpleCommand.IsSimpleOptions;
/**
diff --git a/src/test/java/org/geometrycommands/IsValidCommandTest.java b/src/test/java/org/geometrycommands/IsValidCommandTest.java
index a828024d..1a3ef350 100644
--- a/src/test/java/org/geometrycommands/IsValidCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsValidCommandTest.java
@@ -6,10 +6,10 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The IsValidCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/IsWithinDistanceCommandTest.java b/src/test/java/org/geometrycommands/IsWithinDistanceCommandTest.java
index 855cc03a..3341aba0 100644
--- a/src/test/java/org/geometrycommands/IsWithinDistanceCommandTest.java
+++ b/src/test/java/org/geometrycommands/IsWithinDistanceCommandTest.java
@@ -4,10 +4,10 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The IsWithinDistanceCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/KochSnowflakeCommandTest.java b/src/test/java/org/geometrycommands/KochSnowflakeCommandTest.java
index fd172f66..9cb2971a 100644
--- a/src/test/java/org/geometrycommands/KochSnowflakeCommandTest.java
+++ b/src/test/java/org/geometrycommands/KochSnowflakeCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The KochSnowflakeCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/LargestEmptyCircleCommandTest.java b/src/test/java/org/geometrycommands/LargestEmptyCircleCommandTest.java
index 973994d2..0bbac7fa 100644
--- a/src/test/java/org/geometrycommands/LargestEmptyCircleCommandTest.java
+++ b/src/test/java/org/geometrycommands/LargestEmptyCircleCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.LargestEmptyCircleCommand.LargestEmptyCircleOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The LargestEmptyCircleCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/LineDissolverCommandTest.java b/src/test/java/org/geometrycommands/LineDissolverCommandTest.java
index 5335e655..ac4f32fd 100644
--- a/src/test/java/org/geometrycommands/LineDissolverCommandTest.java
+++ b/src/test/java/org/geometrycommands/LineDissolverCommandTest.java
@@ -1,12 +1,12 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.LineDissolverCommand.LineDissolverOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The LineDissolverCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/LineMergeCommandTest.java b/src/test/java/org/geometrycommands/LineMergeCommandTest.java
index e17874f8..031d0be2 100644
--- a/src/test/java/org/geometrycommands/LineMergeCommandTest.java
+++ b/src/test/java/org/geometrycommands/LineMergeCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.LineMergeCommand.LineMergeOptions;
/**
diff --git a/src/test/java/org/geometrycommands/ListCommandTest.java b/src/test/java/org/geometrycommands/ListCommandTest.java
index 4f31cb7f..91db4b29 100644
--- a/src/test/java/org/geometrycommands/ListCommandTest.java
+++ b/src/test/java/org/geometrycommands/ListCommandTest.java
@@ -4,8 +4,8 @@
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.ListCommand.ListOptions;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The ListCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/LocatePointCommandTest.java b/src/test/java/org/geometrycommands/LocatePointCommandTest.java
index a0eb75f6..9cb2b66f 100644
--- a/src/test/java/org/geometrycommands/LocatePointCommandTest.java
+++ b/src/test/java/org/geometrycommands/LocatePointCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.LocatePointCommand.LocatePointOptions;
/**
diff --git a/src/test/java/org/geometrycommands/MaximumInscribedCircleCommandTest.java b/src/test/java/org/geometrycommands/MaximumInscribedCircleCommandTest.java
index 3f8f59b8..f8060ed3 100644
--- a/src/test/java/org/geometrycommands/MaximumInscribedCircleCommandTest.java
+++ b/src/test/java/org/geometrycommands/MaximumInscribedCircleCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.MaximumInscribedCircleCommand.MaximumInscribedCircleOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The MaximumInscribedCircleCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/MinimumBoundingCircleCommandTest.java b/src/test/java/org/geometrycommands/MinimumBoundingCircleCommandTest.java
index 9be03073..b31f456f 100644
--- a/src/test/java/org/geometrycommands/MinimumBoundingCircleCommandTest.java
+++ b/src/test/java/org/geometrycommands/MinimumBoundingCircleCommandTest.java
@@ -3,9 +3,14 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.MinimumBoundingCircleCommand.MinimumBoundingCircleOptions;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.PrecisionModel;
+import org.locationtech.jts.io.ParseException;
+import org.locationtech.jts.io.WKTReader;
+import org.locationtech.jts.precision.GeometryPrecisionReducer;
/**
* The MinimumBoundingCircleCommand UnitTest
@@ -47,7 +52,7 @@ public void execute() throws Exception {
MinimumBoundingCircleCommand command = new MinimumBoundingCircleCommand();
command.execute(options, reader, writer);
- assertEquals(resultGeometry, writer.getBuffer().toString());
+ assertGeometriesSimilar(resultGeometry, writer.getBuffer().toString());
}
@Test
@@ -57,12 +62,13 @@ public void run() throws Exception {
"mincircle",
"-g", inputGeometry,
}, null);
- assertEquals(resultGeometry, result);
+ assertGeometriesSimilar(resultGeometry, result);
// Geometry from input stream
result = runApp(new String[]{
"mincircle"
}, inputGeometry);
- assertEquals(resultGeometry, result);
+ assertGeometriesSimilar(resultGeometry, result);
}
+
}
\ No newline at end of file
diff --git a/src/test/java/org/geometrycommands/MinimumClearanceCommandTest.java b/src/test/java/org/geometrycommands/MinimumClearanceCommandTest.java
index 6b7b9695..7488ab6c 100644
--- a/src/test/java/org/geometrycommands/MinimumClearanceCommandTest.java
+++ b/src/test/java/org/geometrycommands/MinimumClearanceCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.MinimumClearanceCommand.MinimumClearanceOptions;
/**
diff --git a/src/test/java/org/geometrycommands/MinimumDiameterCommandTest.java b/src/test/java/org/geometrycommands/MinimumDiameterCommandTest.java
index a3b6619a..bece2b9f 100644
--- a/src/test/java/org/geometrycommands/MinimumDiameterCommandTest.java
+++ b/src/test/java/org/geometrycommands/MinimumDiameterCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.MinimumDiameterCommand.MinimumDiameterOptions;
/**
diff --git a/src/test/java/org/geometrycommands/MinimumRectangleCommandTest.java b/src/test/java/org/geometrycommands/MinimumRectangleCommandTest.java
index cb8e808f..2d6673aa 100644
--- a/src/test/java/org/geometrycommands/MinimumRectangleCommandTest.java
+++ b/src/test/java/org/geometrycommands/MinimumRectangleCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.MinimumRectangleCommand.MinimumRectangleOptions;
/**
diff --git a/src/test/java/org/geometrycommands/MortonCurveCommandTest.java b/src/test/java/org/geometrycommands/MortonCurveCommandTest.java
index 0a229ecb..86f86ac9 100644
--- a/src/test/java/org/geometrycommands/MortonCurveCommandTest.java
+++ b/src/test/java/org/geometrycommands/MortonCurveCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.MortonCurveCommand.MortonCurveOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The MortonCurveCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/NarrowCommandTest.java b/src/test/java/org/geometrycommands/NarrowCommandTest.java
index 9496e4c2..35959d55 100644
--- a/src/test/java/org/geometrycommands/NarrowCommandTest.java
+++ b/src/test/java/org/geometrycommands/NarrowCommandTest.java
@@ -1,7 +1,7 @@
package org.geometrycommands;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.NarrowCommand.NarrowOptions;
import java.io.Reader;
import java.io.StringReader;
diff --git a/src/test/java/org/geometrycommands/NearestPointsCommandTest.java b/src/test/java/org/geometrycommands/NearestPointsCommandTest.java
index d1972abb..7f00932a 100644
--- a/src/test/java/org/geometrycommands/NearestPointsCommandTest.java
+++ b/src/test/java/org/geometrycommands/NearestPointsCommandTest.java
@@ -1,11 +1,9 @@
package org.geometrycommands;
-import static junit.framework.Assert.assertEquals;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.geometrycommands.NearestPointsCommand.NearestPointsOptions;
-
+import static org.junit.jupiter.api.Assertions.*;
import java.io.StringReader;
import java.io.StringWriter;
@@ -44,7 +42,7 @@ public void run() throws Exception {
"198.81383362021836 -108.04193427198595, 179.6353481269556 -113.71517798125049, " +
"173.96210441769105 -94.53669248798772))"
}, null);
- Assert.assertEquals("MULTIPOINT ((110 90), (173.96210441769105 -94.53669248798772))", result);
+ assertEquals("MULTIPOINT ((110 90), (173.96210441769105 -94.53669248798772))", result);
// Geometry from input stream
result = runApp(new String[]{
@@ -53,7 +51,7 @@ public void run() throws Exception {
"198.81383362021836 -108.04193427198595, 179.6353481269556 -113.71517798125049, " +
"173.96210441769105 -94.53669248798772))"
}, "POLYGON ((90 90, 90 110, 110 110, 110 90, 90 90))");
- Assert.assertEquals("MULTIPOINT ((110 90), (173.96210441769105 -94.53669248798772))", result);
+ assertEquals("MULTIPOINT ((110 90), (173.96210441769105 -94.53669248798772))", result);
}
}
diff --git a/src/test/java/org/geometrycommands/NodeCommandTest.java b/src/test/java/org/geometrycommands/NodeCommandTest.java
index 353b1423..1950d5c3 100644
--- a/src/test/java/org/geometrycommands/NodeCommandTest.java
+++ b/src/test/java/org/geometrycommands/NodeCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The NodeCommand UnitTest
@@ -28,11 +28,10 @@ public void execute() throws Exception {
NodeCommand command = new NodeCommand();
command.execute(options, reader, writer);
- assertEquals("MULTILINESTRING ((5.19775390625 51.07421875, 5.6 51.6), (5.6 51.6, 6.4 52.6), " +
- "(6.4 52.6, 7.52685546875 53.7548828125, 8.2 53.2), (8.2 53.2, 9 52.4), " +
- "(9 52.4, 11.65771484375 49.931640625, 7.52685546875 47.20703125, 9 52.4), " +
- "(9 52.4, 9.50439453125 54.501953125, 8.2 53.2), (8.2 53.2, 7.35107421875 52.4365234375, 6.4 52.6), " +
- "(6.4 52.6, 4.53857421875 52.65625, 5.6 51.6), (5.6 51.6, 6.38427734375 50.634765625))",
+ assertEquals("MULTILINESTRING ((5.2 51, 5.6 51.6), (5.6 51.6, 6.4 52.6), " +
+ "(6.4 52.6, 7.6 53.8, 8.2 53.2), (8.2 53.2, 9 52.4), (9 52.4, 11.6 50, 7.6 47.2, 9 52.4), " +
+ "(9 52.4, 9.6 54.6, 8.2 53.2), (8.2 53.2, 7.4 52.4, 6.4 52.6), (6.4 52.6, 4.6 52.6, 5.6 51.6), " +
+ "(5.6 51.6, 6.4 50.6))",
writer.getBuffer().toString());
}
@@ -46,11 +45,9 @@ public void run() throws Exception {
+ "52.65625, 6.38427734375 50.634765625)",
"-n", "5"
}, null);
- assertEquals("MULTILINESTRING ((5.19775390625 51.07421875, 5.6 51.6), (5.6 51.6, 6.4 52.6), " +
- "(6.4 52.6, 7.52685546875 53.7548828125, 8.2 53.2), (8.2 53.2, 9 52.4), " +
- "(9 52.4, 11.65771484375 49.931640625, 7.52685546875 47.20703125, 9 52.4), " +
- "(9 52.4, 9.50439453125 54.501953125, 8.2 53.2), (8.2 53.2, 7.35107421875 52.4365234375, 6.4 52.6), " +
- "(6.4 52.6, 4.53857421875 52.65625, 5.6 51.6), (5.6 51.6, 6.38427734375 50.634765625))", result);
+ assertEquals("MULTILINESTRING ((5.2 51, 5.6 51.6), (5.6 51.6, 6.4 52.6), (6.4 52.6, 7.6 53.8, 8.2 53.2), " +
+ "(8.2 53.2, 9 52.4), (9 52.4, 11.6 50, 7.6 47.2, 9 52.4), (9 52.4, 9.6 54.6, 8.2 53.2), " +
+ "(8.2 53.2, 7.4 52.4, 6.4 52.6), (6.4 52.6, 4.6 52.6, 5.6 51.6), (5.6 51.6, 6.4 50.6))", result);
// Geometry from input stream
result = runApp(new String[]{
@@ -59,10 +56,8 @@ public void run() throws Exception {
}, "LINESTRING (5.19775390625 51.07421875, 7.52685546875 53.7548828125, 11.65771484375 49.931640625, "
+ "7.52685546875 47.20703125, 9.50439453125 54.501953125, 7.35107421875 52.4365234375, 4.53857421875 "
+ "52.65625, 6.38427734375 50.634765625)");
- assertEquals("MULTILINESTRING ((5.19775390625 51.07421875, 5.6 51.6), (5.6 51.6, 6.4 52.6), " +
- "(6.4 52.6, 7.52685546875 53.7548828125, 8.2 53.2), (8.2 53.2, 9 52.4), " +
- "(9 52.4, 11.65771484375 49.931640625, 7.52685546875 47.20703125, 9 52.4), " +
- "(9 52.4, 9.50439453125 54.501953125, 8.2 53.2), (8.2 53.2, 7.35107421875 52.4365234375, 6.4 52.6), " +
- "(6.4 52.6, 4.53857421875 52.65625, 5.6 51.6), (5.6 51.6, 6.38427734375 50.634765625))", result);
+ assertEquals("MULTILINESTRING ((5.2 51, 5.6 51.6), (5.6 51.6, 6.4 52.6), (6.4 52.6, 7.6 53.8, 8.2 53.2), " +
+ "(8.2 53.2, 9 52.4), (9 52.4, 11.6 50, 7.6 47.2, 9 52.4), (9 52.4, 9.6 54.6, 8.2 53.2), " +
+ "(8.2 53.2, 7.4 52.4, 6.4 52.6), (6.4 52.6, 4.6 52.6, 5.6 51.6), (5.6 51.6, 6.4 50.6))", result);
}
}
\ No newline at end of file
diff --git a/src/test/java/org/geometrycommands/NormalizeCommandTest.java b/src/test/java/org/geometrycommands/NormalizeCommandTest.java
index 704ca261..497706c1 100644
--- a/src/test/java/org/geometrycommands/NormalizeCommandTest.java
+++ b/src/test/java/org/geometrycommands/NormalizeCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.NormalizeCommand.NormalizeOptions;
/**
diff --git a/src/test/java/org/geometrycommands/OctagonalEnvelopeCommandTest.java b/src/test/java/org/geometrycommands/OctagonalEnvelopeCommandTest.java
index b9cdeec8..24cb2c20 100644
--- a/src/test/java/org/geometrycommands/OctagonalEnvelopeCommandTest.java
+++ b/src/test/java/org/geometrycommands/OctagonalEnvelopeCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.OctagonalEnvelopeCommand.OctagonalEnvelopeOptions;
/**
diff --git a/src/test/java/org/geometrycommands/OffsetCurveCommandTest.java b/src/test/java/org/geometrycommands/OffsetCurveCommandTest.java
new file mode 100644
index 00000000..80bf9fce
--- /dev/null
+++ b/src/test/java/org/geometrycommands/OffsetCurveCommandTest.java
@@ -0,0 +1,124 @@
+package org.geometrycommands;
+
+import org.geometrycommands.OffsetCurveCommand.OffsetCurveOptions;
+import org.junit.jupiter.api.Test;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * The OffsetCurveCommand UnitTest
+ *
+ * @author Jared Erickson
+ */
+public class OffsetCurveCommandTest extends BaseTest {
+
+ private final String offsetCurveWkt = "LINESTRING (-7.071067811865475 8.071067811865476, -3.0710678118654746 12.071067811865476)";
+
+ @Test
+ public void execute() throws Exception {
+ // Geometry from options
+ String inputGeometry = "LINESTRING (0 1, 2 3, 4 5)";
+ OffsetCurveOptions options = new OffsetCurveOptions();
+ options.setGeometry(inputGeometry);
+ options.setEndCapStyle("round");
+ options.setMitreLimit(5.0);
+ options.setSimplifyFactor(0.01);
+ options.setJoinStyle("round");
+ options.setDistance(10);
+
+ Reader reader = new StringReader("");
+ StringWriter writer = new StringWriter();
+
+ OffsetCurveCommand command = new OffsetCurveCommand();
+ command.execute(options, reader, writer);
+ assertEquals(offsetCurveWkt, writer.getBuffer().toString());
+
+ // Geometry from reader
+ options = new OffsetCurveOptions();
+ options.setDistance(10);
+
+ reader = new StringReader(inputGeometry);
+ writer = new StringWriter();
+
+ command = new OffsetCurveCommand();
+ command.execute(options, reader, writer);
+ assertEquals(offsetCurveWkt, writer.getBuffer().toString());
+
+ // Single sided
+ options = new OffsetCurveOptions();
+ options.setDistance(10);
+ options.setSingleSided(true);
+ options.setEndCapStyle("square");
+ options.setQuadrantSegements(6);
+
+ reader = new StringReader("LINESTRING (0 1, 2 3, 4 5)");
+ writer = new StringWriter();
+
+ command = new OffsetCurveCommand();
+ command.execute(options, reader, writer);
+ assertEquals(offsetCurveWkt, writer.getBuffer().toString());
+ }
+
+ @Test
+ public void run() throws Exception {
+ // Geometry from options
+ String result = runApp(new String[]{
+ "offsetCurve",
+ "-g", "LINESTRING (0 1, 2 3, 4 5)",
+ "-d", "10"
+ }, null);
+ assertEquals(offsetCurveWkt, result);
+
+ // Geometry from input stream
+ result = runApp(new String[]{
+ "offsetCurve",
+ "-d", "10"
+ }, "LINESTRING (0 1, 2 3, 4 5)");
+ assertEquals(offsetCurveWkt, result);
+
+ // Butt
+ result = runApp(new String[]{
+ "offsetCurve",
+ "-d", "10",
+ "-c", "butt"
+ }, "LINESTRING (0 1, 2 3, 4 5)");
+ assertEquals(offsetCurveWkt, result);
+
+ // Flat
+ result = runApp(new String[]{
+ "offsetCurve",
+ "-d", "10",
+ "-c", "flat"
+ }, "LINESTRING (0 1, 2 3, 4 5)");
+ assertEquals(offsetCurveWkt, result);
+
+ // Square
+ result = runApp(new String[]{
+ "offsetCurve",
+ "-d", "10",
+ "-c", "square"
+ }, "LINESTRING (0 1, 2 3, 4 5)");
+ assertEquals(offsetCurveWkt, result);
+
+ // Join Style Mitre
+ result = runApp(new String[]{
+ "offsetCurve",
+ "-d", "10",
+ "-j", "mitre"
+ }, "LINESTRING (0 1, 2 3, 4 5)");
+ assertGeometriesSimilar(offsetCurveWkt, result);
+
+ // Join Style Bevel
+ result = runApp(new String[]{
+ "offsetCurve",
+ "-d", "10",
+ "-j", "bevel"
+ }, "LINESTRING (0 1, 2 3, 4 5)");
+ assertGeometriesSimilar(offsetCurveWkt, result);
+ }
+
+}
diff --git a/src/test/java/org/geometrycommands/OptionsTest.java b/src/test/java/org/geometrycommands/OptionsTest.java
index 30b20706..a82d6c4e 100644
--- a/src/test/java/org/geometrycommands/OptionsTest.java
+++ b/src/test/java/org/geometrycommands/OptionsTest.java
@@ -1,7 +1,7 @@
package org.geometrycommands;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
public class OptionsTest {
diff --git a/src/test/java/org/geometrycommands/OverlapsCommandTest.java b/src/test/java/org/geometrycommands/OverlapsCommandTest.java
index 4115ebf2..e6d4cf4c 100644
--- a/src/test/java/org/geometrycommands/OverlapsCommandTest.java
+++ b/src/test/java/org/geometrycommands/OverlapsCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.OverlapsCommand.OverlapsOptions;
/**
diff --git a/src/test/java/org/geometrycommands/PipeCommandTest.java b/src/test/java/org/geometrycommands/PipeCommandTest.java
new file mode 100644
index 00000000..8b0c4a8f
--- /dev/null
+++ b/src/test/java/org/geometrycommands/PipeCommandTest.java
@@ -0,0 +1,40 @@
+package org.geometrycommands;
+
+import org.geometrycommands.PipeCommand.PipeOptions;
+import org.junit.jupiter.api.Test;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * The PipeCommand UnitTest
+ * @author Jared Erickson
+ */
+public class PipeCommandTest extends BaseTest {
+
+ @Test
+ public void execute() throws Exception {
+ PipeOptions options = new PipeOptions();
+ options.setCommands("buffer -d 10 -g 'POINT(1 1)' | centroid");
+
+ Reader reader = new StringReader("");
+ StringWriter writer = new StringWriter();
+
+ PipeCommand command = new PipeCommand();
+ command.execute(options, reader, writer);
+ assertEquals("POINT (0.9999999999999994 1)\n", writer.getBuffer().toString());
+ }
+
+ @Test
+ public void run() throws Exception {
+ String result = runApp(new String[]{
+ "pipe",
+ "-c", "buffer -d 10 | centroid"
+ }, "POINT(1 1)");
+ assertEquals("POINT (0.9999999999999994 1)", result);
+ }
+
+}
diff --git a/src/test/java/org/geometrycommands/PlacePointCommandTest.java b/src/test/java/org/geometrycommands/PlacePointCommandTest.java
index 5a1e7c0c..73ed7bbf 100644
--- a/src/test/java/org/geometrycommands/PlacePointCommandTest.java
+++ b/src/test/java/org/geometrycommands/PlacePointCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.PlacePointCommand.PlacePointOptions;
/**
diff --git a/src/test/java/org/geometrycommands/PointAtAngleCommandTest.java b/src/test/java/org/geometrycommands/PointAtAngleCommandTest.java
index fef117b0..13432464 100644
--- a/src/test/java/org/geometrycommands/PointAtAngleCommandTest.java
+++ b/src/test/java/org/geometrycommands/PointAtAngleCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The PointAtAngleCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/PointsAlongLineCommandTest.java b/src/test/java/org/geometrycommands/PointsAlongLineCommandTest.java
index f083e56f..09e08192 100644
--- a/src/test/java/org/geometrycommands/PointsAlongLineCommandTest.java
+++ b/src/test/java/org/geometrycommands/PointsAlongLineCommandTest.java
@@ -1,12 +1,12 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.PointsAlongLineCommand.PointsAlongLineOptions;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
public class PointsAlongLineCommandTest extends BaseTest {
diff --git a/src/test/java/org/geometrycommands/PolygonizeCommandTest.java b/src/test/java/org/geometrycommands/PolygonizeCommandTest.java
index 50e1a613..2dadeca3 100644
--- a/src/test/java/org/geometrycommands/PolygonizeCommandTest.java
+++ b/src/test/java/org/geometrycommands/PolygonizeCommandTest.java
@@ -5,15 +5,15 @@
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.io.WKTReader;
import org.geometrycommands.PolygonizeCommand.PolygonizeOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The PolygonizeCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/PrecisionReducerCommandTest.java b/src/test/java/org/geometrycommands/PrecisionReducerCommandTest.java
index 69db9ee2..b80657af 100644
--- a/src/test/java/org/geometrycommands/PrecisionReducerCommandTest.java
+++ b/src/test/java/org/geometrycommands/PrecisionReducerCommandTest.java
@@ -6,8 +6,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The PrecisionReducerCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ProjectCommandTest.java b/src/test/java/org/geometrycommands/ProjectCommandTest.java
index 90107372..787c7a8f 100644
--- a/src/test/java/org/geometrycommands/ProjectCommandTest.java
+++ b/src/test/java/org/geometrycommands/ProjectCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ProjectCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/RandomCommandTest.java b/src/test/java/org/geometrycommands/RandomCommandTest.java
index 3fa5ccd0..fc4f8fc2 100644
--- a/src/test/java/org/geometrycommands/RandomCommandTest.java
+++ b/src/test/java/org/geometrycommands/RandomCommandTest.java
@@ -8,8 +8,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The RandomCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/RandomWalkCommandTest.java b/src/test/java/org/geometrycommands/RandomWalkCommandTest.java
index 7ef3ec43..9f63d7bd 100644
--- a/src/test/java/org/geometrycommands/RandomWalkCommandTest.java
+++ b/src/test/java/org/geometrycommands/RandomWalkCommandTest.java
@@ -7,8 +7,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The RandomWalkCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/RectangleCommandTest.java b/src/test/java/org/geometrycommands/RectangleCommandTest.java
index 8e124299..7d1c9bb3 100644
--- a/src/test/java/org/geometrycommands/RectangleCommandTest.java
+++ b/src/test/java/org/geometrycommands/RectangleCommandTest.java
@@ -5,8 +5,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.RectangleCommand.RectangleOptions;
/**
diff --git a/src/test/java/org/geometrycommands/ReflectCommandTest.java b/src/test/java/org/geometrycommands/ReflectCommandTest.java
index bc31438d..b121ad64 100644
--- a/src/test/java/org/geometrycommands/ReflectCommandTest.java
+++ b/src/test/java/org/geometrycommands/ReflectCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ReflectCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/RelateCommandTest.java b/src/test/java/org/geometrycommands/RelateCommandTest.java
index dfd4d8d2..464c073a 100644
--- a/src/test/java/org/geometrycommands/RelateCommandTest.java
+++ b/src/test/java/org/geometrycommands/RelateCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The RelateCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ReverseCommandTest.java b/src/test/java/org/geometrycommands/ReverseCommandTest.java
index ce322f3a..0d6902e4 100644
--- a/src/test/java/org/geometrycommands/ReverseCommandTest.java
+++ b/src/test/java/org/geometrycommands/ReverseCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.ReverseCommand.ReverseOptions;
/**
diff --git a/src/test/java/org/geometrycommands/RotateCommandTest.java b/src/test/java/org/geometrycommands/RotateCommandTest.java
index 0cc9a889..5ba0ec57 100644
--- a/src/test/java/org/geometrycommands/RotateCommandTest.java
+++ b/src/test/java/org/geometrycommands/RotateCommandTest.java
@@ -6,8 +6,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The RotateCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ScaleCommandTest.java b/src/test/java/org/geometrycommands/ScaleCommandTest.java
index 5af61b42..a85782bd 100644
--- a/src/test/java/org/geometrycommands/ScaleCommandTest.java
+++ b/src/test/java/org/geometrycommands/ScaleCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ScaleCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ShearCommandTest.java b/src/test/java/org/geometrycommands/ShearCommandTest.java
index a051c932..09e6dec5 100644
--- a/src/test/java/org/geometrycommands/ShearCommandTest.java
+++ b/src/test/java/org/geometrycommands/ShearCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ShearCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SierpinskiCarpetCommandTest.java b/src/test/java/org/geometrycommands/SierpinskiCarpetCommandTest.java
index dfef3ba4..0f98f2a3 100644
--- a/src/test/java/org/geometrycommands/SierpinskiCarpetCommandTest.java
+++ b/src/test/java/org/geometrycommands/SierpinskiCarpetCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SierpinskiCarpetCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SimilarityCommandTest.java b/src/test/java/org/geometrycommands/SimilarityCommandTest.java
index a9041e2d..46ad51f1 100644
--- a/src/test/java/org/geometrycommands/SimilarityCommandTest.java
+++ b/src/test/java/org/geometrycommands/SimilarityCommandTest.java
@@ -6,8 +6,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SimilarityCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SimplifyCommandTest.java b/src/test/java/org/geometrycommands/SimplifyCommandTest.java
index f60af201..faad26f1 100644
--- a/src/test/java/org/geometrycommands/SimplifyCommandTest.java
+++ b/src/test/java/org/geometrycommands/SimplifyCommandTest.java
@@ -6,8 +6,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SimplifyCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SineStarCommandTest.java b/src/test/java/org/geometrycommands/SineStarCommandTest.java
index bb416211..163de6ca 100644
--- a/src/test/java/org/geometrycommands/SineStarCommandTest.java
+++ b/src/test/java/org/geometrycommands/SineStarCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SineStarCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SliceCommandTest.java b/src/test/java/org/geometrycommands/SliceCommandTest.java
index 26b870f0..d0d71a0d 100644
--- a/src/test/java/org/geometrycommands/SliceCommandTest.java
+++ b/src/test/java/org/geometrycommands/SliceCommandTest.java
@@ -1,7 +1,7 @@
package org.geometrycommands;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.SliceCommand.SliceOptions;
import java.io.Reader;
diff --git a/src/test/java/org/geometrycommands/SnapCommandTest.java b/src/test/java/org/geometrycommands/SnapCommandTest.java
index 45467b91..d7d7d560 100644
--- a/src/test/java/org/geometrycommands/SnapCommandTest.java
+++ b/src/test/java/org/geometrycommands/SnapCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SnapCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SplitCommandTest.java b/src/test/java/org/geometrycommands/SplitCommandTest.java
index 7d0414a3..cee0e6e8 100644
--- a/src/test/java/org/geometrycommands/SplitCommandTest.java
+++ b/src/test/java/org/geometrycommands/SplitCommandTest.java
@@ -2,15 +2,15 @@
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKTReader;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.SplitCommand.SplitOptions;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* The SplitCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/SpokeCommandTest.java b/src/test/java/org/geometrycommands/SpokeCommandTest.java
index 3b824596..3ee97c28 100644
--- a/src/test/java/org/geometrycommands/SpokeCommandTest.java
+++ b/src/test/java/org/geometrycommands/SpokeCommandTest.java
@@ -3,8 +3,8 @@
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.MultiLineString;
import org.locationtech.jts.io.WKTReader;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
import org.geometrycommands.SpokeCommand.SpokeOptions;
import java.io.StringReader;
diff --git a/src/test/java/org/geometrycommands/SquircleCommandTest.java b/src/test/java/org/geometrycommands/SquircleCommandTest.java
index a2f938ee..dbf685f7 100644
--- a/src/test/java/org/geometrycommands/SquircleCommandTest.java
+++ b/src/test/java/org/geometrycommands/SquircleCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.SquircleCommand.SquircleOptions;
/**
diff --git a/src/test/java/org/geometrycommands/SubLineCommandTest.java b/src/test/java/org/geometrycommands/SubLineCommandTest.java
index 51d577c1..77e0d7fc 100644
--- a/src/test/java/org/geometrycommands/SubLineCommandTest.java
+++ b/src/test/java/org/geometrycommands/SubLineCommandTest.java
@@ -6,8 +6,8 @@
import java.io.StringWriter;
import java.util.Map;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SubLineCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SuperCircleCommandTest.java b/src/test/java/org/geometrycommands/SuperCircleCommandTest.java
index 2807904b..8819fa8a 100644
--- a/src/test/java/org/geometrycommands/SuperCircleCommandTest.java
+++ b/src/test/java/org/geometrycommands/SuperCircleCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
import org.geometrycommands.SuperCircleCommand.SuperCircleOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The SuperCircleCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/SymDifferenceCommandTest.java b/src/test/java/org/geometrycommands/SymDifferenceCommandTest.java
index 644ab6f6..6c0d948b 100644
--- a/src/test/java/org/geometrycommands/SymDifferenceCommandTest.java
+++ b/src/test/java/org/geometrycommands/SymDifferenceCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.SymDifferenceCommand.SymDifferenceOptions;
/**
diff --git a/src/test/java/org/geometrycommands/TextCommandTest.java b/src/test/java/org/geometrycommands/TextCommandTest.java
index 4ab0ad47..3991e428 100644
--- a/src/test/java/org/geometrycommands/TextCommandTest.java
+++ b/src/test/java/org/geometrycommands/TextCommandTest.java
@@ -7,8 +7,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
/**
* The TextCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/ToWkbCommandTest.java b/src/test/java/org/geometrycommands/ToWkbCommandTest.java
index b80d4285..945410d2 100644
--- a/src/test/java/org/geometrycommands/ToWkbCommandTest.java
+++ b/src/test/java/org/geometrycommands/ToWkbCommandTest.java
@@ -1,12 +1,12 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import org.geometrycommands.ToWkbCommand.ToWkbOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The ToWkbCommand Unit Test
diff --git a/src/test/java/org/geometrycommands/TouchesCommandTest.java b/src/test/java/org/geometrycommands/TouchesCommandTest.java
index a71952c6..ba13d710 100644
--- a/src/test/java/org/geometrycommands/TouchesCommandTest.java
+++ b/src/test/java/org/geometrycommands/TouchesCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.TouchesCommand.TouchesOptions;
/**
diff --git a/src/test/java/org/geometrycommands/TranslateCommandTest.java b/src/test/java/org/geometrycommands/TranslateCommandTest.java
index 478f897f..9f95b80e 100644
--- a/src/test/java/org/geometrycommands/TranslateCommandTest.java
+++ b/src/test/java/org/geometrycommands/TranslateCommandTest.java
@@ -4,8 +4,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The TranslateCommand UnitTest
diff --git a/src/test/java/org/geometrycommands/UnionCommandTest.java b/src/test/java/org/geometrycommands/UnionCommandTest.java
index e6cdbabe..5f4710f7 100644
--- a/src/test/java/org/geometrycommands/UnionCommandTest.java
+++ b/src/test/java/org/geometrycommands/UnionCommandTest.java
@@ -1,10 +1,10 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.UnionCommand.UnionOptions;
/**
diff --git a/src/test/java/org/geometrycommands/VariableBufferCommandTest.java b/src/test/java/org/geometrycommands/VariableBufferCommandTest.java
index 32470607..06cfe0c5 100644
--- a/src/test/java/org/geometrycommands/VariableBufferCommandTest.java
+++ b/src/test/java/org/geometrycommands/VariableBufferCommandTest.java
@@ -1,14 +1,14 @@
package org.geometrycommands;
import org.geometrycommands.VariableBufferCommand.VariableBufferOptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Arrays;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* The VariableBufferCommand UnitTest
@@ -29,7 +29,7 @@ public void execute() throws Exception {
VariableBufferCommand command = new VariableBufferCommand();
command.execute(options, reader, writer);
- assertEquals("POLYGON ((-4.778594569415369 -0.4714054305846311, -5.167891854123054 0.7928918541230532, " +
+ assertGeometriesSimilar("POLYGON ((-4.778594569415369 -0.4714054305846311, -5.167891854123054 0.7928918541230532, " +
"-5.557189138830738 2.0571891388307377, -5.807852804032304 3.0490967798387163, -6 5, " +
"-5.807852804032304 6.950903220161286, -5.238795325112868 8.8268343236509, " +
"-4.314696123025453 10.555702330196022, -3.0710678118654746 12.071067811865476, " +
@@ -61,7 +61,7 @@ public void run() throws Exception {
"-d", "6",
"-d", "12"
}, null);
- assertEquals("POLYGON ((-3.9275624054901486 4.094229072156818, -3.251678721131326 4.952140780458855, " +
+ assertGeometriesSimilar("POLYGON ((-3.9275624054901486 4.094229072156818, -3.251678721131326 4.952140780458855, " +
"-3.769423364838765 6.65891613580646, -4 9, -3.769423364838765 11.341083864193543, " +
"-3.08655439013544 13.592201188381079, -1.9776353476305442 15.666842796235226, " +
"-0.4852813742385695 17.48528137423857, 1.3331572037647765 18.977635347630546, " +
@@ -92,7 +92,7 @@ public void run() throws Exception {
"-d", "11",
"-d", "20",
}, "LINESTRING (0 1, 2 3, 4 5, 6 7, 8 9)");
- assertEquals("POLYGON ((28 9, 27.615705608064605 5.0981935596774255, 26.47759065022573 1.3463313526981917, " +
+ assertGeometriesSimilar("POLYGON ((28 9, 27.615705608064605 5.0981935596774255, 26.47759065022573 1.3463313526981917, " +
"24.629392246050905 -2.1114046603920436, 22.142135623730947 -5.142135623730955, " +
"19.111404660392036 -7.629392246050909, 15.6536686473018 -9.477590650225732, " +
"11.901806440322567 -10.615705608064609, 8 -11, 4.098193559677426 -10.615705608064605, " +
diff --git a/src/test/java/org/geometrycommands/VersionCommandTest.java b/src/test/java/org/geometrycommands/VersionCommandTest.java
index c0bafdce..eb1d878b 100644
--- a/src/test/java/org/geometrycommands/VersionCommandTest.java
+++ b/src/test/java/org/geometrycommands/VersionCommandTest.java
@@ -1,13 +1,13 @@
package org.geometrycommands;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.*;
import java.util.Properties;
import org.geometrycommands.VersionCommand.VersionOptions;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class VersionCommandTest extends BaseTest {
diff --git a/src/test/java/org/geometrycommands/VoronoiDiagramCommandTest.java b/src/test/java/org/geometrycommands/VoronoiDiagramCommandTest.java
index 97b5f334..836733b8 100644
--- a/src/test/java/org/geometrycommands/VoronoiDiagramCommandTest.java
+++ b/src/test/java/org/geometrycommands/VoronoiDiagramCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.VoronoiDiagramCommand.VoronoiDiagramOptions;
/**
diff --git a/src/test/java/org/geometrycommands/WithinCommandTest.java b/src/test/java/org/geometrycommands/WithinCommandTest.java
index 5a11f57f..e215ec54 100644
--- a/src/test/java/org/geometrycommands/WithinCommandTest.java
+++ b/src/test/java/org/geometrycommands/WithinCommandTest.java
@@ -3,8 +3,8 @@
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.geometrycommands.WithinCommand.WithinOptions;
/**
diff --git a/src/test/resources/examples.properties b/src/test/resources/examples.properties
index 5a0f5461..dab884e1 100644
--- a/src/test/resources/examples.properties
+++ b/src/test/resources/examples.properties
@@ -102,3 +102,8 @@ geom-pointsalong = geom pointsalong -g "LINESTRING (0 0, 10 10)" -d 1
geom-largestemptycircle = geom largestemptycircle -g "MULTIPOINT ((-122.3935317993164 47.57571508225466),(-122.38838195800781 47.57444120741259),(-122.39061355590819 47.5823155737249))"
geom-maximuminscribedcircle = geom maximuminscribedcircle -g "POLYGON ((-122.38855361938475 47.5805786829606, -122.38636493682861 47.5783206388176, -122.38700866699219 47.5750491969984, -122.38177299499512 47.57502024527343, -122.38481998443604 47.5780600889959, -122.38151550292969 47.5805786829606, -122.38855361938475 47.5805786829606))"
geom-variablebuffer = geom variablebuffer -g "LINESTRING(1 2, 3 4, 5 6)" -d 10 -d 15 -d 20
+geom-pipe = geom pipe -c "buffer -g 'POINT(1 1)' -d 10 | centroid"
+geom-fix = geom fix -g "LINESTRING (0 0, 0 0, 0 0, 0 0, 1 1)"
+geom-concavehull = geom concavehull -g "MULTIPOINT ((-122.38657951354979 47.58451555263637),(-122.38649368286131 47.5772205307505),(-122.39078521728516 47.58167872046887),(-122.38177299499512 47.5823155737249),(-122.3876953125 47.5828366297174),(-122.38494873046875 47.58301031389572),(-122.3876953125 47.58121554959838),(-122.38486289978027 47.5812734461813))"
+geom-offsetcurve = geom offsetcurve -g "LINESTRING (-122.38774895668028 47.579341113135314, -122.38665461540221 47.57931940112287, -122.38654732704164 47.58122278667477, -122.38340377807616 47.58118660128292, -122.38322138786316 47.581939252282744)" -d 0.001
+geom-concavehullofpolygons = geom concaveHullOfPolygons -l 0.5 -g "MULTIPOLYGON (((-122.38889694213867 47.57595031143529, -122.3895299434662 47.57526633442543, -122.38845705986023 47.57515414686724, -122.38857507705688 47.57558480102301, -122.38889694213867 47.57595031143529)),((-122.38868772983551 47.57478501191467, -122.38879501819609 47.574224066564, -122.38778114318846 47.5742566377487, -122.38817274570465 47.574600443462614, -122.38868772983551 47.57478501191467)),((-122.3868852853775 47.57554137387374, -122.38756120204926 47.57528442917038, -122.38598942756653 47.575132433118526, -122.38690674304961 47.57534957020037, -122.3868852853775 47.57554137387374)))"
\ No newline at end of file
diff --git a/src/website/requirements.txt b/src/website/requirements.txt
index 129ba365..eeb0b66b 100644
--- a/src/website/requirements.txt
+++ b/src/website/requirements.txt
@@ -1,5 +1,5 @@
# This file may be used to create an environment using:
# $ pip install --upgrade -r
-sphinx==2.0.1
-sphinx-rtd-theme==0.4.3
-rst2pdf==0.96
\ No newline at end of file
+sphinx==7.2.6
+sphinx-rtd-theme==1.3.0
+rst2pdf==0.101
\ No newline at end of file
diff --git a/src/website/source/commands.rst b/src/website/source/commands.rst
index 8aca61e8..37aedb23 100644
--- a/src/website/source/commands.rst
+++ b/src/website/source/commands.rst
@@ -17,6 +17,8 @@ Commands
commands/closelinestring.rst
commands/combine.rst
commands/contains.rst
+ commands/concaveHull.rst
+ commands/concaveHullOfPolygons.rst
commands/convexHull.rst
commands/coordinates.rst
commands/count.rst
@@ -26,19 +28,24 @@ Commands
commands/crosses.rst
commands/delaunay.rst
commands/densify.rst
- commands/draw.rst
- commands/drawbase64.rst
- commands/dump.rst
- commands/ellipse.rst
commands/difference.rst
commands/dimension.rst
- commands/hausdorffdistance.rst
commands/disjoint.rst
commands/distance.rst
commands/distanceline.rst
+ commands/draw.rst
+ commands/drawbase64.rst
+ commands/dump.rst
+ commands/ellipse.rst
+ commands/endpoint.rst
commands/envelope.rst
commands/equals.rst
+ commands/fix.rst
commands/fromwkb.rst
+ commands/get.rst
+ commands/grid.rst
+ commands/hausdorffdistance.rst
+ commands/hilbertcurve.rst
commands/interiorpoint.rst
commands/interpolatepoint.rst
commands/intersection.rst
@@ -52,34 +59,33 @@ Commands
commands/isvalid.rst
commands/iswithindistance.rst
commands/kochsnowflake.rst
- commands/hilbertcurve.rst
- commands/mortoncurve.rst
+ commands/largestemptycircle.rst
commands/linedissolve.rst
commands/linemerge.rst
commands/locatepoint.rst
- commands/type.rst
- commands/grid.rst
- commands/endpoint.rst
- commands/get.rst
- commands/startpoint.rst
+ commands/maximuminscribedcircle.rst
commands/mincircle.rst
commands/minclearance.rst
commands/mindiameter.rst
commands/minrect.rst
+ commands/mortoncurve.rst
commands/narrow.rst
commands/nearestpoints.rst
commands/node.rst
commands/normalize.rst
commands/octagonalenvelope.rst
+ commands/offsetCurve.rst
commands/overlaps.rst
+ commands/pipe.rst
commands/placepoint.rst
commands/pointatangle.rst
+ commands/pointsalong.rst
commands/polygonize.rst
- commands/reduceprecision.rst
commands/project.rst
commands/random.rst
commands/randomwalk.rst
commands/rectangle.rst
+ commands/reduceprecision.rst
commands/reflect.rst
commands/relate.rst
commands/reverse.rst
@@ -91,10 +97,11 @@ Commands
commands/simplify.rst
commands/sinestar.rst
commands/slice.rst
+ commands/snap.rst
commands/split.rst
commands/spoke.rst
- commands/snap.rst
commands/squircle.rst
+ commands/startpoint.rst
commands/subline.rst
commands/supercircle.rst
commands/symdifference.rst
@@ -102,10 +109,9 @@ Commands
commands/touches.rst
commands/towkb.rst
commands/translate.rst
+ commands/type.rst
commands/union.rst
+ commands/variablebuffer.rst
commands/voronoi.rst
commands/within.rst
- commands/pointsalong.rst
- commands/largestemptycircle.rst
- commands/maximuminscribedcircle.rst
diff --git a/src/website/source/conf.py b/src/website/source/conf.py
index 92ccedc5..40262198 100644
--- a/src/website/source/conf.py
+++ b/src/website/source/conf.py
@@ -18,11 +18,11 @@
# -- Project information -----------------------------------------------------
project = 'geom'
-copyright = '2020, Jared Erickson'
+copyright = '2021, Jared Erickson'
author = 'Jared Erickson'
# The full version, including alpha/beta/rc tags
-release = '0.7.0'
+release = '0.9.0'
# -- General configuration ---------------------------------------------------
@@ -32,7 +32,7 @@
# ones.
extensions = ["rst2pdf.pdfbuilder"]
-pdf_documents = [('index',u'geom',u'geoc',u'Jared Erickson'),]
+pdf_documents = [('index',u'geom',u'geom',u'Jared Erickson'),]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
diff --git a/src/website/source/usage.rst b/src/website/source/usage.rst
index e5a533e6..e4c07251 100644
--- a/src/website/source/usage.rst
+++ b/src/website/source/usage.rst
@@ -4,8 +4,23 @@ View a list of all geom commands::
geom list
+Get help for a command::
+
+ geom buffer --help
+ geom buffer: Buffer a geometry by a distance.
+ --help : Print help message
+ -c (--endCapStyle) VAL : The end cap style (round, flat/butt, square)
+ -d (--distance) N : The buffer distance
+ -g (--geometry) VAL : The input geometry
+ -q (--quadrantSegments) N : The number of quadrant segments
+ -s (--singleSided) : The flag for whether the buffer should be single sided
+
Buffer a geometry::
+ echo "POINT (1 1)" | geom buffer -g "POINT(1 1)" -d 10
+
+Or buffer a geometry by piping in text::
+
echo "POINT (1 1)" | geom buffer -d 10
Reproject a geometry::