mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
added capacitor symbol
This commit is contained in:
Binary file not shown.
+2
-2
@@ -119,8 +119,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
(int) ((shapeRect.width + distance) / 2 - leadLenght) + leadThickness / 2,
|
(int) ((shapeRect.width + distance) / 2 - leadLenght) + leadThickness / 2,
|
||||||
(int) shapeRect.height / 2);
|
(int) shapeRect.height / 2);
|
||||||
}
|
}
|
||||||
// Do not track the label because that area was already covered.
|
// Do not track the label because that area was already covered.
|
||||||
drawingObserver.stopTracking();
|
// drawingObserver.stopTracking();
|
||||||
// Draw label.
|
// Draw label.
|
||||||
g2d.setFont(LABEL_FONT);
|
g2d.setFont(LABEL_FONT);
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
g2d.setColor(componentState == ComponentState.SELECTED
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ import org.diylc.components.connectivity.HookupWire;
|
|||||||
import org.diylc.components.connectivity.Jumper;
|
import org.diylc.components.connectivity.Jumper;
|
||||||
import org.diylc.components.connectivity.SolderPad;
|
import org.diylc.components.connectivity.SolderPad;
|
||||||
import org.diylc.components.misc.Label;
|
import org.diylc.components.misc.Label;
|
||||||
import org.diylc.components.passive.ElectrolyticRadial;
|
import org.diylc.components.passive.RadialElectrolytic;
|
||||||
import org.diylc.components.passive.RadialFilmCapacitor;
|
import org.diylc.components.passive.RadialFilmCapacitor;
|
||||||
import org.diylc.components.passive.Resistor;
|
import org.diylc.components.passive.Resistor;
|
||||||
import org.diylc.components.semiconductors.DIL_IC;
|
import org.diylc.components.semiconductors.DIL_IC;
|
||||||
@@ -293,7 +293,7 @@ public class ProjectFileManager {
|
|||||||
component = capacitor;
|
component = capacitor;
|
||||||
} else if (nodeName.equalsIgnoreCase("electrolyte")) {
|
} else if (nodeName.equalsIgnoreCase("electrolyte")) {
|
||||||
LOG.debug("Recognized " + nodeName);
|
LOG.debug("Recognized " + nodeName);
|
||||||
ElectrolyticRadial capacitor = new ElectrolyticRadial();
|
RadialElectrolytic capacitor = new RadialElectrolytic();
|
||||||
capacitor.setName(nameAttr);
|
capacitor.setName(nameAttr);
|
||||||
try {
|
try {
|
||||||
capacitor.setValue(Capacitance.parseCapacitance(valueAttr));
|
capacitor.setValue(Capacitance.parseCapacitance(valueAttr));
|
||||||
|
|||||||
@@ -163,6 +163,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added resistor schematic symbol</description>
|
<description>Added resistor schematic symbol</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added capacitor schematic symbol</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>
|
||||||
|
|||||||
@@ -46,6 +46,9 @@
|
|||||||
|
|
||||||
<target name="jar" depends="clean, lib.copy, resource.copy, compile">
|
<target name="jar" depends="clean, lib.copy, resource.copy, compile">
|
||||||
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}" />
|
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}" />
|
||||||
|
<copy todir="../DIYLC/library" overwrite="true">
|
||||||
|
<fileset dir="${jar.dir}" includes="${ant.project.name}.jar" />
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="javadoc">
|
<target name="javadoc">
|
||||||
|
|||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
package org.diylc.components.passive;
|
||||||
|
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.GeneralPath;
|
||||||
|
|
||||||
|
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
import org.diylc.core.measures.Capacitance;
|
||||||
|
import org.diylc.core.measures.CapacitanceUnit;
|
||||||
|
import org.diylc.core.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
|
@ComponentDescriptor(name = "Capacitor (schematic symbol)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "", zOrder = IDIYComponent.COMPONENT)
|
||||||
|
public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static Size DEFAULT_LENGTH = new Size(0.05, SizeUnit.in);
|
||||||
|
public static Size DEFAULT_WIDTH = new Size(0.15, SizeUnit.in);
|
||||||
|
|
||||||
|
private Capacitance value = new Capacitance(22d, CapacitanceUnit.nF);
|
||||||
|
private Voltage voltage = Voltage._63V;
|
||||||
|
private boolean polarized = false;
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Capacitance getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Capacitance value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Voltage getVoltage() {
|
||||||
|
return voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoltage(Voltage voltage) {
|
||||||
|
this.voltage = voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public boolean getPolarized() {
|
||||||
|
return polarized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolarized(boolean polarized) {
|
||||||
|
this.polarized = polarized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
g2d.rotate(-Math.PI / 4, width / 2, height / 2);
|
||||||
|
g2d.setColor(LEAD_COLOR);
|
||||||
|
g2d.drawLine(0, height / 2, 13, height / 2);
|
||||||
|
g2d.drawLine(width - 13, height / 2, width, height / 2);
|
||||||
|
g2d.setColor(COLOR);
|
||||||
|
g2d.drawLine(14, height / 2 - 6, 14, height / 2 + 6);
|
||||||
|
g2d.drawLine(width - 14, height / 2 - 6, width - 14, height / 2 + 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Size getDefaultWidth() {
|
||||||
|
return DEFAULT_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Size getDefaultLength() {
|
||||||
|
return DEFAULT_LENGTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Shape getBodyShape() {
|
||||||
|
GeneralPath polyline = new GeneralPath();
|
||||||
|
double length = getLength().convertToPixels();
|
||||||
|
double width = getWidth().convertToPixels();
|
||||||
|
polyline.moveTo(0, 0);
|
||||||
|
polyline.lineTo(0, width);
|
||||||
|
polyline.moveTo(length, 0);
|
||||||
|
polyline.lineTo(length, width);
|
||||||
|
return polyline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void decorateComponentBody(Graphics2D g2d) {
|
||||||
|
if (polarized) {
|
||||||
|
// Draw + sign.
|
||||||
|
g2d.setColor(getBorderColor());
|
||||||
|
int plusSize = getClosestOdd(getWidth().convertToPixels() / 4);
|
||||||
|
int x = -plusSize;
|
||||||
|
int y = plusSize;
|
||||||
|
g2d.drawLine(x - plusSize / 2, y, x + plusSize / 2, y);
|
||||||
|
g2d.drawLine(x, y - plusSize / 2, x, y + plusSize / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -50,7 +50,7 @@ public class RadialElectrolytic extends AbstractLeadedComponent<Capacitance> {
|
|||||||
public void setValue(Capacitance value) {
|
public void setValue(Capacitance value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Voltage getVoltage() {
|
public Voltage getVoltage() {
|
||||||
return voltage;
|
return voltage;
|
||||||
@@ -60,7 +60,6 @@ public class RadialElectrolytic extends AbstractLeadedComponent<Capacitance> {
|
|||||||
this.voltage = voltage;
|
this.voltage = voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
g2d.setColor(BODY_COLOR);
|
g2d.setColor(BODY_COLOR);
|
||||||
int margin = 3;
|
int margin = 3;
|
||||||
|
|||||||
Reference in New Issue
Block a user