mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
transformers for to92, dilIC and pot.
This commit is contained in:
@@ -16,6 +16,11 @@ public class DefaultTransformer implements IComponentTransformer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mirroringChangesCircuit() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ public interface IComponentTransformer {
|
|||||||
|
|
||||||
boolean canMirror(IDIYComponent<?> component);
|
boolean canMirror(IDIYComponent<?> component);
|
||||||
|
|
||||||
|
boolean mirroringChangesCircuit();
|
||||||
|
|
||||||
void rotate(IDIYComponent<?> component, Point center, int direction);
|
void rotate(IDIYComponent<?> component, Point center, int direction);
|
||||||
|
|
||||||
void mirror(IDIYComponent<?> component, Point center, int direction);
|
void mirror(IDIYComponent<?> component, Point center, int direction);
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public class SimpleComponentTransformer implements IComponentTransformer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mirroringChangesCircuit() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
||||||
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.x, center.y);
|
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.x, center.y);
|
||||||
|
|||||||
@@ -1185,6 +1185,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
Point center = getCenterOf(components, snapToGrid);
|
Point center = getCenterOf(components, snapToGrid);
|
||||||
|
|
||||||
boolean canMirror = true;
|
boolean canMirror = true;
|
||||||
|
boolean changesCircuit = false;
|
||||||
for (IDIYComponent<?> component : components) {
|
for (IDIYComponent<?> component : components) {
|
||||||
ComponentType type =
|
ComponentType type =
|
||||||
ComponentProcessor.getInstance().extractComponentTypeFrom(
|
ComponentProcessor.getInstance().extractComponentTypeFrom(
|
||||||
@@ -1193,6 +1194,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
canMirror = false;
|
canMirror = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (type.getTransformer() != null && type.getTransformer().mirroringChangesCircuit())
|
||||||
|
changesCircuit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canMirror)
|
if (!canMirror)
|
||||||
@@ -1200,18 +1203,21 @@ public class Presenter implements IPlugInPort {
|
|||||||
"Mirror Selection", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE) != IView.YES_OPTION)
|
"Mirror Selection", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE) != IView.YES_OPTION)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (changesCircuit)
|
||||||
|
if (view.showConfirmDialog("Mirroring operation will change the circuit. Do you want to continue?",
|
||||||
|
"Mirror Selection", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE) != IView.YES_OPTION)
|
||||||
|
return;
|
||||||
|
|
||||||
for (IDIYComponent<?> component : components) {
|
for (IDIYComponent<?> component : components) {
|
||||||
ComponentType type =
|
ComponentType type =
|
||||||
ComponentProcessor.getInstance().extractComponentTypeFrom(
|
ComponentProcessor.getInstance().extractComponentTypeFrom(
|
||||||
(Class<? extends IDIYComponent<?>>) component.getClass());
|
(Class<? extends IDIYComponent<?>>) component.getClass());
|
||||||
if (type.isStretchable() || component.getControlPointCount() == 1) {
|
|
||||||
drawingManager.invalidateComponent(component);
|
drawingManager.invalidateComponent(component);
|
||||||
if (type.getTransformer() != null && type.getTransformer().canMirror(component)) {
|
if (type.getTransformer() != null && type.getTransformer().canMirror(component)) {
|
||||||
type.getTransformer().mirror(component, center, direction);
|
type.getTransformer().mirror(component, center, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private Point getCenterOf(Collection<IDIYComponent<?>> components, boolean snapToGrid) {
|
private Point getCenterOf(Collection<IDIYComponent<?>> components, boolean snapToGrid) {
|
||||||
// Determine center of rotation
|
// Determine center of rotation
|
||||||
|
|||||||
Binary file not shown.
@@ -14,6 +14,7 @@ import org.diylc.appframework.miscutils.ConfigurationManager;
|
|||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.components.transform.PotentiometerTransformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
@@ -28,7 +29,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Potentiometer (panel mount)", author = "Branislav Stojkovic", category = "Passive",
|
@ComponentDescriptor(name = "Potentiometer (panel mount)", author = "Branislav Stojkovic", category = "Passive",
|
||||||
creationMethod = CreationMethod.SINGLE_CLICK, instanceNamePrefix = "VR",
|
creationMethod = CreationMethod.SINGLE_CLICK, instanceNamePrefix = "VR",
|
||||||
description = "Panel mount potentiometer with solder lugs", zOrder = IDIYComponent.COMPONENT, stretchable = false)
|
description = "Panel mount potentiometer with solder lugs", zOrder = IDIYComponent.COMPONENT, stretchable = false,
|
||||||
|
transformer = PotentiometerTransformer.class)
|
||||||
public class PotentiometerPanel extends AbstractPotentiometer {
|
public class PotentiometerPanel extends AbstractPotentiometer {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
import org.diylc.components.misc.Label;
|
import org.diylc.components.misc.Label;
|
||||||
|
import org.diylc.components.transform.ICTransformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
@@ -34,7 +35,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "DIP IC", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "DIP IC", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "IC", description = "Dual-in-line package IC", stretchable = false,
|
instanceNamePrefix = "IC", description = "Dual-in-line package IC", stretchable = false,
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = ICTransformer.class)
|
||||||
public class DIL_IC extends AbstractTransparentComponent<String> {
|
public class DIL_IC extends AbstractTransparentComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.diylc.common.IPlugInPort;
|
|||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
|
import org.diylc.components.transform.TO92Transformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
@@ -33,7 +34,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Transistor (TO-92 package)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Transistor (TO-92 package)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "Q", description = "Transistor with small plastic or epoxy body", stretchable = false,
|
instanceNamePrefix = "Q", description = "Transistor with small plastic or epoxy body", stretchable = false,
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO92Transformer.class)
|
||||||
public class TransistorTO92 extends AbstractTransparentComponent<String> {
|
public class TransistorTO92 extends AbstractTransparentComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package org.diylc.components.transform;
|
||||||
|
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
|
||||||
|
import org.diylc.common.IComponentTransformer;
|
||||||
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.components.semiconductors.DIL_IC;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
|
public class ICTransformer implements IComponentTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRotate(IDIYComponent<?> component) {
|
||||||
|
return component.getClass().equals(DIL_IC.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canMirror(IDIYComponent<?> component) {
|
||||||
|
return component.getClass().equals(DIL_IC.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mirroringChangesCircuit() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
||||||
|
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.x, center.y);
|
||||||
|
for (int index = 0; index < component.getControlPointCount(); index++) {
|
||||||
|
Point p = new Point(component.getControlPoint(index));
|
||||||
|
rotate.transform(p, p);
|
||||||
|
component.setControlPoint(p, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
DIL_IC ic = (DIL_IC) component;
|
||||||
|
Orientation o = ic.getOrientation();
|
||||||
|
int oValue = o.ordinal();
|
||||||
|
oValue += direction;
|
||||||
|
if (oValue < 0)
|
||||||
|
oValue = Orientation.values().length - 1;
|
||||||
|
if (oValue >= Orientation.values().length)
|
||||||
|
oValue = 0;
|
||||||
|
o = Orientation.values()[oValue];
|
||||||
|
ic.setOrientation(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mirror(IDIYComponent<?> component, Point center, int direction) {
|
||||||
|
DIL_IC ic = (DIL_IC) component;
|
||||||
|
|
||||||
|
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||||
|
int dx = 2 * (center.x - ic.getControlPoint(1).x);
|
||||||
|
int dy = 0;
|
||||||
|
Orientation o = ic.getOrientation();
|
||||||
|
switch (o) {
|
||||||
|
case DEFAULT:
|
||||||
|
dx += ic.getControlPoint(0).x - ic.getControlPoint(ic.getControlPointCount() - 1).x;
|
||||||
|
break;
|
||||||
|
case _90:
|
||||||
|
o = Orientation._270;
|
||||||
|
dx -= 2 * (ic.getControlPoint(0).x - ic.getControlPoint(1).x);
|
||||||
|
dy -= ic.getControlPoint(0).y - ic.getControlPoint(ic.getControlPointCount() - 1).y;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
dx += ic.getControlPoint(0).x - ic.getControlPoint(ic.getControlPointCount() - 1).x;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
dx -= 2 * (ic.getControlPoint(0).x - ic.getControlPoint(1).x);
|
||||||
|
dy -= ic.getControlPoint(0).y - ic.getControlPoint(ic.getControlPointCount() - 1).y;
|
||||||
|
o = Orientation._90;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < ic.getControlPointCount(); i++) {
|
||||||
|
Point p = ic.getControlPoint(i);
|
||||||
|
ic.setControlPoint(new Point(p.x + dx, p.y + dy), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
ic.setOrientation(o);
|
||||||
|
} else {
|
||||||
|
int dx = 0;
|
||||||
|
int dy = 2 * (center.y - ic.getControlPoint(1).y);
|
||||||
|
Orientation o = ic.getOrientation();
|
||||||
|
switch (o) {
|
||||||
|
case DEFAULT:
|
||||||
|
dx -= ic.getControlPoint(0).x - ic.getControlPoint(ic.getControlPointCount() - 1).x;
|
||||||
|
dy -= 2 * (ic.getControlPoint(0).y - ic.getControlPoint(1).y);
|
||||||
|
o = Orientation._180;
|
||||||
|
break;
|
||||||
|
case _90:
|
||||||
|
dy += ic.getControlPoint(0).y - ic.getControlPoint(ic.getControlPointCount() - 1).y;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
dx -= ic.getControlPoint(0).x - ic.getControlPoint(ic.getControlPointCount() - 1).x;
|
||||||
|
dy -= 2 * (ic.getControlPoint(0).y - ic.getControlPoint(1).y);
|
||||||
|
o = Orientation.DEFAULT;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
dy += ic.getControlPoint(0).y - ic.getControlPoint(ic.getControlPointCount() - 1).y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < ic.getControlPointCount(); i++) {
|
||||||
|
Point p = ic.getControlPoint(i);
|
||||||
|
ic.setControlPoint(new Point(p.x + dx, p.y + dy), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
ic.setOrientation(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package org.diylc.components.transform;
|
||||||
|
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
|
||||||
|
import org.diylc.common.IComponentTransformer;
|
||||||
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.components.passive.PotentiometerPanel;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
|
public class PotentiometerTransformer implements IComponentTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRotate(IDIYComponent<?> component) {
|
||||||
|
return component.getClass().equals(PotentiometerPanel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canMirror(IDIYComponent<?> component) {
|
||||||
|
return component.getClass().equals(PotentiometerPanel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mirroringChangesCircuit() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
||||||
|
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.x, center.y);
|
||||||
|
for (int index = 0; index < component.getControlPointCount(); index++) {
|
||||||
|
Point p = new Point(component.getControlPoint(index));
|
||||||
|
rotate.transform(p, p);
|
||||||
|
component.setControlPoint(p, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
PotentiometerPanel potentiometer = (PotentiometerPanel) component;
|
||||||
|
Orientation o = potentiometer.getOrientation();
|
||||||
|
int oValue = o.ordinal();
|
||||||
|
oValue += direction;
|
||||||
|
if (oValue < 0)
|
||||||
|
oValue = Orientation.values().length - 1;
|
||||||
|
if (oValue >= Orientation.values().length)
|
||||||
|
oValue = 0;
|
||||||
|
o = Orientation.values()[oValue];
|
||||||
|
potentiometer.setOrientation(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("incomplete-switch")
|
||||||
|
@Override
|
||||||
|
public void mirror(IDIYComponent<?> component, Point center, int direction) {
|
||||||
|
PotentiometerPanel potentiometer = (PotentiometerPanel) component;
|
||||||
|
int dx = center.x - potentiometer.getControlPoint(1).x;
|
||||||
|
int dy = center.y - potentiometer.getControlPoint(1).y;
|
||||||
|
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||||
|
Orientation o = potentiometer.getOrientation();
|
||||||
|
switch (o) {
|
||||||
|
case _90:
|
||||||
|
o = Orientation._270;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
o = Orientation._90;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < potentiometer.getControlPointCount(); i++) {
|
||||||
|
Point p = potentiometer.getControlPoint(i);
|
||||||
|
potentiometer
|
||||||
|
.setControlPoint(
|
||||||
|
new Point(p.x + 2 * dx, p.y + (potentiometer.getControlPoint(2).y - potentiometer.getControlPoint(0).y)),
|
||||||
|
i);
|
||||||
|
}
|
||||||
|
|
||||||
|
potentiometer.setOrientation(o);
|
||||||
|
} else {
|
||||||
|
Orientation o = potentiometer.getOrientation();
|
||||||
|
switch (o) {
|
||||||
|
case DEFAULT:
|
||||||
|
o = Orientation._180;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
o = Orientation.DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < potentiometer.getControlPointCount(); i++) {
|
||||||
|
Point p = potentiometer.getControlPoint(i);
|
||||||
|
potentiometer
|
||||||
|
.setControlPoint(new Point(p.x + (potentiometer.getControlPoint(2).x - potentiometer.getControlPoint(0).x),
|
||||||
|
p.y + 2 * dy), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
potentiometer.setOrientation(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package org.diylc.components.transform;
|
||||||
|
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
|
||||||
|
import org.diylc.common.IComponentTransformer;
|
||||||
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.components.semiconductors.TransistorTO92;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
|
public class TO92Transformer implements IComponentTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRotate(IDIYComponent<?> component) {
|
||||||
|
return component.getClass().equals(TransistorTO92.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canMirror(IDIYComponent<?> component) {
|
||||||
|
return component.getClass().equals(TransistorTO92.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mirroringChangesCircuit() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(IDIYComponent<?> component, Point center, int direction) {
|
||||||
|
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.x, center.y);
|
||||||
|
for (int index = 0; index < component.getControlPointCount(); index++) {
|
||||||
|
Point p = new Point(component.getControlPoint(index));
|
||||||
|
rotate.transform(p, p);
|
||||||
|
component.setControlPoint(p, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
TransistorTO92 transistor = (TransistorTO92) component;
|
||||||
|
Orientation o = transistor.getOrientation();
|
||||||
|
int oValue = o.ordinal();
|
||||||
|
oValue += direction;
|
||||||
|
if (oValue < 0)
|
||||||
|
oValue = Orientation.values().length - 1;
|
||||||
|
if (oValue >= Orientation.values().length)
|
||||||
|
oValue = 0;
|
||||||
|
o = Orientation.values()[oValue];
|
||||||
|
transistor.setOrientation(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("incomplete-switch")
|
||||||
|
@Override
|
||||||
|
public void mirror(IDIYComponent<?> component, Point center, int direction) {
|
||||||
|
TransistorTO92 transistor = (TransistorTO92) component;
|
||||||
|
int dx = center.x - transistor.getControlPoint(1).x;
|
||||||
|
int dy = center.y - transistor.getControlPoint(1).y;
|
||||||
|
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||||
|
Orientation o = transistor.getOrientation();
|
||||||
|
switch (o) {
|
||||||
|
case DEFAULT:
|
||||||
|
o = Orientation._180;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
o = Orientation.DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < transistor.getControlPointCount(); i++) {
|
||||||
|
Point p = transistor.getControlPoint(i);
|
||||||
|
transistor.setControlPoint(
|
||||||
|
new Point(p.x + 2 * dx, p.y + (transistor.getControlPoint(2).y - transistor.getControlPoint(0).y)), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
transistor.setOrientation(o);
|
||||||
|
} else {
|
||||||
|
Orientation o = transistor.getOrientation();
|
||||||
|
switch (o) {
|
||||||
|
case _90:
|
||||||
|
o = Orientation._270;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
o = Orientation._90;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < transistor.getControlPointCount(); i++) {
|
||||||
|
Point p = transistor.getControlPoint(i);
|
||||||
|
transistor.setControlPoint(new Point(p.x + (transistor.getControlPoint(2).x - transistor.getControlPoint(0).x),
|
||||||
|
p.y + 2 * dy), i);
|
||||||
|
}
|
||||||
|
|
||||||
|
transistor.setOrientation(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<listEntry value="1"/>
|
<listEntry value="1"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;Library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;DIYLC&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;Library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;DIYLC&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-core&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45"/>
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -33,7 +33,6 @@ import org.diylc.common.EventType;
|
|||||||
import org.diylc.common.IComponentTransformer;
|
import org.diylc.common.IComponentTransformer;
|
||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ISelectionProcessor;
|
|
||||||
import org.diylc.core.ExpansionMode;
|
import org.diylc.core.ExpansionMode;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Template;
|
import org.diylc.core.Template;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import javax.swing.JScrollPane;
|
|||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.diylc.common.ITask;
|
import org.diylc.common.ITask;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.plugins.cloud.model.CommentEntity;
|
import org.diylc.plugins.cloud.model.CommentEntity;
|
||||||
@@ -38,8 +37,6 @@ public class CommentDialog extends JDialog {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(CommentDialog.class);
|
|
||||||
|
|
||||||
private ProjectEntity project;
|
private ProjectEntity project;
|
||||||
private List<CommentEntity> comments;
|
private List<CommentEntity> comments;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user