Skip to content

Commit

Permalink
Fixed issue #346.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Sep 27, 2016
1 parent 1b254bc commit 2e6de65
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/org/nschmidt/ldparteditor/data/VM15Flipper.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ public void flipSelection() {
linkedDatFile.insertAfter(cline, new GData5(cline.colourNumber, cline.r, cline.g, cline.b, cline.a, first, third, second, fourth, cline.parent, linkedDatFile));
clinesToDelete2.add(cline);
}

// Adjacent Condline Check 1
checkAdjacentCondline(clinesToDelete2, first, second, third, fourth);
checkAdjacentCondline(clinesToDelete2, first, second, fourth, third);
// Adjacent Condline Check 2
checkAdjacentCondline(clinesToDelete2, second, third, first, fourth);
checkAdjacentCondline(clinesToDelete2, second, third, fourth, first);
// Adjacent Condline Check 3
checkAdjacentCondline(clinesToDelete2, third, fourth, first, second);
checkAdjacentCondline(clinesToDelete2, third, fourth, second, first);
// Adjacent Condline Check 4
checkAdjacentCondline(clinesToDelete2, fourth, first, third, second);
checkAdjacentCondline(clinesToDelete2, fourth, first, second, third);
}
}

Expand Down Expand Up @@ -258,4 +271,24 @@ public void flipSelection() {
}
validateState();
}

private void checkAdjacentCondline(final Set<GData5> clinesToDelete,
Vertex start, Vertex end, Vertex controlPoint, Vertex mergeTarget) {
final GData5 cline= hasCondline(start, end);
if (cline != null && lineLinkedToVertices.containsKey(cline)) {
Vertex[] verts = condlines.get(cline);
if (verts != null) {
Vertex backupVert = null;
if (verts[2].equals(controlPoint)) {
backupVert = verts[3];
} else if (verts[3].equals(controlPoint)) {
backupVert = verts[2];
}
if (backupVert != null) {
linkedDatFile.insertAfter(cline, new GData5(cline.colourNumber, cline.r, cline.g, cline.b, cline.a, verts[0], verts[1], backupVert, mergeTarget, cline.parent, linkedDatFile));
clinesToDelete.add(cline);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
*/
public class Edger2Settings {

private BigDecimal equalDistance = new BigDecimal("0.0001"); //$NON-NLS-1$
private BigDecimal equalDistance = new BigDecimal("0.0010"); //$NON-NLS-1$
private BigDecimal af = new BigDecimal("0.1"); //$NON-NLS-1$
private BigDecimal ac = new BigDecimal("60"); //$NON-NLS-1$
private BigDecimal ae = new BigDecimal("60"); //$NON-NLS-1$
Expand Down
23 changes: 23 additions & 0 deletions testcases/flipper.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
0 Flipper Test
0 Name: new.dat
0 Author: Nils Schmidt [BlackBrick89]
0 !LDRAW_ORG Unofficial_Part
0 !LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt

0 BFC CERTIFY CCW

3 14 2.43 -.45 3.08 -4 -10 14 -11.73 -10.99 3.81
3 14 -11.73 -10.99 3.81 -4.67 -.31 -4.22 2.43 -.45 3.08
3 13 -11.73 -10.99 3.81 -4 -10 14 -18.62 -6.76 10.02
3 13 -18.62 -6.76 10.02 -4 -10 14 -10.62 -6.09 19.5
3 13 -10.62 -6.09 19.5 -4 -10 14 2.43 -.45 3.08
3 13 -10.62 -6.09 19.5 2.43 -.45 3.08 2.17 4.89 9.88
3 13 2.17 4.89 9.88 2.43 -.45 3.08 -2.52 5.91 -.15
3 13 -2.52 5.91 -.15 2.43 -.45 3.08 -4.67 -.31 -4.22
3 13 -2.52 5.91 -.15 -4.67 -.31 -4.22 -18.62 -6.76 10.02
3 13 -18.62 -6.76 10.02 -4.67 -.31 -4.22 -11.73 -10.99 3.81
5 24 -11.73 -10.99 3.81 -4 -10 14 -18.62 -6.76 10.02 2.43 -.45 3.08
5 24 2.43 -.45 3.08 -11.73 -10.99 3.81 -4 -10 14 -4.67 -.31 -4.22
5 24 2.43 -.45 3.08 -4 -10 14 -10.62 -6.09 19.5 -11.73 -10.99 3.81
5 24 2.43 -.45 3.08 -4.67 -.31 -4.22 -2.52 5.91 -.15 -11.73 -10.99 3.81
5 24 -11.73 -10.99 3.81 -4.67 -.31 -4.22 2.43 -.45 3.08 -10.62 -6.09 19.5

0 comments on commit 2e6de65

Please sign in to comment.