mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
added eyelet/turret
This commit is contained in:
Binary file not shown.
@@ -175,6 +175,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added capacitor schematic symbol</description>
|
<description>Added capacitor schematic symbol</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added eyelet/turret component</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>
|
||||||
|
|||||||
+3
-3
@@ -22,9 +22,9 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
|
|
||||||
public static Color EYELET_COLOR = Color.decode("#C3E4ED");
|
public static Color EYELET_COLOR = Color.decode("#C3E4ED");
|
||||||
|
|
||||||
public static Size SPACING = new Size(0.3d, SizeUnit.in);
|
public static Size SPACING = new Size(0.5d, SizeUnit.in);
|
||||||
public static Size EYELET_SIZE = new Size(1/8d, SizeUnit.in);
|
public static Size EYELET_SIZE = new Size(0.2d, SizeUnit.in);
|
||||||
public static Size HOLE_SIZE = new Size(2d, SizeUnit.mm);
|
public static Size HOLE_SIZE = new Size(0.1d, SizeUnit.in);
|
||||||
|
|
||||||
// private Area copperArea;
|
// private Area copperArea;
|
||||||
protected Size spacing = SPACING;
|
protected Size spacing = SPACING;
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
package org.diylc.components.connectivity;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import org.diylc.components.AbstractComponent;
|
||||||
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.IDrawingObserver;
|
||||||
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.VisibilityPolicy;
|
||||||
|
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 = "Eyelet", category = "Connectivity", author = "Branislav Stojkovic", description = "Eyelet or turret terminal", instanceNamePrefix = "Eyelet", stretchable = false, zOrder = IDIYComponent.TRACE + 0.1)
|
||||||
|
public class Eyelet extends AbstractComponent<String> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static Size SIZE = new Size(0.2d, SizeUnit.in);
|
||||||
|
public static Size HOLE_SIZE = new Size(0.1d, SizeUnit.in);
|
||||||
|
public static Color COLOR = Color.decode("#C3E4ED");
|
||||||
|
|
||||||
|
private Size size = SIZE;
|
||||||
|
private Size holeSize = HOLE_SIZE;
|
||||||
|
private Color color = COLOR;
|
||||||
|
private Point point = new Point(0, 0);
|
||||||
|
private String value = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
|
IDrawingObserver drawingObserver) {
|
||||||
|
int diameter = getClosestOdd(size.convertToPixels());
|
||||||
|
int holeDiameter = getClosestOdd(holeSize.convertToPixels());
|
||||||
|
g2d.setColor(color);
|
||||||
|
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||||
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker());
|
||||||
|
g2d.drawOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||||
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
|
g2d.fillOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
|
||||||
|
holeDiameter);
|
||||||
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker());
|
||||||
|
g2d.drawOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
|
||||||
|
holeDiameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
int diameter = getClosestOdd(width / 2);
|
||||||
|
int holeDiameter = 5;
|
||||||
|
g2d.setColor(COLOR);
|
||||||
|
g2d.fillOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
|
||||||
|
g2d.setColor(COLOR.darker());
|
||||||
|
g2d.drawOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
|
||||||
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
|
g2d.fillOval((width - holeDiameter) / 2, (height - holeDiameter) / 2, holeDiameter,
|
||||||
|
holeDiameter);
|
||||||
|
g2d.setColor(COLOR.darker());
|
||||||
|
g2d.drawOval((width - holeDiameter) / 2, (height - holeDiameter) / 2, holeDiameter,
|
||||||
|
holeDiameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Size getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(Size size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Hole size")
|
||||||
|
public Size getHoleSize() {
|
||||||
|
return holeSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHoleSize(Size holeSize) {
|
||||||
|
this.holeSize = holeSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return super.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getControlPointCount() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isControlPointSticky(int index) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
|
return VisibilityPolicy.NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point getControlPoint(int index) {
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setControlPoint(Point point, int index) {
|
||||||
|
this.point.setLocation(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Color")
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(Color color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@EditableProperty
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user