mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
better scaling
added marshall board and trimmer
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry>
|
<entry>
|
||||||
<string>metric</string>
|
<string>lastPath</string>
|
||||||
<boolean>true</boolean>
|
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles</string>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>zoom</string>
|
<string>zoom</string>
|
||||||
<double>1.0</double>
|
<double>1.0</double>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastPath</string>
|
<string>metric</string>
|
||||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles</string>
|
<boolean>false</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>showTemplatesAtStartup</string>
|
<string>showTemplatesAtStartup</string>
|
||||||
|
|||||||
Binary file not shown.
+2
-2
@@ -53,7 +53,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
|||||||
* @param x
|
* @param x
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected int getClosestOdd(int x) {
|
protected int getClosestOdd(double x) {
|
||||||
return (x / 2) * 2 + 1;
|
return ((int) x / 2) * 2 + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -24,10 +24,12 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
|
|||||||
public static Color GUIDELINE_COLOR = Color.blue;
|
public static Color GUIDELINE_COLOR = Color.blue;
|
||||||
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
|
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
|
||||||
|
|
||||||
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
protected Point[] controlPoints = new Point[] {
|
||||||
new Point(DEFAULT_SIZE.convertToPixels() / 2, 0),
|
new Point(0, 0),
|
||||||
new Point(DEFAULT_SIZE.convertToPixels() / 2, DEFAULT_SIZE.convertToPixels()),
|
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), 0),
|
||||||
new Point(DEFAULT_SIZE.convertToPixels(), DEFAULT_SIZE.convertToPixels()) };
|
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), (int) (DEFAULT_SIZE
|
||||||
|
.convertToPixels())),
|
||||||
|
new Point((int) DEFAULT_SIZE.convertToPixels(), (int) DEFAULT_SIZE.convertToPixels()) };
|
||||||
|
|
||||||
protected Color color = getDefaultColor();
|
protected Color color = getDefaultColor();
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -40,7 +40,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
protected Size width;
|
protected Size width;
|
||||||
protected Point[] points = new Point[] {
|
protected Point[] points = new Point[] {
|
||||||
new Point((int) (-DEFAULT_SIZE.convertToPixels() / 2), 0),
|
new Point((int) (-DEFAULT_SIZE.convertToPixels() / 2), 0),
|
||||||
new Point(DEFAULT_SIZE.convertToPixels() / 2, 0) };
|
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), 0) };
|
||||||
protected Color bodyColor = Color.white;
|
protected Color bodyColor = Color.white;
|
||||||
protected Color borderColor = Color.black;
|
protected Color borderColor = Color.black;
|
||||||
protected Color labelColor = LABEL_COLOR;
|
protected Color labelColor = LABEL_COLOR;
|
||||||
@@ -173,7 +173,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
* @return default lead thickness. Override this method to change it.
|
* @return default lead thickness. Override this method to change it.
|
||||||
*/
|
*/
|
||||||
protected int getLeadThickness() {
|
protected int getLeadThickness() {
|
||||||
return LEAD_THICKNESS.convertToPixels();
|
return (int) LEAD_THICKNESS.convertToPixels();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -16,13 +16,13 @@ public class Size extends AbstractMeasure<SizeUnit> implements Comparable<Size>
|
|||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
public int convertToPixels() {
|
public double convertToPixels() {
|
||||||
// double factor = getUnit().getFactor() / SizeUnit.in.getFactor();
|
// double factor = getUnit().getFactor() / SizeUnit.in.getFactor();
|
||||||
// int grids = (int) (factor * getValue() * Constants.GRIDS_PER_INCH);
|
// int grids = (int) (factor * getValue() * Constants.GRIDS_PER_INCH);
|
||||||
// double remainder = (factor * getValue() * Constants.GRIDS_PER_INCH) - grids;
|
// double remainder = (factor * getValue() * Constants.GRIDS_PER_INCH) - grids;
|
||||||
// return (int) Math.round(Constants.PIXELS_PER_INCH / Constants.GRIDS_PER_INCH
|
// return (int) Math.round(Constants.PIXELS_PER_INCH / Constants.GRIDS_PER_INCH
|
||||||
// * (grids + remainder));
|
// * (grids + remainder));
|
||||||
return (int) (getValue() * getUnit().getFactor() / SizeUnit.in.getFactor() * Constants.PIXELS_PER_INCH);
|
return getValue() * getUnit().getFactor() / SizeUnit.in.getFactor() * Constants.PIXELS_PER_INCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -13,8 +13,8 @@ public class CalcUtils {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int roundToGrid(int x, Size gridSpacing) {
|
public static int roundToGrid(int x, Size gridSpacing) {
|
||||||
int grid = gridSpacing.convertToPixels();
|
double grid = gridSpacing.convertToPixels();
|
||||||
return (Math.round(1f * x / grid) * grid);
|
return (int) (Math.round(1f * x / grid) * grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void snapPointToGrid(Point point, Size gridSpacing) {
|
public static void snapPointToGrid(Point point, Size gridSpacing) {
|
||||||
|
|||||||
+1
-1
@@ -331,7 +331,7 @@ public class DrawingManager {
|
|||||||
|
|
||||||
public Dimension getCanvasDimensions(Project project, Double zoomLevel, boolean useZoom) {
|
public Dimension getCanvasDimensions(Project project, Double zoomLevel, boolean useZoom) {
|
||||||
double width = project.getWidth().convertToPixels();
|
double width = project.getWidth().convertToPixels();
|
||||||
int height = project.getHeight().convertToPixels();
|
double height = project.getHeight().convertToPixels();
|
||||||
if (useZoom) {
|
if (useZoom) {
|
||||||
width *= zoomLevel;
|
width *= zoomLevel;
|
||||||
height *= zoomLevel;
|
height *= zoomLevel;
|
||||||
|
|||||||
+2
-2
@@ -815,8 +815,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
for (IDIYComponent<?> component : components) {
|
for (IDIYComponent<?> component : components) {
|
||||||
for (int i = 0; i < component.getControlPointCount(); i++) {
|
for (int i = 0; i < component.getControlPointCount(); i++) {
|
||||||
Point point = new Point(component.getControlPoint(i));
|
Point point = new Point(component.getControlPoint(i));
|
||||||
point.translate(currentProject.getGridSpacing().convertToPixels(), currentProject
|
point.translate((int) currentProject.getGridSpacing().convertToPixels(),
|
||||||
.getGridSpacing().convertToPixels());
|
(int) currentProject.getGridSpacing().convertToPixels());
|
||||||
component.setControlPoint(point, i);
|
component.setControlPoint(point, i);
|
||||||
}
|
}
|
||||||
addComponent(component, ComponentProcessor.getInstance().extractComponentTypeFrom(
|
addComponent(component, ComponentProcessor.getInstance().extractComponentTypeFrom(
|
||||||
|
|||||||
+6
-11
@@ -161,8 +161,8 @@ public class ProjectFileManager {
|
|||||||
int height = Integer.parseInt(root.getAttribute("Height")) + 1;
|
int height = Integer.parseInt(root.getAttribute("Height")) + 1;
|
||||||
int boardWidth = (int) (width * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue());
|
int boardWidth = (int) (width * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue());
|
||||||
int boardHeight = (int) (height * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue());
|
int boardHeight = (int) (height * Constants.PIXELS_PER_INCH * V1_GRID_SPACING.getValue());
|
||||||
int projectWidth = project.getWidth().convertToPixels();
|
int projectWidth = (int) project.getWidth().convertToPixels();
|
||||||
int projectHeight = project.getHeight().convertToPixels();
|
int projectHeight = (int) project.getHeight().convertToPixels();
|
||||||
int x = (projectWidth - boardWidth) / 2;
|
int x = (projectWidth - boardWidth) / 2;
|
||||||
int y = (projectHeight - boardHeight) / 2;
|
int y = (projectHeight - boardHeight) / 2;
|
||||||
AbstractBoard board;
|
AbstractBoard board;
|
||||||
@@ -178,11 +178,11 @@ public class ProjectFileManager {
|
|||||||
throw new IllegalArgumentException("Unrecognized board type: " + type);
|
throw new IllegalArgumentException("Unrecognized board type: " + type);
|
||||||
}
|
}
|
||||||
board.setName("Main board");
|
board.setName("Main board");
|
||||||
Point referencePoint = new Point(roundToGrid(x, V1_GRID_SPACING), roundToGrid(y,
|
Point referencePoint = new Point(CalcUtils.roundToGrid(x, V1_GRID_SPACING), CalcUtils
|
||||||
V1_GRID_SPACING));
|
.roundToGrid(y, V1_GRID_SPACING));
|
||||||
board.setControlPoint(referencePoint, 0);
|
board.setControlPoint(referencePoint, 0);
|
||||||
board.setControlPoint(new Point(roundToGrid(x + boardWidth, V1_GRID_SPACING), roundToGrid(y
|
board.setControlPoint(new Point(CalcUtils.roundToGrid(x + boardWidth, V1_GRID_SPACING),
|
||||||
+ boardHeight, V1_GRID_SPACING)), 1);
|
CalcUtils.roundToGrid(y + boardHeight, V1_GRID_SPACING)), 1);
|
||||||
project.getComponents().add(board);
|
project.getComponents().add(board);
|
||||||
|
|
||||||
NodeList childNodes = root.getChildNodes();
|
NodeList childNodes = root.getChildNodes();
|
||||||
@@ -435,9 +435,4 @@ public class ProjectFileManager {
|
|||||||
fis.close();
|
fis.close();
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int roundToGrid(int x, Size gridSpacing) {
|
|
||||||
int grid = gridSpacing.convertToPixels();
|
|
||||||
return (Math.round(1f * x / grid) * grid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -49,7 +49,7 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
private Image bufferImage;
|
private Image bufferImage;
|
||||||
private GraphicsConfiguration screenGraphicsConfiguration;
|
private GraphicsConfiguration screenGraphicsConfiguration;
|
||||||
|
|
||||||
private static boolean USE_HARDWARE_ACCELLERATION = true;
|
private static boolean USE_HARDWARE_ACCELLERATION = false;
|
||||||
|
|
||||||
static final EnumSet<DrawOption> DRAW_OPTIONS = EnumSet.of(DrawOption.GRID,
|
static final EnumSet<DrawOption> DRAW_OPTIONS = EnumSet.of(DrawOption.GRID,
|
||||||
DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.ANTIALIASING,
|
DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.ANTIALIASING,
|
||||||
|
|||||||
+1
-1
@@ -112,7 +112,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
private RulerScrollPane getScrollPane() {
|
private RulerScrollPane getScrollPane() {
|
||||||
if (scrollPane == null) {
|
if (scrollPane == null) {
|
||||||
scrollPane = new RulerScrollPane(getCanvasPanel(), new ProjectDrawingProvider(
|
scrollPane = new RulerScrollPane(getCanvasPanel(), new ProjectDrawingProvider(
|
||||||
plugInPort, true), new Size(1d, SizeUnit.cm).convertToPixels(), new Size(1d,
|
plugInPort, true), (int) new Size(1d, SizeUnit.cm).convertToPixels(), (int) new Size(1d,
|
||||||
SizeUnit.in).convertToPixels());
|
SizeUnit.in).convertToPixels());
|
||||||
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY,
|
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY,
|
||||||
true);
|
true);
|
||||||
|
|||||||
@@ -167,6 +167,10 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Fixed lead alignment issue</description>
|
<description>Fixed lead alignment issue</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Better scaling, grid lines are more precise</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
<com.diyfever.gui.update.Change>
|
<com.diyfever.gui.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added resistor schematic symbol</description>
|
<description>Added resistor schematic symbol</description>
|
||||||
@@ -179,6 +183,14 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added eyelet/turret component</description>
|
<description>Added eyelet/turret component</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added Marshall/Trainwreck style boards</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added few types of trimmers</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
||||||
</url>
|
</url>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/DIYLC"/>
|
|
||||||
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
|
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/diylc.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
Binary file not shown.
+1
-1
@@ -27,7 +27,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
|
|
||||||
protected String value = "";
|
protected String value = "";
|
||||||
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
||||||
new Point(DEFAULT_WIDTH.convertToPixels(), DEFAULT_HEIGHT.convertToPixels()) };
|
new Point((int) DEFAULT_WIDTH.convertToPixels(), (int) DEFAULT_HEIGHT.convertToPixels()) };
|
||||||
protected Point firstPoint = new Point();
|
protected Point firstPoint = new Point();
|
||||||
protected Point secondPoint = new Point();
|
protected Point secondPoint = new Point();
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -40,9 +40,9 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
/ MAX_ALPHA));
|
/ MAX_ALPHA));
|
||||||
}
|
}
|
||||||
Point p = new Point(firstPoint);
|
Point p = new Point(firstPoint);
|
||||||
int diameter = getClosestOdd(EYELET_SIZE.convertToPixels());
|
int diameter = getClosestOdd((int) EYELET_SIZE.convertToPixels());
|
||||||
int holeDiameter = getClosestOdd(HOLE_SIZE.convertToPixels());
|
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||||
int spacing = this.spacing.convertToPixels();
|
int spacing = (int) this.spacing.convertToPixels();
|
||||||
|
|
||||||
while (p.y < secondPoint.y - spacing) {
|
while (p.y < secondPoint.y - spacing) {
|
||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
|
|||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
package org.diylc.components.boards;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.IDrawingObserver;
|
||||||
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
import org.diylc.core.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
|
@ComponentDescriptor(name = "Marshall Style Perf Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board as found on some Marshall and Trainwreck amps")
|
||||||
|
public class MarshallPerfBoard extends AbstractBoard {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
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 HOLE_SIZE = new Size(1 / 8d, SizeUnit.in);
|
||||||
|
|
||||||
|
// private Area copperArea;
|
||||||
|
protected Size spacing = SPACING;
|
||||||
|
|
||||||
|
public MarshallPerfBoard() {
|
||||||
|
super();
|
||||||
|
this.boardColor = BOARD_COLOR;
|
||||||
|
this.borderColor = BORDER_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
|
IDrawingObserver drawingObserver) {
|
||||||
|
super.draw(g2d, componentState, project, drawingObserver);
|
||||||
|
if (componentState != ComponentState.DRAGGING) {
|
||||||
|
if (alpha < MAX_ALPHA) {
|
||||||
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||||
|
/ MAX_ALPHA));
|
||||||
|
}
|
||||||
|
Point p = new Point(firstPoint);
|
||||||
|
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||||
|
int spacing = (int) this.spacing.convertToPixels();
|
||||||
|
|
||||||
|
while (p.y < secondPoint.y - spacing) {
|
||||||
|
p.x = firstPoint.x;
|
||||||
|
p.y += spacing;
|
||||||
|
while (p.x < secondPoint.x - spacing) {
|
||||||
|
p.x += spacing;
|
||||||
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
|
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
|
||||||
|
holeDiameter);
|
||||||
|
g2d.setColor(borderColor);
|
||||||
|
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
|
||||||
|
holeDiameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Size getSpacing() {
|
||||||
|
return spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpacing(Size spacing) {
|
||||||
|
this.spacing = spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
g2d.setColor(BOARD_COLOR);
|
||||||
|
g2d.fillRect(2, 2, width - 4, height - 4);
|
||||||
|
g2d.setColor(BORDER_COLOR);
|
||||||
|
g2d.drawRect(2, 2, width - 4, height - 4);
|
||||||
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
|
g2d.fillOval(width / 2 - 2, width / 2 - 2, 5, 5);
|
||||||
|
g2d.setColor(BORDER_COLOR);
|
||||||
|
g2d.drawOval(width / 2 - 2, width / 2 - 2, 5, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-3
@@ -40,9 +40,9 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
/ MAX_ALPHA));
|
/ MAX_ALPHA));
|
||||||
}
|
}
|
||||||
Point p = new Point(firstPoint);
|
Point p = new Point(firstPoint);
|
||||||
int diameter = getClosestOdd(PAD_SIZE.convertToPixels());
|
int diameter = getClosestOdd((int) PAD_SIZE.convertToPixels());
|
||||||
int holeDiameter = getClosestOdd(HOLE_SIZE.convertToPixels());
|
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||||
int spacing = this.spacing.convertToPixels();
|
int spacing = (int) this.spacing.convertToPixels();
|
||||||
|
|
||||||
while (p.y < secondPoint.y - spacing) {
|
while (p.y < secondPoint.y - spacing) {
|
||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
|
|||||||
+5
-5
@@ -43,18 +43,18 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
/ MAX_ALPHA));
|
/ MAX_ALPHA));
|
||||||
}
|
}
|
||||||
Point p = new Point(firstPoint);
|
Point p = new Point(firstPoint);
|
||||||
int stripSize = getClosestOdd(STRIP_SIZE.convertToPixels());
|
int stripSize = getClosestOdd((int) STRIP_SIZE.convertToPixels());
|
||||||
int holeSize = getClosestOdd(HOLE_SIZE.convertToPixels());
|
int holeSize = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||||
int spacing = this.spacing.convertToPixels();
|
int spacing = (int) this.spacing.convertToPixels();
|
||||||
|
|
||||||
while (p.y < secondPoint.y - spacing) {
|
while (p.y < secondPoint.y - spacing) {
|
||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
p.y += spacing;
|
p.y += spacing;
|
||||||
g2d.setColor(stripColor);
|
g2d.setColor(stripColor);
|
||||||
g2d.fillRect(p.x + SPACING.convertToPixels() / 2, p.y - stripSize / 2,
|
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2,
|
||||||
secondPoint.x - spacing - p.x, stripSize);
|
secondPoint.x - spacing - p.x, stripSize);
|
||||||
g2d.setColor(stripColor.darker());
|
g2d.setColor(stripColor.darker());
|
||||||
g2d.drawRect(p.x + SPACING.convertToPixels() / 2, p.y - stripSize / 2,
|
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2,
|
||||||
secondPoint.x - spacing - p.x, stripSize);
|
secondPoint.x - spacing - p.x, stripSize);
|
||||||
while (p.x < secondPoint.x - spacing) {
|
while (p.x < secondPoint.x - spacing) {
|
||||||
p.x += spacing;
|
p.x += spacing;
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLeadThickness() {
|
protected int getLeadThickness() {
|
||||||
return getThickness().convertToPixels();
|
return (int) getThickness().convertToPixels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
||||||
int thickness = size.convertToPixels();
|
int thickness = (int) size.convertToPixels();
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
|
||||||
|
|||||||
+2
-2
@@ -34,8 +34,8 @@ public class Eyelet extends AbstractComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
int diameter = getClosestOdd(size.convertToPixels());
|
int diameter = getClosestOdd((int) size.convertToPixels());
|
||||||
int holeDiameter = getClosestOdd(holeSize.convertToPixels());
|
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
||||||
g2d.setColor(color);
|
g2d.setColor(color);
|
||||||
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ public class SolderPad extends AbstractComponent<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
int diameter = getClosestOdd(size.convertToPixels());
|
int diameter = getClosestOdd((int) size.convertToPixels());
|
||||||
int holeDiameter = getClosestOdd(HOLE_SIZE.convertToPixels());
|
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
|
||||||
if (type == Type.ROUND) {
|
if (type == Type.ROUND) {
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ public class TraceCut extends AbstractComponent<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
int size = getClosestOdd(this.size.convertToPixels());
|
int size = getClosestOdd((int) this.size.convertToPixels());
|
||||||
int dotDiameter = size - 6;
|
int dotDiameter = size - 6;
|
||||||
g2d.setColor(fillColor);
|
g2d.setColor(fillColor);
|
||||||
g2d.fillRect(point.x - size / 2, point.y - size / 2, size, size);
|
g2d.fillRect(point.x - size / 2, point.y - size / 2, size, size);
|
||||||
|
|||||||
+6
-6
@@ -48,7 +48,7 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
|||||||
|
|
||||||
private void updateControlPoints() {
|
private void updateControlPoints() {
|
||||||
Point firstPoint = controlPoints[0];
|
Point firstPoint = controlPoints[0];
|
||||||
int spacing = SPACING.convertToPixels();
|
int spacing = (int) SPACING.convertToPixels();
|
||||||
switch (switchType) {
|
switch (switchType) {
|
||||||
case SPST:
|
case SPST:
|
||||||
controlPoints = new Point[] { firstPoint,
|
controlPoints = new Point[] { firstPoint,
|
||||||
@@ -187,9 +187,9 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
|||||||
// so far.
|
// so far.
|
||||||
drawingObserver.stopTracking();
|
drawingObserver.stopTracking();
|
||||||
// Draw lugs.
|
// Draw lugs.
|
||||||
int circleDiameter = getClosestOdd(CIRCLE_SIZE.convertToPixels());
|
int circleDiameter = getClosestOdd((int) CIRCLE_SIZE.convertToPixels());
|
||||||
int lugWidth = getClosestOdd(LUG_WIDTH.convertToPixels());
|
int lugWidth = getClosestOdd((int) LUG_WIDTH.convertToPixels());
|
||||||
int lugHeight = getClosestOdd(LUG_HEIGHT.convertToPixels());
|
int lugHeight = getClosestOdd((int) LUG_HEIGHT.convertToPixels());
|
||||||
for (Point p : controlPoints) {
|
for (Point p : controlPoints) {
|
||||||
g2d.setColor(CIRCLE_COLOR);
|
g2d.setColor(CIRCLE_COLOR);
|
||||||
g2d.fillOval(p.x - circleDiameter / 2, p.y - circleDiameter / 2, circleDiameter,
|
g2d.fillOval(p.x - circleDiameter / 2, p.y - circleDiameter / 2, circleDiameter,
|
||||||
@@ -202,8 +202,8 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
|||||||
public RoundRectangle2D getBody() {
|
public RoundRectangle2D getBody() {
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
Point firstPoint = controlPoints[0];
|
Point firstPoint = controlPoints[0];
|
||||||
int margin = MARGIN.convertToPixels();
|
int margin = (int) MARGIN.convertToPixels();
|
||||||
int spacing = SPACING.convertToPixels();
|
int spacing = (int) SPACING.convertToPixels();
|
||||||
switch (switchType) {
|
switch (switchType) {
|
||||||
case SPST:
|
case SPST:
|
||||||
body = new RoundRectangle2D.Double(firstPoint.x - margin, firstPoint.y - margin,
|
body = new RoundRectangle2D.Double(firstPoint.x - margin, firstPoint.y - margin,
|
||||||
|
|||||||
+3
-3
@@ -73,9 +73,9 @@ public class BOM extends AbstractComponent<Void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Calculate maximum entry size.
|
// Calculate maximum entry size.
|
||||||
int maxEntrySize = maxNameWidth + maxValueWidth + 2 * SPACING.convertToPixels();
|
int maxEntrySize = maxNameWidth + maxValueWidth + 2 * (int) SPACING.convertToPixels();
|
||||||
int columnCount = size.convertToPixels() / maxEntrySize;
|
int columnCount = (int) size.convertToPixels() / maxEntrySize;
|
||||||
int columnWidth = size.convertToPixels() / columnCount;
|
int columnWidth = (int) size.convertToPixels() / columnCount;
|
||||||
int entriesPerColumn = (int) Math.ceil(1.d * bom.size() / columnCount);
|
int entriesPerColumn = (int) Math.ceil(1.d * bom.size() / columnCount);
|
||||||
if (entriesPerColumn == 0) {
|
if (entriesPerColumn == 0) {
|
||||||
g2d.drawString(DEFAULT_TEXT, point.x, point.y);
|
g2d.drawString(DEFAULT_TEXT, point.x, point.y);
|
||||||
|
|||||||
+3
-3
@@ -122,11 +122,11 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
||||||
g2d.setColor(markerColor);
|
g2d.setColor(markerColor);
|
||||||
int width = getClosestOdd(getWidth().convertToPixels());
|
int width = getClosestOdd(getWidth().convertToPixels());
|
||||||
g2d.fillRect(getLength().convertToPixels() - markerLength, 0, markerLength, width);
|
g2d.fillRect((int) getLength().convertToPixels() - markerLength, 0, markerLength, width);
|
||||||
g2d.setColor(tickColor);
|
g2d.setColor(tickColor);
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
||||||
g2d.drawLine(getLength().convertToPixels() - markerLength / 2,
|
g2d.drawLine((int) getLength().convertToPixels() - markerLength / 2,
|
||||||
(int) (width / 2 - width * 0.15), getLength().convertToPixels() - markerLength
|
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels() - markerLength
|
||||||
/ 2, (int) (width / 2 + width * 0.15));
|
/ 2, (int) (width / 2 + width * 0.15));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -47,7 +47,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updateControlPoints() {
|
protected void updateControlPoints() {
|
||||||
int spacing = this.spacing.convertToPixels();
|
int spacing = (int) this.spacing.convertToPixels();
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
controlPoints[1].setLocation(controlPoints[0].x + spacing, controlPoints[0].y);
|
controlPoints[1].setLocation(controlPoints[0].x + spacing, controlPoints[0].y);
|
||||||
@@ -71,7 +71,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Area[] getBody() {
|
public Area[] getBody() {
|
||||||
int spacing = this.spacing.convertToPixels();
|
int spacing = (int) this.spacing.convertToPixels();
|
||||||
int diameter = getClosestOdd(bodyDiameter.convertToPixels());
|
int diameter = getClosestOdd(bodyDiameter.convertToPixels());
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
body = new Area[7];
|
body = new Area[7];
|
||||||
|
|||||||
+372
@@ -0,0 +1,372 @@
|
|||||||
|
package org.diylc.components.passive;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
|
import org.diylc.common.ObjectCache;
|
||||||
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.IDrawingObserver;
|
||||||
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
import org.diylc.core.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
|
@ComponentDescriptor(name = "Trimmer Potentiometer", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.SINGLE_CLICK, instanceNamePrefix = "VR", description = "Various types of board mounted trimmer potentiometers", zOrder = IDIYComponent.COMPONENT, stretchable = false)
|
||||||
|
public class TrimmerPotentiometer extends AbstractPotentiometer {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected static Size FLAT_BODY_SIZE = new Size(9.5d, SizeUnit.mm);
|
||||||
|
protected static Size FLAT_SHAFT_SIZE = new Size(4d, SizeUnit.mm);
|
||||||
|
protected static Size VERTICAL_BODY_LENGTH = new Size(9.5d, SizeUnit.mm);
|
||||||
|
protected static Size VERTICAL_BODY_WIDTH = new Size(4.5d, SizeUnit.mm);
|
||||||
|
protected static Size SPACING = new Size(0.1d, SizeUnit.in);
|
||||||
|
private static Color BODY_COLOR = Color.decode("#FFFFE0");
|
||||||
|
private static Color BORDER_COLOR = Color.decode("#8E8E38");
|
||||||
|
private static Color SHAFT_COLOR = Color.decode("#FFFFE0");
|
||||||
|
private static Color SHAFT_BORDER_COLOR = Color.decode("#8E8E38");
|
||||||
|
public static Color PIN_COLOR = Color.decode("#00B2EE");
|
||||||
|
public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
||||||
|
public static Size PIN_SIZE = new Size(0.03d, SizeUnit.in);
|
||||||
|
|
||||||
|
protected Color bodyColor = BODY_COLOR;
|
||||||
|
protected Color borderColor = BORDER_COLOR;
|
||||||
|
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
|
||||||
|
transient protected Shape[] body = null;
|
||||||
|
|
||||||
|
protected TrimmerType type = TrimmerType.FLAT_SMALL;
|
||||||
|
|
||||||
|
public TrimmerPotentiometer() {
|
||||||
|
controlPoints = new Point[] { new Point(0, 0), new Point(0, 0), new Point(0, 0) };
|
||||||
|
updateControlPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateControlPoints() {
|
||||||
|
int spacing = (int) SPACING.convertToPixels();
|
||||||
|
int dx1 = 0;
|
||||||
|
int dy1 = 0;
|
||||||
|
int dx2 = 0;
|
||||||
|
int dy2 = 0;
|
||||||
|
switch (orientation) {
|
||||||
|
case DEFAULT:
|
||||||
|
switch (type) {
|
||||||
|
case FLAT_SMALL:
|
||||||
|
dx1 = 2 * spacing;
|
||||||
|
dy1 = spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = 2 * spacing;
|
||||||
|
break;
|
||||||
|
case FLAT_LARGE:
|
||||||
|
dx1 = 4 * spacing;
|
||||||
|
dy1 = spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = 2 * spacing;
|
||||||
|
break;
|
||||||
|
case VERTICAL_INLINE:
|
||||||
|
dx1 = 0;
|
||||||
|
dy1 = spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = 2 * spacing;
|
||||||
|
break;
|
||||||
|
case VERTICAL_OFFSET:
|
||||||
|
dx1 = spacing;
|
||||||
|
dy1 = spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = 2 * spacing;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case _90:
|
||||||
|
switch (type) {
|
||||||
|
case FLAT_SMALL:
|
||||||
|
dx1 = -spacing;
|
||||||
|
dy1 = 2 * spacing;
|
||||||
|
dx2 = -2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
case FLAT_LARGE:
|
||||||
|
dx1 = -spacing;
|
||||||
|
dy1 = 4 * spacing;
|
||||||
|
dx2 = -2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
case VERTICAL_INLINE:
|
||||||
|
dx1 = -spacing;
|
||||||
|
dy1 = 0;
|
||||||
|
dx2 = -2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
case VERTICAL_OFFSET:
|
||||||
|
dx1 = -spacing;
|
||||||
|
dy1 = spacing;
|
||||||
|
dx2 = -2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
switch (type) {
|
||||||
|
case FLAT_SMALL:
|
||||||
|
dx1 = -2 * spacing;
|
||||||
|
dy1 = -spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = -2 * spacing;
|
||||||
|
break;
|
||||||
|
case FLAT_LARGE:
|
||||||
|
dx1 = -4 * spacing;
|
||||||
|
dy1 = -spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = -2 * spacing;
|
||||||
|
break;
|
||||||
|
case VERTICAL_INLINE:
|
||||||
|
dx1 = 0;
|
||||||
|
dy1 = -spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = -2 * spacing;
|
||||||
|
break;
|
||||||
|
case VERTICAL_OFFSET:
|
||||||
|
dx1 = -spacing;
|
||||||
|
dy1 = -spacing;
|
||||||
|
dx2 = 0;
|
||||||
|
dy2 = -2 * spacing;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
switch (type) {
|
||||||
|
case FLAT_SMALL:
|
||||||
|
dx1 = spacing;
|
||||||
|
dy1 = -2 * spacing;
|
||||||
|
dx2 = 2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
case FLAT_LARGE:
|
||||||
|
dx1 = spacing;
|
||||||
|
dy1 = -4 * spacing;
|
||||||
|
dx2 = 2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
case VERTICAL_INLINE:
|
||||||
|
dx1 = spacing;
|
||||||
|
dy1 = 0;
|
||||||
|
dx2 = 2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
case VERTICAL_OFFSET:
|
||||||
|
dx1 = spacing;
|
||||||
|
dy1 = -spacing;
|
||||||
|
dx2 = 2 * spacing;
|
||||||
|
dy2 = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
controlPoints[1].setLocation(controlPoints[0].x + dx1, controlPoints[0].y + dy1);
|
||||||
|
controlPoints[2].setLocation(controlPoints[0].x + dx2, controlPoints[0].y + dy2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Shape[] getBody() {
|
||||||
|
if (body == null) {
|
||||||
|
body = new Shape[2];
|
||||||
|
|
||||||
|
// Calculate the center point as center of the minimum bounding
|
||||||
|
// rectangle.
|
||||||
|
int centerX = (Math.max(Math.max(controlPoints[0].x, controlPoints[1].x),
|
||||||
|
controlPoints[2].x) + Math.min(
|
||||||
|
Math.min(controlPoints[0].x, controlPoints[1].x), controlPoints[2].x)) / 2;
|
||||||
|
int centerY = (Math.max(Math.max(controlPoints[0].y, controlPoints[1].y),
|
||||||
|
controlPoints[2].y) + Math.min(
|
||||||
|
Math.min(controlPoints[0].y, controlPoints[1].y), controlPoints[2].y)) / 2;
|
||||||
|
|
||||||
|
// Calculate body dimensions based on the selected type.
|
||||||
|
int length = 0;
|
||||||
|
int width = 0;
|
||||||
|
switch (type) {
|
||||||
|
case FLAT_LARGE:
|
||||||
|
case FLAT_SMALL:
|
||||||
|
length = getClosestOdd(FLAT_BODY_SIZE.convertToPixels());
|
||||||
|
width = length;
|
||||||
|
int shaftSize = getClosestOdd(FLAT_SHAFT_SIZE.convertToPixels());
|
||||||
|
Area shaft = new Area(new Ellipse2D.Double(centerX - shaftSize / 2, centerY
|
||||||
|
- shaftSize / 2, shaftSize, shaftSize));
|
||||||
|
Area slot = new Area(new Rectangle2D.Double(centerX - shaftSize / 2, centerY
|
||||||
|
- shaftSize / 8, shaftSize, shaftSize / 4));
|
||||||
|
slot.transform(AffineTransform.getRotateInstance(Math.PI / 4, centerX, centerY));
|
||||||
|
shaft.subtract(slot);
|
||||||
|
body[1] = shaft;
|
||||||
|
break;
|
||||||
|
case VERTICAL_INLINE:
|
||||||
|
case VERTICAL_OFFSET:
|
||||||
|
length = getClosestOdd(VERTICAL_BODY_LENGTH.convertToPixels());
|
||||||
|
width = getClosestOdd(VERTICAL_BODY_WIDTH.convertToPixels());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (orientation == Orientation.DEFAULT || orientation == Orientation._180) {
|
||||||
|
int p = length;
|
||||||
|
length = width;
|
||||||
|
width = p;
|
||||||
|
}
|
||||||
|
body[0] = new Rectangle2D.Double(centerX - length / 2, centerY - width / 2, length,
|
||||||
|
width);
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setControlPoint(Point point, int index) {
|
||||||
|
super.setControlPoint(point, index);
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOrientation(Orientation orientation) {
|
||||||
|
super.setOrientation(orientation);
|
||||||
|
updateControlPoints();
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
|
IDrawingObserver drawingObserver) {
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
Shape mainShape = getBody()[0];
|
||||||
|
Shape shaftShape = getBody()[1];
|
||||||
|
if (mainShape != null) {
|
||||||
|
g2d.setColor(bodyColor);
|
||||||
|
Composite oldComposite = g2d.getComposite();
|
||||||
|
if (alpha < MAX_ALPHA) {
|
||||||
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||||
|
/ MAX_ALPHA));
|
||||||
|
}
|
||||||
|
g2d.fill(mainShape);
|
||||||
|
if (shaftShape != null) {
|
||||||
|
g2d.setColor(SHAFT_COLOR);
|
||||||
|
g2d.fill(shaftShape);
|
||||||
|
g2d.setColor(SHAFT_BORDER_COLOR);
|
||||||
|
g2d.draw(shaftShape);
|
||||||
|
}
|
||||||
|
g2d.setComposite(oldComposite);
|
||||||
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
||||||
|
g2d.draw(mainShape);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw pins.
|
||||||
|
int pinSize = getClosestOdd(PIN_SIZE.convertToPixels());
|
||||||
|
for (Point point : controlPoints) {
|
||||||
|
g2d.setColor(PIN_COLOR);
|
||||||
|
g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
||||||
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
|
g2d.drawOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw label.
|
||||||
|
g2d.setFont(LABEL_FONT);
|
||||||
|
g2d
|
||||||
|
.setColor(componentState == ComponentState.SELECTED ? LABEL_COLOR_SELECTED
|
||||||
|
: LABEL_COLOR);
|
||||||
|
FontMetrics fontMetrics = g2d.getFontMetrics();
|
||||||
|
Rectangle2D bodyRect = getBody()[0].getBounds2D();
|
||||||
|
Rectangle2D rect = fontMetrics.getStringBounds(getName(), g2d);
|
||||||
|
|
||||||
|
int textHeight = (int) rect.getHeight();
|
||||||
|
int textWidth = (int) rect.getWidth();
|
||||||
|
int panelHeight = (int) bodyRect.getHeight();
|
||||||
|
int panelWidth = (int) bodyRect.getWidth();
|
||||||
|
|
||||||
|
int x = (panelWidth - textWidth) / 2;
|
||||||
|
int y = (panelHeight - textHeight) / 2 + fontMetrics.getAscent();
|
||||||
|
|
||||||
|
g2d.drawString(getName(), (int) (bodyRect.getX() + x), (int) (bodyRect.getY() + y));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
int margin = 4;
|
||||||
|
g2d.setColor(BODY_COLOR);
|
||||||
|
g2d.fillRect(margin, margin, width - 2 * margin, width - 2 * margin);
|
||||||
|
g2d.setColor(BORDER_COLOR);
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
g2d.drawRect(margin, margin, width - 2 * margin, width - 2 * margin);
|
||||||
|
int shaftSize = 11;
|
||||||
|
int slotSize = 2;
|
||||||
|
Area area = new Area(new Ellipse2D.Double(width / 2 - shaftSize / 2, width / 2 - shaftSize / 2,
|
||||||
|
shaftSize, shaftSize));
|
||||||
|
Area slot = new Area(new Rectangle2D.Double(0, width / 2 - slotSize / 2, width, slotSize));
|
||||||
|
slot.transform(AffineTransform.getRotateInstance(Math.PI / 4, width / 2, width / 2));
|
||||||
|
area.subtract(slot);
|
||||||
|
g2d.setColor(SHAFT_COLOR);
|
||||||
|
g2d.fill(area);
|
||||||
|
g2d.setColor(SHAFT_BORDER_COLOR);
|
||||||
|
g2d.draw(area);
|
||||||
|
|
||||||
|
int pinSize = 3;
|
||||||
|
g2d.setColor(PIN_COLOR);
|
||||||
|
g2d.fillOval(margin - pinSize / 2, 10 - pinSize / 2, pinSize, pinSize);
|
||||||
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
|
g2d.drawOval(margin - pinSize / 2, 10 - pinSize / 2, pinSize, pinSize);
|
||||||
|
|
||||||
|
g2d.setColor(PIN_COLOR);
|
||||||
|
g2d.fillOval(margin - pinSize / 2, 21 - pinSize / 2, pinSize, pinSize);
|
||||||
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
|
g2d.drawOval(margin - pinSize / 2, 21 - pinSize / 2, pinSize, pinSize);
|
||||||
|
|
||||||
|
g2d.setColor(PIN_COLOR);
|
||||||
|
g2d.fillOval(width - margin - pinSize / 2, width / 2 - pinSize / 2, pinSize, pinSize);
|
||||||
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
|
g2d.drawOval(width - margin - pinSize / 2, width / 2 - pinSize / 2, pinSize, pinSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Body")
|
||||||
|
public Color getBodyColor() {
|
||||||
|
return bodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodyColor(Color bodyColor) {
|
||||||
|
this.bodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Border")
|
||||||
|
public Color getBorderColor() {
|
||||||
|
return borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorderColor(Color borderColor) {
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public TrimmerType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(TrimmerType type) {
|
||||||
|
this.type = type;
|
||||||
|
updateControlPoints();
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum TrimmerType {
|
||||||
|
FLAT_LARGE, FLAT_SMALL, VERTICAL_INLINE, VERTICAL_OFFSET;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name().substring(0, 1) + name().substring(1).toLowerCase().replace("_", " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
-28
@@ -146,6 +146,8 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
Point firstPoint = controlPoints[0];
|
Point firstPoint = controlPoints[0];
|
||||||
controlPoints = new Point[pinCount.getValue()];
|
controlPoints = new Point[pinCount.getValue()];
|
||||||
controlPoints[0] = firstPoint;
|
controlPoints[0] = firstPoint;
|
||||||
|
int pinSpacing = (int) this.pinSpacing.convertToPixels();
|
||||||
|
int rowSpacing = (int) this.rowSpacing.convertToPixels();
|
||||||
// Update control points.
|
// Update control points.
|
||||||
int dx1;
|
int dx1;
|
||||||
int dy1;
|
int dy1;
|
||||||
@@ -155,27 +157,27 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
dx1 = 0;
|
dx1 = 0;
|
||||||
dy1 = i * pinSpacing.convertToPixels();
|
dy1 = i * pinSpacing;
|
||||||
dx2 = rowSpacing.convertToPixels();
|
dx2 = rowSpacing;
|
||||||
dy2 = i * pinSpacing.convertToPixels();
|
dy2 = i * pinSpacing;
|
||||||
break;
|
break;
|
||||||
case _90:
|
case _90:
|
||||||
dx1 = -i * pinSpacing.convertToPixels();
|
dx1 = -i * pinSpacing;
|
||||||
dy1 = 0;
|
dy1 = 0;
|
||||||
dx2 = -i * pinSpacing.convertToPixels();
|
dx2 = -i * pinSpacing;
|
||||||
dy2 = rowSpacing.convertToPixels();
|
dy2 = rowSpacing;
|
||||||
break;
|
break;
|
||||||
case _180:
|
case _180:
|
||||||
dx1 = 0;
|
dx1 = 0;
|
||||||
dy1 = -i * pinSpacing.convertToPixels();
|
dy1 = -i * pinSpacing;
|
||||||
dx2 = -rowSpacing.convertToPixels();
|
dx2 = -rowSpacing;
|
||||||
dy2 = -i * pinSpacing.convertToPixels();
|
dy2 = -i * pinSpacing;
|
||||||
break;
|
break;
|
||||||
case _270:
|
case _270:
|
||||||
dx1 = i * pinSpacing.convertToPixels();
|
dx1 = i * pinSpacing;
|
||||||
dy1 = 0;
|
dy1 = 0;
|
||||||
dx2 = i * pinSpacing.convertToPixels();
|
dx2 = i * pinSpacing;
|
||||||
dy2 = -rowSpacing.convertToPixels();
|
dy2 = -rowSpacing;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unexpected orientation: " + orientation);
|
throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||||
@@ -193,39 +195,41 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
int y = controlPoints[0].y;
|
int y = controlPoints[0].y;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int pinSize = PIN_SIZE.convertToPixels();
|
int pinSize = (int) PIN_SIZE.convertToPixels();
|
||||||
|
int pinSpacing = (int) this.pinSpacing.convertToPixels();
|
||||||
|
int rowSpacing = (int) this.rowSpacing.convertToPixels();
|
||||||
Area indentation = null;
|
Area indentation = null;
|
||||||
int indentationSize = getClosestOdd(INDENT_SIZE.convertToPixels());
|
int indentationSize = getClosestOdd(INDENT_SIZE.convertToPixels());
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
width = rowSpacing.convertToPixels() - pinSize;
|
width = rowSpacing - pinSize;
|
||||||
height = (pinCount.getValue() / 2) * pinSpacing.convertToPixels();
|
height = (pinCount.getValue() / 2) * pinSpacing;
|
||||||
x += pinSize / 2;
|
x += pinSize / 2;
|
||||||
y -= pinSpacing.convertToPixels() / 2;
|
y -= pinSpacing / 2;
|
||||||
indentation = new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2, y
|
indentation = new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2, y
|
||||||
- indentationSize / 2, indentationSize, indentationSize));
|
- indentationSize / 2, indentationSize, indentationSize));
|
||||||
break;
|
break;
|
||||||
case _90:
|
case _90:
|
||||||
width = (pinCount.getValue() / 2) * pinSpacing.convertToPixels();
|
width = (pinCount.getValue() / 2) * pinSpacing;
|
||||||
height = rowSpacing.convertToPixels() - pinSize;
|
height = rowSpacing - pinSize;
|
||||||
x -= (pinSpacing.convertToPixels() / 2) + width - pinSpacing.convertToPixels();
|
x -= (pinSpacing / 2) + width - pinSpacing;
|
||||||
y += pinSize / 2;
|
y += pinSize / 2;
|
||||||
indentation = new Area(new Ellipse2D.Double(x + width - indentationSize / 2, y
|
indentation = new Area(new Ellipse2D.Double(x + width - indentationSize / 2, y
|
||||||
+ height / 2 - indentationSize / 2, indentationSize, indentationSize));
|
+ height / 2 - indentationSize / 2, indentationSize, indentationSize));
|
||||||
break;
|
break;
|
||||||
case _180:
|
case _180:
|
||||||
width = rowSpacing.convertToPixels() - pinSize;
|
width = rowSpacing - pinSize;
|
||||||
height = (pinCount.getValue() / 2) * pinSpacing.convertToPixels();
|
height = (pinCount.getValue() / 2) * pinSpacing;
|
||||||
x -= rowSpacing.convertToPixels() - pinSize / 2;
|
x -= rowSpacing - pinSize / 2;
|
||||||
y -= (pinSpacing.convertToPixels() / 2) + height - pinSpacing.convertToPixels();
|
y -= (pinSpacing / 2) + height - pinSpacing;
|
||||||
indentation = new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2, y
|
indentation = new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2, y
|
||||||
+ height - indentationSize / 2, indentationSize, indentationSize));
|
+ height - indentationSize / 2, indentationSize, indentationSize));
|
||||||
break;
|
break;
|
||||||
case _270:
|
case _270:
|
||||||
width = (pinCount.getValue() / 2) * pinSpacing.convertToPixels();
|
width = (pinCount.getValue() / 2) * pinSpacing;
|
||||||
height = rowSpacing.convertToPixels() - pinSize;
|
height = rowSpacing - pinSize;
|
||||||
x -= pinSpacing.convertToPixels() / 2;
|
x -= pinSpacing / 2;
|
||||||
y += pinSize / 2 - rowSpacing.convertToPixels();
|
y += pinSize / 2 - rowSpacing;
|
||||||
indentation = new Area(new Ellipse2D.Double(x - indentationSize / 2, y + height / 2
|
indentation = new Area(new Ellipse2D.Double(x - indentationSize / 2, y + height / 2
|
||||||
- indentationSize / 2, indentationSize, indentationSize));
|
- indentationSize / 2, indentationSize, indentationSize));
|
||||||
break;
|
break;
|
||||||
@@ -245,7 +249,7 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
int pinSize = PIN_SIZE.convertToPixels() / 2 * 2;
|
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||||
Area mainArea = getBody()[0];
|
Area mainArea = getBody()[0];
|
||||||
for (Point point : controlPoints) {
|
for (Point point : controlPoints) {
|
||||||
g2d.setColor(PIN_COLOR);
|
g2d.setColor(PIN_COLOR);
|
||||||
|
|||||||
+2
-2
@@ -77,8 +77,8 @@ public class DiodePlastic extends AbstractLeadedComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
protected void decorateComponentBody(Graphics2D g2d) {
|
protected void decorateComponentBody(Graphics2D g2d) {
|
||||||
g2d.setColor(markerColor);
|
g2d.setColor(markerColor);
|
||||||
int width = getLength().convertToPixels();
|
int width = (int) getLength().convertToPixels();
|
||||||
int markerWidth = MARKER_WIDTH.convertToPixels();
|
int markerWidth = (int) MARKER_WIDTH.convertToPixels();
|
||||||
g2d.fillRect(width - markerWidth, 0, markerWidth, getClosestOdd(getWidth()
|
g2d.fillRect(width - markerWidth, 0, markerWidth, getClosestOdd(getWidth()
|
||||||
.convertToPixels()));
|
.convertToPixels()));
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -103,7 +103,7 @@ public class TransistorTO220 extends AbstractTransparentComponent<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateControlPoints() {
|
private void updateControlPoints() {
|
||||||
int pinSpacing = PIN_SPACING.convertToPixels();
|
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||||
// Update control points.
|
// Update control points.
|
||||||
int x = controlPoints[0].x;
|
int x = controlPoints[0].x;
|
||||||
int y = controlPoints[0].y;
|
int y = controlPoints[0].y;
|
||||||
@@ -134,10 +134,10 @@ public class TransistorTO220 extends AbstractTransparentComponent<String> {
|
|||||||
body = new Shape[2];
|
body = new Shape[2];
|
||||||
int x = controlPoints[0].x;
|
int x = controlPoints[0].x;
|
||||||
int y = controlPoints[0].y;
|
int y = controlPoints[0].y;
|
||||||
int pinSpacing = PIN_SPACING.convertToPixels();
|
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||||
int bodyWidth = getClosestOdd(BODY_WIDTH.convertToPixels());
|
int bodyWidth = getClosestOdd(BODY_WIDTH.convertToPixels());
|
||||||
int bodyHeight = getClosestOdd(BODY_HEIGHT.convertToPixels());
|
int bodyHeight = getClosestOdd(BODY_HEIGHT.convertToPixels());
|
||||||
int tabThickness = TAB_THICKNESS.convertToPixels();
|
int tabThickness = (int) TAB_THICKNESS.convertToPixels();
|
||||||
|
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
@@ -174,7 +174,7 @@ public class TransistorTO220 extends AbstractTransparentComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
int pinSize = PIN_SIZE.convertToPixels() / 2 * 2;
|
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||||
Shape mainArea = getBody()[0];
|
Shape mainArea = getBody()[0];
|
||||||
Shape tabArea = getBody()[1];
|
Shape tabArea = getBody()[1];
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
@@ -194,6 +194,7 @@ public class TransistorTO220 extends AbstractTransparentComponent<String> {
|
|||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
||||||
g2d.draw(mainArea);
|
g2d.draw(mainArea);
|
||||||
|
|
||||||
|
// Draw pins.
|
||||||
for (Point point : controlPoints) {
|
for (Point point : controlPoints) {
|
||||||
g2d.setColor(PIN_COLOR);
|
g2d.setColor(PIN_COLOR);
|
||||||
g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
||||||
|
|||||||
+3
-3
@@ -98,7 +98,7 @@ public class TransistorTO92 extends AbstractTransparentComponent<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateControlPoints() {
|
private void updateControlPoints() {
|
||||||
int pinSpacing = PIN_SPACING.convertToPixels();
|
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||||
// Update control points.
|
// Update control points.
|
||||||
int x = controlPoints[0].x;
|
int x = controlPoints[0].x;
|
||||||
int y = controlPoints[0].y;
|
int y = controlPoints[0].y;
|
||||||
@@ -128,7 +128,7 @@ public class TransistorTO92 extends AbstractTransparentComponent<String> {
|
|||||||
if (body == null) {
|
if (body == null) {
|
||||||
int x = controlPoints[0].x;
|
int x = controlPoints[0].x;
|
||||||
int y = controlPoints[0].y;
|
int y = controlPoints[0].y;
|
||||||
int pinSpacing = PIN_SPACING.convertToPixels();
|
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||||
int bodyDiameter = getClosestOdd(BODY_DIAMETER.convertToPixels());
|
int bodyDiameter = getClosestOdd(BODY_DIAMETER.convertToPixels());
|
||||||
|
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
@@ -166,7 +166,7 @@ public class TransistorTO92 extends AbstractTransparentComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
int pinSize = PIN_SIZE.convertToPixels() / 2 * 2;
|
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||||
Area mainArea = getBody();
|
Area mainArea = getBody();
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
|
|||||||
Reference in New Issue
Block a user