mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Honor "Terminal Strip" connectivity when creating a netlist
This commit is contained in:
@@ -49,12 +49,11 @@ public class ComponentType {
|
|||||||
private IComponentTransformer transformer;
|
private IComponentTransformer transformer;
|
||||||
private KeywordPolicy keywordPolicy;
|
private KeywordPolicy keywordPolicy;
|
||||||
private String keywordTag;
|
private String keywordTag;
|
||||||
private boolean continuity;
|
|
||||||
|
|
||||||
public ComponentType(String name, String description, CreationMethod creationMethod, String category,
|
public ComponentType(String name, String description, CreationMethod creationMethod, String category,
|
||||||
String namePrefix, String author, Icon icon, Class<? extends IDIYComponent<?>> instanceClass, double zOrder,
|
String namePrefix, String author, Icon icon, Class<? extends IDIYComponent<?>> instanceClass, double zOrder,
|
||||||
boolean flexibleZOrder, boolean stretchable, BomPolicy bomPolicy, boolean autoEdit,
|
boolean flexibleZOrder, boolean stretchable, BomPolicy bomPolicy, boolean autoEdit,
|
||||||
IComponentTransformer transformer, KeywordPolicy keywordPolicy, String keywordTag, boolean continuity) {
|
IComponentTransformer transformer, KeywordPolicy keywordPolicy, String keywordTag) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -72,7 +71,6 @@ public class ComponentType {
|
|||||||
this.transformer = transformer;
|
this.transformer = transformer;
|
||||||
this.keywordPolicy = keywordPolicy;
|
this.keywordPolicy = keywordPolicy;
|
||||||
this.keywordTag = keywordTag;
|
this.keywordTag = keywordTag;
|
||||||
this.continuity = continuity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -139,10 +137,6 @@ public class ComponentType {
|
|||||||
return keywordTag;
|
return keywordTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isContinuity() {
|
|
||||||
return continuity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
DIY Layout Creator (DIYLC).
|
||||||
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
|
This file is part of DIYLC.
|
||||||
|
|
||||||
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
DIYLC is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package org.diylc.core;
|
||||||
|
|
||||||
|
public interface IContinuity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests control point connectivity.
|
||||||
|
*
|
||||||
|
* @param index1
|
||||||
|
* @param index2
|
||||||
|
* @return true if the two points are connected, false otherwise.
|
||||||
|
*/
|
||||||
|
boolean arePointsConnected(int index1, int index2);
|
||||||
|
}
|
||||||
@@ -117,12 +117,4 @@ public @interface ComponentDescriptor {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String keywordTag() default "";
|
String keywordTag() default "";
|
||||||
|
|
||||||
/**
|
|
||||||
* For components that show continuity between the two ending points, e.d. wires, jumpers, etc.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean continuity() default false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ public class ComponentProcessor {
|
|||||||
IComponentTransformer transformer;
|
IComponentTransformer transformer;
|
||||||
KeywordPolicy keywordPolicy;
|
KeywordPolicy keywordPolicy;
|
||||||
String keywordTag;
|
String keywordTag;
|
||||||
boolean continuity;
|
|
||||||
if (clazz.isAnnotationPresent(ComponentDescriptor.class)) {
|
if (clazz.isAnnotationPresent(ComponentDescriptor.class)) {
|
||||||
ComponentDescriptor annotation = clazz.getAnnotation(ComponentDescriptor.class);
|
ComponentDescriptor annotation = clazz.getAnnotation(ComponentDescriptor.class);
|
||||||
name = annotation.name();
|
name = annotation.name();
|
||||||
@@ -115,7 +114,6 @@ public class ComponentProcessor {
|
|||||||
transformer = getComponentTransformer(annotation.transformer());
|
transformer = getComponentTransformer(annotation.transformer());
|
||||||
keywordPolicy = annotation.keywordPolicy();
|
keywordPolicy = annotation.keywordPolicy();
|
||||||
keywordTag = annotation.keywordTag();
|
keywordTag = annotation.keywordTag();
|
||||||
continuity = annotation.continuity();
|
|
||||||
} else { // default
|
} else { // default
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -137,7 +135,7 @@ public class ComponentProcessor {
|
|||||||
}
|
}
|
||||||
ComponentType componentType =
|
ComponentType componentType =
|
||||||
new ComponentType(name, description, creationMethod, category, namePrefix, author, icon, clazz, zOrder,
|
new ComponentType(name, description, creationMethod, category, namePrefix, author, icon, clazz, zOrder,
|
||||||
flexibleZOrder, stretchable, bomPolicy, autoEdit, transformer, keywordPolicy, keywordTag, continuity);
|
flexibleZOrder, stretchable, bomPolicy, autoEdit, transformer, keywordPolicy, keywordTag);
|
||||||
componentTypeMap.put(clazz.getName(), componentType);
|
componentTypeMap.put(clazz.getName(), componentType);
|
||||||
return componentType;
|
return componentType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import java.util.Set;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.appframework.simplemq.MessageDispatcher;
|
import org.diylc.appframework.simplemq.MessageDispatcher;
|
||||||
import org.diylc.common.ComponentType;
|
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
import org.diylc.common.GridType;
|
import org.diylc.common.GridType;
|
||||||
@@ -51,6 +50,7 @@ import org.diylc.common.IComponentFiler;
|
|||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.Theme;
|
import org.diylc.core.Theme;
|
||||||
@@ -505,7 +505,6 @@ public class DrawingManager {
|
|||||||
continuityArea = null;
|
continuityArea = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<Area> getContinuityAreas(Project project) {
|
public List<Area> getContinuityAreas(Project project) {
|
||||||
// Find all individual continuity areas for all components
|
// Find all individual continuity areas for all components
|
||||||
List<Area> preliminaryAreas = new ArrayList<Area>();
|
List<Area> preliminaryAreas = new ArrayList<Area>();
|
||||||
@@ -514,10 +513,11 @@ public class DrawingManager {
|
|||||||
for (IDIYComponent<?> c : project.getComponents()) {
|
for (IDIYComponent<?> c : project.getComponents()) {
|
||||||
ComponentArea a = getComponentArea(c);
|
ComponentArea a = getComponentArea(c);
|
||||||
|
|
||||||
ComponentType type =
|
if (c instanceof IContinuity) {
|
||||||
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
for (int i = 0; i < c.getControlPointCount() - 1; i++)
|
||||||
if (type.isContinuity()) {
|
for (int j = i + 1; j < c.getControlPointCount(); j++)
|
||||||
connections.add(new Connection(c.getControlPoint(0), c.getControlPoint(c.getControlPointCount() - 1)));
|
if (((IContinuity)c).arePointsConnected(i, j))
|
||||||
|
connections.add(new Connection(c.getControlPoint(i), c.getControlPoint(j)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a == null || a.getOutlineArea() == null)
|
if (a == null || a.getOutlineArea() == null)
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public class InstantiationManager {
|
|||||||
|
|
||||||
public static final ComponentType clipboardType = new ComponentType("Clipboard contents",
|
public static final ComponentType clipboardType = new ComponentType("Clipboard contents",
|
||||||
"Components from the clipboard", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, false, null,
|
"Components from the clipboard", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, false, null,
|
||||||
false, null, KeywordPolicy.NEVER_SHOW, null, false);
|
false, null, KeywordPolicy.NEVER_SHOW, null);
|
||||||
public static final ComponentType blockType = new ComponentType("Building block",
|
public static final ComponentType blockType = new ComponentType("Building block",
|
||||||
"Components from the building block", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, false, null,
|
"Components from the building block", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, false, null,
|
||||||
false, null, KeywordPolicy.NEVER_SHOW, null, false);
|
false, null, KeywordPolicy.NEVER_SHOW, null);
|
||||||
|
|
||||||
public InstantiationManager() {}
|
public InstantiationManager() {}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import java.awt.Point;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Line2D;
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -68,6 +67,7 @@ import org.diylc.common.IPlugInPort;
|
|||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.common.VariantPackage;
|
import org.diylc.common.VariantPackage;
|
||||||
import org.diylc.core.ExpansionMode;
|
import org.diylc.core.ExpansionMode;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.ISwitch;
|
import org.diylc.core.ISwitch;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
@@ -2712,8 +2712,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
||||||
ComponentType type =
|
ComponentType type =
|
||||||
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||||
|
|
||||||
// extract nodes
|
// extract nodes
|
||||||
if (!type.isContinuity()) {
|
if (!(c instanceof IContinuity)) {
|
||||||
for (int i = 0; i < c.getControlPointCount(); i++) {
|
for (int i = 0; i < c.getControlPointCount(); i++) {
|
||||||
String nodeName = c.getControlPointNodeName(i);
|
String nodeName = c.getControlPointNodeName(i);
|
||||||
if (nodeName != null) {
|
if (nodeName != null) {
|
||||||
@@ -2768,7 +2769,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
switchPositions.put(switches.get(j), positions[j]);
|
switchPositions.put(switches.get(j), positions[j]);
|
||||||
posList.add(new Position(switches.get(j), positions[j]));
|
posList.add(new Position(switches.get(j), positions[j]));
|
||||||
}
|
}
|
||||||
List<Line2D> connections = getConnections(switchPositions);
|
List<Connection> connections = getConnections(switchPositions);
|
||||||
Netlist graph = constructNetlist(nodes, connections, continuity);
|
Netlist graph = constructNetlist(nodes, connections, continuity);
|
||||||
|
|
||||||
// merge graphs that are effectively the same
|
// merge graphs that are effectively the same
|
||||||
@@ -2801,7 +2802,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
return netlists;
|
return netlists;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Netlist constructNetlist(List<Node> nodes, List<Line2D> connections, List<Area> continuityAreas) {
|
private Netlist constructNetlist(List<Node> nodes, List<Connection> connections, List<Area> continuityAreas) {
|
||||||
Netlist netlist = new Netlist();
|
Netlist netlist = new Netlist();
|
||||||
|
|
||||||
// debugging code
|
// debugging code
|
||||||
@@ -2875,7 +2876,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
return netlist;
|
return netlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkGraphConnection(Point2D point1, Point2D point2, List<Line2D> connections,
|
private boolean checkGraphConnection(Point2D point1, Point2D point2, List<Connection> connections,
|
||||||
List<Area> continuityAreas, boolean[] visited) {
|
List<Area> continuityAreas, boolean[] visited) {
|
||||||
double t = DrawingManager.CONTROL_POINT_SIZE;
|
double t = DrawingManager.CONTROL_POINT_SIZE;
|
||||||
|
|
||||||
@@ -2891,7 +2892,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (visited[i])
|
if (visited[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Line2D c = connections.get(i);
|
Connection c = connections.get(i);
|
||||||
if (point1.distance(c.getP1()) < t) {
|
if (point1.distance(c.getP1()) < t) {
|
||||||
visited[i] = true;
|
visited[i] = true;
|
||||||
if (checkGraphConnection(c.getP2(), point2, connections, continuityAreas, visited))
|
if (checkGraphConnection(c.getP2(), point2, connections, continuityAreas, visited))
|
||||||
@@ -2908,14 +2909,17 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<Line2D> getConnections(Map<ISwitch, Integer> switchPositions) {
|
private List<Connection> getConnections(Map<ISwitch, Integer> switchPositions) {
|
||||||
List<Line2D> connections = new ArrayList<Line2D>();
|
List<Connection> connections = new ArrayList<Connection>();
|
||||||
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
||||||
ComponentType type =
|
ComponentType type =
|
||||||
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||||
// handle direct connections
|
// handle direct connections
|
||||||
if (type.isContinuity()) {
|
if (c instanceof IContinuity) {
|
||||||
connections.add(new Line2D.Double(c.getControlPoint(0), c.getControlPoint(c.getControlPointCount() - 1)));
|
for (int i = 0; i < c.getControlPointCount() - 1; i++)
|
||||||
|
for (int j = i + 1; j < c.getControlPointCount(); j++)
|
||||||
|
if (((IContinuity)c).arePointsConnected(i, j))
|
||||||
|
connections.add(new Connection(c.getControlPoint(i), c.getControlPoint(j)));
|
||||||
}
|
}
|
||||||
// handle switches
|
// handle switches
|
||||||
if (ISwitch.class.isAssignableFrom(type.getInstanceClass()) && switchPositions.containsKey(c)) {
|
if (ISwitch.class.isAssignableFrom(type.getInstanceClass()) && switchPositions.containsKey(c)) {
|
||||||
@@ -2924,7 +2928,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
for (int i = 0; i < c.getControlPointCount() - 1; i++)
|
for (int i = 0; i < c.getControlPointCount() - 1; i++)
|
||||||
for (int j = i + 1; j < c.getControlPointCount(); j++)
|
for (int j = i + 1; j < c.getControlPointCount(); j++)
|
||||||
if (s.arePointsConnected(i, j, position))
|
if (s.arePointsConnected(i, j, position))
|
||||||
connections.add(new Line2D.Double(c.getControlPoint(i), c.getControlPoint(j)));
|
connections.add(new Connection(c.getControlPoint(i), c.getControlPoint(j)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -37,6 +37,7 @@ import org.diylc.common.Orientation;
|
|||||||
import org.diylc.components.AbstractTransparentComponent;
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
import org.diylc.components.transform.TerminalStripTransformer;
|
import org.diylc.components.transform.TerminalStripTransformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
@@ -53,7 +54,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Terminal Strip", author = "Branislav Stojkovic", category = "Boards",
|
@ComponentDescriptor(name = "Terminal Strip", author = "Branislav Stojkovic", category = "Boards",
|
||||||
instanceNamePrefix = "TS", description = "Row of terminals for point-to-point construction", stretchable = false,
|
instanceNamePrefix = "TS", description = "Row of terminals for point-to-point construction", stretchable = false,
|
||||||
zOrder = IDIYComponent.BOARD, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = TerminalStripTransformer.class)
|
zOrder = IDIYComponent.BOARD, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = TerminalStripTransformer.class)
|
||||||
public class TerminalStrip extends AbstractTransparentComponent<String> {
|
public class TerminalStrip extends AbstractTransparentComponent<String> implements IContinuity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -455,4 +456,9 @@ public class TerminalStrip extends AbstractTransparentComponent<String> {
|
|||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return "TerminalStrip" + index;
|
return "TerminalStrip" + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return Math.abs(index1 - index2) == getTerminalCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.diylc.common.SimpleComponentTransformer;
|
|||||||
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.CreationMethod;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
@@ -41,7 +42,7 @@ import org.diylc.core.measures.SizeUnit;
|
|||||||
description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW,
|
description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW,
|
||||||
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB",
|
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB",
|
||||||
transformer = SimpleComponentTransformer.class)
|
transformer = SimpleComponentTransformer.class)
|
||||||
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
public class CopperTrace extends AbstractLeadedComponent<Void> implements IContinuity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -167,4 +168,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
|||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return Math.abs(index1 - index2) == getControlPointCount() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.diylc.common.PCBLayer;
|
|||||||
import org.diylc.common.SimpleComponentTransformer;
|
import org.diylc.common.SimpleComponentTransformer;
|
||||||
import org.diylc.components.AbstractCurvedComponent;
|
import org.diylc.components.AbstractCurvedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
@@ -40,7 +41,7 @@ import org.diylc.core.measures.SizeUnit;
|
|||||||
instanceNamePrefix = "Trace", description = "Curved copper trace with two control points",
|
instanceNamePrefix = "Trace", description = "Curved copper trace with two control points",
|
||||||
zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
||||||
public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
public class CurvedTrace extends AbstractCurvedComponent<Void> implements IContinuity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -116,4 +117,9 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
|||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return Math.abs(index1 - index2) == getControlPointCount() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.common.SimpleComponentTransformer;
|
import org.diylc.common.SimpleComponentTransformer;
|
||||||
import org.diylc.components.AbstractCurvedComponent;
|
import org.diylc.components.AbstractCurvedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
@@ -38,8 +39,8 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Hookup Wire", author = "Branislav Stojkovic", category = "Connectivity",
|
@ComponentDescriptor(name = "Hookup Wire", author = "Branislav Stojkovic", category = "Connectivity",
|
||||||
instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.COMPONENT,
|
instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.COMPONENT,
|
||||||
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||||
transformer = SimpleComponentTransformer.class, continuity = true)
|
transformer = SimpleComponentTransformer.class)
|
||||||
public class HookupWire extends AbstractCurvedComponent<Void> {
|
public class HookupWire extends AbstractCurvedComponent<Void> implements IContinuity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -132,4 +133,9 @@ public class HookupWire extends AbstractCurvedComponent<Void> {
|
|||||||
public void setStripeColor(Color stripeColor) {
|
public void setStripeColor(Color stripeColor) {
|
||||||
this.stripeColor = stripeColor;
|
this.stripeColor = stripeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return Math.abs(index1 - index2) == getControlPointCount() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.diylc.common.SimpleComponentTransformer;
|
|||||||
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.CreationMethod;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
@@ -41,8 +42,8 @@ import org.diylc.core.measures.Size;
|
|||||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity",
|
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity",
|
||||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "J", description = "",
|
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "J", description = "",
|
||||||
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||||
transformer = SimpleComponentTransformer.class, continuity = true)
|
transformer = SimpleComponentTransformer.class)
|
||||||
public class Jumper extends AbstractLeadedComponent<Void> {
|
public class Jumper extends AbstractLeadedComponent<Void> implements IContinuity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -157,4 +158,9 @@ public class Jumper extends AbstractLeadedComponent<Void> {
|
|||||||
public Display getDisplay() {
|
public Display getDisplay() {
|
||||||
return super.getDisplay();
|
return super.getDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.common.SimpleComponentTransformer;
|
import org.diylc.common.SimpleComponentTransformer;
|
||||||
import org.diylc.components.AbstractCurvedComponent;
|
import org.diylc.components.AbstractCurvedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
|
import org.diylc.core.IContinuity;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.annotations.BomPolicy;
|
import org.diylc.core.annotations.BomPolicy;
|
||||||
@@ -47,8 +48,8 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Twisted Leads", author = "Branislav Stojkovic", category = "Connectivity",
|
@ComponentDescriptor(name = "Twisted Leads", author = "Branislav Stojkovic", category = "Connectivity",
|
||||||
instanceNamePrefix = "W", description = "A pair of flexible leads twisted tighly together", zOrder = IDIYComponent.COMPONENT,
|
instanceNamePrefix = "W", description = "A pair of flexible leads twisted tighly together", zOrder = IDIYComponent.COMPONENT,
|
||||||
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||||
transformer = SimpleComponentTransformer.class, continuity = true)
|
transformer = SimpleComponentTransformer.class)
|
||||||
public class TwistedWire extends AbstractCurvedComponent<Void> {
|
public class TwistedWire extends AbstractCurvedComponent<Void> implements IContinuity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -432,4 +433,9 @@ public class TwistedWire extends AbstractCurvedComponent<Void> {
|
|||||||
|
|
||||||
return calculateLength(left, precision) + calculateLength(right, precision);
|
return calculateLength(left, precision) + calculateLength(right, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean arePointsConnected(int index1, int index2) {
|
||||||
|
return Math.abs(index1 - index2) == getControlPointCount() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -2634,6 +2634,10 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Output SPICE node names in the "Nxxx" format</description>
|
<description>Output SPICE node names in the "Nxxx" format</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Honor "Terminal Strip" connectivity when creating a netlist</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
|||||||
Reference in New Issue
Block a user