Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/bin/
*.iml
.idea/
.DS_Store
*/target/
.*
/.settings/
7 changes: 0 additions & 7 deletions Clipper Console/.classpath

This file was deleted.

1 change: 0 additions & 1 deletion Clipper Console/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions Clipper Console/.project

This file was deleted.

11 changes: 0 additions & 11 deletions Clipper Console/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

32 changes: 32 additions & 0 deletions Clipper Console/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>de.lighti.clipper</groupId>
<artifactId>clipper-java-double</artifactId>
<!-- Three first numbers are the base Clipper library version -->
<version>6.4.2.1-SNAPSHOT</version>
</parent>

<artifactId>clipper-double-console</artifactId>

<properties>
<maven.install.skip>true</maven.install.skip>
</properties>

<build>
<sourceDirectory>src</sourceDirectory>
</build>

<dependencies>
<dependency>
<groupId>de.lighti.clipper</groupId>
<artifactId>clipper</artifactId>
<version>6.4.2.1-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
12 changes: 6 additions & 6 deletions Clipper Console/src/de/lighti/clipper/console/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import de.lighti.clipper.DefaultClipper;
import de.lighti.clipper.Path;
import de.lighti.clipper.Paths;
import de.lighti.clipper.Point.LongPoint;
import de.lighti.clipper.Point;

