mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
ground work for graph analysis
This commit is contained in:
@@ -122,6 +122,11 @@ public class BlankBoard extends AbstractBoard {
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
static enum Type {
|
||||
|
||||
@@ -364,7 +364,12 @@ public class Breadboard extends AbstractComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum BreadboardSize {
|
||||
Half, Full
|
||||
|
||||
@@ -119,6 +119,11 @@ public class EyeletBoard extends AbstractBoard {
|
||||
|
||||
public void setSpacing(Size spacing) {
|
||||
this.spacing = spacing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -103,6 +103,11 @@ public class MarshallPerfBoard extends AbstractBoard {
|
||||
|
||||
public void setSpacing(Size spacing) {
|
||||
this.spacing = spacing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -112,6 +112,11 @@ public class PerfBoard extends AbstractBoard {
|
||||
|
||||
public void setSpacing(Size spacing) {
|
||||
this.spacing = spacing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -449,5 +449,10 @@ public class TerminalStrip extends AbstractTransparentComponent<String> {
|
||||
|
||||
public void setBorderColor(Color borderColor) {
|
||||
this.borderColor = borderColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return "TerminalStrip" + index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,5 +236,10 @@ public class TriPadBoard extends AbstractBoard {
|
||||
} else {
|
||||
this.stripSpan = stripSpan;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,11 @@ public class VeroBoard extends AbstractBoard {
|
||||
|
||||
public void setOrientation(OrientationHV orientation) {
|
||||
this.orientation = orientation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -162,4 +162,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||
protected boolean IsCopperArea() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,4 +111,9 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
public LineStyle getStyle() {
|
||||
return super.getStyle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,4 +157,9 @@ public class CutLine extends AbstractTransparentComponent<Void> {
|
||||
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,5 +126,10 @@ public class Dot extends AbstractComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,5 +164,10 @@ public class Eyelet extends AbstractComponent<String> {
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,12 @@ public class GroundFill extends AbstractComponent<Void> {
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
|
||||
@@ -132,5 +132,5 @@ public class HookupWire extends AbstractCurvedComponent<Void> {
|
||||
|
||||
public void setStripeColor(Color stripeColor) {
|
||||
this.stripeColor = stripeColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,6 +262,11 @@ public class Line extends AbstractLeadedComponent<Void> {
|
||||
@Override
|
||||
protected Size getDefaultLength() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -182,6 +182,11 @@ public class SolderPad extends AbstractComponent<Void> {
|
||||
public Void getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@@ -230,5 +230,10 @@ public class TraceCut extends AbstractComponent<Void> {
|
||||
@Override
|
||||
public String getName() {
|
||||
return super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,5 +162,10 @@ public class Turret extends AbstractComponent<String> {
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.awt.Rectangle;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
@@ -426,9 +426,7 @@ public class MiniRelay extends AbstractTransparentComponent<String> {
|
||||
}
|
||||
|
||||
public static enum RelayType {
|
||||
|
||||
SPDT, DPDT;
|
||||
|
||||
}
|
||||
|
||||
public static enum RelaySize {
|
||||
|
||||
+48
-1
@@ -39,6 +39,7 @@ import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.ISwitch;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
@@ -52,7 +53,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Mini Toggle Switch", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||
description = "Panel mounted mini toggle switch", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
instanceNamePrefix = "SW", autoEdit = false)
|
||||
public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchType> {
|
||||
public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchType> implements ISwitch {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -377,5 +378,51 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
||||
|
||||
public void setBorderColor(Color borderColor) {
|
||||
this.borderColor = borderColor;
|
||||
}
|
||||
|
||||
// switch stuff
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
// we don't want the switch to produce any nodes, it just makes connections
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPositionCount() {
|
||||
switch (switchType) {
|
||||
case SPST:
|
||||
case SPDT:
|
||||
case DPDT:
|
||||
case _3PDT:
|
||||
case _4PDT:
|
||||
case _5PDT:
|
||||
return 2;
|
||||
case _DP3T_mustang:
|
||||
return 3;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPositionName(int position) {
|
||||
return Integer.toString(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean arePointsConnected(int index1, int index2, int position) {
|
||||
switch (switchType) {
|
||||
case SPST:
|
||||
return position == 1;
|
||||
case SPDT:
|
||||
case DPDT:
|
||||
case _3PDT:
|
||||
case _4PDT:
|
||||
case _5PDT:
|
||||
return (index2 - index1) < 3 && index1 % 3 == position && index2 % 3 == position + 1;
|
||||
case _DP3T_mustang:
|
||||
return (index2 - index1) < 3 && index1 % 3 == 0 && index2 % 3 == position + 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,5 +422,5 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
||||
updateControlPoints();
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,5 +314,10 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
|
||||
updateControlPoints();
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + (index == 0 ? "Tip" : "Sleeve");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,6 +567,11 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
||||
this.coilType2 = coilType2;
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return "PickupTerminal";
|
||||
}
|
||||
|
||||
public static enum HumbuckerType {
|
||||
|
||||
@@ -325,5 +325,10 @@ public class JazzBassPickup extends AbstractTransparentComponent<String> {
|
||||
|
||||
public void setPoleColor(Color poleColor) {
|
||||
this.poleColor = poleColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + ".PickupTerminal";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.awt.geom.Area;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
@@ -365,8 +365,8 @@ public class LeverSwitch extends AbstractTransparentComponent<String> {
|
||||
updateControlPoints();
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum LeverSwitchType {
|
||||
DP3T("DP3T (Standard Strat)"), _4P5T("4P5T (Super/Mega)"), DP5T("DP5T");
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
@@ -349,6 +349,11 @@ public class P90Pickup extends AbstractTransparentComponent<String> {
|
||||
|
||||
public void setPoleColor(Color poleColor) {
|
||||
this.poleColor = poleColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + ".PickupTerminal";
|
||||
}
|
||||
|
||||
public enum P90Type {
|
||||
|
||||
@@ -313,5 +313,10 @@ public class PBassPickup extends AbstractTransparentComponent<String> {
|
||||
|
||||
public void setPoleColor(Color poleColor) {
|
||||
this.poleColor = poleColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + ".PickupTerminal";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.awt.geom.Area;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
@@ -464,6 +464,11 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
||||
|
||||
public void setPoleColor(Color poleColor) {
|
||||
this.poleColor = poleColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + ".PickupTerminal";
|
||||
}
|
||||
|
||||
public enum SingleCoilType {
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.awt.Point;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -58,7 +58,12 @@ public class BOM extends AbstractComponent<Void> {
|
||||
private Size size = DEFAULT_SIZE;
|
||||
|
||||
private Point point = new Point(0, 0);
|
||||
private Color color = COLOR;
|
||||
private Color color = COLOR;
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.diylc.components.misc;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
|
||||
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -130,7 +130,10 @@ public class BatterySymbol extends AbstractSchematicLeadedSymbol<String> {
|
||||
* width / 32);
|
||||
g2d.drawLine(height / 2 - 6 * width / 32, height / 2 - 3 * width / 32, height / 2 - 6 * width / 32, height / 2 - 7
|
||||
* width / 32);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + "." + (index == 0 ? "+" : "-");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Polygon;
|
||||
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
@@ -134,6 +134,11 @@ public class GroundSymbol extends AbstractComponent<Void> {
|
||||
@Override
|
||||
public void setControlPoint(Point point, int index) {
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,9 +27,9 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
||||
import org.diylc.appframework.miscutils.IconImageConverter;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
@@ -41,7 +41,7 @@ import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.PercentEditor;
|
||||
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
|
||||
@ComponentDescriptor(name = "Image", author = "Branislav Stojkovic", category = "Misc",
|
||||
@@ -60,6 +60,11 @@ public class Image extends AbstractTransparentComponent<Void> {
|
||||
if (imgURL != null) {
|
||||
ICON = new ImageIcon(imgURL, name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Point point = new Point(0, 0);
|
||||
|
||||
@@ -282,5 +282,10 @@ public class Label extends AbstractComponent<String> {
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.text = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,5 +311,10 @@ public class PCBText extends AbstractComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.components.Abstract3LegSymbol;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -116,5 +116,10 @@ public class BJTSymbol extends Abstract3LegSymbol {
|
||||
this.polarity = polarity;
|
||||
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + "." + index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,11 @@ public abstract class AbstractShape extends AbstractTransparentComponent<Void> {
|
||||
Math.min(controlPoints[0].y, controlPoints[1].y));
|
||||
secondPoint.setLocation(Math.max(controlPoints[0].x, controlPoints[1].x),
|
||||
Math.max(controlPoints[0].y, controlPoints[1].y));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
Reference in New Issue
Block a user