diff --git a/.gitignore b/.gitignore index 4644e4e..95cad72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -.metadata -target +# Ignore Eclipse output directory bin -.settings + +# Ignore Gradle stuff +.gradle +build diff --git a/.project b/.project new file mode 100644 index 0000000..3aa51d4 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + ClipperJava + Project clipper-java created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/Clipper Console/.classpath b/Clipper Console/.classpath index 7233eb2..2bfdb57 100644 --- a/Clipper Console/.classpath +++ b/Clipper Console/.classpath @@ -1,21 +1,13 @@ - + - - - - - - - + + + + - - - - - - + diff --git a/Clipper Console/.project b/Clipper Console/.project index e3ecceb..9a83135 100644 --- a/Clipper Console/.project +++ b/Clipper Console/.project @@ -1,6 +1,6 @@ - Clipper Console + ClipperConsole @@ -11,13 +11,13 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.buildship.core.gradleprojectbuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Clipper Console/.settings/org.eclipse.buildship.core.prefs b/Clipper Console/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/Clipper Console/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/Clipper Console/.settings/org.eclipse.jdt.core.prefs b/Clipper Console/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..35068d9 --- /dev/null +++ b/Clipper Console/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Clipper Console/pom.xml b/Clipper Console/pom.xml deleted file mode 100644 index 7b6aabc..0000000 --- a/Clipper Console/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - 4.0.0 - de.lighti - ClipperConsole - 6.4.2 - Clipper Console Application - A command line tool to read and process polygon files - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - - - de.lighti - Clipper - 6.4.2 - - - \ No newline at end of file diff --git a/Clipper GUI/.classpath b/Clipper GUI/.classpath index 7233eb2..2bfdb57 100644 --- a/Clipper GUI/.classpath +++ b/Clipper GUI/.classpath @@ -1,21 +1,13 @@ - + - - - - - - - + + + + - - - - - - + diff --git a/Clipper GUI/.project b/Clipper GUI/.project index 545699e..e6c3122 100644 --- a/Clipper GUI/.project +++ b/Clipper GUI/.project @@ -1,6 +1,6 @@ - Clipper GUI + ClipperGUI @@ -11,13 +11,13 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.buildship.core.gradleprojectbuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Clipper GUI/.settings/org.eclipse.buildship.core.prefs b/Clipper GUI/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/Clipper GUI/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/Clipper GUI/.settings/org.eclipse.jdt.core.prefs b/Clipper GUI/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..35068d9 --- /dev/null +++ b/Clipper GUI/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Clipper GUI/pom.xml b/Clipper GUI/pom.xml deleted file mode 100644 index 30c4f99..0000000 --- a/Clipper GUI/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - 4.0.0 - de.lighti - ClipperGUI - 6.4.2 - Clipper GUI Application - A swing-based application to visualize the various operations of the Clipper library - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - - - de.lighti - Clipper - 6.4.2 - - - \ No newline at end of file diff --git a/Clipper/.classpath b/Clipper/.classpath index 149cb3c..4be791f 100644 --- a/Clipper/.classpath +++ b/Clipper/.classpath @@ -1,20 +1,12 @@ - + - - + + - - - - - - - - - - - + + + diff --git a/Clipper/.project b/Clipper/.project index 01f23cc..9f34631 100644 --- a/Clipper/.project +++ b/Clipper/.project @@ -11,13 +11,13 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.buildship.core.gradleprojectbuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Clipper/.settings/org.eclipse.buildship.core.prefs b/Clipper/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/Clipper/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/Clipper/.settings/org.eclipse.jdt.core.prefs b/Clipper/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..35068d9 --- /dev/null +++ b/Clipper/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Clipper/pom.xml b/Clipper/pom.xml deleted file mode 100644 index 6a48531..0000000 --- a/Clipper/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - 4.0.0 - de.lighti - Clipper - 6.4.2 - A Polygon clipper for Java - Polygon Clipper is a library to execute various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap. It comes with two Demo applications, one for the console and one using a Swing based GUI. - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - \ No newline at end of file diff --git a/Clipper/src/de/lighti/clipper/DefaultClipper.java b/Clipper/src/de/lighti/clipper/DefaultClipper.java index 9b01cb4..5ef5f3e 100644 --- a/Clipper/src/de/lighti/clipper/DefaultClipper.java +++ b/Clipper/src/de/lighti/clipper/DefaultClipper.java @@ -1316,6 +1316,7 @@ private boolean fixupIntersectionOrder() { //---------------------------------------------------------------------- + @SuppressWarnings("unused") private void fixupOutPolyline( OutRec outrec ) { Path.OutPt pp = outrec.getPoints(); Path.OutPt lastPP = pp.prev; diff --git a/Clipper/src/de/lighti/clipper/Path.java b/Clipper/src/de/lighti/clipper/Path.java index ddf7492..f6cbeba 100644 --- a/Clipper/src/de/lighti/clipper/Path.java +++ b/Clipper/src/de/lighti/clipper/Path.java @@ -6,7 +6,7 @@ import java.util.Collections; /** - * A pure convenience class to avoid writing List everywhere. + * A pure convenience class to avoid writing List<LongPoint> everywhere. * * @author Tobias Mahlmann * diff --git a/Clipper/src/de/lighti/clipper/Paths.java b/Clipper/src/de/lighti/clipper/Paths.java index 3084f0b..f2a9722 100644 --- a/Clipper/src/de/lighti/clipper/Paths.java +++ b/Clipper/src/de/lighti/clipper/Paths.java @@ -3,7 +3,7 @@ import java.util.ArrayList; /** - * A pure convenience class to avoid writing List everywhere. + * A pure convenience class to avoid writing List<Path> everywhere. * * @author Tobias Mahlmann * diff --git a/Clipper/src/de/lighti/clipper/Point.java b/Clipper/src/de/lighti/clipper/Point.java index 98f290b..ea9389a 100644 --- a/Clipper/src/de/lighti/clipper/Point.java +++ b/Clipper/src/de/lighti/clipper/Point.java @@ -162,7 +162,8 @@ else if (pt2.y > pt1.y == pt2.y < pt3.y) { } } - private final static NumberComparator NUMBER_COMPARATOR = new NumberComparator(); + @SuppressWarnings("rawtypes") + private static final NumberComparator NUMBER_COMPARATOR = new NumberComparator(); protected T x; @@ -180,6 +181,7 @@ protected Point( T x, T y, T z ) { this.z = z; } + @SuppressWarnings("unchecked") @Override public boolean equals( Object obj ) { if (obj == null) { diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..88f960b --- /dev/null +++ b/build.gradle @@ -0,0 +1,72 @@ +allprojects { + group = "de.lighti" + version = "6.4.2" +} + +description = 'ClipperJava is a 1:1 Java port of the Clipper project developed by Angus Johnson, which as an implementation of the algorithm proposed by Bala R. Vatti. Clipper has various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap. It comes with two Demo applications, one for the Console and one using a Swing-based GUI.' + +subprojects { + apply plugin: 'java' + apply plugin: 'maven-publish' + + java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + withSourcesJar() + withJavadocJar() + } + + jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Version': project.version + } + } + + sourceSets { + main { + java { + srcDirs 'src' + } + } + } + + tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true + } + + publishing { + publications { + ClipperJava(MavenPublication) { + from components.java + } + } + } + + javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + } +} + +project(':Clipper') { + description = 'Clipper is a library with various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap.' +} + +project(':ClipperConsole') { + description = 'ClipperConsole is a command line tool to read and process polygon files.' + + dependencies { + implementation project(':Clipper') + } +} + +project(':ClipperGUI') { + description = 'ClipperGUI is a swing-based application to visualize the various operations of the Clipper library.' + + dependencies { + implementation project(':Clipper') + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..a88141e --- /dev/null +++ b/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name='ClipperJava' +include 'Clipper', 'Clipper Console', 'Clipper GUI' +project(':Clipper').name = 'Clipper' +project(':Clipper Console').name = 'ClipperConsole' +project(':Clipper GUI').name = 'ClipperGUI' \ No newline at end of file