Rollback Include layer id in continuity areas

This commit is contained in:
Bane Stojkovic
2022-11-22 18:10:03 +01:00
parent aaa24ad56a
commit 0f2e581a02
38 changed files with 109 additions and 73 deletions
@@ -28,4 +28,8 @@ public enum PCBLayer {
public String toString() { public String toString() {
return name().substring(1); return name().substring(1);
}; };
public int getId() {
return Integer.parseInt(toString());
}
} }
@@ -42,9 +42,10 @@ public interface IDrawingObserver {
/** /**
* Notifies the observer that it should start tracking conductive continuity areas. * Notifies the observer that it should start tracking conductive continuity areas.
* *
* @param layerId id of the layer
* @param positive designates if the area should be additive or subtractive * @param positive designates if the area should be additive or subtractive
*/ */
void startTrackingContinuityArea(boolean positive); void startTrackingContinuityArea(int layerId, boolean positive);
/** /**
* Notifies the observer that it should stop tracking conductive continuity areas. * Notifies the observer that it should stop tracking conductive continuity areas.
@@ -32,15 +32,17 @@ public class ComponentArea implements Serializable {
private Area outlineArea; private Area outlineArea;
private Collection<Area> continuityPositiveAreas; private Collection<Area> continuityPositiveAreas;
private Collection<Area> continuityNegativeAreas; private Collection<Area> continuityNegativeAreas;
private int layerId;
public ComponentArea() { public ComponentArea() {
} }
public ComponentArea(Area outlineArea, Collection<Area> continuityPositiveAreas, Collection<Area> continuityNegativeAreas) { public ComponentArea(Area outlineArea, Collection<Area> continuityPositiveAreas, Collection<Area> continuityNegativeAreas, int layerId) {
super(); super();
this.outlineArea = outlineArea; this.outlineArea = outlineArea;
this.continuityPositiveAreas = continuityPositiveAreas; this.continuityPositiveAreas = continuityPositiveAreas;
this.continuityNegativeAreas = continuityNegativeAreas; this.continuityNegativeAreas = continuityNegativeAreas;
this.layerId = layerId;
} }
public Area getOutlineArea() { public Area getOutlineArea() {
@@ -54,4 +56,8 @@ public class ComponentArea implements Serializable {
public Collection<Area> getContinuityNegativeAreas() { public Collection<Area> getContinuityNegativeAreas() {
return continuityNegativeAreas; return continuityNegativeAreas;
} }
public int getLayerId() {
return layerId;
}
} }
@@ -134,7 +134,7 @@ public class DrawingCache {
stats.getSecond().add(componentEnd - componentStart); stats.getSecond().add(componentEnd - componentStart);
// copy over tracking area from the cache, regardless if we rendered or not // copy over tracking area from the cache, regardless if we rendered or not
g2d.merge(value.getCurrentArea(), value.getContinuityPositiveAreas(), value.getContinuityNegativeAreas()); g2d.merge(value.getCurrentArea(), value.getContinuityPositiveAreas(), value.getContinuityNegativeAreas(), value.getLayerId());
} else { } else {
// no caching, just draw as usual // no caching, just draw as usual
component.draw(g2d, componentState, outlineMode, project, g2d); component.draw(g2d, componentState, outlineMode, project, g2d);
@@ -264,7 +264,7 @@ public class DrawingCache {
// add to the cache // add to the cache
value = new CacheValue(component, image, wrapper.getCurrentArea(), wrapper.getContinuityPositiveAreas(), value = new CacheValue(component, image, wrapper.getCurrentArea(), wrapper.getContinuityPositiveAreas(),
wrapper.getContinuityNegativeAreas(), componentState, outlineMode, zoom, dx, dy, rect); wrapper.getContinuityNegativeAreas(), wrapper.getLayerId(), componentState, outlineMode, zoom, dx, dy, rect);
imageCache.put(component, new SoftReference<DrawingCache.CacheValue>(value)); imageCache.put(component, new SoftReference<DrawingCache.CacheValue>(value));
} }
@@ -283,11 +283,13 @@ public class DrawingCache {
int dx; int dx;
int dy; int dy;
Rectangle2D cacheBounds; Rectangle2D cacheBounds;
int layerId;
public CacheValue(IDIYComponent<?> component, BufferedImage image, Area currentArea, public CacheValue(IDIYComponent<?> component, BufferedImage image, Area currentArea,
Map<String, Area> continuityPositiveAreas, Map<String, Area> continuityNegativeAreas, Map<String, Area> continuityPositiveAreas, Map<String, Area> continuityNegativeAreas, int layerId,
ComponentState state, boolean outlineMode, double zoom, int dx, int dy, Rectangle2D cacheBounds) { ComponentState state, boolean outlineMode, double zoom, int dx, int dy, Rectangle2D cacheBounds) {
super(); super();
this.layerId = layerId;
this.cacheBounds = cacheBounds; this.cacheBounds = cacheBounds;
// take a copy of the component, so we can check if it changed in the meantime // take a copy of the component, so we can check if it changed in the meantime
try { try {
@@ -325,6 +327,10 @@ public class DrawingCache {
return continuityNegativeAreas; return continuityNegativeAreas;
} }
public int getLayerId() {
return layerId;
}
public ComponentState getState() { public ComponentState getState() {
return state; return state;
} }
@@ -684,23 +684,22 @@ public class DrawingManager {
messageDispatcher.dispatchMessage(EventType.REPAINT); messageDispatcher.dispatchMessage(EventType.REPAINT);
} }
public void findContinuityAreaAtPoint(Project project, Point2D p) { public void findContinuityAreaAtPoint(Point2D p) {
if (continuityGraphCache == null) if (continuityGraphCache == null)
continuityGraphCache = getContinuityGraph(project); continuityGraphCache = getContinuityGraph();
currentContinuityAreas = continuityGraphCache.findAreasFor(p); currentContinuityAreas = continuityGraphCache.findAreasFor(p);
} }
public List<Area> getContinuityAreas(Project project) { public List<Area> getContinuityAreas() {
// Find all individual continuity areas for all components // Find all individual continuity areas for all components
List<Area> preliminaryAreas = new ArrayList<Area>(); List<Area> preliminaryAreas = new ArrayList<Area>();
List<Boolean> checkBreakout = new ArrayList<Boolean>(); List<Boolean> checkBreakout = new ArrayList<Boolean>();
for (IDIYComponent<?> c : project.getComponents()) { for (ComponentArea a : this.componentAreaMap.values()) {
ComponentArea a = getComponentArea(c);
if (a == null || a.getOutlineArea() == null) if (a == null || a.getOutlineArea() == null)
continue; continue;
Collection<Area> positiveAreas = a.getContinuityPositiveAreas(); Collection<Area> positiveAreas = a.getContinuityPositiveAreas();
if (positiveAreas != null) if (positiveAreas != null)
for (Area a1 : positiveAreas) { for (Area a1 : positiveAreas) {
@@ -733,9 +732,9 @@ public class DrawingManager {
return areas; return areas;
} }
public ContinuityGraph getContinuityGraph(Project project) { public ContinuityGraph getContinuityGraph() {
Set<Connection> connections = new HashSet<Connection>(); Set<Connection> connections = new HashSet<Connection>();
for (IDIYComponent<?> c : project.getComponents()) { for (IDIYComponent<?> c : this.componentAreaMap.keySet()) {
if (c instanceof IContinuity) { if (c instanceof IContinuity) {
for (int i = 0; i < c.getControlPointCount() - 1; i++) for (int i = 0; i < c.getControlPointCount() - 1; i++)
for (int j = i + 1; j < c.getControlPointCount(); j++) for (int j = i + 1; j < c.getControlPointCount(); j++)
@@ -744,13 +743,13 @@ public class DrawingManager {
} }
} }
List<Area> areas = getContinuityAreas(project); List<Area> areas = getContinuityAreas();
return NetlistBuilder.buildContinuityGraph(areas, connections); return NetlistBuilder.buildContinuityGraph(areas, connections);
} }
public List<Area> getContinuityAreaProximity(Project project, float threshold) { public List<Area> getContinuityAreaProximity(float threshold) {
List<Area> continuityAreas = getContinuityAreas(project); List<Area> continuityAreas = getContinuityAreas();
Stroke s = ObjectCache.getInstance().fetchBasicStroke(threshold - 1); // value eyeballed for Stroke s = ObjectCache.getInstance().fetchBasicStroke(threshold - 1); // value eyeballed for
// approx good results // approx good results
List<Area> expanded = continuityAreas.parallelStream() List<Area> expanded = continuityAreas.parallelStream()
@@ -82,6 +82,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
private boolean drawingComponent = false; private boolean drawingComponent = false;
private boolean trackingAllowed = true; private boolean trackingAllowed = true;
private int layerId;
private boolean trackingContinuityAllowed = false; private boolean trackingContinuityAllowed = false;
private boolean trackingContinuityPositive = true; private boolean trackingContinuityPositive = true;
@@ -133,6 +134,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
currentArea = new Area(); currentArea = new Area();
continuityPositiveAreas = new HashMap<String, Area>(); continuityPositiveAreas = new HashMap<String, Area>();
continuityNegativeAreas = new HashMap<String, Area>(); continuityNegativeAreas = new HashMap<String, Area>();
layerId = 0;
// trackingStacks.clear(); // trackingStacks.clear();
continuityMarker = null; continuityMarker = null;
originalStroke = canvasGraphics.getStroke(); originalStroke = canvasGraphics.getStroke();
@@ -159,7 +161,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
canvasGraphics.setComposite(originalComposite); canvasGraphics.setComposite(originalComposite);
canvasGraphics.setFont(originalFont); canvasGraphics.setFont(originalFont);
// Map<String, Integer> sorted = sortByComparator(trackingStacks, false); // Map<String, Integer> sorted = sortByComparator(trackingStacks, false);
return new ComponentArea(currentArea, new ArrayList<Area>(continuityPositiveAreas.values()), new ArrayList<Area>(continuityNegativeAreas.values())); return new ComponentArea(currentArea, new ArrayList<Area>(continuityPositiveAreas.values()),
new ArrayList<Area>(continuityNegativeAreas.values()), layerId);
} }
// start - used for caching // start - used for caching
@@ -176,12 +179,18 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
return continuityNegativeAreas; return continuityNegativeAreas;
} }
public int getLayerId() {
return layerId;
}
// end - used for caching // end - used for caching
public void merge(Area currentArea, Map<String, Area> continuityPositiveAreas, Map<String, Area> continuityNegativeAreas) { public void merge(Area currentArea, Map<String, Area> continuityPositiveAreas,
Map<String, Area> continuityNegativeAreas, int layerId) {
this.currentArea = currentArea; this.currentArea = currentArea;
this.continuityPositiveAreas = continuityPositiveAreas; this.continuityPositiveAreas = continuityPositiveAreas;
this.continuityNegativeAreas = continuityNegativeAreas; this.continuityNegativeAreas = continuityNegativeAreas;
this.layerId = layerId;
} }
@Override @Override
@@ -195,7 +204,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
} }
@Override @Override
public void startTrackingContinuityArea(boolean positive) { public void startTrackingContinuityArea(int layerId, boolean positive) {
this.layerId = layerId;
this.trackingContinuityAllowed = true; this.trackingContinuityAllowed = true;
this.trackingContinuityPositive = positive; this.trackingContinuityPositive = positive;
} }
@@ -680,7 +680,7 @@ public class Presenter implements IPlugInPort {
projectFileManager.notifyFileChange(); projectFileManager.notifyFileChange();
} }
} else if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown) { } else if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown) {
drawingManager.findContinuityAreaAtPoint(currentProject, scaledPoint); drawingManager.findContinuityAreaAtPoint(scaledPoint);
messageDispatcher.dispatchMessage(EventType.REPAINT); messageDispatcher.dispatchMessage(EventType.REPAINT);
} else { } else {
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>(selectedComponents); List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>(selectedComponents);
@@ -2809,7 +2809,7 @@ public class Presenter implements IPlugInPort {
@Override @Override
public List<Netlist> extractNetlists(boolean includeSwitches) throws NetlistException { public List<Netlist> extractNetlists(boolean includeSwitches) throws NetlistException {
List<Area> continuityAreas = drawingManager.getContinuityAreas(currentProject); List<Area> continuityAreas = drawingManager.getContinuityAreas();
return NetlistBuilder.extractNetlists(includeSwitches, currentProject, continuityAreas); return NetlistBuilder.extractNetlists(includeSwitches, currentProject, continuityAreas);
} }
@@ -2874,11 +2874,12 @@ public class Presenter implements IPlugInPort {
ComponentArea componentArea = drawingManager.getComponentArea(c); ComponentArea componentArea = drawingManager.getComponentArea(c);
areas.put(c, componentArea); areas.put(c, componentArea);
} }
return new Snapshot(currentProject.clone(), new HashSet<IDIYComponent<?>>(selectedComponents), areas, new HashSet<Area>(drawingManager.getContinuityAreas(currentProject))); return new Snapshot(currentProject.clone(), new HashSet<IDIYComponent<?>>(selectedComponents), areas,
new HashSet<Area>(drawingManager.getContinuityAreas()));
} }
@Override @Override
public List<Area> checkContinuityAreaProximity(Size threshold) { public List<Area> checkContinuityAreaProximity(Size threshold) {
return drawingManager.getContinuityAreaProximity(this.currentProject, (float)threshold.convertToPixels()); return drawingManager.getContinuityAreaProximity((float)threshold.convertToPixels());
} }
} }
Binary file not shown.
@@ -110,10 +110,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
points[1] = new Point2D.Double(targetSize / 2, 0); points[1] = new Point2D.Double(targetSize / 2, 0);
} }
protected boolean IsCopperArea() { protected boolean isCopperArea() {
return false; return false;
} }
protected int getLayerId() {
return 0;
}
protected Point2D[] getPoints() { protected Point2D[] getPoints() {
// convert old points to new // convert old points to new
if (points.length == 2) { if (points.length == 2) {
@@ -149,7 +153,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
Shape shape = getBodyShape(); Shape shape = getBodyShape();
// If there's no body, just draw the line connecting the ending points. // If there's no body, just draw the line connecting the ending points.
if (shape == null) { if (shape == null) {
drawLead(g2d, componentState, drawingObserver, IsCopperArea()); drawLead(g2d, componentState, drawingObserver, isCopperArea());
return; return;
} }
@@ -415,7 +419,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
private void drawLead(Graphics2D g2d, ComponentState componentState, IDrawingObserver observer, boolean isCopperArea) { private void drawLead(Graphics2D g2d, ComponentState componentState, IDrawingObserver observer, boolean isCopperArea) {
if (isCopperArea) if (isCopperArea)
observer.startTrackingContinuityArea(true); observer.startTrackingContinuityArea(getLayerId(), true);
float thickness = getLeadThickness(); float thickness = getLeadThickness();
@@ -195,7 +195,7 @@ public class Breadboard extends AbstractProtoBoard {
} }
// draw transparent connections just to designate connections // draw transparent connections just to designate connections
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.0f)); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.0f));
@@ -380,7 +380,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + (segment.x + i) * spacing); int padX = (int) (x0 + (segment.x + i) * spacing);
int padY = (int) (y0 + (segment.y + j) * spacing); int padY = (int) (y0 + (segment.y + j) * spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(segment.label); drawingObserver.setContinuityMarker(segment.label);
g2d.setColor(padColor); g2d.setColor(padColor);
@@ -432,7 +432,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + potPad.x * spacing); int padX = (int) (x0 + potPad.x * spacing);
int padY = (int) (y0 + (potPad.y + 8 * i) * spacing); int padY = (int) (y0 + (potPad.y + 8 * i) * spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(potPad.label + i); drawingObserver.setContinuityMarker(potPad.label + i);
g2d.setColor(padColor); g2d.setColor(padColor);
@@ -483,7 +483,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + potPad.x * spacing); int padX = (int) (x0 + potPad.x * spacing);
int padY = (int) (y0 + potPad.y * spacing); int padY = (int) (y0 + potPad.y * spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(potPad.label); drawingObserver.setContinuityMarker(potPad.label);
g2d.setColor(padColor); g2d.setColor(padColor);
@@ -513,7 +513,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + (6.5 + i) * spacing); int padX = (int) (x0 + (6.5 + i) * spacing);
int padY = (int) (y0 + (36 + j) * spacing); int padY = (int) (y0 + (36 + j) * spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(connectorLabels[i]); drawingObserver.setContinuityMarker(connectorLabels[i]);
g2d.setColor(padColor); g2d.setColor(padColor);
@@ -543,7 +543,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + (17) * spacing); int padX = (int) (x0 + (17) * spacing);
int padY = (int) (y0 + 35.5 * spacing); int padY = (int) (y0 + 35.5 * spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker("GND"); drawingObserver.setContinuityMarker("GND");
g2d.setColor(padColor); g2d.setColor(padColor);
@@ -140,7 +140,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.setColor(traceColor); g2d.setColor(traceColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4)); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
// draw segment connectors // draw segment connectors
for (int y = 0; y < ROW_COUNT; y++) { for (int y = 0; y < ROW_COUNT; y++) {
@@ -223,7 +223,7 @@ public class ProtoBoard extends AbstractProtoBoard {
// draw top mini pad traces // draw top mini pad traces
g2d.setColor(traceColor); g2d.setColor(traceColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4)); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.drawLine((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing), (int) (point.getY() + 1 * spacing), g2d.drawLine((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing), (int) (point.getY() + 1 * spacing),
(int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing), (int) (point.getY() + 3.5 * spacing)); (int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing), (int) (point.getY() + 3.5 * spacing));
g2d.drawLine((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 1.5) * spacing + miniPadSize / 2), (int) (point.getY() + 1 * spacing), g2d.drawLine((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 1.5) * spacing + miniPadSize / 2), (int) (point.getY() + 1 * spacing),
@@ -255,7 +255,7 @@ public class ProtoBoard extends AbstractProtoBoard {
int padX = (int) (point.getX() + (xOffset + x) * spacing); int padX = (int) (point.getX() + (xOffset + x) * spacing);
int padY = (int) (point.getY() + (yOffset + y) * spacing); int padY = (int) (point.getY() + (yOffset + y) * spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker("SEGMENT=" + segment + ";ROW=" + y); drawingObserver.setContinuityMarker("SEGMENT=" + segment + ";ROW=" + y);
g2d.setColor(padColor); g2d.setColor(padColor);
@@ -295,7 +295,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.drawRect((int) (point.getX() + (1 + SEGMENTS_SUM[3]) * spacing), (int) (point.getY() + (yOffset - 2 + y * (ROW_COUNT + 2)) * spacing), g2d.drawRect((int) (point.getX() + (1 + SEGMENTS_SUM[3]) * spacing), (int) (point.getY() + (yOffset - 2 + y * (ROW_COUNT + 2)) * spacing),
(int)(3 * spacing), (int)spacing); (int)(3 * spacing), (int)spacing);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
for (int x = 0; x < 3; x++) { for (int x = 0; x < 3; x++) {
int padX = (int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5 + x) * spacing); int padX = (int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5 + x) * spacing);
@@ -344,7 +344,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.setColor(traceColor); g2d.setColor(traceColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4)); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
// Draw two horizontal traces in the top-right section // Draw two horizontal traces in the top-right section
g2d.drawLine((int) (point.getX() + width - 4 * spacing), (int) (point.getY() + 0.5 * spacing), (int) (point.getX() + width - (2) * spacing), (int) (point.getY() + 0.5 * spacing)); g2d.drawLine((int) (point.getX() + width - 4 * spacing), (int) (point.getY() + 0.5 * spacing), (int) (point.getX() + width - (2) * spacing), (int) (point.getY() + 0.5 * spacing));
@@ -403,7 +403,7 @@ public class ProtoBoard extends AbstractProtoBoard {
for (int i = 0; i < padXs.length; i++) { for (int i = 0; i < padXs.length; i++) {
int padX = padXs[i]; int padX = padXs[i];
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
if (i == 0 || i == 2 || i == 5) { if (i == 0 || i == 2 || i == 5) {
switch (y) { switch (y) {
@@ -473,7 +473,7 @@ public class ProtoBoard extends AbstractProtoBoard {
for (int y = 0; y < ROW_COUNT; y++) { for (int y = 0; y < ROW_COUNT; y++) {
g2d.setColor(padColor); g2d.setColor(padColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
// top row // top row
g2d.fillRect((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing) + 1, (int) (point.getY() + (yOffset + y - 0.5d) * spacing + 2), miniPadSize, miniPadSize); g2d.fillRect((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing) + 1, (int) (point.getY() + (yOffset + y - 0.5d) * spacing + 2), miniPadSize, miniPadSize);
@@ -492,7 +492,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.setColor(undersidePadColor); g2d.setColor(undersidePadColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
// bottom row // bottom row
@@ -302,7 +302,7 @@ public class TagStrip extends AbstractTransparentComponent<String> implements IC
g2d.draw(mainArea); g2d.draw(mainArea);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
for (int i = 1; i < body.length; i++) for (int i = 1; i < body.length; i++)
g2d.fill(body[i]); g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -379,7 +379,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
g2d.draw(mainArea); g2d.draw(mainArea);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
for (int i = 1; i < body.length; i++) for (int i = 1; i < body.length; i++)
g2d.fill(body[i]); g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -84,7 +84,7 @@ public class TriPadBoard extends AbstractVeroBoard {
} }
g2d.setColor(stripColor); g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x + spacing - stripSize / 2), (int)(y - stripSize / 2), (int)(spacing * (spacesToDraw - 1) + stripSize), g2d.fillRect((int)(x + spacing - stripSize / 2), (int)(y - stripSize / 2), (int)(spacing * (spacesToDraw - 1) + stripSize),
stripSize); stripSize);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -122,7 +122,7 @@ public class TriPadBoard extends AbstractVeroBoard {
} }
g2d.setColor(stripColor); g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x - stripSize / 2), (int)(y + spacing - stripSize / 2), stripSize, (int)(spacing * (spacesToDraw - 1) g2d.fillRect((int)(x - stripSize / 2), (int)(y + spacing - stripSize / 2), stripSize, (int)(spacing * (spacesToDraw - 1)
+ stripSize)); + stripSize));
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -73,7 +73,7 @@ public class VeroBoard extends AbstractVeroBoard {
x = firstPoint.getX(); x = firstPoint.getX();
y += spacing; y += spacing;
g2d.setColor(stripColor); g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x + spacing / 2), (int)(y - stripSize / 2), (int)(finalSecondPoint.getX() - spacing - x), stripSize); g2d.fillRect((int)(x + spacing / 2), (int)(y - stripSize / 2), (int)(finalSecondPoint.getX() - spacing - x), stripSize);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
g2d.setColor(stripColor.darker()); g2d.setColor(stripColor.darker());
@@ -91,7 +91,7 @@ public class VeroBoard extends AbstractVeroBoard {
x += spacing; x += spacing;
y = firstPoint.getY(); y = firstPoint.getY();
g2d.setColor(stripColor); g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x - stripSize / 2), (int)(y + spacing / 2), stripSize, (int)(finalSecondPoint.getY() - spacing - y)); g2d.fillRect((int)(x - stripSize / 2), (int)(y + spacing / 2), stripSize, (int)(finalSecondPoint.getY() - spacing - y));
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
g2d.setColor(stripColor.darker()); g2d.setColor(stripColor.darker());
@@ -158,10 +158,15 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
} }
@Override @Override
protected boolean IsCopperArea() { protected boolean isCopperArea() {
return true; return true;
} }
@Override
protected int getLayerId() {
return getLayer().getId();
}
@Override @Override
public String getControlPointNodeName(int index) { public String getControlPointNodeName(int index) {
return null; return null;
@@ -63,7 +63,7 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: color; : color;
g2d.setColor(curveColor); g2d.setColor(curveColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
g2d.draw(curve); g2d.draw(curve);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
} }
@@ -72,7 +72,7 @@ public class Eyelet extends AbstractComponent<String> {
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels()); int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f)); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
g2d.setColor(color); g2d.setColor(color);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter); g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
@@ -73,7 +73,7 @@ public class GroundFill extends AbstractComponent<Void> {
xPoints[i] = (int)controlPoints[i].getX(); xPoints[i] = (int)controlPoints[i].getX();
yPoints[i] = (int)controlPoints[i].getY(); yPoints[i] = (int)controlPoints[i].getY();
} }
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
g2d.fillPolygon(xPoints, yPoints, controlPoints.length); g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
// Do not track any changes that follow because the whole board has been // Do not track any changes that follow because the whole board has been
@@ -69,7 +69,7 @@ public class SolderPad extends AbstractComponent<Void> {
double holeDiameter = getHoleSize().convertToPixels(); double holeDiameter = getHoleSize().convertToPixels();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: color); : color);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
if (type == Type.ROUND) { if (type == Type.ROUND) {
g2d.fill(new Ellipse2D.Double(point.getX() - diameter / 2, point.getY() - diameter / 2, diameter, diameter)); g2d.fill(new Ellipse2D.Double(point.getX() - diameter / 2, point.getY() - diameter / 2, diameter, diameter));
} else if (type == Type.OVAL_HORIZONTAL) { } else if (type == Type.OVAL_HORIZONTAL) {
@@ -84,7 +84,7 @@ public class TraceCut extends AbstractComponent<Void> {
int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels()); int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels());
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor()); : getBoardColor());
drawingObserver.startTrackingContinuityArea(false); drawingObserver.startTrackingContinuityArea(1, false);
if (getOrientation() == OrientationHV.VERTICAL) if (getOrientation() == OrientationHV.VERTICAL)
g2d.fillRect((int)(point.getX() - holeSpacing / 2 - cutWidth / 2), (int)(point.getY() - size / 2 - 1), cutWidth, size + 2); g2d.fillRect((int)(point.getX() - holeSpacing / 2 - cutWidth / 2), (int)(point.getY() - size / 2 - 1), cutWidth, size + 2);
else else
@@ -93,7 +93,7 @@ public class TraceCut extends AbstractComponent<Void> {
} else { } else {
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor()); : getBoardColor());
drawingObserver.startTrackingContinuityArea(false); drawingObserver.startTrackingContinuityArea(1, false);
g2d.fillRoundRect((int)(point.getX() - size / 2), (int)(point.getY() - size / 2), size, size, size, size); g2d.fillRoundRect((int)(point.getX() - size / 2), (int)(point.getY() - size / 2), size, size, size, size);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -70,7 +70,7 @@ public class Turret extends AbstractComponent<String> {
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels()); int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
g2d.setColor(color); g2d.setColor(color);
g2d.setStroke(ObjectCache.getInstance().fetchZoomableStroke(1f)); g2d.setStroke(ObjectCache.getInstance().fetchZoomableStroke(1f));
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter); g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
@@ -127,7 +127,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
} }
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[1]); g2d.fill(body[1]);
g2d.fill(body[2]); g2d.fill(body[2]);
if (body[3] != null) if (body[3] != null)
@@ -127,7 +127,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
} }
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[1]); g2d.fill(body[1]);
g2d.fill(body[2]); g2d.fill(body[2]);
if (body[3] != null) if (body[3] != null)
@@ -123,7 +123,7 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
} }
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[3]); g2d.fill(body[3]);
g2d.fill(body[4]); g2d.fill(body[4]);
@@ -114,7 +114,7 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
} }
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[1]); g2d.fill(body[1]);
g2d.fill(body[2]); g2d.fill(body[2]);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -121,7 +121,7 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> {
} }
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
for (int i = 2; i < body.length; i++) for (int i = 2; i < body.length; i++)
g2d.fill(body[i]); g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -350,7 +350,7 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
// Draw outer pins // Draw outer pins
if (configuration.getNeedsSecondLevel()) { if (configuration.getNeedsSecondLevel()) {
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
for (int i = secondLevelStart; i < body.length; i++) { for (int i = secondLevelStart; i < body.length; i++) {
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor);
g2d.fill(body[i]); g2d.fill(body[i]);
@@ -373,7 +373,7 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
// Draw pins // Draw pins
for (int i = 1; i <= secondLevelStart; i++) { for (int i = 1; i <= secondLevelStart; i++) {
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor);
g2d.fill(body[i]); g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -216,7 +216,7 @@ public class RotarySwitchSealed extends AbstractAngledComponent<RotarySwitchSeal
} }
g2d.setColor(pinColor); g2d.setColor(pinColor);
if (getMount() == Mount.CHASSIS) if (getMount() == Mount.CHASSIS)
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(pinShape); g2d.fill(pinShape);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
g2d.setColor(pinColor.darker()); g2d.setColor(pinColor.darker());
@@ -76,7 +76,7 @@ public class SwitchLatchingSymbol
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((float) (terminalSize / 4))); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((float) (terminalSize / 4)));
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
for (int i = 0; i < controlPoints.length; i++) { for (int i = 0; i < controlPoints.length; i++) {
Ellipse2D.Double terminal = new Ellipse2D.Double(controlPoints[i].getX() - terminalSize / 2, Ellipse2D.Double terminal = new Ellipse2D.Double(controlPoints[i].getX() - terminalSize / 2,
@@ -191,7 +191,7 @@ public class S1Switch extends AbstractTransparentComponent<Void> implements ISwi
g2d.drawOval((int)(p.getX() - padDiameter / 2), (int)(p.getY() - padDiameter / 2), padDiameter, padDiameter); g2d.drawOval((int)(p.getX() - padDiameter / 2), (int)(p.getY() - padDiameter / 2), padDiameter, padDiameter);
} else { } else {
g2d.setColor(PAD_COLOR); g2d.setColor(PAD_COLOR);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fillOval((int)(p.getX() - padDiameter / 2), (int)(p.getY() - padDiameter / 2), padDiameter, padDiameter); g2d.fillOval((int)(p.getX() - padDiameter / 2), (int)(p.getY() - padDiameter / 2), padDiameter, padDiameter);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
g2d.setColor(PAD_COLOR.darker()); g2d.setColor(PAD_COLOR.darker());
@@ -93,7 +93,7 @@ public class CommonNode extends AbstractComponent<String> implements ICommonNode
} }
g2d.setColor(bgColor); g2d.setColor(bgColor);
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(text.hashCode(), true);
g2d.fill(rect); g2d.fill(rect);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
drawingObserver.stopTracking(); drawingObserver.stopTracking();
@@ -279,11 +279,11 @@ public class PotentiometerPanel extends AbstractPotentiometer {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA)); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
} }
if (!outlineMode) { if (!outlineMode) {
if (i == 3) // if (i == 3)
drawingObserver.startTrackingContinuityArea(true); // drawingObserver.startTrackingContinuityArea(true);
g2d.fill(shape); g2d.fill(shape);
if (i == 3) // if (i == 3)
drawingObserver.stopTrackingContinuityArea(); // drawingObserver.stopTrackingContinuityArea();
} }
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
Color finalBorderColor; Color finalBorderColor;
@@ -248,7 +248,7 @@ public class Jumbo4PinTubeSocket extends AbstractAngledComponent<String> {
Shape terminalShape = body[1]; Shape terminalShape = body[1];
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getTerminalColor()); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getTerminalColor());
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(terminalShape); g2d.fill(terminalShape);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
@@ -287,7 +287,7 @@ public class TubeSocket extends AbstractAngledComponent<String> {
} }
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : PIN_COLOR); g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : PIN_COLOR);
if (getMount() == Mount.CHASSIS) if (getMount() == Mount.CHASSIS)
drawingObserver.startTrackingContinuityArea(true); drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(pinShape); g2d.fill(pinShape);
drawingObserver.stopTrackingContinuityArea(); drawingObserver.stopTrackingContinuityArea();
if (!outlineMode) { if (!outlineMode) {
Binary file not shown.
Binary file not shown.