mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
add caching to guitar pickups
This commit is contained in:
@@ -24,6 +24,8 @@ import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.awt.StringUtils;
|
||||
@@ -250,6 +252,18 @@ public abstract class AbstractGuitarPickup extends AbstractTransparentComponent<
|
||||
.setLocation(points[0].x + 3 * dx * pointSpacing, points[0].y + 3 * dy * pointSpacing);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
public enum Polarity {
|
||||
North, South, Humbucking;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Humbucker Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Double-coil humbucker guitar pickup (PAF, Mini Humbuckers, Filtertrons)",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", enableCache = true)
|
||||
public class HumbuckerPickup extends AbstractGuitarPickup {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Jazz Bass Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Single coil pickup for Jazz Bass and similar guitars",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", enableCache = true)
|
||||
public class JazzBassPickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -145,10 +145,10 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
||||
g2d.setColor(COMMON_LUG_COLOR.darker());
|
||||
g2d.draw(body[3]);
|
||||
|
||||
g2d.setColor(Color.black);
|
||||
for(int i = 0; i < getControlPointCount(); i++) {
|
||||
g2d.drawString(i + "", controlPoints[i].x, controlPoints[i].y);
|
||||
}
|
||||
// g2d.setColor(Color.black);
|
||||
// for(int i = 0; i < getControlPointCount(); i++) {
|
||||
// g2d.drawString(i + "", controlPoints[i].x, controlPoints[i].y);
|
||||
// }
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "P-90 Single Coil Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Single coil P-90 guitar pickup, both \"dog ear\" and \"soap bar\"",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", enableCache = true)
|
||||
public class P90Pickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "P- Bass Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Split-coil pickup for P-Bass and similar guitars",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", enableCache = true)
|
||||
public class PBassPickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Single Coil Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Single coil guitar pickup, both Strat and Tele style",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram", enableCache = true)
|
||||
public class SingleCoilPickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
Reference in New Issue
Block a user