mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
Rollback Include layer id in continuity areas
This commit is contained in:
@@ -27,5 +27,9 @@ public enum PCBLayer {
|
||||
|
||||
public String toString() {
|
||||
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.
|
||||
*
|
||||
* @param layerId id of the layer
|
||||
* @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.
|
||||
|
||||
@@ -32,15 +32,17 @@ public class ComponentArea implements Serializable {
|
||||
private Area outlineArea;
|
||||
private Collection<Area> continuityPositiveAreas;
|
||||
private Collection<Area> continuityNegativeAreas;
|
||||
private int layerId;
|
||||
|
||||
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();
|
||||
this.outlineArea = outlineArea;
|
||||
this.continuityPositiveAreas = continuityPositiveAreas;
|
||||
this.continuityNegativeAreas = continuityNegativeAreas;
|
||||
this.layerId = layerId;
|
||||
}
|
||||
|
||||
public Area getOutlineArea() {
|
||||
@@ -54,4 +56,8 @@ public class ComponentArea implements Serializable {
|
||||
public Collection<Area> getContinuityNegativeAreas() {
|
||||
return continuityNegativeAreas;
|
||||
}
|
||||
|
||||
public int getLayerId() {
|
||||
return layerId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class DrawingCache {
|
||||
stats.getSecond().add(componentEnd - componentStart);
|
||||
|
||||
// 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 {
|
||||
// no caching, just draw as usual
|
||||
component.draw(g2d, componentState, outlineMode, project, g2d);
|
||||
@@ -264,7 +264,7 @@ public class DrawingCache {
|
||||
|
||||
// add to the cache
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -283,11 +283,13 @@ public class DrawingCache {
|
||||
int dx;
|
||||
int dy;
|
||||
Rectangle2D cacheBounds;
|
||||
int layerId;
|
||||
|
||||
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) {
|
||||
super();
|
||||
this.layerId = layerId;
|
||||
this.cacheBounds = cacheBounds;
|
||||
// take a copy of the component, so we can check if it changed in the meantime
|
||||
try {
|
||||
@@ -324,6 +326,10 @@ public class DrawingCache {
|
||||
public Map<String, Area> getContinuityNegativeAreas() {
|
||||
return continuityNegativeAreas;
|
||||
}
|
||||
|
||||
public int getLayerId() {
|
||||
return layerId;
|
||||
}
|
||||
|
||||
public ComponentState getState() {
|
||||
return state;
|
||||
|
||||
@@ -684,23 +684,22 @@ public class DrawingManager {
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
}
|
||||
|
||||
public void findContinuityAreaAtPoint(Project project, Point2D p) {
|
||||
public void findContinuityAreaAtPoint(Point2D p) {
|
||||
if (continuityGraphCache == null)
|
||||
continuityGraphCache = getContinuityGraph(project);
|
||||
continuityGraphCache = getContinuityGraph();
|
||||
|
||||
currentContinuityAreas = continuityGraphCache.findAreasFor(p);
|
||||
}
|
||||
|
||||
public List<Area> getContinuityAreas(Project project) {
|
||||
public List<Area> getContinuityAreas() {
|
||||
// Find all individual continuity areas for all components
|
||||
List<Area> preliminaryAreas = new ArrayList<Area>();
|
||||
List<Boolean> checkBreakout = new ArrayList<Boolean>();
|
||||
|
||||
for (IDIYComponent<?> c : project.getComponents()) {
|
||||
ComponentArea a = getComponentArea(c);
|
||||
|
||||
for (ComponentArea a : this.componentAreaMap.values()) {
|
||||
if (a == null || a.getOutlineArea() == null)
|
||||
continue;
|
||||
|
||||
Collection<Area> positiveAreas = a.getContinuityPositiveAreas();
|
||||
if (positiveAreas != null)
|
||||
for (Area a1 : positiveAreas) {
|
||||
@@ -733,9 +732,9 @@ public class DrawingManager {
|
||||
return areas;
|
||||
}
|
||||
|
||||
public ContinuityGraph getContinuityGraph(Project project) {
|
||||
public ContinuityGraph getContinuityGraph() {
|
||||
Set<Connection> connections = new HashSet<Connection>();
|
||||
for (IDIYComponent<?> c : project.getComponents()) {
|
||||
for (IDIYComponent<?> c : this.componentAreaMap.keySet()) {
|
||||
if (c instanceof IContinuity) {
|
||||
for (int i = 0; i < c.getControlPointCount() - 1; i++)
|
||||
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);
|
||||
}
|
||||
|
||||
public List<Area> getContinuityAreaProximity(Project project, float threshold) {
|
||||
List<Area> continuityAreas = getContinuityAreas(project);
|
||||
public List<Area> getContinuityAreaProximity(float threshold) {
|
||||
List<Area> continuityAreas = getContinuityAreas();
|
||||
Stroke s = ObjectCache.getInstance().fetchBasicStroke(threshold - 1); // value eyeballed for
|
||||
// approx good results
|
||||
List<Area> expanded = continuityAreas.parallelStream()
|
||||
|
||||
@@ -82,6 +82,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
|
||||
private boolean drawingComponent = false;
|
||||
private boolean trackingAllowed = true;
|
||||
private int layerId;
|
||||
private boolean trackingContinuityAllowed = false;
|
||||
private boolean trackingContinuityPositive = true;
|
||||
|
||||
@@ -103,7 +104,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
private String continuityMarker;
|
||||
private Shape lastShape;
|
||||
|
||||
private double zoom;
|
||||
private double zoom;
|
||||
|
||||
/**
|
||||
* Creates a wrapper around specified {@link Graphics2D} object.
|
||||
@@ -133,6 +134,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
currentArea = new Area();
|
||||
continuityPositiveAreas = new HashMap<String, Area>();
|
||||
continuityNegativeAreas = new HashMap<String, Area>();
|
||||
layerId = 0;
|
||||
// trackingStacks.clear();
|
||||
continuityMarker = null;
|
||||
originalStroke = canvasGraphics.getStroke();
|
||||
@@ -159,7 +161,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
canvasGraphics.setComposite(originalComposite);
|
||||
canvasGraphics.setFont(originalFont);
|
||||
// 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
|
||||
@@ -176,12 +179,18 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
return continuityNegativeAreas;
|
||||
}
|
||||
|
||||
public int getLayerId() {
|
||||
return layerId;
|
||||
}
|
||||
|
||||
// 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.continuityPositiveAreas = continuityPositiveAreas;
|
||||
this.continuityNegativeAreas = continuityNegativeAreas;
|
||||
this.layerId = layerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,7 +204,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTrackingContinuityArea(boolean positive) {
|
||||
public void startTrackingContinuityArea(int layerId, boolean positive) {
|
||||
this.layerId = layerId;
|
||||
this.trackingContinuityAllowed = true;
|
||||
this.trackingContinuityPositive = positive;
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ public class Presenter implements IPlugInPort {
|
||||
projectFileManager.notifyFileChange();
|
||||
}
|
||||
} else if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown) {
|
||||
drawingManager.findContinuityAreaAtPoint(currentProject, scaledPoint);
|
||||
drawingManager.findContinuityAreaAtPoint(scaledPoint);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
} else {
|
||||
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>(selectedComponents);
|
||||
@@ -2809,7 +2809,7 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
@@ -2874,11 +2874,12 @@ public class Presenter implements IPlugInPort {
|
||||
ComponentArea componentArea = drawingManager.getComponentArea(c);
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
protected boolean IsCopperArea() {
|
||||
protected boolean isCopperArea() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected int getLayerId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected Point2D[] getPoints() {
|
||||
// convert old points to new
|
||||
if (points.length == 2) {
|
||||
@@ -149,7 +153,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
Shape shape = getBodyShape();
|
||||
// If there's no body, just draw the line connecting the ending points.
|
||||
if (shape == null) {
|
||||
drawLead(g2d, componentState, drawingObserver, IsCopperArea());
|
||||
drawLead(g2d, componentState, drawingObserver, isCopperArea());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -415,7 +419,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
|
||||
private void drawLead(Graphics2D g2d, ComponentState componentState, IDrawingObserver observer, boolean isCopperArea) {
|
||||
if (isCopperArea)
|
||||
observer.startTrackingContinuityArea(true);
|
||||
observer.startTrackingContinuityArea(getLayerId(), true);
|
||||
|
||||
float thickness = getLeadThickness();
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ public class Breadboard extends AbstractProtoBoard {
|
||||
}
|
||||
|
||||
// draw transparent connections just to designate connections
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
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 padY = (int) (y0 + (segment.y + j) * spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
drawingObserver.setContinuityMarker(segment.label);
|
||||
|
||||
g2d.setColor(padColor);
|
||||
@@ -432,7 +432,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
|
||||
int padX = (int) (x0 + potPad.x * spacing);
|
||||
int padY = (int) (y0 + (potPad.y + 8 * i) * spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
drawingObserver.setContinuityMarker(potPad.label + i);
|
||||
|
||||
g2d.setColor(padColor);
|
||||
@@ -483,7 +483,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
|
||||
int padX = (int) (x0 + potPad.x * spacing);
|
||||
int padY = (int) (y0 + potPad.y * spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
drawingObserver.setContinuityMarker(potPad.label);
|
||||
|
||||
g2d.setColor(padColor);
|
||||
@@ -513,7 +513,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
|
||||
int padX = (int) (x0 + (6.5 + i) * spacing);
|
||||
int padY = (int) (y0 + (36 + j) * spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
drawingObserver.setContinuityMarker(connectorLabels[i]);
|
||||
|
||||
g2d.setColor(padColor);
|
||||
@@ -543,7 +543,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
|
||||
int padX = (int) (x0 + (17) * spacing);
|
||||
int padY = (int) (y0 + 35.5 * spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
drawingObserver.setContinuityMarker("GND");
|
||||
|
||||
g2d.setColor(padColor);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ProtoBoard extends AbstractProtoBoard {
|
||||
g2d.setColor(traceColor);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
|
||||
// draw segment connectors
|
||||
for (int y = 0; y < ROW_COUNT; y++) {
|
||||
@@ -223,7 +223,7 @@ public class ProtoBoard extends AbstractProtoBoard {
|
||||
// draw top mini pad traces
|
||||
g2d.setColor(traceColor);
|
||||
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),
|
||||
(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),
|
||||
@@ -255,7 +255,7 @@ public class ProtoBoard extends AbstractProtoBoard {
|
||||
int padX = (int) (point.getX() + (xOffset + x) * spacing);
|
||||
int padY = (int) (point.getY() + (yOffset + y) * spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
drawingObserver.setContinuityMarker("SEGMENT=" + segment + ";ROW=" + y);
|
||||
|
||||
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),
|
||||
(int)(3 * spacing), (int)spacing);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
|
||||
for (int x = 0; x < 3; x++) {
|
||||
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.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
|
||||
// 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));
|
||||
@@ -403,7 +403,7 @@ public class ProtoBoard extends AbstractProtoBoard {
|
||||
|
||||
for (int i = 0; i < padXs.length; i++) {
|
||||
int padX = padXs[i];
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
|
||||
if (i == 0 || i == 2 || i == 5) {
|
||||
switch (y) {
|
||||
@@ -473,7 +473,7 @@ public class ProtoBoard extends AbstractProtoBoard {
|
||||
for (int y = 0; y < ROW_COUNT; y++) {
|
||||
g2d.setColor(padColor);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
|
||||
// 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);
|
||||
@@ -492,7 +492,7 @@ public class ProtoBoard extends AbstractProtoBoard {
|
||||
|
||||
g2d.setColor(undersidePadColor);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
|
||||
// bottom row
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ public class TagStrip extends AbstractTransparentComponent<String> implements IC
|
||||
g2d.draw(mainArea);
|
||||
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
for (int i = 1; i < body.length; i++)
|
||||
g2d.fill(body[i]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
@@ -379,7 +379,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
||||
g2d.draw(mainArea);
|
||||
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
for (int i = 1; i < body.length; i++)
|
||||
g2d.fill(body[i]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TriPadBoard extends AbstractVeroBoard {
|
||||
}
|
||||
|
||||
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),
|
||||
stripSize);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
@@ -122,7 +122,7 @@ public class TriPadBoard extends AbstractVeroBoard {
|
||||
}
|
||||
|
||||
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)
|
||||
+ stripSize));
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
@@ -73,7 +73,7 @@ public class VeroBoard extends AbstractVeroBoard {
|
||||
x = firstPoint.getX();
|
||||
y += spacing;
|
||||
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);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
@@ -91,7 +91,7 @@ public class VeroBoard extends AbstractVeroBoard {
|
||||
x += spacing;
|
||||
y = firstPoint.getY();
|
||||
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));
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
|
||||
@@ -158,10 +158,15 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean IsCopperArea() {
|
||||
protected boolean isCopperArea() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayerId() {
|
||||
return getLayer().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: color;
|
||||
g2d.setColor(curveColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
|
||||
g2d.draw(curve);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class Eyelet extends AbstractComponent<String> {
|
||||
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||
g2d.setColor(color);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(1, true);
|
||||
g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
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();
|
||||
yPoints[i] = (int)controlPoints[i].getY();
|
||||
}
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
|
||||
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
// 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();
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: color);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
|
||||
if (type == Type.ROUND) {
|
||||
g2d.fill(new Ellipse2D.Double(point.getX() - diameter / 2, point.getY() - diameter / 2, diameter, diameter));
|
||||
} else if (type == Type.OVAL_HORIZONTAL) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class TraceCut extends AbstractComponent<Void> {
|
||||
int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels());
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: getBoardColor());
|
||||
drawingObserver.startTrackingContinuityArea(false);
|
||||
drawingObserver.startTrackingContinuityArea(1, false);
|
||||
if (getOrientation() == OrientationHV.VERTICAL)
|
||||
g2d.fillRect((int)(point.getX() - holeSpacing / 2 - cutWidth / 2), (int)(point.getY() - size / 2 - 1), cutWidth, size + 2);
|
||||
else
|
||||
@@ -93,7 +93,7 @@ public class TraceCut extends AbstractComponent<Void> {
|
||||
} else {
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: getBoardColor());
|
||||
drawingObserver.startTrackingContinuityArea(false);
|
||||
drawingObserver.startTrackingContinuityArea(1, false);
|
||||
g2d.fillRoundRect((int)(point.getX() - size / 2), (int)(point.getY() - size / 2), size, size, size, size);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Turret extends AbstractComponent<String> {
|
||||
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
||||
g2d.setColor(color);
|
||||
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);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
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);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.fill(body[1]);
|
||||
g2d.fill(body[2]);
|
||||
if (body[3] != null)
|
||||
|
||||
@@ -127,7 +127,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.fill(body[1]);
|
||||
g2d.fill(body[2]);
|
||||
if (body[3] != null)
|
||||
|
||||
@@ -123,7 +123,7 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
|
||||
g2d.fill(body[3]);
|
||||
g2d.fill(body[4]);
|
||||
|
||||
@@ -114,7 +114,7 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.fill(body[1]);
|
||||
g2d.fill(body[2]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
for (int i = 2; i < body.length; i++)
|
||||
g2d.fill(body[i]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
+2
-2
@@ -350,7 +350,7 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
|
||||
|
||||
// Draw outer pins
|
||||
if (configuration.getNeedsSecondLevel()) {
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
for (int i = secondLevelStart; i < body.length; i++) {
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor);
|
||||
g2d.fill(body[i]);
|
||||
@@ -373,7 +373,7 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
|
||||
|
||||
// Draw pins
|
||||
for (int i = 1; i <= secondLevelStart; i++) {
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor);
|
||||
g2d.fill(body[i]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ public class RotarySwitchSealed extends AbstractAngledComponent<RotarySwitchSeal
|
||||
}
|
||||
g2d.setColor(pinColor);
|
||||
if (getMount() == Mount.CHASSIS)
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.fill(pinShape);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(pinColor.darker());
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class SwitchLatchingSymbol
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((float) (terminalSize / 4)));
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
for (int i = 0; i < controlPoints.length; i++) {
|
||||
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(PAD_COLOR.darker());
|
||||
|
||||
@@ -93,7 +93,7 @@ public class CommonNode extends AbstractComponent<String> implements ICommonNode
|
||||
}
|
||||
|
||||
g2d.setColor(bgColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(text.hashCode(), true);
|
||||
g2d.fill(rect);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
@@ -279,11 +279,11 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
if (!outlineMode) {
|
||||
if (i == 3)
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
// if (i == 3)
|
||||
// drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fill(shape);
|
||||
if (i == 3)
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
// if (i == 3)
|
||||
// drawingObserver.stopTrackingContinuityArea();
|
||||
}
|
||||
g2d.setComposite(oldComposite);
|
||||
Color finalBorderColor;
|
||||
|
||||
@@ -248,7 +248,7 @@ public class Jumbo4PinTubeSocket extends AbstractAngledComponent<String> {
|
||||
Shape terminalShape = body[1];
|
||||
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getTerminalColor());
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.fill(terminalShape);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ public class TubeSocket extends AbstractAngledComponent<String> {
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : PIN_COLOR);
|
||||
if (getMount() == Mount.CHASSIS)
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
drawingObserver.startTrackingContinuityArea(hashCode(), true);
|
||||
g2d.fill(pinShape);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
if (!outlineMode) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user