Ability to rotate selection

This commit is contained in:
bancika
2013-04-25 14:36:50 +00:00
parent 18edd60763
commit 6ef5ad5854
9 changed files with 24 additions and 20 deletions
@@ -28,7 +28,7 @@ import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Plastic DC Jack", category = "Electromechanical", author = "Branislav Stojkovic", description = "Panel mount plastic DC jack", stretchable = false, zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false)
@ComponentDescriptor(name = "Plastic DC Jack", category = "Electromechanical", author = "Branislav Stojkovic", description = "Panel mount plastic DC jack", stretchable = false, zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, rotatable = false)
public class PlasticDCJack extends AbstractTransparentComponent<String> {
private static final long serialVersionUID = 1L;
@@ -12,7 +12,7 @@ import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@ComponentDescriptor(name = "BJT Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "Bipolar junction transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "BJT Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "Bipolar junction transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class BJTSymbol extends AbstractTransistorSymbol {
private static final long serialVersionUID = 1L;
@@ -49,19 +49,22 @@ public class BJTSymbol extends AbstractTransistorSymbol {
double theta;
if (polarity == BJTPolarity.NPN) {
theta = Math.atan(1.0 / 3);
arrow = new Area(new Polygon(new int[] { x + pinSpacing, x + pinSpacing,
x + pinSpacing * 10 / 6 }, new int[] { y - pinSpacing / 5 + pinSpacing / 2,
y + pinSpacing / 5 + pinSpacing / 2, y + pinSpacing / 2 }, 3));
arrow.transform(AffineTransform.getRotateInstance(theta, x + pinSpacing / 2, y
+ pinSpacing / 2));
arrow = new Area(new Polygon(new int[] { x + pinSpacing,
x + pinSpacing, x + pinSpacing * 10 / 6 },
new int[] { y - pinSpacing / 5 + pinSpacing / 2,
y + pinSpacing / 5 + pinSpacing / 2,
y + pinSpacing / 2 }, 3));
arrow.transform(AffineTransform.getRotateInstance(theta, x
+ pinSpacing / 2, y + pinSpacing / 2));
} else {
theta = -Math.atan(1.0 / 3);
arrow = new Area(new Polygon(new int[] { x + pinSpacing, x + pinSpacing * 10 / 6,
x + pinSpacing * 10 / 6 }, new int[] { y - pinSpacing / 2,
y - pinSpacing / 5 - pinSpacing / 2, y + pinSpacing / 5 - pinSpacing / 2 },
3));
arrow.transform(AffineTransform.getRotateInstance(theta, x + pinSpacing / 2, y
- pinSpacing / 2));
arrow = new Area(new Polygon(new int[] { x + pinSpacing,
x + pinSpacing * 10 / 6, x + pinSpacing * 10 / 6 },
new int[] { y - pinSpacing / 2,
y - pinSpacing / 5 - pinSpacing / 2,
y + pinSpacing / 5 - pinSpacing / 2 }, 3));
arrow.transform(AffineTransform.getRotateInstance(theta, x
+ pinSpacing / 2, y - pinSpacing / 2));
}
body[2] = arrow;
}
@@ -82,7 +85,8 @@ public class BJTSymbol extends AbstractTransistorSymbol {
g2d.drawLine(width / 3, height / 3 + 1, width * 3 / 4, height / 4);
g2d.drawLine(width * 3 / 4, height - 1, width * 3 / 4, height * 3 / 4);
g2d.drawLine(width / 3, height * 2 / 3 - 1, width * 3 / 4, height * 3 / 4);
g2d.drawLine(width / 3, height * 2 / 3 - 1, width * 3 / 4,
height * 3 / 4);
}
@EditableProperty(name = "Polarity")
@@ -30,7 +30,7 @@ import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "IC Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "IC", description = "IC symbol with 3 or 5 contacts", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "IC Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "IC", description = "IC symbol with 3 or 5 contacts", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class ICSymbol extends AbstractTransparentComponent<String> {
private static final long serialVersionUID = 1L;
@@ -10,7 +10,7 @@ import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@ComponentDescriptor(name = "JFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "JFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class JFETSymbol extends AbstractTransistorSymbol {
private static final long serialVersionUID = 1L;
@@ -10,7 +10,7 @@ import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class MOSFETSymbol extends AbstractTransistorSymbol {
private static final long serialVersionUID = 1L;
@@ -14,7 +14,7 @@ import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@ComponentDescriptor(name = "Diode Symbol", author = "Branislav Stojkovic", category = "Tubes", instanceNamePrefix = "V", description = "Diode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "Diode Symbol", author = "Branislav Stojkovic", category = "Tubes", instanceNamePrefix = "V", description = "Diode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class DiodeSymbol extends AbstractTubeSymbol {
private static final long serialVersionUID = 1L;
@@ -13,7 +13,7 @@ import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@ComponentDescriptor(name = "Pentode Symbol", author = "Branislav Stojkovic", category = "Tubes", instanceNamePrefix = "V", description = "Pentode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "Pentode Symbol", author = "Branislav Stojkovic", category = "Tubes", instanceNamePrefix = "V", description = "Pentode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class PentodeSymbol extends AbstractTubeSymbol {
private static final long serialVersionUID = 1L;
@@ -13,7 +13,7 @@ import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@ComponentDescriptor(name = "Triode Symbol", author = "Branislav Stojkovic", category = "Tubes", instanceNamePrefix = "V", description = "Triode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
@ComponentDescriptor(name = "Triode Symbol", author = "Branislav Stojkovic", category = "Tubes", instanceNamePrefix = "V", description = "Triode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
public class TriodeSymbol extends AbstractTubeSymbol {
private static final long serialVersionUID = 1L;