fix path decomposition

This commit is contained in:
Branislav Stojkovic
2019-02-02 20:46:12 +01:00
parent b44c3bad62
commit 024ede48a8
5 changed files with 13 additions and 1 deletions
@@ -322,7 +322,7 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
// } // }
} }
enum PointCount { public enum PointCount {
TWO(2), THREE(3), FOUR(4), FIVE(5), SEVEN(7); TWO(2), THREE(3), FOUR(4), FIVE(5), SEVEN(7);
private int count; private int count;
Binary file not shown.
@@ -159,6 +159,15 @@ public class TwistedWire extends AbstractCurvedComponent<Void> {
this.secondLeadArea = null; this.secondLeadArea = null;
} }
@Override
public void setPointCount(PointCount pointCount) {
super.setPointCount(pointCount);
// invalidate cached areas
this.firstLeadArea = null;
this.secondLeadArea = null;
}
@Override @Override
public Void getValue() { public Void getValue() {
return null; return null;
@@ -186,14 +195,17 @@ public class TwistedWire extends AbstractCurvedComponent<Void> {
curves.add(new CubicCurve2D.Double(current.x, current.y, (current.x + coords[0]) / 2, curves.add(new CubicCurve2D.Double(current.x, current.y, (current.x + coords[0]) / 2,
(current.y + coords[1]) / 2, (current.x + coords[0]) / 2, (current.y + coords[1]) / 2, coords[0], (current.y + coords[1]) / 2, (current.x + coords[0]) / 2, (current.y + coords[1]) / 2, coords[0],
coords[1])); coords[1]));
current.setLocation(coords[0], coords[1]);
break; break;
case PathIterator.SEG_QUADTO: case PathIterator.SEG_QUADTO:
curves.add(new CubicCurve2D.Double(current.x, current.y, coords[0], coords[1], coords[0], coords[1], curves.add(new CubicCurve2D.Double(current.x, current.y, coords[0], coords[1], coords[0], coords[1],
coords[2], coords[3])); coords[2], coords[3]));
current.setLocation(coords[2], coords[3]);
break; break;
case PathIterator.SEG_CUBICTO: case PathIterator.SEG_CUBICTO:
curves.add(new CubicCurve2D.Double(current.x, current.y, coords[0], coords[1], coords[2], coords[3], curves.add(new CubicCurve2D.Double(current.x, current.y, coords[0], coords[1], coords[2], coords[3],
coords[4], coords[5])); coords[4], coords[5]));
current.setLocation(coords[4], coords[5]);
break; break;
} }
iterator.next(); iterator.next();
Binary file not shown.
Binary file not shown.