public class Program {

static Path IntsToPolygon( int[] ints ) {
final int len1 = ints.length / 2;
final Path result = new Path( len1 );
for (int i = 0; i < len1; i++) {
result.add( new LongPoint( ints[i * 2], ints[i * 2 + 1] ) );
result.add( new Point( ints[i * 2], ints[i * 2 + 1] ) );
}
return result;
}
Expand Down Expand Up @@ -81,7 +81,7 @@ static boolean LoadFromFile( String filename, Paths ppg, int dec_places, int xOf

x = x + xOffset;
y = y + yOffset;
pg.add( new LongPoint( x, y ) );
pg.add( new Point( x, y ) );
}
}
else {
Expand All @@ -100,7 +100,7 @@ static boolean LoadFromFile( String filename, Paths ppg, int dec_places, int xOf

x = x * scaling + xOffset;
y = y * scaling + yOffset;
pg.add( new LongPoint( (int) Math.round( x ), (int) Math.round( y ) ) );
pg.add( new Point( (int) Math.round( x ), (int) Math.round( y ) ) );
}
}
}
Expand Down Expand Up @@ -271,7 +271,7 @@ static Path MakeRandomPolygon( Random r, int maxWidth, int maxHeight, int edgeCo
static Path MakeRandomPolygon( Random r, int maxWidth, int maxHeight, int edgeCount, int scale ) {
final Path result = new Path( edgeCount );
for (int i = 0; i < edgeCount; i++) {
result.add( new LongPoint( r.nextInt( maxWidth ) * scale, r.nextInt( maxHeight ) * scale ) );
result.add( new Point( r.nextInt( maxWidth ) * scale, r.nextInt( maxHeight ) * scale ) );
}
return result;
}
Expand All @@ -296,7 +296,7 @@ static void saveToFile( String filename, Paths ppg, int dec_places ) throws IOEx
writer.write( String.format( "%d%n", ppg.size() ) );
for (final Path pg : ppg) {
writer.write( String.format( "%d%n", pg.size() ) );
for (final LongPoint ip : pg) {
for (final Point ip : pg) {
writer.write( String.format( "%.2f, %.2f%n", ip.getX() / scaling, ip.getY() / scaling ) );
}
}
Expand Down
14 changes: 7 additions & 7 deletions Clipper Console/src/de/lighti/clipper/console/SVGBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import de.lighti.clipper.LongRect;
import de.lighti.clipper.Path;
import de.lighti.clipper.Paths;
import de.lighti.clipper.Point.LongPoint;
import de.lighti.clipper.Point;

//a very simple class that builds an SVG file with any number of
//polygons of the specified formats ...
Expand Down Expand Up @@ -125,7 +125,7 @@ public boolean SaveToFile( String filename, double scale, int margin ) throws IO

for (; i < PolyInfoList.size(); i++) {
for (final Path pg : PolyInfoList.get( i ).polygons) {
for (final LongPoint pt : pg) {
for (final Point pt : pg) {
if (pt.getX() < rec.left) {
rec.left = pt.getX();
}
Expand All @@ -146,8 +146,8 @@ else if (pt.getY() > rec.bottom) {
rec.top = (int) (rec.top * scale);
rec.right = (int) (rec.right * scale);
rec.bottom = (int) (rec.bottom * scale);
final long offsetX = -rec.left + margin;
final long offsetY = -rec.top + margin;
final long offsetX = (long) -rec.left + margin;
final long offsetY = (long) -rec.top + margin;

final BufferedWriter writer = new BufferedWriter( new FileWriter( filename ) );
try {
Expand All @@ -174,9 +174,9 @@ else if (pt.getY() > rec.bottom) {
if (pi.si.showCoords) {
writer.write( String.format( "<g font-family=\"Verdana\" font-size=\"11\" fill=\"black\">%n%n" ) );
for (final Path p : pi.polygons) {
for (final LongPoint pt : p) {
final long x = pt.getX();
final long y = pt.getY();
for (final Point pt : p) {
final long x = (long) pt.getX();
final long y = (long) pt.getY();
writer.write( String.format( "<text x=\"%d\" y=\"%d\">%d,%d</text>\n", (int) (x * scale + offsetX), (int) (y * scale + offsetY), x,
y ) );

Expand Down
7 changes: 0 additions & 7 deletions Clipper GUI/.classpath

This file was deleted.

1 change: 0 additions & 1 deletion Clipper GUI/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions Clipper GUI/.project

This file was deleted.

11 changes: 0 additions & 11 deletions Clipper GUI/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

32 changes: 32 additions & 0 deletions Clipper GUI/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>de.lighti.clipper</groupId>
<artifactId>clipper-java-double</artifactId>
<!-- Three first numbers are the base Clipper library version -->
<version>6.4.2.1-SNAPSHOT</version>
</parent>

<artifactId>clipper-double-gui</artifactId>

<properties>
<maven.install.skip>true</maven.install.skip>
</properties>

<build>
<sourceDirectory>src</sourceDirectory>
</build>

<dependencies>
<dependency>
<groupId>de.lighti.clipper</groupId>
<artifactId>clipper</artifactId>
<version>6.4.2.1-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
6 changes: 3 additions & 3 deletions Clipper GUI/src/de/lighti/clipper/gui/ClipperDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import de.lighti.clipper.Clipper.PolyType;
import de.lighti.clipper.Path;
import de.lighti.clipper.Paths;
import de.lighti.clipper.Point.LongPoint;
import de.lighti.clipper.Point;

public class ClipperDialog extends JFrame {
static boolean loadFromFile( String filename, Paths ppg, int dec_places ) throws IOException {
Expand Down Expand Up @@ -92,7 +92,7 @@ static boolean loadFromFile( String filename, Paths ppg, int dec_places, long xO

x = x + xOffset;
y = y + yOffset;
pg.add( new LongPoint( x, y ) );
pg.add( new Point( x, y ) );
}
}
else {
Expand All @@ -111,7 +111,7 @@ static boolean loadFromFile( String filename, Paths ppg, int dec_places, long xO

x = x * scaling + xOffset;
y = y * scaling + yOffset;
pg.add( new LongPoint( (int) Math.round( x ), (int) Math.round( y ) ) );
pg.add( new Point( (int) Math.round( x ), (int) Math.round( y ) ) );
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions Clipper GUI/src/de/lighti/clipper/gui/PolygonCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import de.lighti.clipper.DefaultClipper;
import de.lighti.clipper.Path;
import de.lighti.clipper.Paths;
import de.lighti.clipper.Point.LongPoint;

public class PolygonCanvas extends JPanel {

Expand Down Expand Up @@ -95,7 +94,7 @@ private Polygon createPolygonFromPath( Path p ) {
final int[] y = new int[p.size()];

for (int i = p.size() - 1; i >= 0; i--) {
final LongPoint ip = p.get( i );
final de.lighti.clipper.Point ip = p.get( i );
x[i] = (int) (ip.getX() * zoom) + cur.x - origin.x;
y[i] = (int) (ip.getY() * zoom) + cur.y - origin.y;
}
Expand All @@ -119,7 +118,7 @@ public void generateAustPlusRandomEllipses() {
for (int j = 0; j < vertCnt; ++j) {
final float x = polyStream.readFloat() * scale;
final float y = polyStream.readFloat() * scale;
pg.add( new LongPoint( (int) x, (int) y ) );
pg.add( new de.lighti.clipper.Point( (int) x, (int) y ) );
}
subjects.add( pg );
}
Expand Down Expand Up @@ -157,7 +156,7 @@ public void generateAustPlusRandomEllipses() {
final int type = pit.currentSegment( coords );
switch (type) {
case PathIterator.SEG_LINETO:
clip.add( new LongPoint( (int) (coords[0] * scale), (int) (coords[1] * scale) ) );
clip.add( new de.lighti.clipper.Point( (int) (coords[0] * scale), (int) (coords[1] * scale) ) );
break;
default:
break;
Expand All @@ -172,8 +171,8 @@ public void generateAustPlusRandomEllipses() {

}

private LongPoint GenerateRandomPoint( int l, int t, int r, int b, Random rand ) {
return new LongPoint( rand.nextInt( r ) + l, rand.nextInt( b ) + t );
private de.lighti.clipper.Point GenerateRandomPoint(int l, int t, int r, int b, Random rand ) {
return new de.lighti.clipper.Point( rand.nextInt( r ) + l, rand.nextInt( b ) + t );
}

public void generateRandomPolygon() {
Expand Down
14 changes: 7 additions & 7 deletions Clipper GUI/src/de/lighti/clipper/gui/SVGBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import de.lighti.clipper.LongRect;
import de.lighti.clipper.Path;
import de.lighti.clipper.Paths;
import de.lighti.clipper.Point.LongPoint;
import de.lighti.clipper.Point;

//a very simple class that builds an SVG file with any number of
//polygons of the specified formats ...
Expand Down Expand Up @@ -134,7 +134,7 @@ public boolean SaveToFile( String filename, double scale, int margin ) throws IO

for (; i < PolyInfoList.size(); i++) {

for (final LongPoint pt : PolyInfoList.get( i ).polygons) {
for (final Point pt : PolyInfoList.get( i ).polygons) {
if (pt.getX() < rec.left) {
rec.left = pt.getX();
}
Expand All @@ -155,8 +155,8 @@ else if (pt.getY() > rec.bottom) {
rec.top = (int) (rec.top * scale);
rec.right = (int) (rec.right * scale);
rec.bottom = (int) (rec.bottom * scale);
final long offsetX = -rec.left + margin;
final long offsetY = -rec.top + margin;
final long offsetX = (long) -rec.left + margin;
final long offsetY = (long) -rec.top + margin;

final BufferedWriter writer = new BufferedWriter( new FileWriter( filename ) );
try {
Expand All @@ -182,9 +182,9 @@ else if (pt.getY() > rec.bottom) {
if (pi.si.showCoords) {
writer.write( String.format( "<g font-family=\"Verdana\" font-size=\"11\" fill=\"black\">%n%n" ) );

for (final LongPoint pt : p) {
final long x = pt.getX();
final long y = pt.getY();
for (final Point pt : p) {
final long x = (long) pt.getX();
final long y = (long) pt.getY();
writer.write( String.format( "<text x=\"%d\" y=\"%d\">%d,%d</text>\n", (int) (x * scale + offsetX), (int) (y * scale + offsetY), x, y ) );

}
Expand Down
6 changes: 0 additions & 6 deletions Clipper/.classpath

This file was deleted.

1 change: 0 additions & 1 deletion Clipper/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions Clipper/.project

This file was deleted.

Loading