mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Threads on 1/4" Closed Jack were not rendered at all
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.diylc.components;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Area;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
@@ -13,7 +14,7 @@ public abstract class AbstractMultiPartComponent<T> extends AbstractTransparentC
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public abstract Area[] getBody();
|
||||
public abstract Shape[] getBody();
|
||||
|
||||
public void drawSelectionOutline(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
@@ -25,11 +26,11 @@ public abstract class AbstractMultiPartComponent<T> extends AbstractTransparentC
|
||||
}
|
||||
|
||||
public Area getBodyOutline() {
|
||||
Area[] body = getBody();
|
||||
Shape[] body = getBody();
|
||||
Area outline = new Area();
|
||||
for (Area b : body)
|
||||
if (b != null)
|
||||
outline.add(b);
|
||||
for (Shape b : body)
|
||||
if (b != null && b instanceof Area)
|
||||
outline.add((Area)b);
|
||||
return outline;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
private Point[] controlPoints = new Point[] {new Point(0, 0)};
|
||||
private JackType type = JackType.MONO;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
transient private Area[] body;
|
||||
transient private Shape[] body;
|
||||
private String value = "";
|
||||
|
||||
public ClosedJack1_4() {
|
||||
@@ -130,9 +130,9 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public Area[] getBody() {
|
||||
public Shape[] getBody() {
|
||||
if (body == null) {
|
||||
body = new Area[5];
|
||||
body = new Shape[5];
|
||||
|
||||
// Create body.
|
||||
int x = controlPoints[0].x;
|
||||
@@ -169,9 +169,9 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
path.lineTo(p.x, p.y);
|
||||
}
|
||||
Area pathArea = new Area(path);
|
||||
pathArea.intersect(shaft);
|
||||
body[2] = new Area(path);
|
||||
// Area pathArea = new Area(path);
|
||||
// pathArea.intersect(shaft);
|
||||
body[2] = path;
|
||||
|
||||
// Create lugs.
|
||||
Area lugs = new Area();
|
||||
@@ -245,7 +245,7 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
g2d.draw(body[1]);
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(SHAFT_COLOR.darker());
|
||||
g2d.fill(body[2]);
|
||||
// g2d.fill(body[2]);
|
||||
g2d.draw(body[2]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user