mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
added point by point component creation
This commit is contained in:
@@ -1,2 +1,6 @@
|
|||||||
<map>
|
<map>
|
||||||
|
<entry>
|
||||||
|
<string>lastPath</string>
|
||||||
|
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
||||||
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
Binary file not shown.
+13
-7
@@ -2,6 +2,7 @@ package org.diylc.common;
|
|||||||
|
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,27 +12,29 @@ import org.diylc.core.IDIYComponent;
|
|||||||
*
|
*
|
||||||
* @see IDIYComponent
|
* @see IDIYComponent
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public class ComponentType {
|
public class ComponentType {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
private CreationMethod creationMethod;
|
||||||
private String category;
|
private String category;
|
||||||
private String namePrefix;
|
private String namePrefix;
|
||||||
private String author;
|
private String author;
|
||||||
private Icon icon;
|
private Icon icon;
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Class<? extends IDIYComponent> instanceClass;
|
private Class<? extends IDIYComponent> instanceClass;
|
||||||
private double zOrder;
|
private double zOrder;
|
||||||
private boolean stretchable;
|
private boolean stretchable;
|
||||||
private boolean sticky;
|
private boolean sticky;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
public ComponentType(String name, String description, CreationMethod creationMethod,
|
||||||
public ComponentType(String name, String description, String category, String namePrefix,
|
String category, String namePrefix, String author, Icon icon,
|
||||||
String author, Icon icon, Class<? extends IDIYComponent> instanceClass,
|
Class<? extends IDIYComponent> instanceClass, double zOrder, boolean stretchable,
|
||||||
double zOrder, boolean stretchable, boolean sticky) {
|
boolean sticky) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.creationMethod = creationMethod;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.namePrefix = namePrefix;
|
this.namePrefix = namePrefix;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
@@ -50,6 +53,10 @@ public class ComponentType {
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CreationMethod getCreationMethod() {
|
||||||
|
return creationMethod;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCategory() {
|
public String getCategory() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
@@ -66,7 +73,6 @@ public class ComponentType {
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Class<? extends IDIYComponent> getInstanceClass() {
|
public Class<? extends IDIYComponent> getInstanceClass() {
|
||||||
return instanceClass;
|
return instanceClass;
|
||||||
}
|
}
|
||||||
@@ -78,7 +84,7 @@ public class ComponentType {
|
|||||||
public boolean isStretchable() {
|
public boolean isStretchable() {
|
||||||
return stretchable;
|
return stretchable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSticky() {
|
public boolean isSticky() {
|
||||||
return sticky;
|
return sticky;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-7
@@ -31,10 +31,10 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color LEAD_COLOR = Color.black;
|
public static Color LEAD_COLOR = Color.decode("#65909A");
|
||||||
public static Color LABEL_COLOR = Color.black;
|
public static Color LABEL_COLOR = Color.black;
|
||||||
public static Color LABEL_COLOR_SELECTED = Color.red;
|
public static Color LABEL_COLOR_SELECTED = Color.red;
|
||||||
public static Size LEAD_THICKNESS = new Size(0.3d, SizeUnit.mm);
|
public static Size LEAD_THICKNESS = new Size(0.8d, SizeUnit.mm);
|
||||||
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
|
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
|
||||||
|
|
||||||
protected Size width;
|
protected Size width;
|
||||||
@@ -91,12 +91,15 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
||||||
g2d.draw(shape);
|
g2d.draw(shape);
|
||||||
// Draw leads.
|
// Draw leads.
|
||||||
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
|
int leadThickness = getLeadThickness().convertToPixels();
|
||||||
|
g2d.setStroke(new BasicStroke(leadThickness));
|
||||||
g2d.setColor(getLeadColor(componentState));
|
g2d.setColor(getLeadColor(componentState));
|
||||||
g2d.drawLine((int) (shapeRect.width - distance) / 2, (int) shapeRect.height / 2,
|
g2d.drawLine((int) (shapeRect.width - distance) / 2, (int) shapeRect.height / 2,
|
||||||
(int) ((shapeRect.width - distance) / 2 + leadLenght), (int) shapeRect.height / 2);
|
(int) ((shapeRect.width - distance) / 2 + leadLenght) - leadThickness / 2,
|
||||||
|
(int) shapeRect.height / 2);
|
||||||
g2d.drawLine((int) (shapeRect.width + distance) / 2, (int) shapeRect.height / 2,
|
g2d.drawLine((int) (shapeRect.width + distance) / 2, (int) shapeRect.height / 2,
|
||||||
(int) ((shapeRect.width + distance) / 2 - leadLenght), (int) shapeRect.height / 2);
|
(int) ((shapeRect.width + distance) / 2 - leadLenght) + leadThickness / 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.
|
||||||
@@ -204,12 +207,12 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
public void setHeight(Size height) {
|
public void setHeight(Size height) {
|
||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Display getDisplay() {
|
public Display getDisplay() {
|
||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplay(Display display) {
|
public void setDisplay(Display display) {
|
||||||
this.display = display;
|
this.display = display;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package org.diylc.core;
|
||||||
|
|
||||||
|
public enum CreationMethod {
|
||||||
|
|
||||||
|
SINGLE_CLICK, POINT_BY_POINT;
|
||||||
|
}
|
||||||
+8
@@ -3,6 +3,7 @@ package org.diylc.core.annotations;
|
|||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,6 +25,13 @@ public @interface ComponentDescriptor {
|
|||||||
*/
|
*/
|
||||||
String description();
|
String description();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return method that should be used to create a component. If
|
||||||
|
* <code>CreationMethod.POINT_BY_POINT</code> is used, user will
|
||||||
|
* have to select ending points before the component is created.
|
||||||
|
*/
|
||||||
|
CreationMethod creationMethod() default CreationMethod.SINGLE_CLICK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return component category, e.g. "Passive", "Semiconductors", etc.
|
* @return component category, e.g. "Passive", "Semiconductors", etc.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
-5
@@ -17,6 +17,7 @@ import javax.swing.ImageIcon;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.ComponentType;
|
import org.diylc.common.ComponentType;
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -54,6 +55,7 @@ public class ComponentProcessor {
|
|||||||
public ComponentType createComponentTypeFrom(Class<? extends IDIYComponent<?>> clazz) {
|
public ComponentType createComponentTypeFrom(Class<? extends IDIYComponent<?>> clazz) {
|
||||||
String name;
|
String name;
|
||||||
String description;
|
String description;
|
||||||
|
CreationMethod creationMethod;
|
||||||
String category;
|
String category;
|
||||||
String namePrefix;
|
String namePrefix;
|
||||||
String author;
|
String author;
|
||||||
@@ -65,6 +67,7 @@ public class ComponentProcessor {
|
|||||||
ComponentDescriptor annotation = clazz.getAnnotation(ComponentDescriptor.class);
|
ComponentDescriptor annotation = clazz.getAnnotation(ComponentDescriptor.class);
|
||||||
name = annotation.name();
|
name = annotation.name();
|
||||||
description = annotation.description();
|
description = annotation.description();
|
||||||
|
creationMethod = annotation.creationMethod();
|
||||||
category = annotation.category();
|
category = annotation.category();
|
||||||
namePrefix = annotation.instanceNamePrefix();
|
namePrefix = annotation.instanceNamePrefix();
|
||||||
author = annotation.author();
|
author = annotation.author();
|
||||||
@@ -74,6 +77,7 @@ public class ComponentProcessor {
|
|||||||
} else {
|
} else {
|
||||||
name = clazz.getSimpleName();
|
name = clazz.getSimpleName();
|
||||||
description = "";
|
description = "";
|
||||||
|
creationMethod = CreationMethod.SINGLE_CLICK;
|
||||||
category = "Uncategorized";
|
category = "Uncategorized";
|
||||||
namePrefix = "Unknown";
|
namePrefix = "Unknown";
|
||||||
author = "Unknown";
|
author = "Unknown";
|
||||||
@@ -88,9 +92,7 @@ public class ComponentProcessor {
|
|||||||
Image image = new BufferedImage(Presenter.ICON_SIZE, Presenter.ICON_SIZE,
|
Image image = new BufferedImage(Presenter.ICON_SIZE, Presenter.ICON_SIZE,
|
||||||
java.awt.image.BufferedImage.TYPE_INT_ARGB);
|
java.awt.image.BufferedImage.TYPE_INT_ARGB);
|
||||||
Graphics2D g2d = (Graphics2D) image.getGraphics();
|
Graphics2D g2d = (Graphics2D) image.getGraphics();
|
||||||
g2d
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
componentInstance.drawIcon(g2d, Presenter.ICON_SIZE, Presenter.ICON_SIZE);
|
componentInstance.drawIcon(g2d, Presenter.ICON_SIZE, Presenter.ICON_SIZE);
|
||||||
icon = new ImageIcon(image);
|
icon = new ImageIcon(image);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
@@ -98,8 +100,8 @@ public class ComponentProcessor {
|
|||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
ComponentType componentType = new ComponentType(name, description, category, namePrefix,
|
ComponentType componentType = new ComponentType(name, description, creationMethod,
|
||||||
author, icon, clazz, zOrder, stretchable, sticky);
|
category, namePrefix, author, icon, clazz, zOrder, stretchable, sticky);
|
||||||
return componentType;
|
return componentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+100
-48
@@ -14,6 +14,7 @@ import java.io.IOException;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -38,6 +39,7 @@ import org.diylc.common.IComponentFiler;
|
|||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
@@ -103,7 +105,10 @@ public class Presenter implements IPlugInPort {
|
|||||||
private Point previousDragPoint = null;
|
private Point previousDragPoint = null;
|
||||||
private Project preDragProject = null;
|
private Project preDragProject = null;
|
||||||
|
|
||||||
|
// Component creation
|
||||||
private ComponentType componentSlot;
|
private ComponentType componentSlot;
|
||||||
|
private Point controlPointSlot;
|
||||||
|
private Point potentialControlPoint;
|
||||||
|
|
||||||
private boolean snapToGrid = true;
|
private boolean snapToGrid = true;
|
||||||
|
|
||||||
@@ -307,8 +312,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
drawControlPoints.add(component);
|
drawControlPoints.add(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
projectPainter.draw(g2d, currentProject, drawOptions, filter, selectionRect,
|
projectPainter.drawProject(g2d, currentProject, drawOptions, filter, selectionRect,
|
||||||
selectedComponents, drawControlPoints, dragInProgress, zoomLevel);
|
selectedComponents, drawControlPoints, Arrays.asList(controlPointSlot,
|
||||||
|
potentialControlPoint), dragInProgress, zoomLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -347,13 +353,34 @@ public class Presenter implements IPlugInPort {
|
|||||||
.format("mouseClicked(%s, %s, %s, %s)", point, ctrlDown, shiftDown, altDown));
|
.format("mouseClicked(%s, %s, %s, %s)", point, ctrlDown, shiftDown, altDown));
|
||||||
Point scaledPoint = scalePoint(point);
|
Point scaledPoint = scalePoint(point);
|
||||||
if (componentSlot != null) {
|
if (componentSlot != null) {
|
||||||
try {
|
switch (componentSlot.getCreationMethod()) {
|
||||||
instantiateComponent(componentSlot, scaledPoint);
|
case SINGLE_CLICK:
|
||||||
} catch (Exception e) {
|
try {
|
||||||
LOG.error("Error instatiating component of type: "
|
instantiateComponent(componentSlot, scaledPoint);
|
||||||
+ componentSlot.getInstanceClass().getName(), e);
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error instatiating component of type: "
|
||||||
|
+ componentSlot.getInstanceClass().getName(), e);
|
||||||
|
}
|
||||||
|
setNewComponentSlot(null);
|
||||||
|
break;
|
||||||
|
case POINT_BY_POINT:
|
||||||
|
if (controlPointSlot != null) {
|
||||||
|
try {
|
||||||
|
instantiateComponent(componentSlot, controlPointSlot, scaledPoint);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error instatiating component of type: "
|
||||||
|
+ componentSlot.getInstanceClass().getName(), e);
|
||||||
|
}
|
||||||
|
setNewComponentSlot(null);
|
||||||
|
} else {
|
||||||
|
controlPointSlot = scaledPoint;
|
||||||
|
snapPointToGrid(controlPointSlot);
|
||||||
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG.error("Unknown creation method: " + componentSlot.getCreationMethod());
|
||||||
}
|
}
|
||||||
setNewComponentSlot(null);
|
|
||||||
} else {
|
} else {
|
||||||
List<IDIYComponent<?>> components = findComponentsAt(scaledPoint);
|
List<IDIYComponent<?>> components = findComponentsAt(scaledPoint);
|
||||||
// If there's nothing under mouse cursor deselect all.
|
// If there's nothing under mouse cursor deselect all.
|
||||||
@@ -388,38 +415,46 @@ public class Presenter implements IPlugInPort {
|
|||||||
public void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
public void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||||
Map<IDIYComponent<?>, Set<Integer>> components = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
Map<IDIYComponent<?>, Set<Integer>> components = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
||||||
Point scaledPoint = scalePoint(point);
|
Point scaledPoint = scalePoint(point);
|
||||||
// Go backwards so we take the highest z-order components first.
|
if (componentSlot != null
|
||||||
for (int i = currentProject.getComponents().size() - 1; i >= 0; i--) {
|
&& componentSlot.getCreationMethod() == CreationMethod.POINT_BY_POINT) {
|
||||||
IDIYComponent<?> component = currentProject.getComponents().get(i);
|
potentialControlPoint = scaledPoint;
|
||||||
ComponentType componentType = componentTypeMap.get(component.getClass().getName());
|
snapPointToGrid(potentialControlPoint);
|
||||||
for (int pointIndex = 0; pointIndex < component.getControlPointCount(); pointIndex++) {
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
Point controlPoint = component.getControlPoint(pointIndex);
|
} else {
|
||||||
// Only consider selected components that are not grouped.
|
// Go backwards so we take the highest z-order components first.
|
||||||
if (selectedComponents.contains(component) && componentType.isStretchable()
|
for (int i = currentProject.getComponents().size() - 1; i >= 0; i--) {
|
||||||
&& findAllGroupedComponents(component).size() == 1) {
|
IDIYComponent<?> component = currentProject.getComponents().get(i);
|
||||||
try {
|
ComponentType componentType = componentTypeMap.get(component.getClass().getName());
|
||||||
if (scaledPoint.distance(controlPoint) < ProjectPainter.CONTROL_POINT_SIZE) {
|
for (int pointIndex = 0; pointIndex < component.getControlPointCount(); pointIndex++) {
|
||||||
Set<Integer> indices = new HashSet<Integer>();
|
Point controlPoint = component.getControlPoint(pointIndex);
|
||||||
if (componentType.isStretchable()) {
|
// Only consider selected components that are not grouped.
|
||||||
indices.add(pointIndex);
|
if (selectedComponents.contains(component) && componentType.isStretchable()
|
||||||
} else {
|
&& findAllGroupedComponents(component).size() == 1) {
|
||||||
for (int j = 0; j < component.getControlPointCount(); j++) {
|
try {
|
||||||
indices.add(j);
|
if (scaledPoint.distance(controlPoint) < ProjectPainter.CONTROL_POINT_SIZE) {
|
||||||
|
Set<Integer> indices = new HashSet<Integer>();
|
||||||
|
if (componentType.isStretchable()) {
|
||||||
|
indices.add(pointIndex);
|
||||||
|
} else {
|
||||||
|
for (int j = 0; j < component.getControlPointCount(); j++) {
|
||||||
|
indices.add(j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
components.put(component, indices);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
components.put(component, indices);
|
} catch (Exception e) {
|
||||||
break;
|
LOG.warn("Error reading control point for component of type: "
|
||||||
|
+ component.getClass().getName());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.warn("Error reading control point for component of type: "
|
|
||||||
+ component.getClass().getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// // If CTRL is pressed, we only care about the top most
|
||||||
|
// component.
|
||||||
|
// if (altDown && components.size() > 0) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
// // If CTRL is pressed, we only care about the top most component.
|
|
||||||
// if (altDown && components.size() > 0) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
messageDispatcher.dispatchMessage(EventType.MOUSE_MOVED, scaledPoint);
|
messageDispatcher.dispatchMessage(EventType.MOUSE_MOVED, scaledPoint);
|
||||||
@@ -637,6 +672,16 @@ public class Presenter implements IPlugInPort {
|
|||||||
return (Math.round(1f * x / grid) * grid);
|
return (Math.round(1f * x / grid) * grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void snapPointToGrid(Point point) {
|
||||||
|
int x = point.x;
|
||||||
|
int y = point.y;
|
||||||
|
if (snapToGrid) {
|
||||||
|
x = roundToGrid(x);
|
||||||
|
y = roundToGrid(y);
|
||||||
|
}
|
||||||
|
point.setLocation(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragEnded(Point point) {
|
public void dragEnded(Point point) {
|
||||||
LOG.debug(String.format("dragEnded(%s)", point));
|
LOG.debug(String.format("dragEnded(%s)", point));
|
||||||
@@ -719,7 +764,6 @@ public class Presenter implements IPlugInPort {
|
|||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectionDefaultPropertyValue(String propertyName, Object value) {
|
public void setSelectionDefaultPropertyValue(String propertyName, Object value) {
|
||||||
LOG.info(String.format("setSelectionDefaultPropertyValue(%s, %s)", propertyName, value));
|
LOG.info(String.format("setSelectionDefaultPropertyValue(%s, %s)", propertyName, value));
|
||||||
@@ -887,8 +931,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
private void instantiateComponent(ComponentType componentType, Point... points)
|
||||||
private void instantiateComponent(ComponentType componentType, Point point) throws Exception {
|
throws Exception {
|
||||||
LOG.info("Instatiating component of type: " + componentType.getInstanceClass().getName());
|
LOG.info("Instatiating component of type: " + componentType.getInstanceClass().getName());
|
||||||
|
|
||||||
Project oldProject = cloner.deepClone(currentProject);
|
Project oldProject = cloner.deepClone(currentProject);
|
||||||
@@ -919,17 +963,23 @@ public class Presenter implements IPlugInPort {
|
|||||||
selectedComponents.add(component);
|
selectedComponents.add(component);
|
||||||
|
|
||||||
// Translate them to the desired location.
|
// Translate them to the desired location.
|
||||||
if (point != null) {
|
if (points != null) {
|
||||||
for (int j = 0; j < component.getControlPointCount(); j++) {
|
switch (componentType.getCreationMethod()) {
|
||||||
Point controlPoint = new Point(component.getControlPoint(j));
|
case SINGLE_CLICK:
|
||||||
int x = controlPoint.x + point.x;
|
for (int j = 0; j < component.getControlPointCount(); j++) {
|
||||||
int y = controlPoint.y + point.y;
|
Point controlPoint = new Point(component.getControlPoint(j));
|
||||||
if (snapToGrid) {
|
controlPoint.translate(points[0].x, points[0].y);
|
||||||
x = roundToGrid(x);
|
snapPointToGrid(controlPoint);
|
||||||
y = roundToGrid(y);
|
component.setControlPoint(controlPoint, j);
|
||||||
}
|
}
|
||||||
controlPoint.setLocation(x, y);
|
break;
|
||||||
component.setControlPoint(controlPoint, j);
|
case POINT_BY_POINT:
|
||||||
|
for (int j = 0; j < points.length; j++) {
|
||||||
|
Point point = points[j];
|
||||||
|
snapPointToGrid(point);
|
||||||
|
component.setControlPoint(point, j);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,6 +1114,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
LOG.info(String.format("setNewComponentSlot(%s)", componentType == null ? null
|
LOG.info(String.format("setNewComponentSlot(%s)", componentType == null ? null
|
||||||
: componentType.getName()));
|
: componentType.getName()));
|
||||||
this.componentSlot = componentType;
|
this.componentSlot = componentType;
|
||||||
|
this.controlPointSlot = null;
|
||||||
|
this.potentialControlPoint = null;
|
||||||
selectedComponents.clear();
|
selectedComponents.clear();
|
||||||
fireSelectionChanged();
|
fireSelectionChanged();
|
||||||
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
|
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
|
||||||
@@ -1098,6 +1150,6 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (findAllGroupedComponents(component).size() > 1) {
|
if (findAllGroupedComponents(component).size() > 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return selectedComponents.contains(component);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-51
@@ -16,7 +16,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.diylc.common.ComponentSelection;
|
import org.diylc.common.ComponentSelection;
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
import org.diylc.common.IComponentFiler;
|
import org.diylc.common.IComponentFiler;
|
||||||
@@ -33,9 +32,7 @@ import org.diylc.utils.Constants;
|
|||||||
*/
|
*/
|
||||||
public class ProjectPainter {
|
public class ProjectPainter {
|
||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(ProjectPainter.class);
|
public static final int CONTROL_POINT_SIZE = 7;
|
||||||
|
|
||||||
public static final int CONTROL_POINT_SIZE = 5;
|
|
||||||
public static boolean ENABLE_ANTIALIASING = true;
|
public static boolean ENABLE_ANTIALIASING = true;
|
||||||
public static boolean DEBUG_COMPONENT_AREAS = false;
|
public static boolean DEBUG_COMPONENT_AREAS = false;
|
||||||
|
|
||||||
@@ -51,9 +48,10 @@ public class ProjectPainter {
|
|||||||
lastDrawnStateMap = new HashMap<IDIYComponent<?>, ComponentState>();
|
lastDrawnStateMap = new HashMap<IDIYComponent<?>, ComponentState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Graphics2D g2d, Project project, Set<DrawOption> drawOptions,
|
public void drawProject(Graphics2D g2d, Project project, Set<DrawOption> drawOptions,
|
||||||
IComponentFiler filter, Rectangle selectionRect, ComponentSelection selectedComponents,
|
IComponentFiler filter, Rectangle selectionRect, ComponentSelection selectedComponents,
|
||||||
Set<IDIYComponent<?>> drawControlPoints, boolean dragInProgress, double zoomLevel) {
|
Set<IDIYComponent<?>> drawControlPoints, List<Point> controlPointSlot,
|
||||||
|
boolean dragInProgress, double zoomLevel) {
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -93,57 +91,64 @@ public class ProjectPainter {
|
|||||||
|
|
||||||
// g2dWrapper.resetTx();
|
// g2dWrapper.resetTx();
|
||||||
|
|
||||||
List<IDIYComponent<?>> components = project.getComponents();
|
|
||||||
// componentAreaMap.clear();
|
// componentAreaMap.clear();
|
||||||
if (components != null) {
|
for (IDIYComponent<?> component : project.getComponents()) {
|
||||||
for (IDIYComponent<?> component : components) {
|
// Do not draw the component if it's filtered out.
|
||||||
// Do not draw the component if it's filtered out.
|
if (filter != null && !filter.testComponent(component)) {
|
||||||
if (filter != null && !filter.testComponent(component)) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
ComponentState state = ComponentState.NORMAL;
|
||||||
ComponentState state = ComponentState.NORMAL;
|
if (drawOptions.contains(DrawOption.SELECTION)
|
||||||
if (drawOptions.contains(DrawOption.SELECTION)
|
&& selectedComponents.contains(component)) {
|
||||||
&& selectedComponents.contains(component)) {
|
if (dragInProgress) {
|
||||||
if (dragInProgress) {
|
state = ComponentState.DRAGGING;
|
||||||
state = ComponentState.DRAGGING;
|
} else {
|
||||||
} else {
|
state = ComponentState.SELECTED;
|
||||||
state = ComponentState.SELECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do not track the area if component is not invalidated and was
|
|
||||||
// drawn in the same state.
|
|
||||||
boolean trackArea = lastDrawnStateMap.get(component) != state;
|
|
||||||
g2dWrapper.startedDrawingComponent();
|
|
||||||
if (!trackArea) {
|
|
||||||
g2dWrapper.stopTracking();
|
|
||||||
}
|
|
||||||
// Draw the component through the g2dWrapper.
|
|
||||||
component.draw(g2dWrapper, state, project, g2dWrapper);
|
|
||||||
Area area = g2dWrapper.finishedDrawingComponent();
|
|
||||||
if (trackArea) {
|
|
||||||
componentAreaMap.put(component, area);
|
|
||||||
lastDrawnStateMap.put(component, state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Draw control points.
|
// Do not track the area if component is not invalidated and was
|
||||||
for (IDIYComponent<?> component : components) {
|
// drawn in the same state.
|
||||||
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
|
boolean trackArea = lastDrawnStateMap.get(component) != state;
|
||||||
|
g2dWrapper.startedDrawingComponent();
|
||||||
|
if (!trackArea) {
|
||||||
|
g2dWrapper.stopTracking();
|
||||||
|
}
|
||||||
|
// Draw the component through the g2dWrapper.
|
||||||
|
component.draw(g2dWrapper, state, project, g2dWrapper);
|
||||||
|
Area area = g2dWrapper.finishedDrawingComponent();
|
||||||
|
if (trackArea) {
|
||||||
|
componentAreaMap.put(component, area);
|
||||||
|
lastDrawnStateMap.put(component, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw control points of the component in the slot.
|
||||||
|
if (controlPointSlot != null) {
|
||||||
|
for (Point point : controlPointSlot) {
|
||||||
|
if (point != null) {
|
||||||
|
g2dWrapper.setColor(Constants.SELECTED_CONTROL_POINT_COLOR);
|
||||||
|
g2dWrapper.fillOval(point.x - CONTROL_POINT_SIZE / 2, point.y
|
||||||
|
- CONTROL_POINT_SIZE / 2, CONTROL_POINT_SIZE, CONTROL_POINT_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g2dWrapper.setColor(Constants.CONTROL_POINT_COLOR);
|
||||||
|
// Draw control points.
|
||||||
|
for (IDIYComponent<?> component : project.getComponents()) {
|
||||||
|
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
|
||||||
|
if (drawControlPoints.contains(component)) {
|
||||||
|
boolean isSelected = selectedComponents.contains(component);
|
||||||
|
g2dWrapper.setColor(isSelected ? Constants.SELECTED_CONTROL_POINT_COLOR
|
||||||
|
: Constants.CONTROL_POINT_COLOR);
|
||||||
for (int i = 0; i < component.getControlPointCount(); i++) {
|
for (int i = 0; i < component.getControlPointCount(); i++) {
|
||||||
Point controlPoint = component.getControlPoint(i);
|
Point controlPoint = component.getControlPoint(i);
|
||||||
try {
|
int pointSize = CONTROL_POINT_SIZE;
|
||||||
if (drawControlPoints.contains(component)) {
|
if (!isSelected) {
|
||||||
g2dWrapper.setColor(Constants.CONTROL_POINT_COLOR);
|
pointSize -= 2;
|
||||||
g2dWrapper.setStroke(new BasicStroke(2));
|
|
||||||
// g2d.drawOval(controlPoint.x - 2,
|
|
||||||
// controlPoint.y - 2, 4, 4);
|
|
||||||
g2dWrapper.fillOval(controlPoint.x - CONTROL_POINT_SIZE / 2,
|
|
||||||
controlPoint.y - CONTROL_POINT_SIZE / 2,
|
|
||||||
CONTROL_POINT_SIZE, CONTROL_POINT_SIZE);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.error("Could not obtain control points for component of type "
|
|
||||||
+ component.getClass().getName());
|
|
||||||
}
|
}
|
||||||
|
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
|
||||||
|
- pointSize / 2, pointSize, pointSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -7,14 +7,16 @@ import java.awt.Stroke;
|
|||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public static final int PIXELS_PER_INCH = 100;//Toolkit.getDefaultToolkit().getScreenResolution();
|
public static final int PIXELS_PER_INCH = 120;//Toolkit.getDefaultToolkit().getScreenResolution();
|
||||||
public static int GRIDS_PER_INCH = 8;
|
public static int GRIDS_PER_INCH = 8;
|
||||||
// public static Size GRID_SIZE = new Size(1d / GRIDS_PER_INCH, SizeUnit.in);
|
// public static Size GRID_SIZE = new Size(1d / GRIDS_PER_INCH, SizeUnit.in);
|
||||||
// public static final int GRID = 20;
|
// public static final int GRID = 20;
|
||||||
|
|
||||||
public static Color CANVAS_COLOR = Color.white;
|
public static Color CANVAS_COLOR = Color.white;
|
||||||
public static Color GRID_COLOR = new Color(240, 240, 240);
|
public static Color GRID_COLOR = new Color(240, 240, 240);
|
||||||
public static Color CONTROL_POINT_COLOR = Color.blue;
|
public static Color CONTROL_POINT_COLOR = Color.black;
|
||||||
|
public static Color SELECTED_CONTROL_POINT_COLOR = Color.blue;
|
||||||
|
public static Color CREATION_POINT_COLOR = Color.decode("#32CD32");
|
||||||
|
|
||||||
public static Font LABEL_FONT = new Font("Tahoma", Font.BOLD, 11);
|
public static Font LABEL_FONT = new Font("Tahoma", Font.BOLD, 11);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BOARD_COLOR = Color.decode("#BCED91");
|
public static Color BOARD_COLOR = Color.decode("#F8EBB3");
|
||||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
||||||
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
|
||||||
public static Size DEFAULT_HEIGHT = new Size(1d, SizeUnit.in);
|
public static Size DEFAULT_HEIGHT = new Size(1d, SizeUnit.in);
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color PAD_COLOR = Color.decode("#B87333");
|
public static Color PAD_COLOR = Color.decode("#F3926C");
|
||||||
|
|
||||||
public static Size SPACING = new Size(0.1d, SizeUnit.in);
|
public static Size SPACING = new Size(0.1d, SizeUnit.in);
|
||||||
public static Size PAD_SIZE = new Size(0.08d, SizeUnit.in);
|
public static Size PAD_SIZE = new Size(0.08d, SizeUnit.in);
|
||||||
|
|||||||
+1
-2
@@ -21,8 +21,7 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BOARD_COLOR = Color.decode("#BCED91");
|
public static Color PAD_COLOR = Color.decode("#F3926C");
|
||||||
public static Color PAD_COLOR = Color.decode("#B87333");
|
|
||||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
||||||
|
|
||||||
public static Size SPACING = new Size(0.1d, SizeUnit.in);
|
public static Size SPACING = new Size(0.1d, SizeUnit.in);
|
||||||
|
|||||||
+2
-1
@@ -7,13 +7,14 @@ import java.awt.Shape;
|
|||||||
|
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "Trace", description = "", zOrder = IDIYComponent.ABOVE_BOARD, sticky = true)
|
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "Trace", description = "", zOrder = IDIYComponent.ABOVE_BOARD, sticky = true)
|
||||||
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+2
-1
@@ -7,12 +7,13 @@ import java.awt.Shape;
|
|||||||
|
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "J", description = "", zOrder = IDIYComponent.ABOVE_BOARD, sticky = true)
|
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "J", description = "", zOrder = IDIYComponent.ABOVE_BOARD, sticky = true)
|
||||||
public class Jumper extends AbstractLeadedComponent<Void> {
|
public class Jumper extends AbstractLeadedComponent<Void> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -14,7 +15,7 @@ import org.diylc.core.measures.CapacitanceUnit;
|
|||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Axial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
@ComponentDescriptor(name = "Axial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
||||||
public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -14,7 +15,7 @@ import org.diylc.core.measures.CapacitanceUnit;
|
|||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Ceramic Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
@ComponentDescriptor(name = "Ceramic Capacitor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
||||||
public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacitance> {
|
public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -14,7 +15,7 @@ import org.diylc.core.measures.CapacitanceUnit;
|
|||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Radial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
@ComponentDescriptor(name = "Radial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
||||||
public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -14,7 +15,7 @@ import org.diylc.core.measures.ResistanceUnit;
|
|||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "R", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R", description = "test", zOrder = IDIYComponent.COMPONENT, sticky = true)
|
||||||
public class Resistor extends AbstractLeadedComponent<Resistance> {
|
public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
Reference in New Issue
Block a user