mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Output SPICE node names in the "Nxxx" format
join all nodes connected to GND together
This commit is contained in:
@@ -298,4 +298,8 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommonPointName(int pointIndex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,12 +131,18 @@ public interface IDIYComponent<T> extends Serializable {
|
||||
String getInternalLinkName(int index1, int index2);
|
||||
|
||||
/**
|
||||
* @param pointIndex name of the internal section containing the specified point, or null if the component does not have internal sections.
|
||||
* @param pointIndex
|
||||
* @return name of the internal section containing the specified point, or null if the component does not have internal sections.
|
||||
* One point can be shared between multiple sections, in which case, the result may contain more than one element.
|
||||
* @return
|
||||
*/
|
||||
String[] getSectionNames(int pointIndex);
|
||||
|
||||
/**
|
||||
* @param pointIndex
|
||||
* @return name of the common point that joins all the other points with the same name together, e.g. GND
|
||||
*/
|
||||
String getCommonPointName(int pointIndex);
|
||||
|
||||
/**
|
||||
* Draws the component onto the {@link Graphics2D}.
|
||||
*
|
||||
|
||||
@@ -2824,10 +2824,14 @@ public class Presenter implements IPlugInPort {
|
||||
Point2D point1 = node1.getComponent().getControlPoint(node1.getPointIndex());
|
||||
Point2D point2 = node2.getComponent().getControlPoint(node2.getPointIndex());
|
||||
|
||||
String commonPoint1 = node1.getComponent().getCommonPointName(node1.getPointIndex());
|
||||
String commonPoint2 = node2.getComponent().getCommonPointName(node2.getPointIndex());
|
||||
|
||||
// try both directions
|
||||
if (point1.distance(point2) < t ||
|
||||
checkGraphConnection(point1, point2, connections, continuityAreas, new boolean[connections.size()]) ||
|
||||
checkGraphConnection(point2, point1, connections, continuityAreas, new boolean[connections.size()])) {
|
||||
checkGraphConnection(point2, point1, connections, continuityAreas, new boolean[connections.size()]) ||
|
||||
(commonPoint1 != null && commonPoint1.equalsIgnoreCase(commonPoint2))) {
|
||||
boolean added = false;
|
||||
// add to an existing vertex if possible
|
||||
for (Group g : netlist.getGroups())
|
||||
|
||||
Binary file not shown.
@@ -141,6 +141,11 @@ public class GroundSymbol extends AbstractComponent<Void> {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommonPointName(int pointIndex) {
|
||||
return "GND";
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||
return VisibilityPolicy.WHEN_SELECTED;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class SpiceAnalyzer extends NetlistAnalyzer implements INetlistAnalyzer {
|
||||
|
||||
// output to spice
|
||||
for (int i = 0; i < c.getControlPointCount(); i++) {
|
||||
sb.append(fill(Integer.toString(nodeIndices[i]), 5));
|
||||
sb.append(fill(formatSpiceNode(nodeIndices[i]), 5));
|
||||
sb.append(" ");
|
||||
}
|
||||
|
||||
@@ -130,6 +130,10 @@ public class SpiceAnalyzer extends NetlistAnalyzer implements INetlistAnalyzer {
|
||||
return new Summary(netlist, sb.toString());
|
||||
}
|
||||
|
||||
private static String formatSpiceNode(int i) {
|
||||
return String.format("N%03d" , i);
|
||||
}
|
||||
|
||||
private String fill(String source, int desiredLength) {
|
||||
String res = source;
|
||||
for (int i = 0; i < desiredLength - source.length(); i++)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -2621,5 +2621,21 @@
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
<org.diylc.appframework.update.Version>
|
||||
<versionNumber>
|
||||
<major>3</major>
|
||||
<minor>57</minor>
|
||||
<build>0</build>
|
||||
</versionNumber>
|
||||
<releaseDate>2019-03-10 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Output SPICE node names in the "Nxxx" format</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
</a>
|
||||
</java.util.Arrays_-ArrayList>
|
||||
|
||||
Reference in New Issue
Block a user