mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
add caching support to more component types
This commit is contained in:
@@ -41,4 +41,8 @@ public class Counter {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%dx %dms", count, TimeUnit.MILLISECONDS.convert(nanotime, TimeUnit.NANOSECONDS));
|
return String.format("%dx %dms", count, TimeUnit.MILLISECONDS.convert(nanotime, TimeUnit.NANOSECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toAvgString() {
|
||||||
|
return String.format("%dx %dms avg", count, TimeUnit.MILLISECONDS.convert(nanotime / count, TimeUnit.NANOSECONDS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class DrawingCache {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void draw(IDIYComponent<?> component, G2DWrapper g2d, ComponentState componentState,
|
public void draw(IDIYComponent<?> component, G2DWrapper g2d, ComponentState componentState,
|
||||||
boolean outlineMode, Project project, double zoom, boolean trackArea) {
|
boolean outlineMode, Project project, double zoom) {
|
||||||
ComponentType type = ComponentProcessor.getInstance()
|
ComponentType type = ComponentProcessor.getInstance()
|
||||||
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) component.getClass());
|
.extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) component.getClass());
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class DrawingCache {
|
|||||||
// only honor the cache if the component hasn't changed in the meantime
|
// only honor the cache if the component hasn't changed in the meantime
|
||||||
if (value == null || !value.getComponent().equalsTo(component)
|
if (value == null || !value.getComponent().equalsTo(component)
|
||||||
|| value.getState() != componentState || value.getZoom() != zoom) {
|
|| value.getState() != componentState || value.getZoom() != zoom) {
|
||||||
LOG.trace("Rendering " + component.getName() + " for cache.");
|
// figure out size and placement of buffer image
|
||||||
Rectangle2D rect = component.getCachingBounds();
|
Rectangle2D rect = component.getCachingBounds();
|
||||||
int width = (int)Math.round(rect.getWidth() * zoom);
|
int width = (int)Math.round(rect.getWidth() * zoom);
|
||||||
int height = (int)Math.round(rect.getHeight() * zoom);
|
int height = (int)Math.round(rect.getHeight() * zoom);
|
||||||
@@ -100,9 +100,6 @@ public class DrawingCache {
|
|||||||
|
|
||||||
// initialize wrapper
|
// initialize wrapper
|
||||||
wrapper.startedDrawingComponent();
|
wrapper.startedDrawingComponent();
|
||||||
if (!trackArea) {
|
|
||||||
wrapper.stopTracking();
|
|
||||||
}
|
|
||||||
|
|
||||||
long componentStart = System.nanoTime();
|
long componentStart = System.nanoTime();
|
||||||
|
|
||||||
@@ -135,6 +132,10 @@ public class DrawingCache {
|
|||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (wrapper.getCurrentArea() == null || wrapper.getCurrentArea().isEmpty()) {
|
||||||
|
LOG.warn("Empty outline area detected for " + component.getName());
|
||||||
|
}
|
||||||
|
|
||||||
// add to the cache
|
// add to the cache
|
||||||
value = new CacheValue(component, image, wrapper.getCurrentArea(), wrapper.getContinuityPositiveAreas(),
|
value = new CacheValue(component, image, wrapper.getCurrentArea(), wrapper.getContinuityPositiveAreas(),
|
||||||
wrapper.getContinuityNegativeAreas(), componentState, zoom, dx, dy);
|
wrapper.getContinuityNegativeAreas(), componentState, zoom, dx, dy);
|
||||||
@@ -170,11 +171,13 @@ public class DrawingCache {
|
|||||||
stats.getSecond().add(componentEnd - componentStart);
|
stats.getSecond().add(componentEnd - componentStart);
|
||||||
|
|
||||||
// copy over tracking area from the cache
|
// copy over tracking area from the cache
|
||||||
g2d.merge(value.getCurrentArea(), value.getContinuityPositiveAreas(), value.getContinuityNegativeAreas());
|
g2d.merge(value.getCurrentArea(), value.getContinuityPositiveAreas(), value.getContinuityNegativeAreas());
|
||||||
} else {
|
} else {
|
||||||
// no caching, just draw as usual
|
// no caching, just draw as usual
|
||||||
component.draw(g2d, componentState, outlineMode, project, g2d);
|
component.draw(g2d, componentState, outlineMode, project, g2d);
|
||||||
}
|
}
|
||||||
|
g2d.stopTracking();
|
||||||
|
g2d.stopTrackingContinuityArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logStats() {
|
public void logStats() {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@@ -111,6 +110,7 @@ public class DrawingManager {
|
|||||||
private Map<String, Counter> renderStatsByType = new HashMap<String, Counter>();
|
private Map<String, Counter> renderStatsByType = new HashMap<String, Counter>();
|
||||||
private long lastStatsReportedTime = System.currentTimeMillis();
|
private long lastStatsReportedTime = System.currentTimeMillis();
|
||||||
private long statReportFrequencyMs = 1000 * 60;
|
private long statReportFrequencyMs = 1000 * 60;
|
||||||
|
private Counter totalStats = new Counter();
|
||||||
|
|
||||||
public DrawingManager(MessageDispatcher<EventType> messageDispatcher) {
|
public DrawingManager(MessageDispatcher<EventType> messageDispatcher) {
|
||||||
super();
|
super();
|
||||||
@@ -145,7 +145,7 @@ public class DrawingManager {
|
|||||||
IComponentFiler filter, Rectangle selectionRect, Collection<IDIYComponent<?>> selectedComponents,
|
IComponentFiler filter, Rectangle selectionRect, Collection<IDIYComponent<?>> selectedComponents,
|
||||||
Set<IDIYComponent<?>> lockedComponents, Set<IDIYComponent<?>> groupedComponents, List<Point> controlPointSlot,
|
Set<IDIYComponent<?>> lockedComponents, Set<IDIYComponent<?>> groupedComponents, List<Point> controlPointSlot,
|
||||||
List<IDIYComponent<?>> componentSlot, boolean dragInProgress, Double externalZoom) {
|
List<IDIYComponent<?>> componentSlot, boolean dragInProgress, Double externalZoom) {
|
||||||
long start = System.nanoTime();
|
long totalStartTime = System.nanoTime();
|
||||||
failedComponents.clear();
|
failedComponents.clear();
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
return failedComponents;
|
return failedComponents;
|
||||||
@@ -287,7 +287,7 @@ public class DrawingManager {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if (drawOptions.contains(DrawOption.ENABLE_CACHING)) // go through the DrawingCache
|
if (drawOptions.contains(DrawOption.ENABLE_CACHING)) // go through the DrawingCache
|
||||||
DrawingCache.Instance.draw(component, g2dWrapper, state, drawOptions.contains(DrawOption.OUTLINE_MODE), project, zoom, trackArea);
|
DrawingCache.Instance.draw(component, g2dWrapper, state, drawOptions.contains(DrawOption.OUTLINE_MODE), project, zoom);
|
||||||
else // go stragiht to the wrapper
|
else // go stragiht to the wrapper
|
||||||
component.draw(g2dWrapper, state, drawOptions.contains(DrawOption.OUTLINE_MODE), project, g2dWrapper);
|
component.draw(g2dWrapper, state, drawOptions.contains(DrawOption.OUTLINE_MODE), project, g2dWrapper);
|
||||||
|
|
||||||
@@ -453,10 +453,9 @@ public class DrawingManager {
|
|||||||
g2d.fill(extraSpaceArea);
|
g2d.fill(extraSpaceArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
long end = System.nanoTime();
|
long totalEndTime = System.nanoTime();
|
||||||
|
|
||||||
long ms = TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS);
|
totalStats.add(totalEndTime - totalStartTime);
|
||||||
LOG.trace(String.format("Render time = %d ms", ms));
|
|
||||||
|
|
||||||
logStats();
|
logStats();
|
||||||
|
|
||||||
@@ -471,6 +470,7 @@ public class DrawingManager {
|
|||||||
.map(e -> e.toString())
|
.map(e -> e.toString())
|
||||||
.collect(Collectors.joining("; ", "{", "}"));
|
.collect(Collectors.joining("; ", "{", "}"));
|
||||||
LOG.debug("Render stats: " + mapAsString);
|
LOG.debug("Render stats: " + mapAsString);
|
||||||
|
LOG.debug("Page stats: " + totalStats.toAvgString());
|
||||||
DrawingCache.Instance.logStats();
|
DrawingCache.Instance.logStats();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2884,6 +2884,26 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<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>3</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2020-04-05 00:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added component-level caching that should speed up rendering dramatically. While in experimental phase, it will be exposed as "Enable Cache Boost" item in the "Config" menu so it can be turned off if it causes any issues</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Switched terminal on the "Open Jack 1/4" does not stick to other components</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
|
|||||||
Binary file not shown.
@@ -251,6 +251,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
if (bodyColor != null) {
|
if (bodyColor != null) {
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||||
|
|
||||||
|
drawingObserver.startTracking();
|
||||||
|
|
||||||
if (!outlineMode && ConfigurationManager.getInstance().readBoolean(IPlugInPort.HI_QUALITY_RENDER_KEY, false)) {
|
if (!outlineMode && ConfigurationManager.getInstance().readBoolean(IPlugInPort.HI_QUALITY_RENDER_KEY, false)) {
|
||||||
Point p1 = new Point((int) (length / 2), 0);
|
Point p1 = new Point((int) (length / 2), 0);
|
||||||
Point p2 = new Point((int) (length / 2), (int) width);
|
Point p2 = new Point((int) (length / 2), (int) width);
|
||||||
@@ -262,6 +264,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
} else {
|
} else {
|
||||||
g2d.fill(shape);
|
g2d.fill(shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawingObserver.stopTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingObserver.stopTracking();
|
drawingObserver.stopTracking();
|
||||||
@@ -287,8 +291,16 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
: borderColor;
|
: borderColor;
|
||||||
}
|
}
|
||||||
g2d.setColor(finalBorderColor);
|
g2d.setColor(finalBorderColor);
|
||||||
|
|
||||||
|
// if we are not filling the shape with color we need to ensure that we track the outline (e.g. with schematic symbols)
|
||||||
|
if (bodyColor == null)
|
||||||
|
drawingObserver.startTracking();
|
||||||
|
|
||||||
g2d.draw(shape);
|
g2d.draw(shape);
|
||||||
|
|
||||||
|
if (bodyColor == null)
|
||||||
|
drawingObserver.stopTracking();
|
||||||
|
|
||||||
if (decorateAboveBorder()) {
|
if (decorateAboveBorder()) {
|
||||||
g2d.setComposite(newComposite);
|
g2d.setComposite(newComposite);
|
||||||
decorateComponentBody(g2d, outlineMode);
|
decorateComponentBody(g2d, outlineMode);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ package org.diylc.components.connectivity;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.SimpleComponentTransformer;
|
import org.diylc.common.SimpleComponentTransformer;
|
||||||
@@ -46,7 +47,8 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Eyelet", category = "Connectivity", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Eyelet", category = "Connectivity", author = "Branislav Stojkovic",
|
||||||
description = "Eyelet or turret terminal", instanceNamePrefix = "Eyelet",
|
description = "Eyelet or turret terminal", instanceNamePrefix = "Eyelet",
|
||||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false,
|
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false,
|
||||||
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = SimpleComponentTransformer.class)
|
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = SimpleComponentTransformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class Eyelet extends AbstractComponent<String> {
|
public class Eyelet extends AbstractComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -169,5 +171,11 @@ public class Eyelet extends AbstractComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
double size = getSize().convertToPixels();
|
||||||
|
return new Rectangle2D.Double(point.getX() - size, point.getY() - size, size * 2, size * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,16 +78,16 @@ public class HookupWire extends AbstractCurvedComponent<Void> implements IContin
|
|||||||
stroke = ObjectCache.getInstance().fetchStroke(thickness, new float[] {thickness / 4, thickness * 3}, 0, BasicStroke.CAP_ROUND);
|
stroke = ObjectCache.getInstance().fetchStroke(thickness, new float[] {thickness / 4, thickness * 3}, 0, BasicStroke.CAP_ROUND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Shape s = stroke.createStrokedShape(curve);
|
Shape s = stroke.createStrokedShape(curve);
|
||||||
|
drawingObserver.startTracking();
|
||||||
g2d.fill(s);
|
g2d.fill(s);
|
||||||
|
drawingObserver.stopTracking();
|
||||||
|
|
||||||
if (getStriped()) {
|
if (getStriped()) {
|
||||||
stroke = ObjectCache.getInstance().fetchStroke(thickness, new float[] { thickness / 2, thickness * 2 }, thickness * 10, BasicStroke.CAP_BUTT);
|
stroke = ObjectCache.getInstance().fetchStroke(thickness, new float[] { thickness / 2, thickness * 2 }, thickness * 10, BasicStroke.CAP_BUTT);
|
||||||
Shape stripe = stroke.createStrokedShape(curve);
|
Shape stripe = stroke.createStrokedShape(curve);
|
||||||
g2d.setColor(getStripeColor());
|
g2d.setColor(getStripeColor());
|
||||||
drawingObserver.stopTracking();
|
g2d.fill(stripe);
|
||||||
g2d.fill(stripe);
|
|
||||||
drawingObserver.startTracking();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingObserver.stopTracking();
|
drawingObserver.stopTracking();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Solder Pad", category = "Connectivity", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Solder Pad", category = "Connectivity", author = "Branislav Stojkovic",
|
||||||
description = "Copper solder pad, round or square", instanceNamePrefix = "Pad",
|
description = "Copper solder pad, round or square", instanceNamePrefix = "Pad",
|
||||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class, enableCache = true)
|
||||||
public class SolderPad extends AbstractComponent<Void> {
|
public class SolderPad extends AbstractComponent<Void> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -190,6 +190,12 @@ public class SolderPad extends AbstractComponent<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(Void value) {}
|
public void setValue(Void value) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
double size = getSize().convertToPixels();
|
||||||
|
return new Rectangle2D.Double(point.getX() - size, point.getY() - size, size * 2, size * 2);
|
||||||
|
}
|
||||||
|
|
||||||
public static enum Type {
|
public static enum Type {
|
||||||
ROUND, SQUARE, OVAL_HORIZONTAL, OVAL_VERTICAL;
|
ROUND, SQUARE, OVAL_HORIZONTAL, OVAL_VERTICAL;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ package org.diylc.components.connectivity;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.SimpleComponentTransformer;
|
import org.diylc.common.SimpleComponentTransformer;
|
||||||
@@ -45,7 +46,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Trace Cut", category = "Connectivity", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Trace Cut", category = "Connectivity", author = "Branislav Stojkovic",
|
||||||
description = "Designates the place where a trace on the vero board needs to be cut", instanceNamePrefix = "Cut",
|
description = "Designates the place where a trace on the vero board needs to be cut", instanceNamePrefix = "Cut",
|
||||||
zOrder = IDIYComponent.BOARD + 1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
zOrder = IDIYComponent.BOARD + 1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||||
transformer = SimpleComponentTransformer.class)
|
transformer = SimpleComponentTransformer.class, enableCache = true)
|
||||||
public class TraceCut extends AbstractComponent<Void> {
|
public class TraceCut extends AbstractComponent<Void> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -237,5 +238,11 @@ public class TraceCut extends AbstractComponent<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
double size = getSize().convertToPixels();
|
||||||
|
return new Rectangle2D.Double(point.getX() - size, point.getY() - size, size * 2, size * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ package org.diylc.components.connectivity;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.SimpleComponentTransformer;
|
import org.diylc.common.SimpleComponentTransformer;
|
||||||
@@ -44,7 +45,8 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Turret Lug", category = "Connectivity", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Turret Lug", category = "Connectivity", author = "Branislav Stojkovic",
|
||||||
description = "Turret terminal lug", instanceNamePrefix = "Turret",
|
description = "Turret terminal lug", instanceNamePrefix = "Turret",
|
||||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false,
|
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false,
|
||||||
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = SimpleComponentTransformer.class)
|
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = SimpleComponentTransformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class Turret extends AbstractComponent<String> {
|
public class Turret extends AbstractComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -167,5 +169,11 @@ public class Turret extends AbstractComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public String getControlPointNodeName(int index) {
|
public String getControlPointNodeName(int index) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
double size = getSize().convertToPixels();
|
||||||
|
return new Rectangle2D.Double(point.getX() - size, point.getY() - size, size * 2, size * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
@@ -56,7 +57,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Cliff 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Cliff 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Cliff-style closed panel mount 1/4\" phono jack",
|
description = "Cliff-style closed panel mount 1/4\" phono jack",
|
||||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = CliffJackTransformer.class)
|
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = CliffJackTransformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -345,5 +347,17 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Area[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Area a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(a);
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import java.awt.geom.AffineTransform;
|
|||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
import java.awt.geom.GeneralPath;
|
import java.awt.geom.GeneralPath;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.awt.StringUtils;
|
import org.diylc.awt.StringUtils;
|
||||||
@@ -56,7 +57,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Closed 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Closed 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Enclosed panel mount 1/4\" phono jack", zOrder = IDIYComponent.COMPONENT,
|
description = "Enclosed panel mount 1/4\" phono jack", zOrder = IDIYComponent.COMPONENT,
|
||||||
instanceNamePrefix = "J", autoEdit = false, transformer = ClosedJackTransformer.class)
|
instanceNamePrefix = "J", autoEdit = false, transformer = ClosedJackTransformer.class, enableCache = true)
|
||||||
public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -369,5 +370,17 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Shape[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Shape a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(new Area(a));
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "DIP Switch", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
@ComponentDescriptor(name = "DIP Switch", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
||||||
instanceNamePrefix = "SW", description = "Dual-in-line package switch",
|
instanceNamePrefix = "SW", description = "Dual-in-line package switch",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class DIPSwitch extends AbstractTransparentComponent<String> implements ISwitch {
|
public class DIPSwitch extends AbstractTransparentComponent<String> implements ISwitch {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -544,6 +545,13 @@ public class DIPSwitch extends AbstractTransparentComponent<String> implements I
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
|
}
|
||||||
|
|
||||||
private String toBinary(int n) {
|
private String toBinary(int n) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
do {
|
do {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Fuse Holder (Panel)", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Fuse Holder (Panel)", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Panel mounted fuse holder", zOrder = IDIYComponent.COMPONENT,
|
description = "Panel mounted fuse holder", zOrder = IDIYComponent.COMPONENT,
|
||||||
instanceNamePrefix = "FH", autoEdit = false)
|
instanceNamePrefix = "FH", autoEdit = false, enableCache = true)
|
||||||
public class FuseHolderPanel extends AbstractMultiPartComponent<String> {
|
public class FuseHolderPanel extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -337,5 +337,12 @@ public class FuseHolderPanel extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.awt.Point;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
@@ -51,7 +52,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "IEC Socket", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "IEC Socket", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Panel mounted IEC power socket", zOrder = IDIYComponent.COMPONENT,
|
description = "Panel mounted IEC power socket", zOrder = IDIYComponent.COMPONENT,
|
||||||
instanceNamePrefix = "IEC", autoEdit = false)
|
instanceNamePrefix = "IEC", autoEdit = false, enableCache = true)
|
||||||
public class IECSocket extends AbstractMultiPartComponent<String> {
|
public class IECSocket extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -391,5 +392,12 @@ public class IECSocket extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Mini Relay", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
@ComponentDescriptor(name = "Mini Relay", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
||||||
instanceNamePrefix = "RY", description = "Miniature PCB mount relay, like Omron G5V-1 or G5V-2",
|
instanceNamePrefix = "RY", description = "Miniature PCB mount relay, like Omron G5V-1 or G5V-2",
|
||||||
zOrder = IDIYComponent.COMPONENT)
|
zOrder = IDIYComponent.COMPONENT, enableCache = true)
|
||||||
public class MiniRelay extends AbstractTransparentComponent<String> {
|
public class MiniRelay extends AbstractTransparentComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -430,6 +430,28 @@ public class MiniRelay extends AbstractTransparentComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int minX = Integer.MAX_VALUE;
|
||||||
|
int maxX = Integer.MIN_VALUE;
|
||||||
|
int minY = Integer.MAX_VALUE;
|
||||||
|
int maxY = Integer.MIN_VALUE;
|
||||||
|
int margin = 50;
|
||||||
|
for (int i = 0; i < getControlPointCount(); i++) {
|
||||||
|
Point p = getControlPoint(i);
|
||||||
|
if (p.x < minX)
|
||||||
|
minX = p.x;
|
||||||
|
if (p.x > maxX)
|
||||||
|
maxX = p.x;
|
||||||
|
if (p.y < minY)
|
||||||
|
minY = p.y;
|
||||||
|
if (p.y > maxY)
|
||||||
|
maxY = p.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum RelayType {
|
public static enum RelayType {
|
||||||
|
|||||||
+9
-1
@@ -29,6 +29,7 @@ import java.awt.Point;
|
|||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
@@ -52,7 +53,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Mini Toggle Switch", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Mini Toggle Switch", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Panel mounted mini toggle switch", zOrder = IDIYComponent.COMPONENT,
|
description = "Panel mounted mini toggle switch", zOrder = IDIYComponent.COMPONENT,
|
||||||
instanceNamePrefix = "SW", autoEdit = false)
|
instanceNamePrefix = "SW", autoEdit = false, enableCache = true)
|
||||||
public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchType> implements ISwitch {
|
public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchType> implements ISwitch {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -454,5 +455,12 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
|||||||
return (index2 - index1) < 3 && index1 % 3 == 0 && index2 % 3 == position + 1;
|
return (index2 - index1) < 3 && index1 % 3 == 0 && index2 % 3 == position + 1;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody().getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
@@ -54,7 +55,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Open 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Open 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Switchcraft-style open panel mount 1/4\" phono jack, stereo and mono",
|
description = "Switchcraft-style open panel mount 1/4\" phono jack, stereo and mono",
|
||||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J")
|
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
|
||||||
public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final double RING_THETA = Math.PI * 0.795;
|
private static final double RING_THETA = Math.PI * 0.795;
|
||||||
@@ -323,7 +324,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isControlPointSticky(int index) {
|
public boolean isControlPointSticky(int index) {
|
||||||
return index < 2 || getType() == OpenJackType.STEREO;
|
return index < 2 || (getType() == OpenJackType.STEREO || getType() == OpenJackType.SWITCHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -409,6 +410,18 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Area[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Area a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(a);
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
|
}
|
||||||
|
|
||||||
public enum OpenJackType {
|
public enum OpenJackType {
|
||||||
|
|
||||||
MONO, STEREO, SWITCHED;
|
MONO, STEREO, SWITCHED;
|
||||||
|
|||||||
+13
-1
@@ -53,7 +53,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Pilot Lamp Holder", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Pilot Lamp Holder", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Fender-style pilot bulb holder for T2 and T-3 ¼ miniature bayonet lamps",
|
description = "Fender-style pilot bulb holder for T2 and T-3 ¼ miniature bayonet lamps",
|
||||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PL")
|
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PL", enableCache = true)
|
||||||
public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -411,5 +411,17 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
|||||||
|
|
||||||
protected double getTheta() {
|
protected double getTheta() {
|
||||||
return Math.toRadians(getAngle());
|
return Math.toRadians(getAngle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Area[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Area a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(a);
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Pin Header", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
@ComponentDescriptor(name = "Pin Header", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
||||||
instanceNamePrefix = "PH", description = "PCB mount male pin header with editable number or pins and pin spacing",
|
instanceNamePrefix = "PH", description = "PCB mount male pin header with editable number or pins and pin spacing",
|
||||||
zOrder = IDIYComponent.COMPONENT)
|
zOrder = IDIYComponent.COMPONENT, enableCache = true)
|
||||||
public class PinHeader extends AbstractTransparentComponent<Void> {
|
public class PinHeader extends AbstractTransparentComponent<Void> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -354,5 +354,27 @@ public class PinHeader extends AbstractTransparentComponent<Void> {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setValue(Void value) {
|
public void setValue(Void value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int minX = Integer.MAX_VALUE;
|
||||||
|
int maxX = Integer.MIN_VALUE;
|
||||||
|
int minY = Integer.MAX_VALUE;
|
||||||
|
int maxY = Integer.MIN_VALUE;
|
||||||
|
int margin = 50;
|
||||||
|
for (int i = 0; i < getControlPointCount(); i++) {
|
||||||
|
Point p = getControlPoint(i);
|
||||||
|
if (p.x < minX)
|
||||||
|
minX = p.x;
|
||||||
|
if (p.x > maxX)
|
||||||
|
maxX = p.x;
|
||||||
|
if (p.y < minY)
|
||||||
|
minY = p.y;
|
||||||
|
if (p.y > maxY)
|
||||||
|
maxY = p.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.awt.Rectangle;
|
|||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.awt.StringUtils;
|
import org.diylc.awt.StringUtils;
|
||||||
@@ -52,7 +53,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Plastic DC Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Plastic DC Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Panel mount plastic DC jack", zOrder = IDIYComponent.COMPONENT,
|
description = "Panel mount plastic DC jack", zOrder = IDIYComponent.COMPONENT,
|
||||||
instanceNamePrefix = "J", autoEdit = false)
|
instanceNamePrefix = "J", autoEdit = false, enableCache = true)
|
||||||
public class PlasticDCJack extends AbstractMultiPartComponent<String> {
|
public class PlasticDCJack extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -267,5 +268,12 @@ public class PlasticDCJack extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import java.awt.geom.Area;
|
|||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
import java.awt.geom.Path2D;
|
import java.awt.geom.Path2D;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.awt.TwoCircleTangent;
|
import org.diylc.awt.TwoCircleTangent;
|
||||||
@@ -52,7 +53,8 @@ import org.diylc.core.measures.SizeUnit;
|
|||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "RCA Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "RCA Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
description = "Panel mount RCA phono jack socket", zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J")
|
description = "Panel mount RCA phono jack socket", zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J",
|
||||||
|
enableCache = true)
|
||||||
public class RCAJack extends AbstractMultiPartComponent<String> {
|
public class RCAJack extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -323,5 +325,12 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[1].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.awt.Point;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.Format;
|
import java.text.Format;
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Multi-Section Capacitor", author = "Branislav Stojkovic", category = "Passive",
|
@ComponentDescriptor(name = "Multi-Section Capacitor", author = "Branislav Stojkovic", category = "Passive",
|
||||||
instanceNamePrefix = "C", description = "Multi-section vertically mounted electrolytic capacitor, similar to JJ, CE and others",
|
instanceNamePrefix = "C", description = "Multi-section vertically mounted electrolytic capacitor, similar to JJ, CE and others",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, enableCache = true)
|
||||||
public class MultiSectionCapacitor extends AbstractTransparentComponent<Capacitance[]> {
|
public class MultiSectionCapacitor extends AbstractTransparentComponent<Capacitance[]> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -521,5 +522,12 @@ public class MultiSectionCapacitor extends AbstractTransparentComponent<Capacita
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Potentiometer", author = "Branislav Stojkovic", category = "Passive",
|
@ComponentDescriptor(name = "Potentiometer", author = "Branislav Stojkovic", category = "Passive",
|
||||||
creationMethod = CreationMethod.SINGLE_CLICK, instanceNamePrefix = "VR",
|
creationMethod = CreationMethod.SINGLE_CLICK, instanceNamePrefix = "VR",
|
||||||
description = "Panel mount potentiometer with solder lugs", zOrder = IDIYComponent.COMPONENT,
|
description = "Panel mount potentiometer with solder lugs", zOrder = IDIYComponent.COMPONENT,
|
||||||
transformer = PotentiometerTransformer.class)
|
transformer = PotentiometerTransformer.class, enableCache = true)
|
||||||
public class PotentiometerPanel extends AbstractPotentiometer {
|
public class PotentiometerPanel extends AbstractPotentiometer {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -470,6 +470,18 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Area[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Area a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(a);
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+10
@@ -24,6 +24,7 @@ package org.diylc.components.semiconductors;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.common.Display;
|
import org.diylc.common.Display;
|
||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
@@ -52,6 +53,8 @@ public abstract class AbstractTransistorPackage extends AbstractTransparentCompo
|
|||||||
|
|
||||||
protected abstract void updateControlPoints();
|
protected abstract void updateControlPoints();
|
||||||
|
|
||||||
|
public abstract Area[] getBody();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int mapToSpiceNode(int index) {
|
public int mapToSpiceNode(int index) {
|
||||||
if (getPinout() == null)
|
if (getPinout() == null)
|
||||||
@@ -208,4 +211,11 @@ public abstract class AbstractTransistorPackage extends AbstractTransparentCompo
|
|||||||
return null;
|
return null;
|
||||||
return Integer.toString(index + 1);
|
return Integer.toString(index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Bridge Rectifier", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Bridge Rectifier", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "BR", description = "Few variations of bridge rectifier chips",
|
instanceNamePrefix = "BR", description = "Few variations of bridge rectifier chips",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class BridgeRectifier extends AbstractTransparentComponent<String> {
|
public class BridgeRectifier extends AbstractTransparentComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -667,6 +668,13 @@ public class BridgeRectifier extends AbstractTransparentComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
int margin = 20;
|
||||||
|
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum RectifierType {
|
public static enum RectifierType {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Diode (glass)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Diode (glass)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||||
description = "Glass diode, like most small signal diodes.", zOrder = IDIYComponent.COMPONENT,
|
description = "Glass diode, like most small signal diodes.", zOrder = IDIYComponent.COMPONENT,
|
||||||
transformer = SimpleComponentTransformer.class)
|
transformer = SimpleComponentTransformer.class, enableCache = true)
|
||||||
public class DiodeGlass extends AbstractLeadedComponent<String> {
|
public class DiodeGlass extends AbstractLeadedComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Diode (plastic)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Diode (plastic)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||||
description = "Plastic diode, like most rectifier, zener, schottky, etc.", zOrder = IDIYComponent.COMPONENT,
|
description = "Plastic diode, like most rectifier, zener, schottky, etc.", zOrder = IDIYComponent.COMPONENT,
|
||||||
transformer = SimpleComponentTransformer.class)
|
transformer = SimpleComponentTransformer.class, enableCache = true)
|
||||||
public class DiodePlastic extends AbstractLeadedComponent<String> {
|
public class DiodePlastic extends AbstractLeadedComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Transistor (TO-1)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Transistor (TO-1)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "Q", description = "Transistor with small metal body",
|
instanceNamePrefix = "Q", description = "Transistor with small metal body",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO1Transformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO1Transformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class TransistorTO1 extends AbstractTransistorPackage {
|
public class TransistorTO1 extends AbstractTransistorPackage {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Transistor (TO-126)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Transistor (TO-126)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "Q", description = "Transistors with a hole for heat sink mounting",
|
instanceNamePrefix = "Q", description = "Transistors with a hole for heat sink mounting",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO220Transformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO220Transformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class TransistorTO126 extends AbstractTransistorPackage {
|
public class TransistorTO126 extends AbstractTransistorPackage {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Transistor (TO-220)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Transistor (TO-220)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "Q", description = "Transistors with metal tab for heat sink mounting",
|
instanceNamePrefix = "Q", description = "Transistors with metal tab for heat sink mounting",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO220Transformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO220Transformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class TransistorTO220 extends AbstractTransistorPackage {
|
public class TransistorTO220 extends AbstractTransistorPackage {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Transistor (TO-3)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Transistor (TO-3)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "Q", description = "Transistor with large metal body",
|
instanceNamePrefix = "Q", description = "Transistor with large metal body",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, enableCache = true)
|
||||||
public class TransistorTO3 extends AbstractTransparentComponent<String> {
|
public class TransistorTO3 extends AbstractTransparentComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -359,5 +359,17 @@ public class TransistorTO3 extends AbstractTransparentComponent<String> {
|
|||||||
|
|
||||||
public void setDisplay(Display display) {
|
public void setDisplay(Display display) {
|
||||||
this.display = display;
|
this.display = display;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Area[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Area a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(a);
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Transistor (TO-92)", author = "Branislav Stojkovic", category = "Semiconductors",
|
@ComponentDescriptor(name = "Transistor (TO-92)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||||
instanceNamePrefix = "Q", description = "Transistor with small plastic or epoxy body",
|
instanceNamePrefix = "Q", description = "Transistor with small plastic or epoxy body",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO92Transformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = TO92Transformer.class,
|
||||||
|
enableCache = true)
|
||||||
public class TransistorTO92 extends AbstractTransistorPackage {
|
public class TransistorTO92 extends AbstractTransistorPackage {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Tube Socket", author = "Branislav Stojkovic", category = "Tubes",
|
@ComponentDescriptor(name = "Tube Socket", author = "Branislav Stojkovic", category = "Tubes",
|
||||||
instanceNamePrefix = "V", description = "Various types of tube/valve sockets",
|
instanceNamePrefix = "V", description = "Various types of tube/valve sockets",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, enableCache = true)
|
||||||
public class TubeSocket extends AbstractTransparentComponent<String> {
|
public class TubeSocket extends AbstractTransparentComponent<String> {
|
||||||
|
|
||||||
private static final Size B9A_PIN_SPACING_CHASSIS = new Size(12.5d, SizeUnit.mm);
|
private static final Size B9A_PIN_SPACING_CHASSIS = new Size(12.5d, SizeUnit.mm);
|
||||||
@@ -437,6 +437,13 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
|
|||||||
updateControlPoints();
|
updateControlPoints();
|
||||||
// Reset body shape
|
// Reset body shape
|
||||||
body = null;
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Rectangle2D rect = getBody().getBounds2D();
|
||||||
|
int margin = 40; // to catch the pins that are outside the body, if needed
|
||||||
|
return new Rectangle2D.Double(rect.getX() - margin, rect.getY() - margin, rect.getWidth() + 2 * margin, rect.getHeight() + 2 * margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum Base {
|
public static enum Base {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;Library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;DIYLC&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-core&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;Library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;DIYLC&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-core&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;diylc-library&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="diylc-swing"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugContinuityAreas=true -Ddorg.diylc.debugComponentAreas=true -Ddorg.diylc.WriteStaticVariants=true -Dorg.diylc.WriteStaticBlocks=true"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m -Xmx2048m -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugContinuityAreas=true -Dorg.diylc.debugComponentAreas=true -Ddorg.diylc.WriteStaticVariants=true -Dorg.diylc.WriteStaticBlocks=true"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<property name="jar.dir" value="${build.dir}/jar" />
|
<property name="jar.dir" value="${build.dir}/jar" />
|
||||||
<property name="report.dir" value="${build.dir}/junitreport" />
|
<property name="report.dir" value="${build.dir}/junitreport" />
|
||||||
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
||||||
<property name="diylc.version" value="4.2.0" />
|
<property name="diylc.version" value="4.3.0" />
|
||||||
|
|
||||||
<property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" />
|
<property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" />
|
||||||
<property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" />
|
<property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" />
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -75,7 +75,7 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Continuous Creation",
|
ActionFactory.getInstance().createConfigAction(plugInPort, "Continuous Creation",
|
||||||
IPlugInPort.CONTINUOUS_CREATION_KEY, false), CONFIG_MENU);
|
IPlugInPort.CONTINUOUS_CREATION_KEY, false), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(
|
swingUI.injectMenuAction(
|
||||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Enable Caching (Beta)",
|
ActionFactory.getInstance().createConfigAction(plugInPort, "Enable Cache Boost",
|
||||||
IPlugInPort.CACHING_ENABLED_KEY, true), CONFIG_MENU);
|
IPlugInPort.CACHING_ENABLED_KEY, true), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(
|
swingUI.injectMenuAction(
|
||||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Export Grid", IPlugInPort.EXPORT_GRID_KEY, false),
|
ActionFactory.getInstance().createConfigAction(plugInPort, "Export Grid", IPlugInPort.EXPORT_GRID_KEY, false),
|
||||||
|
|||||||
Reference in New Issue
Block a user