mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
netlist analyzer enhancements
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
package org.diylc.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.diylc.netlist.Netlist;
|
||||
import org.diylc.netlist.Node;
|
||||
@@ -59,4 +60,9 @@ public interface INetlistAnalyzer {
|
||||
* @return name of the font to be used for display.
|
||||
*/
|
||||
String getFontName();
|
||||
|
||||
/**
|
||||
* @return ability to process netlists with or without switches included.
|
||||
*/
|
||||
Set<NetlistSwitchPreference> getSwitchPreference();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.diylc.common;
|
||||
|
||||
public enum NetlistSwitchPreference {
|
||||
WITH, WITHOUT;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class NetlistBuilder {
|
||||
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||
|
||||
// extract nodes
|
||||
if (!(c instanceof IContinuity) && !(c instanceof ICommonNode)) {
|
||||
if (!(c instanceof IContinuity && !(c instanceof ISwitch)) && !(c instanceof ICommonNode)) {
|
||||
// regular components, create a node per control point
|
||||
for (int i = 0; i < c.getControlPointCount(); i++) {
|
||||
String nodeName = c.getControlPointNodeName(i);
|
||||
@@ -415,8 +415,10 @@ public class NetlistBuilder {
|
||||
IDIYComponent<?> c = project.getComponents().get(z);
|
||||
ComponentType type = ComponentProcessor.getInstance()
|
||||
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||
// handle direct connections
|
||||
if (c instanceof IContinuity) {
|
||||
// handle direct connections or connections through a switch
|
||||
// when not using "includeSwitches" flag
|
||||
if (c instanceof IContinuity &&
|
||||
(!(c instanceof ISwitch) || switchPositions.isEmpty())) {
|
||||
for (int i = 0; i < c.getControlPointCount() - 1; i++)
|
||||
for (int j = i + 1; j < c.getControlPointCount(); j++)
|
||||
if (((IContinuity) c).arePointsConnected(i, j))
|
||||
|
||||
Reference in New Issue
Block a user