mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Added "Tag Strip" component for point-to-point layouts
Removed border property from boards
This commit is contained in:
@@ -2934,10 +2934,18 @@
|
|||||||
<releaseDate>2020-04-09 00:00:00.000 CET</releaseDate>
|
<releaseDate>2020-04-09 00:00:00.000 CET</releaseDate>
|
||||||
<name></name>
|
<name></name>
|
||||||
<changes>
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added "Tag Strip" component for point-to-point layouts</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Prevent the app from closing while running background operations, like saving and exporting files</description>
|
<description>Prevent the app from closing while running background operations, like saving and exporting files</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Automatically determine border color of board components</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Fixed the issue with "Highlight Connected Areas" not recognizing some conductive areas</description>
|
<description>Fixed the issue with "Highlight Connected Areas" not recognizing some conductive areas</description>
|
||||||
|
|||||||
Binary file not shown.
@@ -46,7 +46,6 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BOARD_COLOR = Color.decode("#F8EBB3");
|
public static Color BOARD_COLOR = Color.decode("#F8EBB3");
|
||||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
|
||||||
public static Color COORDINATE_COLOR = Color.gray.brighter();
|
public static Color COORDINATE_COLOR = Color.gray.brighter();
|
||||||
public static float COORDINATE_FONT_SIZE = 9f;
|
public static float COORDINATE_FONT_SIZE = 9f;
|
||||||
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
||||||
@@ -59,7 +58,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
protected Point secondPoint = new Point();
|
protected Point secondPoint = new Point();
|
||||||
|
|
||||||
protected Color boardColor = BOARD_COLOR;
|
protected Color boardColor = BOARD_COLOR;
|
||||||
protected Color borderColor = BORDER_COLOR;
|
@Deprecated
|
||||||
|
protected Color borderColor;
|
||||||
protected Color coordinateColor = COORDINATE_COLOR;
|
protected Color coordinateColor = COORDINATE_COLOR;
|
||||||
protected Boolean drawCoordinates = null;
|
protected Boolean drawCoordinates = null;
|
||||||
protected CoordinateType xType = CoordinateType.Numbers;
|
protected CoordinateType xType = CoordinateType.Numbers;
|
||||||
@@ -92,7 +92,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
// tracked so far.
|
// tracked so far.
|
||||||
drawingObserver.stopTracking();
|
drawingObserver.stopTracking();
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
: borderColor);
|
: getBoardColor().darker());
|
||||||
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,15 +212,6 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
this.coordinateColor = coordinateColor;
|
this.coordinateColor = coordinateColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
|
||||||
public Color getBorderColor() {
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "X")
|
@EditableProperty(name = "X")
|
||||||
public CoordinateType getxType() {
|
public CoordinateType getxType() {
|
||||||
if (xType == null)
|
if (xType == null)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class BlankBoard extends AbstractBoard {
|
|||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
g2d.setColor(BOARD_COLOR);
|
g2d.setColor(BOARD_COLOR);
|
||||||
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public class BlankBoard extends AbstractBoard {
|
|||||||
// tracked so far.
|
// tracked so far.
|
||||||
drawingObserver.stopTracking();
|
drawingObserver.stopTracking();
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
: borderColor);
|
: getBoardColor().darker());
|
||||||
if (getType() == Type.SQUARE)
|
if (getType() == Type.SQUARE)
|
||||||
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BOARD_COLOR = Color.decode("#E3EAB4");
|
public static Color BOARD_COLOR = Color.decode("#E3EAB4");
|
||||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
|
||||||
public static Color EYELET_COLOR = Color.decode("#C3E4ED");
|
public static Color EYELET_COLOR = Color.decode("#C3E4ED");
|
||||||
|
|
||||||
public static Size SPACING = new Size(0.5d, SizeUnit.in);
|
public static Size SPACING = new Size(0.5d, SizeUnit.in);
|
||||||
@@ -63,7 +62,6 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
public EyeletBoard() {
|
public EyeletBoard() {
|
||||||
super();
|
super();
|
||||||
this.boardColor = BOARD_COLOR;
|
this.boardColor = BOARD_COLOR;
|
||||||
this.borderColor = BORDER_COLOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -133,7 +131,7 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
g2d.setColor(BOARD_COLOR);
|
g2d.setColor(BOARD_COLOR);
|
||||||
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
g2d.setColor(EYELET_COLOR);
|
g2d.setColor(EYELET_COLOR);
|
||||||
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
|
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ public class MarshallPerfBoard extends AbstractBoard {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BOARD_COLOR = Color.decode("#CD8500");
|
public static Color BOARD_COLOR = Color.decode("#CD8500");
|
||||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
|
||||||
public static Size SPACING = new Size(3 / 8d, SizeUnit.in);
|
public static Size SPACING = new Size(3 / 8d, SizeUnit.in);
|
||||||
public static Size HOLE_SIZE = new Size(1 / 8d, SizeUnit.in);
|
public static Size HOLE_SIZE = new Size(1 / 8d, SizeUnit.in);
|
||||||
|
|
||||||
@@ -61,7 +60,6 @@ public class MarshallPerfBoard extends AbstractBoard {
|
|||||||
public MarshallPerfBoard() {
|
public MarshallPerfBoard() {
|
||||||
super();
|
super();
|
||||||
this.boardColor = BOARD_COLOR;
|
this.boardColor = BOARD_COLOR;
|
||||||
this.borderColor = BORDER_COLOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,7 +88,7 @@ public class MarshallPerfBoard extends AbstractBoard {
|
|||||||
p.x += spacing;
|
p.x += spacing;
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
|
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
|
||||||
g2d.setColor(borderColor);
|
g2d.setColor(getBoardColor().darker());
|
||||||
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
|
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,34 +115,34 @@ public class MarshallPerfBoard extends AbstractBoard {
|
|||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
g2d.setColor(BOARD_COLOR);
|
g2d.setColor(BOARD_COLOR);
|
||||||
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
|
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.fillOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.drawOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
|
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.fillOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.drawOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
|
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.fillOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.drawOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
|
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.fillOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
g2d.drawOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||||
getClosestOdd(5.0 / factor));
|
getClosestOdd(5.0 / factor));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
g2d.setColor(BOARD_COLOR);
|
g2d.setColor(BOARD_COLOR);
|
||||||
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
g2d.setColor(COPPER_COLOR);
|
g2d.setColor(COPPER_COLOR);
|
||||||
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
|
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
|
||||||
|
|||||||
@@ -0,0 +1,412 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
DIY Layout Creator (DIYLC).
|
||||||
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
|
This file is part of DIYLC.
|
||||||
|
|
||||||
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
DIYLC is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package org.diylc.components.boards;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.common.ObjectCache;
|
||||||
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
|
import org.diylc.components.transform.TerminalStripTransformer;
|
||||||
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.IDrawingObserver;
|
||||||
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
|
import org.diylc.core.VisibilityPolicy;
|
||||||
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
import org.diylc.core.annotations.KeywordPolicy;
|
||||||
|
import org.diylc.core.annotations.PositiveNonZeroMeasureValidator;
|
||||||
|
import org.diylc.core.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
|
@ComponentDescriptor(name = "Tag Strip", author = "Branislav Stojkovic", category = "Boards",
|
||||||
|
instanceNamePrefix = "TS", description = "Row of terminals for point-to-point construction",
|
||||||
|
zOrder = IDIYComponent.BOARD, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = TerminalStripTransformer.class)
|
||||||
|
public class TagStrip extends AbstractTransparentComponent<String> implements IContinuity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static Color BOARD_COLOR = Color.decode("#CD8500");
|
||||||
|
public static Color TERMINAL_COLOR = Color.lightGray;
|
||||||
|
public static Color TERMINAL_BORDER_COLOR = TERMINAL_COLOR.darker();
|
||||||
|
public static int EDGE_RADIUS = 2;
|
||||||
|
public static Size MOUNTING_HOLE_SIZE = new Size(0.07d, SizeUnit.in);
|
||||||
|
public static Size MOUNTING_HOLE_DISTANCE = new Size(0.25d, SizeUnit.in);
|
||||||
|
public static Size TERMINAL_THICKNESS = new Size(0.04d, SizeUnit.in);
|
||||||
|
|
||||||
|
private String value = "";
|
||||||
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
|
private int terminalCount = 7;
|
||||||
|
private static Size BOARD_THICKNESS = new Size(0.05d, SizeUnit.in);
|
||||||
|
private Size terminalSpacing = new Size(0.375d, SizeUnit.in);
|
||||||
|
private Point[] controlPoints = new Point[] {new Point(0, 0)};
|
||||||
|
private Color boardColor = BOARD_COLOR;
|
||||||
|
|
||||||
|
private TagStripMount mount = TagStripMount.Central;
|
||||||
|
|
||||||
|
transient private Area[] body;
|
||||||
|
|
||||||
|
public TagStrip() {
|
||||||
|
super();
|
||||||
|
updateControlPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Orientation getOrientation() {
|
||||||
|
return orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrientation(Orientation orientation) {
|
||||||
|
this.orientation = orientation;
|
||||||
|
updateControlPoints();
|
||||||
|
// Reset body shape.
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Terminals")
|
||||||
|
public int getTerminalCount() {
|
||||||
|
return terminalCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalCount(int terminalCount) {
|
||||||
|
this.terminalCount = terminalCount;
|
||||||
|
updateControlPoints();
|
||||||
|
// Reset body shape;
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Terminal Spacing", validatorClass = PositiveNonZeroMeasureValidator.class)
|
||||||
|
public Size getTerminalSpacing() {
|
||||||
|
return terminalSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTerminalSpacing(Size pinSpacing) {
|
||||||
|
this.terminalSpacing = pinSpacing;
|
||||||
|
updateControlPoints();
|
||||||
|
// Reset body shape;
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getControlPointCount() {
|
||||||
|
return controlPoints.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getControlPoint(int index) {
|
||||||
|
return controlPoints[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isControlPointSticky(int index) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
|
return VisibilityPolicy.NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setControlPoint(Point point, int index) {
|
||||||
|
controlPoints[index].setLocation(point);
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateControlPoints() {
|
||||||
|
Point firstPoint = controlPoints[0];
|
||||||
|
controlPoints = new Point[getTerminalCount()];
|
||||||
|
controlPoints[0] = firstPoint;
|
||||||
|
int pinSpacing = (int) this.terminalSpacing.convertToPixels();
|
||||||
|
// Update control points.
|
||||||
|
int dx1;
|
||||||
|
int dy1;
|
||||||
|
for (int i = 0; i < getTerminalCount(); i++) {
|
||||||
|
switch (orientation) {
|
||||||
|
case DEFAULT:
|
||||||
|
dx1 = 0;
|
||||||
|
dy1 = i * pinSpacing;
|
||||||
|
break;
|
||||||
|
case _90:
|
||||||
|
dx1 = -i * pinSpacing;
|
||||||
|
dy1 = 0;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
dx1 = 0;
|
||||||
|
dy1 = -i * pinSpacing;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
dx1 = i * pinSpacing;
|
||||||
|
dy1 = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||||
|
}
|
||||||
|
controlPoints[i] = new Point(firstPoint.x + dx1, firstPoint.y + dy1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Area[] getBody() {
|
||||||
|
if (body == null) {
|
||||||
|
body = new Area[1 + getTerminalCount()];
|
||||||
|
int x = controlPoints[0].x;
|
||||||
|
int y = controlPoints[0].y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int terminalSpacing = (int) getTerminalSpacing().convertToPixels();
|
||||||
|
int boardThickness = getClosestOdd(BOARD_THICKNESS.convertToPixels());
|
||||||
|
int boardLength = (int) ((getTerminalCount() - 0.5) * terminalSpacing + 2 * boardThickness);
|
||||||
|
int holeSize = getClosestOdd(MOUNTING_HOLE_SIZE.convertToPixels());
|
||||||
|
int terminalThickness = (int) TERMINAL_THICKNESS.convertToPixels();
|
||||||
|
int terminalSize = terminalSpacing / 2;
|
||||||
|
int holeDistance = terminalSize / 2 + terminalThickness / 2 + 1;
|
||||||
|
int terminalWidth;
|
||||||
|
int terminalHeight;
|
||||||
|
int holeDx;
|
||||||
|
int holeDy;
|
||||||
|
switch (orientation) {
|
||||||
|
case DEFAULT:
|
||||||
|
width = boardThickness;
|
||||||
|
height = boardLength;
|
||||||
|
terminalWidth = terminalThickness;
|
||||||
|
terminalHeight = terminalSize;
|
||||||
|
x -= boardThickness + terminalThickness / 2;
|
||||||
|
y -= terminalSize / 2 + boardThickness;
|
||||||
|
holeDx = holeDistance;
|
||||||
|
holeDy = 0;
|
||||||
|
break;
|
||||||
|
case _90:
|
||||||
|
width = boardLength;
|
||||||
|
height = boardThickness;
|
||||||
|
terminalWidth = terminalSize;
|
||||||
|
terminalHeight = terminalThickness;
|
||||||
|
x += boardThickness - boardLength + terminalSize / 2;
|
||||||
|
y -= boardThickness + terminalThickness / 2;
|
||||||
|
holeDx = 0;
|
||||||
|
holeDy = holeDistance;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
width = boardThickness;
|
||||||
|
height = boardLength;
|
||||||
|
terminalWidth = terminalThickness;
|
||||||
|
terminalHeight = terminalSize;
|
||||||
|
x += terminalThickness / 2;
|
||||||
|
y += boardThickness - boardLength + terminalSize / 2;
|
||||||
|
holeDx = -holeDistance;
|
||||||
|
holeDy = 0;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
width = boardLength;
|
||||||
|
height = boardThickness;
|
||||||
|
terminalWidth = terminalSize;
|
||||||
|
terminalHeight = terminalThickness;
|
||||||
|
x -= terminalSize / 2 + boardThickness;
|
||||||
|
y -= -terminalThickness / 2;
|
||||||
|
holeDx = 0;
|
||||||
|
holeDy = -holeDistance;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||||
|
}
|
||||||
|
Area bodyArea = new Area(new Rectangle2D.Double(x, y, width, height));
|
||||||
|
body[0] = bodyArea;
|
||||||
|
|
||||||
|
for (int i = 0; i < getTerminalCount(); i++) {
|
||||||
|
Point p1 = getControlPoint(i);
|
||||||
|
Area terminal =
|
||||||
|
new Area(new Rectangle2D.Double(p1.x - terminalWidth/ 2, p1.y - terminalHeight / 2, terminalWidth, terminalHeight));
|
||||||
|
|
||||||
|
body[1 + i] = terminal;
|
||||||
|
|
||||||
|
if ((getMount() == TagStripMount.Central && i == getTerminalCount() / 2) || (getMount() == TagStripMount.Outside && (i == 0 || i == getTerminalCount() - 1))) {
|
||||||
|
Area mount = new Area(new Rectangle2D.Double(p1.getX() + holeDx - terminalSize / 2, p1.getY() + holeDy - terminalSize / 2, terminalSize, terminalSize));
|
||||||
|
mount.subtract(new Area(new Ellipse2D.Double(p1.getX() + holeDx - holeSize / 2, p1.getY() + holeDy - holeSize / 2, holeSize, holeSize)));
|
||||||
|
body[1 + i].add(mount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
|
IDrawingObserver drawingObserver) {
|
||||||
|
if (checkPointsClipped(g2d.getClip())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Area[] area = getBody();
|
||||||
|
Area mainArea = area[0];
|
||||||
|
|
||||||
|
Composite oldComposite = g2d.getComposite();
|
||||||
|
if (alpha < MAX_ALPHA) {
|
||||||
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
|
}
|
||||||
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBoardColor());
|
||||||
|
g2d.fill(mainArea);
|
||||||
|
|
||||||
|
Color finalBorderColor;
|
||||||
|
if (outlineMode) {
|
||||||
|
Theme theme =
|
||||||
|
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||||
|
finalBorderColor =
|
||||||
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|
: theme.getOutlineColor();
|
||||||
|
} else {
|
||||||
|
finalBorderColor =
|
||||||
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|
: getBoardColor().darker();
|
||||||
|
}
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
|
g2d.draw(mainArea);
|
||||||
|
|
||||||
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
for (int i = 1; i < body.length; i++)
|
||||||
|
g2d.fill(body[i]);
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
Color finalTerminalBorderColor;
|
||||||
|
if (outlineMode) {
|
||||||
|
Theme theme =
|
||||||
|
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||||
|
finalTerminalBorderColor =
|
||||||
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|
: theme.getOutlineColor();
|
||||||
|
} else {
|
||||||
|
finalTerminalBorderColor =
|
||||||
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|
: TERMINAL_BORDER_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.setColor(finalTerminalBorderColor);
|
||||||
|
for (int i = 1; i < body.length; i++)
|
||||||
|
g2d.draw(body[i]);
|
||||||
|
|
||||||
|
g2d.setComposite(oldComposite);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
g2d.rotate(-Math.PI / 4, width / 2, height / 2);
|
||||||
|
g2d.setColor(BOARD_COLOR);
|
||||||
|
int thickness = 2 * width / 32;
|
||||||
|
g2d.fillRect(0, height / 2 - thickness / 2, width, thickness);
|
||||||
|
g2d.setColor(TERMINAL_COLOR.darker());
|
||||||
|
int terminalWidth = 7 * width / 32;
|
||||||
|
g2d.fillRect(2, height / 2 + thickness / 2, terminalWidth, thickness);
|
||||||
|
g2d.fillRect((int) (2 + terminalWidth * 1.5), height / 2 + thickness / 2, terminalWidth, thickness);
|
||||||
|
g2d.fillRect((int) (2 + terminalWidth * 3), height / 2 + thickness / 2, terminalWidth, thickness);
|
||||||
|
g2d.setColor(TERMINAL_COLOR);
|
||||||
|
g2d.fillRect((int) (2 + terminalWidth * 1.5), height / 2 + thickness / 2 + 1, terminalWidth, terminalWidth);
|
||||||
|
g2d.setColor(Color.white);
|
||||||
|
g2d.fillOval((int) (2 + terminalWidth * 1.75), height / 2 + thickness / 2 + 1 + terminalWidth / 2, terminalWidth / 2, terminalWidth / 2);
|
||||||
|
// int radius = 6 * width / 32;
|
||||||
|
// int holeSize = 3 * width / 32;
|
||||||
|
// g2d.setColor(BOARD_COLOR);
|
||||||
|
// g2d.fillRect(width / 4, 1, width / 2, height - 4);
|
||||||
|
// g2d.setColor(BORDER_COLOR);
|
||||||
|
// g2d.drawRect(width / 4, 1, width / 2, height - 4);
|
||||||
|
// int terminalSize = getClosestOdd(height / 5);
|
||||||
|
// Area terminal =
|
||||||
|
// new Area(new RoundRectangle2D.Double(2 * width / 32, height / 5, width - 4 * width / 32, terminalSize, radius,
|
||||||
|
// radius));
|
||||||
|
// terminal.subtract(new Area(new Ellipse2D.Double(2 * width / 32 + holeSize, height * 3 / 10 - holeSize / 2, holeSize, holeSize)));
|
||||||
|
// terminal.subtract(new Area(new Ellipse2D.Double(width - 2 * width / 32 - holeSize * 2, height * 3 / 10 - holeSize / 2, holeSize, holeSize)));
|
||||||
|
//
|
||||||
|
// g2d.setColor(TERMINAL_COLOR);
|
||||||
|
// g2d.fill(terminal);
|
||||||
|
// g2d.setColor(TERMINAL_BORDER_COLOR);
|
||||||
|
// g2d.draw(terminal);
|
||||||
|
// g2d.translate(0, height * 2 / 5);
|
||||||
|
// g2d.setColor(TERMINAL_COLOR);
|
||||||
|
// g2d.fill(terminal);
|
||||||
|
// g2d.setColor(TERMINAL_BORDER_COLOR);
|
||||||
|
// g2d.draw(terminal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Board")
|
||||||
|
public Color getBoardColor() {
|
||||||
|
if (boardColor == null) {
|
||||||
|
boardColor = BOARD_COLOR;
|
||||||
|
}
|
||||||
|
return boardColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBoardColor(Color bodyColor) {
|
||||||
|
this.boardColor = bodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getControlPointNodeName(int index) {
|
||||||
|
return "TerminalStrip" + index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Mounting Lugs")
|
||||||
|
public TagStripMount getMount() {
|
||||||
|
return mount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMount(TagStripMount mount) {
|
||||||
|
this.mount = mount;
|
||||||
|
updateControlPoints();
|
||||||
|
// Reset body shape;
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TagStripMount {
|
||||||
|
Central, Outside;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,7 +59,6 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BOARD_COLOR = Color.decode("#CD8500");
|
public static Color BOARD_COLOR = Color.decode("#CD8500");
|
||||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
|
||||||
public static Color TERMINAL_COLOR = Color.lightGray;
|
public static Color TERMINAL_COLOR = Color.lightGray;
|
||||||
public static Color TERMINAL_BORDER_COLOR = TERMINAL_COLOR.darker();
|
public static Color TERMINAL_BORDER_COLOR = TERMINAL_COLOR.darker();
|
||||||
public static int EDGE_RADIUS = 2;
|
public static int EDGE_RADIUS = 2;
|
||||||
@@ -74,7 +73,9 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
private Size holeSpacing = new Size(0.5d, SizeUnit.in);
|
private Size holeSpacing = new Size(0.5d, SizeUnit.in);
|
||||||
private Point[] controlPoints = new Point[] {new Point(0, 0)};
|
private Point[] controlPoints = new Point[] {new Point(0, 0)};
|
||||||
private Color boardColor = BOARD_COLOR;
|
private Color boardColor = BOARD_COLOR;
|
||||||
private Color borderColor = BORDER_COLOR;
|
@SuppressWarnings("unused")
|
||||||
|
@Deprecated
|
||||||
|
private transient Color borderColor;
|
||||||
private boolean centerHole = false;
|
private boolean centerHole = false;
|
||||||
|
|
||||||
transient private Area[] body;
|
transient private Area[] body;
|
||||||
@@ -249,7 +250,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
|
|
||||||
public Area[] getBody() {
|
public Area[] getBody() {
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
body = new Area[2];
|
body = new Area[1 + getTerminalCount()];
|
||||||
int x = controlPoints[0].x;
|
int x = controlPoints[0].x;
|
||||||
int y = controlPoints[0].y;
|
int y = controlPoints[0].y;
|
||||||
int width;
|
int width;
|
||||||
@@ -260,7 +261,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
int boardWidth = (int) getBoardWidth().convertToPixels();
|
int boardWidth = (int) getBoardWidth().convertToPixels();
|
||||||
int boardLength = (getTerminalCount() - 1) * terminalSpacing + 2 * boardWidth;
|
int boardLength = (getTerminalCount() - 1) * terminalSpacing + 2 * boardWidth;
|
||||||
Area indentation = null;
|
Area indentation = null;
|
||||||
Area terminals = null;
|
|
||||||
int mountingHoleSize = getClosestOdd(MOUNTING_HOLE_SIZE.convertToPixels());
|
int mountingHoleSize = getClosestOdd(MOUNTING_HOLE_SIZE.convertToPixels());
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
@@ -314,7 +315,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
bodyArea.subtract(indentation);
|
bodyArea.subtract(indentation);
|
||||||
body[0] = bodyArea;
|
body[0] = bodyArea;
|
||||||
|
|
||||||
terminals = new Area();
|
|
||||||
for (int i = 0; i < getTerminalCount(); i++) {
|
for (int i = 0; i < getTerminalCount(); i++) {
|
||||||
Point p1 = getControlPoint(i);
|
Point p1 = getControlPoint(i);
|
||||||
Point p2 = getControlPoint(i + getTerminalCount());
|
Point p2 = getControlPoint(i + getTerminalCount());
|
||||||
@@ -338,9 +339,9 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
bodyArea.subtract(centerHole);
|
bodyArea.subtract(centerHole);
|
||||||
}
|
}
|
||||||
|
|
||||||
terminals.add(terminal);
|
body[1 + i] = terminal;
|
||||||
}
|
}
|
||||||
body[1] = terminals;
|
|
||||||
}
|
}
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
@@ -351,8 +352,8 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
if (checkPointsClipped(g2d.getClip())) {
|
if (checkPointsClipped(g2d.getClip())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Area[] body = getBody();
|
||||||
Area mainArea = getBody()[0];
|
Area mainArea = getBody()[0];
|
||||||
Area terminalArea = getBody()[1];
|
|
||||||
|
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
@@ -371,7 +372,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
} else {
|
} else {
|
||||||
finalBorderColor =
|
finalBorderColor =
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
: getBorderColor();
|
: getBoardColor().darker();
|
||||||
}
|
}
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
|
||||||
@@ -380,7 +381,8 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
|
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||||
drawingObserver.startTrackingContinuityArea(true);
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
g2d.fill(terminalArea);
|
for (int i = 1; i < body.length; i++)
|
||||||
|
g2d.fill(body[i]);
|
||||||
drawingObserver.stopTrackingContinuityArea();
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
Color finalTerminalBorderColor;
|
Color finalTerminalBorderColor;
|
||||||
@@ -397,7 +399,8 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
g2d.setColor(finalTerminalBorderColor);
|
g2d.setColor(finalTerminalBorderColor);
|
||||||
g2d.draw(terminalArea);
|
for (int i = 1; i < body.length; i++)
|
||||||
|
g2d.draw(body[i]);
|
||||||
|
|
||||||
g2d.setComposite(oldComposite);
|
g2d.setComposite(oldComposite);
|
||||||
}
|
}
|
||||||
@@ -408,7 +411,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
int holeSize = 3 * width / 32;
|
int holeSize = 3 * width / 32;
|
||||||
g2d.setColor(BOARD_COLOR);
|
g2d.setColor(BOARD_COLOR);
|
||||||
g2d.fillRect(width / 4, 1, width / 2, height - 4);
|
g2d.fillRect(width / 4, 1, width / 2, height - 4);
|
||||||
g2d.setColor(BORDER_COLOR);
|
g2d.setColor(BOARD_COLOR.darker());
|
||||||
g2d.drawRect(width / 4, 1, width / 2, height - 4);
|
g2d.drawRect(width / 4, 1, width / 2, height - 4);
|
||||||
int terminalSize = getClosestOdd(height / 5);
|
int terminalSize = getClosestOdd(height / 5);
|
||||||
Area terminal =
|
Area terminal =
|
||||||
@@ -440,18 +443,6 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
|||||||
this.boardColor = bodyColor;
|
this.boardColor = bodyColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
|
||||||
public Color getBorderColor() {
|
|
||||||
if (borderColor == null) {
|
|
||||||
borderColor = BORDER_COLOR;
|
|
||||||
}
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return "TerminalStrip" + index;
|
return "TerminalStrip" + index;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class TraceCut extends AbstractComponent<Void> {
|
|||||||
int factor = 32 / width;
|
int factor = 32 / width;
|
||||||
g2d.setColor(AbstractBoard.BOARD_COLOR);
|
g2d.setColor(AbstractBoard.BOARD_COLOR);
|
||||||
g2d.fillRect(0, 2 / factor, width - 1, height - 4 / factor);
|
g2d.fillRect(0, 2 / factor, width - 1, height - 4 / factor);
|
||||||
g2d.setColor(AbstractBoard.BORDER_COLOR);
|
g2d.setColor(AbstractBoard.BOARD_COLOR.darker());
|
||||||
g2d.drawRect(0, 2 / factor, width - 1, height - 4 / factor);
|
g2d.drawRect(0, 2 / factor, width - 1, height - 4 / factor);
|
||||||
g2d.setColor(COPPER_COLOR);
|
g2d.setColor(COPPER_COLOR);
|
||||||
g2d.fillRect(1 / factor, width / 3, width - 2 / factor, getClosestOdd(width / 3) + 1);
|
g2d.fillRect(1 / factor, width / 3, width - 2 / factor, getClosestOdd(width / 3) + 1);
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ public class V1FileParser implements IOldFileParser {
|
|||||||
if (type.equalsIgnoreCase("pcb")) {
|
if (type.equalsIgnoreCase("pcb")) {
|
||||||
board = new BlankBoard();
|
board = new BlankBoard();
|
||||||
board.setBoardColor(Color.white);
|
board.setBoardColor(Color.white);
|
||||||
board.setBorderColor(Color.black);
|
|
||||||
} else if (type.equalsIgnoreCase("perfboard")) {
|
} else if (type.equalsIgnoreCase("perfboard")) {
|
||||||
board = new PerfBoard();
|
board = new PerfBoard();
|
||||||
} else if (type.equalsIgnoreCase("stripboard")) {
|
} else if (type.equalsIgnoreCase("stripboard")) {
|
||||||
|
|||||||
@@ -285,7 +285,6 @@ public class V2FileParser implements IOldFileParser {
|
|||||||
if (cl != null) {
|
if (cl != null) {
|
||||||
board.setBoardColor(cl);
|
board.setBoardColor(cl);
|
||||||
}
|
}
|
||||||
board.setBorderColor(Color.black);
|
|
||||||
if (com_name != "") {
|
if (com_name != "") {
|
||||||
board.setName(com_name);
|
board.setName(com_name);
|
||||||
} else {
|
} else {
|
||||||
@@ -297,7 +296,6 @@ public class V2FileParser implements IOldFileParser {
|
|||||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Perfboard")) {
|
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Perfboard")) {
|
||||||
PerfBoard board = new PerfBoard();
|
PerfBoard board = new PerfBoard();
|
||||||
board.setBoardColor(Color.white);
|
board.setBoardColor(Color.white);
|
||||||
board.setBorderColor(Color.black);
|
|
||||||
if (com_name != "") {
|
if (com_name != "") {
|
||||||
board.setName(com_name);
|
board.setName(com_name);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user