mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Fix blocks, add tests, fix bounding box calc of some components
This commit is contained in:
@@ -35,6 +35,11 @@ public interface INetlistAnalyzer {
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return summarizer short name
|
||||
*/
|
||||
String getShortName();
|
||||
|
||||
/**
|
||||
* @return name of the icon to use
|
||||
*/
|
||||
|
||||
@@ -26,13 +26,16 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public class Netlist implements Comparable<Netlist> {
|
||||
|
||||
private List<IDIYComponent<?>> components;
|
||||
private Set<Group> groups = new HashSet<Group>();
|
||||
private List<SwitchSetup> switchSetup = new ArrayList<SwitchSetup>();
|
||||
|
||||
public Netlist() {
|
||||
public Netlist(List<IDIYComponent<?>> components) {
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
public Set<Group> getGroups() {
|
||||
@@ -44,6 +47,10 @@ public class Netlist implements Comparable<Netlist> {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<IDIYComponent<?>> getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
public List<Group> getSortedGroups() {
|
||||
List<Group> list = new ArrayList<Group>(groups);
|
||||
Collections.sort(list);
|
||||
|
||||
@@ -417,14 +417,6 @@ public abstract class NetlistAnalyzer {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Set<IDIYComponent<?>> extractComponents(Netlist netlist) {
|
||||
Set<IDIYComponent<?>> res = new HashSet<IDIYComponent<?>>();
|
||||
for (Group g : netlist.getGroups())
|
||||
for (Node n : g.getNodes())
|
||||
res.add(n.getComponent());
|
||||
return res;
|
||||
}
|
||||
|
||||
protected int find(Node node, List<Group> groups) {
|
||||
for (int i = 0; i < groups.size(); i++)
|
||||
if (groups.get(i).getNodes().contains(node))
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
package org.diylc.presenter;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import java.util.TreeSet;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.measures.Size;
|
||||
|
||||
@@ -68,7 +67,7 @@ public class CalcUtils {
|
||||
}
|
||||
|
||||
public static void expandConnections(Set<Connection> connections) {
|
||||
Set<Connection> toAdd = new HashSet<Connection>();
|
||||
Set<Connection> toAdd = new TreeSet<Connection>();
|
||||
for (Connection c1 : connections)
|
||||
for (Connection c2 : connections) {
|
||||
if (c1 == c2)
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.awt.geom.Point2D;
|
||||
*
|
||||
* @author bancika
|
||||
*/
|
||||
public class Connection {
|
||||
public class Connection implements Comparable<Connection> {
|
||||
|
||||
private Point2D p1;
|
||||
private Point2D p2;
|
||||
@@ -72,4 +72,22 @@ public class Connection {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Connection o) {
|
||||
int compare = Double.compare(p1.getX(), o.p1.getX());
|
||||
if (compare != 0)
|
||||
return compare;
|
||||
compare = Double.compare(p1.getY(), o.p1.getY());
|
||||
if (compare != 0)
|
||||
return compare;
|
||||
compare = Double.compare(p2.getX(), o.p2.getX());
|
||||
if (compare != 0)
|
||||
return compare;
|
||||
compare = Double.compare(p2.getY(), o.p2.getY());
|
||||
if (compare != 0)
|
||||
return compare;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
l * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
@@ -46,6 +46,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
@@ -213,8 +214,12 @@ public class Presenter implements IPlugInPort {
|
||||
private Point2D previousScaledPoint;
|
||||
|
||||
private DIYTest test = null;
|
||||
|
||||
|
||||
public Presenter(IView view, IConfigurationManager<?> configManager) {
|
||||
this(view, configManager, false);
|
||||
}
|
||||
|
||||
public Presenter(IView view, IConfigurationManager<?> configManager, boolean importVariantsAndBlocks) {
|
||||
super();
|
||||
this.view = view;
|
||||
this.configManager = configManager;
|
||||
@@ -230,9 +235,11 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
// lockedLayers = EnumSet.noneOf(ComponentLayer.class);
|
||||
// visibleLayers = EnumSet.allOf(ComponentLayer.class);
|
||||
upgradeVariants();
|
||||
importDefaultVariants();
|
||||
importDefaultBlocks();
|
||||
if (importVariantsAndBlocks) {
|
||||
upgradeVariants();
|
||||
importDefaultVariants();
|
||||
importDefaultBlocks();
|
||||
}
|
||||
}
|
||||
|
||||
public void installPlugin(Supplier<IPlugIn> plugInSupplier) {
|
||||
@@ -2596,7 +2603,7 @@ public class Presenter implements IPlugInPort {
|
||||
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream("variants.xml"));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
xStream.toXML(defaultVariantMap, out);
|
||||
ProjectFileManager.xStreamSerializer.toXML(defaultVariantMap, out);
|
||||
out.close();
|
||||
// no more user variants
|
||||
configManager.writeValue(TEMPLATES_KEY, null);
|
||||
@@ -2617,9 +2624,7 @@ public class Presenter implements IPlugInPort {
|
||||
URL resource = Presenter.class.getResource("variants.xml");
|
||||
if (resource != null) {
|
||||
BufferedInputStream in = new BufferedInputStream(resource.openStream());
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
Map<String, List<Template>> defaults = (Map<String, List<Template>>) xStream.fromXML(in);
|
||||
Map<String, List<Template>> defaults = (Map<String, List<Template>>) ProjectFileManager.xStreamSerializer.fromXML(in);
|
||||
in.close();
|
||||
|
||||
Map<String, List<Template>> variantMap =
|
||||
@@ -2657,9 +2662,7 @@ public class Presenter implements IPlugInPort {
|
||||
URL resource = Presenter.class.getResource("blocks.xml");
|
||||
if (resource != null) {
|
||||
BufferedInputStream in = new BufferedInputStream(resource.openStream());
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
Map<String, List<IDIYComponent<?>>> defaults = (Map<String, List<IDIYComponent<?>>>) xStream.fromXML(in);
|
||||
Map<String, List<IDIYComponent<?>>> defaults = (Map<String, List<IDIYComponent<?>>>) ProjectFileManager.xStreamSerializer.fromXML(in);
|
||||
in.close();
|
||||
|
||||
Map<String, List<IDIYComponent<?>>> blocksMap =
|
||||
@@ -3020,20 +3023,9 @@ public class Presenter implements IPlugInPort {
|
||||
public int importVariants(String fileName) throws IOException {
|
||||
LOG.debug(String.format("importVariants(%s)", fileName));
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(fileName));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
|
||||
VariantPackage pkg;
|
||||
|
||||
try {
|
||||
// old way
|
||||
pkg = (VariantPackage) xStream.fromXML(in);
|
||||
} catch (Exception e) {
|
||||
// new way
|
||||
in = new BufferedInputStream(new FileInputStream(fileName));
|
||||
ProjectFileManager.configure(xStream);
|
||||
pkg = (VariantPackage) xStream.fromXML(in);
|
||||
}
|
||||
XStream xStream = projectFileManager.getXStream();
|
||||
|
||||
VariantPackage pkg = (VariantPackage) xStream.fromXML(in);
|
||||
|
||||
in.close();
|
||||
|
||||
@@ -3070,21 +3062,10 @@ public class Presenter implements IPlugInPort {
|
||||
public int importBlocks(String fileName) throws IOException {
|
||||
LOG.debug(String.format("importBlocks(%s)", fileName));
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(fileName));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
XStream xStream = projectFileManager.getXStream();
|
||||
|
||||
BuildingBlockPackage pkg;
|
||||
BuildingBlockPackage pkg = (BuildingBlockPackage) xStream.fromXML(in);
|
||||
|
||||
try {
|
||||
// old way
|
||||
pkg = (BuildingBlockPackage) xStream.fromXML(in);
|
||||
} catch (Exception e) {
|
||||
// new way
|
||||
in = new BufferedInputStream(new FileInputStream(fileName));
|
||||
ProjectFileManager.configure(xStream);
|
||||
pkg = (BuildingBlockPackage) xStream.fromXML(in);
|
||||
}
|
||||
|
||||
in.close();
|
||||
|
||||
if (pkg == null || pkg.getBlocks().isEmpty())
|
||||
@@ -3223,7 +3204,7 @@ public class Presenter implements IPlugInPort {
|
||||
posList.add(new Position(switches.get(j), positions[j]));
|
||||
}
|
||||
List<Connection> connections = getConnections(switchPositions);
|
||||
Netlist graph = constructNetlist(nodes, connections, continuity);
|
||||
Netlist graph = constructNetlist(nodes, connections, continuity, currentProject.getComponents());
|
||||
|
||||
// merge graphs that are effectively the same
|
||||
if (result.containsKey(graph)) {
|
||||
@@ -3255,8 +3236,8 @@ public class Presenter implements IPlugInPort {
|
||||
return netlists;
|
||||
}
|
||||
|
||||
private Netlist constructNetlist(List<Node> nodes, List<Connection> connections, List<Area> continuityAreas) {
|
||||
Netlist netlist = new Netlist();
|
||||
private Netlist constructNetlist(List<Node> nodes, List<Connection> connections, List<Area> continuityAreas, List<IDIYComponent<?>> components) {
|
||||
Netlist netlist = new Netlist(components);
|
||||
|
||||
// debugging code
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
@@ -3363,7 +3344,8 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
@SuppressWarnings({"unchecked", "unlikely-arg-type"})
|
||||
private List<Connection> getConnections(Map<ISwitch, Integer> switchPositions) {
|
||||
Set<Connection> connections = new HashSet<Connection>();
|
||||
Set<Connection> connections = new TreeSet<Connection>();
|
||||
|
||||
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
||||
ComponentType type =
|
||||
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||
|
||||
@@ -1,385 +1,136 @@
|
||||
<map>
|
||||
<entry>
|
||||
<string>TO-92 w/ 2 Leads</string>
|
||||
<list>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J1</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>720</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>740</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>1320</x>
|
||||
<y>250</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../borderColor"/>
|
||||
<leadColor>
|
||||
<red>117</red>
|
||||
<green>157</green>
|
||||
<blue>175</blue>
|
||||
<alpha>255</alpha>
|
||||
</leadColor>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J2</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>780</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>760</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>-177</x>
|
||||
<y>1259</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../borderColor"/>
|
||||
<leadColor>
|
||||
<red>117</red>
|
||||
<green>157</green>
|
||||
<blue>175</blue>
|
||||
<alpha>255</alpha>
|
||||
</leadColor>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.semiconductors.TransistorTO92>
|
||||
<name>Q1</name>
|
||||
<alpha>100</alpha>
|
||||
<value></value>
|
||||
<orientation>DEFAULT</orientation>
|
||||
<controlPoints>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>740</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>750</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>760</y>
|
||||
</java.awt.Point>
|
||||
</controlPoints>
|
||||
<bodyColor>
|
||||
<red>128</red>
|
||||
<green>128</green>
|
||||
<blue>128</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>89</red>
|
||||
<green>89</green>
|
||||
<blue>89</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../../org.diylc.components.connectivity.Jumper/borderColor"/>
|
||||
<display>NAME</display>
|
||||
<folded>false</folded>
|
||||
<pinSpacing>
|
||||
<value>0.05</value>
|
||||
<unit class="org.diylc.core.measures.SizeUnit">in</unit>
|
||||
</pinSpacing>
|
||||
</org.diylc.components.semiconductors.TransistorTO92>
|
||||
</list>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>TO-92 w/ 3 Leads</string>
|
||||
<list>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J1</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>720</x>
|
||||
<y>620</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>760</x>
|
||||
<y>640</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>650</x>
|
||||
<y>-41</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../borderColor"/>
|
||||
<leadColor>
|
||||
<red>117</red>
|
||||
<green>157</green>
|
||||
<blue>175</blue>
|
||||
<alpha>255</alpha>
|
||||
</leadColor>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J2</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>720</x>
|
||||
<y>680</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>760</x>
|
||||
<y>660</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>-206</x>
|
||||
<y>95</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../borderColor"/>
|
||||
<leadColor>
|
||||
<red>117</red>
|
||||
<green>157</green>
|
||||
<blue>175</blue>
|
||||
<alpha>255</alpha>
|
||||
</leadColor>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J3</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>719</x>
|
||||
<y>650</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>760</x>
|
||||
<y>650</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>147</x>
|
||||
<y>-279</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor>
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../borderColor"/>
|
||||
<leadColor>
|
||||
<red>117</red>
|
||||
<green>157</green>
|
||||
<blue>175</blue>
|
||||
<alpha>255</alpha>
|
||||
</leadColor>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.semiconductors.TransistorTO92>
|
||||
<name>Q1</name>
|
||||
<alpha>100</alpha>
|
||||
<value></value>
|
||||
<orientation>DEFAULT</orientation>
|
||||
<controlPoints>
|
||||
<java.awt.Point>
|
||||
<x>760</x>
|
||||
<y>640</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>760</x>
|
||||
<y>650</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>760</x>
|
||||
<y>660</y>
|
||||
</java.awt.Point>
|
||||
</controlPoints>
|
||||
<bodyColor>
|
||||
<red>128</red>
|
||||
<green>128</green>
|
||||
<blue>128</blue>
|
||||
<alpha>255</alpha>
|
||||
</bodyColor>
|
||||
<borderColor>
|
||||
<red>89</red>
|
||||
<green>89</green>
|
||||
<blue>89</blue>
|
||||
<alpha>255</alpha>
|
||||
</borderColor>
|
||||
<labelColor reference="../../org.diylc.components.connectivity.Jumper/borderColor"/>
|
||||
<display>NAME</display>
|
||||
<folded>false</folded>
|
||||
<pinSpacing>
|
||||
<value>0.05</value>
|
||||
<unit class="org.diylc.core.measures.SizeUnit">in</unit>
|
||||
</pinSpacing>
|
||||
</org.diylc.components.semiconductors.TransistorTO92>
|
||||
</list>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>TO-92 w/ 2 Leads</string>
|
||||
<list>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J1</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>720</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>740</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>1320</x>
|
||||
<y>250</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper/bodyColor"/>
|
||||
<borderColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper/borderColor"/>
|
||||
<labelColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper/borderColor"/>
|
||||
<leadColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper/leadColor"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.connectivity.Jumper>
|
||||
<name>J2</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>780</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>760</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>-177</x>
|
||||
<y>1259</y>
|
||||
</java.awt.Point>
|
||||
</points>
|
||||
<bodyColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper[2]/bodyColor"/>
|
||||
<borderColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper[2]/borderColor"/>
|
||||
<labelColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper[2]/borderColor"/>
|
||||
<leadColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper[2]/leadColor"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</org.diylc.components.connectivity.Jumper>
|
||||
<org.diylc.components.semiconductors.TransistorTO92>
|
||||
<name>Q1</name>
|
||||
<alpha>100</alpha>
|
||||
<value></value>
|
||||
<orientation>DEFAULT</orientation>
|
||||
<controlPoints>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>740</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>750</y>
|
||||
</java.awt.Point>
|
||||
<java.awt.Point>
|
||||
<x>580</x>
|
||||
<y>760</y>
|
||||
</java.awt.Point>
|
||||
</controlPoints>
|
||||
<bodyColor reference="../../../../entry/list/org.diylc.components.semiconductors.TransistorTO92/bodyColor"/>
|
||||
<borderColor reference="../../../../entry/list/org.diylc.components.semiconductors.TransistorTO92/borderColor"/>
|
||||
<labelColor reference="../../../../entry/list/org.diylc.components.connectivity.Jumper/borderColor"/>
|
||||
<display>NAME</display>
|
||||
<folded>false</folded>
|
||||
<pinSpacing reference="../../../../entry/list/org.diylc.components.semiconductors.TransistorTO92/pinSpacing"/>
|
||||
</org.diylc.components.semiconductors.TransistorTO92>
|
||||
</list>
|
||||
</entry>
|
||||
</map>
|
||||
<entry>
|
||||
<string>TO-92 w/ 3 Leads</string>
|
||||
<list>
|
||||
<diylc.connectivity.Jumper>
|
||||
<name>J1</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<point x="3.6" y="3.1"/>
|
||||
<point x="3.8" y="3.2"/>
|
||||
<point x="3.25" y="-0.205"/>
|
||||
</points>
|
||||
<bodyColor hex="ffffff"/>
|
||||
<borderColor hex="000000"/>
|
||||
<labelColor hex="000000"/>
|
||||
<leadColor hex="759daf"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</diylc.connectivity.Jumper>
|
||||
<diylc.connectivity.Jumper>
|
||||
<name>J2</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<point x="3.6" y="3.4"/>
|
||||
<point x="3.8" y="3.3"/>
|
||||
<point x="-1.03" y="0.475"/>
|
||||
</points>
|
||||
<bodyColor hex="ffffff"/>
|
||||
<borderColor hex="000000"/>
|
||||
<labelColor hex="000000"/>
|
||||
<leadColor hex="759daf"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</diylc.connectivity.Jumper>
|
||||
<diylc.connectivity.Jumper>
|
||||
<name>J3</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<point x="3.595" y="3.25"/>
|
||||
<point x="3.8" y="3.25"/>
|
||||
<point x="0.735" y="-1.395"/>
|
||||
</points>
|
||||
<bodyColor hex="ffffff"/>
|
||||
<borderColor hex="000000"/>
|
||||
<labelColor hex="000000"/>
|
||||
<leadColor hex="759daf"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</diylc.connectivity.Jumper>
|
||||
<diylc.semiconductors.TransistorTO92>
|
||||
<name>Q1</name>
|
||||
<alpha>100</alpha>
|
||||
<value></value>
|
||||
<orientation>DEFAULT</orientation>
|
||||
<controlPoints>
|
||||
<point x="3.8" y="3.2"/>
|
||||
<point x="3.8" y="3.25"/>
|
||||
<point x="3.8" y="3.3"/>
|
||||
</controlPoints>
|
||||
<bodyColor hex="808080"/>
|
||||
<borderColor hex="595959"/>
|
||||
<labelColor hex="000000"/>
|
||||
<display>NAME</display>
|
||||
<folded>false</folded>
|
||||
<pinSpacing value="0.05" unit="in"/>
|
||||
</diylc.semiconductors.TransistorTO92>
|
||||
</list>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>TO-92 w/ 2 Leads</string>
|
||||
<list>
|
||||
<diylc.connectivity.Jumper>
|
||||
<name>J1</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<point x="2.9" y="3.6"/>
|
||||
<point x="2.9" y="3.7"/>
|
||||
<point x="6.6" y="1.25"/>
|
||||
</points>
|
||||
<bodyColor hex="ffffff"/>
|
||||
<borderColor hex="000000"/>
|
||||
<labelColor hex="000000"/>
|
||||
<leadColor hex="759daf"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</diylc.connectivity.Jumper>
|
||||
<diylc.connectivity.Jumper>
|
||||
<name>J2</name>
|
||||
<alpha>127</alpha>
|
||||
<points>
|
||||
<point x="2.9" y="3.9"/>
|
||||
<point x="2.9" y="3.8"/>
|
||||
<point x="-0.885" y="6.295"/>
|
||||
</points>
|
||||
<bodyColor hex="ffffff"/>
|
||||
<borderColor hex="000000"/>
|
||||
<labelColor hex="000000"/>
|
||||
<leadColor hex="759daf"/>
|
||||
<display>NAME</display>
|
||||
<flipStanding>false</flipStanding>
|
||||
<labelOriantation>Directional</labelOriantation>
|
||||
<moveLabel>false</moveLabel>
|
||||
<style>SOLID</style>
|
||||
</diylc.connectivity.Jumper>
|
||||
<diylc.semiconductors.TransistorTO92>
|
||||
<name>Q1</name>
|
||||
<alpha>100</alpha>
|
||||
<value></value>
|
||||
<orientation>DEFAULT</orientation>
|
||||
<controlPoints>
|
||||
<point x="2.9" y="3.7"/>
|
||||
<point x="2.9" y="3.75"/>
|
||||
<point x="2.9" y="3.8"/>
|
||||
</controlPoints>
|
||||
<bodyColor hex="808080"/>
|
||||
<borderColor hex="595959"/>
|
||||
<labelColor hex="000000"/>
|
||||
<display>NAME</display>
|
||||
<folded>false</folded>
|
||||
<pinSpacing value="0.05" unit="in"/>
|
||||
</diylc.semiconductors.TransistorTO92>
|
||||
</list>
|
||||
</entry>
|
||||
</map>
|
||||
@@ -3781,5 +3781,25 @@
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
<org.diylc.appframework.update.Version>
|
||||
<versionNumber>
|
||||
<major>4</major>
|
||||
<minor>22</minor>
|
||||
<build>2</build>
|
||||
</versionNumber>
|
||||
<releaseDate>2022-03-18 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Fixed the issue with application hanging when loading certain files</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Fixed importing building blocks and variants from a file</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>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,13 @@ public class ProjectFileManager {
|
||||
private XStream xStream;
|
||||
// Legacy deserializer for 3.0.1 through 3.0.7, loads Points referenced in
|
||||
// pixels.
|
||||
private XStream xStreamOld;
|
||||
private XStream xStreamOld;
|
||||
|
||||
public static final XStream xStreamSerializer = new XStream(new DomDriver("UTF-8"));
|
||||
|
||||
static {
|
||||
configure(xStreamSerializer);
|
||||
}
|
||||
|
||||
private String currentFileName = null;
|
||||
private boolean modified = false;
|
||||
@@ -100,7 +106,7 @@ public class ProjectFileManager {
|
||||
configure(xStream);
|
||||
this.xStreamOld = new XStream(new DomDriver());
|
||||
this.xStreamOld.addPermission(AnyTypePermission.ANY);
|
||||
xStreamOld.autodetectAnnotations(true);
|
||||
this.xStreamOld.autodetectAnnotations(true);
|
||||
this.messageDispatcher = messageDispatcher;
|
||||
}
|
||||
|
||||
@@ -109,25 +115,23 @@ public class ProjectFileManager {
|
||||
xStream.alias("point", java.awt.geom.Point2D.class);
|
||||
xStream.alias("point", java.awt.geom.Point2D.Double.class);
|
||||
xStream.alias("font", java.awt.Font.class);
|
||||
// TODO figure out why I commented this out
|
||||
// xStream.alias("color", java.awt.Color.class);
|
||||
xStream.alias("project", Project.class);
|
||||
xStream.aliasPackage("diylc", "org.diylc.components");
|
||||
xStream.registerConverter(new PointConverter());
|
||||
xStream.registerConverter(new ColorConverter());
|
||||
xStream.registerConverter(new FontConverter());
|
||||
xStream.registerConverter(new MeasureConverter());
|
||||
xStream.registerConverter(new AreaConverter());
|
||||
xStream.addImmutableType(Color.class);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.class);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.Double.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Voltage.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Resistance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Capacitance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Current.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Power.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Inductance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Size.class);
|
||||
xStream.registerConverter(new AreaConverter());
|
||||
xStream.addImmutableType(Color.class, true);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.class, true);
|
||||
xStream.addImmutableType(java.awt.geom.Point2D.Double.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Voltage.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Resistance.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Capacitance.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Current.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Power.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Inductance.class, true);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Size.class, true);
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
}
|
||||
|
||||
@@ -303,6 +307,9 @@ public class ProjectFileManager {
|
||||
int build = Integer.parseInt(n.getFirstChild().getNodeValue());
|
||||
|
||||
return new VersionNumber(major, minor, build);
|
||||
|
||||
}
|
||||
|
||||
public XStream getXStream() {
|
||||
return xStream;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user