Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

modified PolyTree from package-protected to public, modified code to … #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions Clipper/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<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>
<groupId>Clipper</groupId>
<artifactId>Clipper</artifactId>
<version>6.2.1</version>

<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion Clipper/src/de/lighti/clipper/ClipperOffset.java
Original file line number Diff line number Diff line change
@@ -389,7 +389,7 @@ public void execute( PolyTree solution, double delta ) {
//remove the outer PolyNode rectangle ...
if (solution.getChildCount() == 1 && solution.getChilds().get( 0 ).getChildCount() > 0) {
final PolyNode outerNode = solution.getChilds().get( 0 );
solution.getChilds().set( 0, outerNode.getChilds().get( 0 ) );
solution.childs.set( 0, outerNode.getChilds().get( 0 ) );
solution.getChilds().get( 0 ).setParent( solution );
for (int i = 1; i < outerNode.getChildCount(); i++) {
solution.addChild( outerNode.getChilds().get( i ) );
24 changes: 14 additions & 10 deletions Clipper/src/de/lighti/clipper/DefaultClipper.java
Original file line number Diff line number Diff line change
@@ -562,16 +562,17 @@ public DefaultClipper( int InitOptions ) //constructor
activeEdges = null;
sortedEdges = null;
intersectList = new ArrayList<IntersectNode>();
intersectNodeComparer = ( node1, node2 ) -> {
final long i = node2.getPt().getY() - node1.getPt().getY();
if (i > 0) {
return 1;
}
else if (i < 0) {
return -1;
}
else {
return 0;
intersectNodeComparer = new Comparator<DefaultClipper.IntersectNode>() {
@Override
public int compare(IntersectNode node1, IntersectNode node2) {
final long i = node2.getPt().getY() - node1.getPt().getY();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
} else {
return 0;
}
}
};

@@ -908,6 +909,9 @@ private void buildResult2( PolyTree polytree ) {
//add each output polygon/contour to polytree ...
for (int i = 0; i < polyOuts.size(); i++) {
final OutRec outRec = polyOuts.get( i );
if (outRec.getPoints() == null) {
continue;
}
final int cnt = outRec.getPoints().getPointCount();
if (outRec.isOpen && cnt < 2 || !outRec.isOpen && cnt < 3) {
continue;
2 changes: 1 addition & 1 deletion Clipper/src/de/lighti/clipper/PolyNode.java
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
import de.lighti.clipper.Clipper.JoinType;
import de.lighti.clipper.Point.LongPoint;

class PolyNode {
public class PolyNode {
enum NodeType {
ANY, OPEN, CLOSED
}
2 changes: 1 addition & 1 deletion Clipper/src/de/lighti/clipper/PolyTree.java
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;

class PolyTree extends PolyNode {
public class PolyTree extends PolyNode {
private final List<PolyNode> allPolys = new ArrayList<PolyNode>();

public void Clear() {