Output SPICE node names in the "Nxxx" format

join all nodes connected to GND together
This commit is contained in:
Branislav Stojkovic
2019-03-13 19:23:35 +01:00
parent 92a2bb9809
commit 4de3b6d97c
9 changed files with 46 additions and 7 deletions
@@ -297,5 +297,9 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
public String[] getSectionNames(int pointIndex) {
return null;
}
@Override
public String getCommonPointName(int pointIndex) {
return null;
}
}
@@ -131,11 +131,17 @@ 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.
* One point can be shared between multiple sections, in which case, the result may contain more than one element.
* @return
* @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.
*/
String[] getSectionNames(int pointIndex);
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())