mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
enhance continuity highlight functionality
expand to more components
This commit is contained in:
@@ -473,10 +473,10 @@ public class DrawingManager {
|
|||||||
List<Area> areas = new ArrayList<Area>();
|
List<Area> areas = new ArrayList<Area>();
|
||||||
for (int i = 0; i < preliminaryAreas.size(); i++) {
|
for (int i = 0; i < preliminaryAreas.size(); i++) {
|
||||||
Area a = preliminaryAreas.get(i);
|
Area a = preliminaryAreas.get(i);
|
||||||
if (checkBreakout.get(i))
|
// if (checkBreakout.get(i))
|
||||||
areas.addAll(tryBreakout(a));
|
areas.addAll(tryBreakout(a));
|
||||||
else
|
// else
|
||||||
areas.add(a);
|
// areas.add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
crunchAreas(areas, connections);
|
crunchAreas(areas, connections);
|
||||||
|
|||||||
@@ -1,23 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
|
*
|
||||||
DIY Layout Creator (DIYLC).
|
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
*
|
||||||
|
* This file is part of DIYLC.
|
||||||
This file is part of DIYLC.
|
*
|
||||||
|
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||||
DIYLC is free software: you can redistribute it and/or modify
|
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||||
it under the terms of the GNU General Public License as published by
|
* License, or (at your option) any later version.
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
DIYLC is distributed in the hope that it will be useful,
|
* Public License for more details.
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||||
GNU General Public License for more details.
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package org.diylc.presenter;
|
package org.diylc.presenter;
|
||||||
|
|
||||||
@@ -211,7 +207,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
|
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
|
||||||
}
|
}
|
||||||
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
||||||
if (!isComponentLocked(component) && isComponentVisible(component)) {
|
if (!isComponentLocked(component) && isComponentVisible(component)
|
||||||
|
&& !ConfigurationManager.getInstance().readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||||
ComponentArea area = drawingManager.getComponentArea(component);
|
ComponentArea area = drawingManager.getComponentArea(component);
|
||||||
if (area != null && area.getOutlineArea() != null && area.getOutlineArea().contains(scaledPoint)) {
|
if (area != null && area.getOutlineArea() != null && area.getOutlineArea().contains(scaledPoint)) {
|
||||||
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
|
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
|
||||||
@@ -937,6 +934,10 @@ public class Presenter implements IPlugInPort {
|
|||||||
dragAction == DnDConstants.ACTION_LINK, dragAction == DnDConstants.ACTION_MOVE, 1);
|
dragAction == DnDConstants.ACTION_LINK, dragAction == DnDConstants.ACTION_MOVE, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (ConfigurationManager.getInstance().readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||||
|
LOG.debug("Cannot start drag in hightlight continuity mode.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.dragInProgress = true;
|
this.dragInProgress = true;
|
||||||
this.dragAction = dragAction;
|
this.dragAction = dragAction;
|
||||||
this.preDragProject = currentProject.clone();
|
this.preDragProject = currentProject.clone();
|
||||||
@@ -1083,7 +1084,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dragOver(Point point) {
|
public boolean dragOver(Point point) {
|
||||||
if (point == null) {
|
if (point == null || ConfigurationManager.getInstance().readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Point scaledPoint = scalePoint(point);
|
Point scaledPoint = scalePoint(point);
|
||||||
@@ -1404,10 +1405,12 @@ public class Presenter implements IPlugInPort {
|
|||||||
this.selectionRect = Utils.createRectangle(scaledPoint, previousDragPoint);
|
this.selectionRect = Utils.createRectangle(scaledPoint, previousDragPoint);
|
||||||
}
|
}
|
||||||
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
||||||
|
if (!ConfigurationManager.getInstance().readBoolean(HIGHLIGHT_CONTINUITY_AREA, false))
|
||||||
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
||||||
if (!isComponentLocked(component) && isComponentVisible(component)) {
|
if (!isComponentLocked(component) && isComponentVisible(component)) {
|
||||||
ComponentArea area = drawingManager.getComponentArea(component);
|
ComponentArea area = drawingManager.getComponentArea(component);
|
||||||
if ((area != null && area.getOutlineArea() != null) && (selectionRect != null) && area.getOutlineArea().intersects(selectionRect)) {
|
if ((area != null && area.getOutlineArea() != null) && (selectionRect != null)
|
||||||
|
&& area.getOutlineArea().intersects(selectionRect)) {
|
||||||
newSelection.addAll(findAllGroupedComponents(component));
|
newSelection.addAll(findAllGroupedComponents(component));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1814,7 +1817,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
// Skip already selected components or ones that cannot be stuck to
|
// Skip already selected components or ones that cannot be stuck to
|
||||||
// other components.
|
// other components.
|
||||||
ComponentArea area = drawingManager.getComponentArea(component);
|
ComponentArea area = drawingManager.getComponentArea(component);
|
||||||
if (newSelection.contains(component) || !component.isControlPointSticky(0) || area == null || area.getOutlineArea() == null)
|
if (newSelection.contains(component) || !component.isControlPointSticky(0) || area == null
|
||||||
|
|| area.getOutlineArea() == null)
|
||||||
continue;
|
continue;
|
||||||
boolean matches = false;
|
boolean matches = false;
|
||||||
for (IDIYComponent<?> selectedComponent : this.selectedComponents) {
|
for (IDIYComponent<?> selectedComponent : this.selectedComponents) {
|
||||||
|
|||||||
Binary file not shown.
@@ -21,7 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.diylc.components.boards;
|
package org.diylc.components.boards;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
@@ -188,6 +190,49 @@ public class Breadboard extends AbstractComponent<Void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw transparent connections just to designate connections
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
Composite oldComposite = g2d.getComposite();
|
||||||
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.0f));
|
||||||
|
|
||||||
|
for (int section = 0; section <= 1; section++) {
|
||||||
|
double offset = section * 18 * spacing;
|
||||||
|
for (int x = 0; x < 2; x++) {
|
||||||
|
int holeX = (int) (point.x + offset + (x + 2) * spacing);
|
||||||
|
int holeY1 = (int) (point.y + (1 + powerOffset) * spacing);
|
||||||
|
int holeY2 = (int) (point.y + (psHoleCount -1 + powerOffset) * spacing);
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
g2d.fillRoundRect(holeX - holeSize / 2, holeY1 - holeSize / 2, holeSize, holeSize + holeY2 - holeY1, holeArc, holeArc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int section = 0; section <= 1; section++) {
|
||||||
|
double offset = section * 7 * spacing;
|
||||||
|
|
||||||
|
for (int y = 0; y < holeCount; y++) {
|
||||||
|
g2d.setColor(COORDINATE_COLOR);
|
||||||
|
int coordinateX;
|
||||||
|
if (section == 0) {
|
||||||
|
coordinateX = (int) (point.x + offset + 5.5 * spacing);
|
||||||
|
} else {
|
||||||
|
coordinateX = (int) (point.x + offset + 10.5 * spacing);
|
||||||
|
}
|
||||||
|
drawCenteredText(g2d, new Integer(y + 1).toString(), coordinateX, (int) (point.y + (y + 1) * spacing),
|
||||||
|
section == 0 ? HorizontalAlignment.RIGHT : HorizontalAlignment.LEFT, VerticalAlignment.CENTER);
|
||||||
|
// for (int x = 0; x < 5; x++) {
|
||||||
|
int holeX1 = (int) (point.x + offset + 6 * spacing);
|
||||||
|
int holeX2 = (int) (point.x + offset + 10 * spacing);
|
||||||
|
int holeY = (int) (point.y + (y + 1) * spacing);
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
g2d.fillRoundRect(holeX1 - holeSize / 2, holeY - holeSize / 2, holeSize + holeX2 - holeX1, holeSize, holeArc, holeArc);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.setComposite(oldComposite);
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ public class GroundFill extends AbstractComponent<Void> {
|
|||||||
xPoints[i] = controlPoints[i].x;
|
xPoints[i] = controlPoints[i].x;
|
||||||
yPoints[i] = controlPoints[i].y;
|
yPoints[i] = controlPoints[i].y;
|
||||||
}
|
}
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
|
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
// Do not track any changes that follow because the whole board has been
|
// Do not track any changes that follow because the whole board has been
|
||||||
// tracked so far.
|
// tracked so far.
|
||||||
drawingObserver.stopTracking();
|
drawingObserver.stopTracking();
|
||||||
|
|||||||
@@ -73,11 +73,13 @@ public class SolderPad extends AbstractComponent<Void> {
|
|||||||
double holeDiameter = getHoleSize().convertToPixels();
|
double holeDiameter = getHoleSize().convertToPixels();
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
: color);
|
: color);
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
if (type == Type.ROUND) {
|
if (type == Type.ROUND) {
|
||||||
g2d.fill(new Ellipse2D.Double(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter));
|
g2d.fill(new Ellipse2D.Double(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter));
|
||||||
} else {
|
} else {
|
||||||
g2d.fill(new Rectangle2D.Double(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter));
|
g2d.fill(new Rectangle2D.Double(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter));
|
||||||
}
|
}
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
if (getHoleSize().getValue() > 0) {
|
if (getHoleSize().getValue() > 0) {
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fill(new Ellipse2D.Double(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter, holeDiameter));
|
g2d.fill(new Ellipse2D.Double(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter, holeDiameter));
|
||||||
|
|||||||
@@ -122,10 +122,13 @@ public class OpenJack1_4 extends AbstractTransparentComponent<String> {
|
|||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
}
|
}
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||||
|
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
g2d.fill(body[1]);
|
g2d.fill(body[1]);
|
||||||
g2d.fill(body[2]);
|
g2d.fill(body[2]);
|
||||||
if (body[3] != null)
|
if (body[3] != null)
|
||||||
g2d.fill(body[3]);
|
g2d.fill(body[3]);
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
g2d.setComposite(oldComposite);
|
g2d.setComposite(oldComposite);
|
||||||
}
|
}
|
||||||
|
|||||||
+352
-352
@@ -1,362 +1,362 @@
|
|||||||
/*
|
///*
|
||||||
|
//
|
||||||
DIY Layout Creator (DIYLC).
|
// DIY Layout Creator (DIYLC).
|
||||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
// Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
//
|
||||||
This file is part of DIYLC.
|
// This file is part of DIYLC.
|
||||||
|
//
|
||||||
DIYLC is free software: you can redistribute it and/or modify
|
// DIYLC is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
DIYLC is distributed in the hope that it will be useful,
|
// DIYLC is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
// along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
*/
|
//*/
|
||||||
package org.diylc.components.passive;
|
//package org.diylc.components.passive;
|
||||||
|
//
|
||||||
import java.awt.AlphaComposite;
|
//import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
//import java.awt.Color;
|
||||||
import java.awt.Composite;
|
//import java.awt.Composite;
|
||||||
import java.awt.FontMetrics;
|
//import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics2D;
|
//import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
//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.awt.geom.Rectangle2D;
|
||||||
|
//
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
//import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.common.Display;
|
//import org.diylc.common.Display;
|
||||||
import org.diylc.common.IPlugInPort;
|
//import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ObjectCache;
|
//import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.Orientation;
|
//import org.diylc.common.Orientation;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
//import org.diylc.components.AbstractTransparentComponent;
|
||||||
import org.diylc.core.ComponentState;
|
//import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
//import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
//import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
//import org.diylc.core.Project;
|
||||||
import org.diylc.core.Theme;
|
//import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
//import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
//import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
//import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.annotations.KeywordPolicy;
|
//import org.diylc.core.annotations.KeywordPolicy;
|
||||||
import org.diylc.core.measures.Capacitance;
|
//import org.diylc.core.measures.Capacitance;
|
||||||
import org.diylc.core.measures.Size;
|
//import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
//import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.utils.Constants;
|
//import org.diylc.utils.Constants;
|
||||||
|
//
|
||||||
//@ComponentDescriptor(name = "Electrolytic Capacitor (can)", author = "Branislav Stojkovic", category = "Passive",
|
////@ComponentDescriptor(name = "Electrolytic Capacitor (can)", author = "Branislav Stojkovic", category = "Passive",
|
||||||
// instanceNamePrefix = "C", description = "Vertical chassis-mount electrolytic capacitor similar to JJ",
|
//// instanceNamePrefix = "C", description = "Vertical chassis-mount electrolytic capacitor similar to JJ",
|
||||||
// stretchable = false, zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
//// stretchable = false, zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||||
public class ElectrolyticCanCapacitor extends AbstractTransparentComponent<Capacitance[]> {
|
//public class ElectrolyticCanCapacitor extends AbstractTransparentComponent<Capacitance[]> {
|
||||||
|
//
|
||||||
private static final long serialVersionUID = 1L;
|
// private static final long serialVersionUID = 1L;
|
||||||
|
//
|
||||||
public static Color BODY_COLOR = Color.lightGray;
|
// public static Color BODY_COLOR = Color.lightGray;
|
||||||
public static Color BASE_COLOR = Color.gray;
|
// public static Color BASE_COLOR = Color.gray;
|
||||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
// public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||||
public static Color PIN_COLOR = Color.decode("#00B2EE");
|
// public static Color PIN_COLOR = Color.decode("#00B2EE");
|
||||||
public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
// public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
||||||
public static Color LABEL_COLOR = Color.black;
|
// public static Color LABEL_COLOR = Color.black;
|
||||||
public static Size PIN_SIZE = new Size(0.08d, SizeUnit.in);
|
// public static Size PIN_SIZE = new Size(0.08d, SizeUnit.in);
|
||||||
// public static Size PIN_SPACING = new Size(0.05d, SizeUnit.in);
|
//// public static Size PIN_SPACING = new Size(0.05d, SizeUnit.in);
|
||||||
public static Size BODY_DIAMETER = new Size(1d, SizeUnit.in);
|
// public static Size BODY_DIAMETER = new Size(1d, SizeUnit.in);
|
||||||
|
//
|
||||||
private Capacitance[] value = new Capacitance[4];
|
// private Capacitance[] value = new Capacitance[4];
|
||||||
private org.diylc.core.measures.Voltage voltage = null;
|
// private org.diylc.core.measures.Voltage voltage = null;
|
||||||
|
//
|
||||||
private Orientation orientation = Orientation.DEFAULT;
|
// private Orientation orientation = Orientation.DEFAULT;
|
||||||
private Point[] controlPoints = new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0)};
|
// private Point[] controlPoints = new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0)};
|
||||||
transient private Area body;
|
// transient private Area body;
|
||||||
private Color bodyColor = BODY_COLOR;
|
// private Color bodyColor = BODY_COLOR;
|
||||||
private Color baseColor = BASE_COLOR;
|
// private Color baseColor = BASE_COLOR;
|
||||||
private Color borderColor = BORDER_COLOR;
|
// private Color borderColor = BORDER_COLOR;
|
||||||
private Color labelColor = LABEL_COLOR;
|
// private Color labelColor = LABEL_COLOR;
|
||||||
protected Display display = Display.NAME;
|
// protected Display display = Display.NAME;
|
||||||
// private Size pinSpacing = PIN_SPACING;
|
//// private Size pinSpacing = PIN_SPACING;
|
||||||
private CanSections sections = CanSections._1;
|
// private CanSections sections = CanSections._1;
|
||||||
private Size diameter = BODY_DIAMETER;
|
// private Size diameter = BODY_DIAMETER;
|
||||||
|
//
|
||||||
public ElectrolyticCanCapacitor() {
|
// public ElectrolyticCanCapacitor() {
|
||||||
super();
|
// super();
|
||||||
updateControlPoints();
|
// updateControlPoints();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@EditableProperty
|
|
||||||
public Capacitance[] getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(Capacitance[] value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty
|
|
||||||
public org.diylc.core.measures.Voltage getVoltage() {
|
|
||||||
return voltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoltage(org.diylc.core.measures.Voltage voltage) {
|
|
||||||
this.voltage = voltage;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// @EditableProperty
|
// @EditableProperty
|
||||||
// public CanSections getSections() {
|
// public Capacitance[] getValue() {
|
||||||
// return sections;
|
// return value;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public void setSections(CanSections sections) {
|
// public void setValue(Capacitance[] value) {
|
||||||
// this.sections = sections;
|
// this.value = value;
|
||||||
// }
|
|
||||||
|
|
||||||
@EditableProperty
|
|
||||||
public Size getDiameter() {
|
|
||||||
return diameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDiameter(Size diameter) {
|
|
||||||
this.diameter = diameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty
|
|
||||||
public Orientation getOrientation() {
|
|
||||||
return orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrientation(Orientation orientation) {
|
|
||||||
this.orientation = orientation;
|
|
||||||
updateControlPoints();
|
|
||||||
// Reset body shape;
|
|
||||||
body = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getControlPointCount() {
|
|
||||||
return controlPoints.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Point getControlPoint(int index) {
|
|
||||||
return controlPoints[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isControlPointSticky(int index) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
|
||||||
return VisibilityPolicy.NEVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setControlPoint(Point point, int index) {
|
|
||||||
controlPoints[index].setLocation(point);
|
|
||||||
body = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateControlPoints() {
|
|
||||||
// int pinSpacing = (int) getPinSpacing().convertToPixels();
|
|
||||||
int pinSpacing = (int) getDiameter().convertToPixels();
|
|
||||||
// switch (getS)
|
|
||||||
|
|
||||||
// Update control points.
|
|
||||||
int x = controlPoints[0].x;
|
|
||||||
int y = controlPoints[0].y;
|
|
||||||
switch (orientation) {
|
|
||||||
case DEFAULT:
|
|
||||||
controlPoints[1].setLocation(x - pinSpacing, y + pinSpacing);
|
|
||||||
controlPoints[2].setLocation(x, y + 2 * pinSpacing);
|
|
||||||
break;
|
|
||||||
case _90:
|
|
||||||
controlPoints[1].setLocation(x - pinSpacing, y - pinSpacing);
|
|
||||||
controlPoints[2].setLocation(x - 2 * pinSpacing, y);
|
|
||||||
break;
|
|
||||||
case _180:
|
|
||||||
controlPoints[1].setLocation(x + pinSpacing, y - pinSpacing);
|
|
||||||
controlPoints[2].setLocation(x, y - 2 * pinSpacing);
|
|
||||||
break;
|
|
||||||
case _270:
|
|
||||||
controlPoints[1].setLocation(x + pinSpacing, y + pinSpacing);
|
|
||||||
controlPoints[2].setLocation(x + 2 * pinSpacing, y);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unexpected orientation: " + orientation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Area getBody() {
|
|
||||||
if (body == null) {
|
|
||||||
int x = (controlPoints[0].x + controlPoints[1].x + controlPoints[2].x) / 3;
|
|
||||||
int y = (controlPoints[0].y + controlPoints[1].y + controlPoints[2].y) / 3;
|
|
||||||
int bodyDiameter = getClosestOdd(getDiameter().convertToPixels());
|
|
||||||
|
|
||||||
body = new Area(new Ellipse2D.Double(x - bodyDiameter / 2, y - bodyDiameter / 2, bodyDiameter, bodyDiameter));
|
|
||||||
|
|
||||||
}
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
|
||||||
IDrawingObserver drawingObserver) {
|
|
||||||
if (checkPointsClipped(g2d.getClip())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
|
||||||
Area mainArea = getBody();
|
|
||||||
Composite oldComposite = g2d.getComposite();
|
|
||||||
if (alpha < MAX_ALPHA) {
|
|
||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
|
||||||
}
|
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
|
||||||
g2d.fill(mainArea);
|
|
||||||
g2d.setComposite(oldComposite);
|
|
||||||
Color finalBorderColor;
|
|
||||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
|
||||||
if (outlineMode) {
|
|
||||||
finalBorderColor =
|
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|
||||||
: theme.getOutlineColor();
|
|
||||||
} else {
|
|
||||||
finalBorderColor =
|
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|
||||||
: borderColor;
|
|
||||||
}
|
|
||||||
g2d.setColor(finalBorderColor);
|
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
|
||||||
g2d.draw(mainArea);
|
|
||||||
|
|
||||||
for (Point point : controlPoints) {
|
|
||||||
if (!outlineMode) {
|
|
||||||
g2d.setColor(PIN_COLOR);
|
|
||||||
g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
|
||||||
}
|
|
||||||
g2d.setColor(outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
|
|
||||||
g2d.drawOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw label.
|
|
||||||
g2d.setFont(project.getFont());
|
|
||||||
Color finalLabelColor;
|
|
||||||
if (outlineMode) {
|
|
||||||
finalLabelColor =
|
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
|
||||||
: theme.getOutlineColor();
|
|
||||||
} else {
|
|
||||||
finalLabelColor =
|
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
|
||||||
: getLabelColor();
|
|
||||||
}
|
|
||||||
g2d.setColor(finalLabelColor);
|
|
||||||
String label = "";
|
|
||||||
label = (getDisplay() == Display.NAME) ? getName() : getValue().toString();
|
|
||||||
if (getDisplay() == Display.NONE) {
|
|
||||||
label = "";
|
|
||||||
}
|
|
||||||
if (getDisplay() == Display.BOTH) {
|
|
||||||
label = getName() + " " + (getValue() == null ? "" : getValue().toString());
|
|
||||||
}
|
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
|
||||||
int textHeight = (int) (rect.getHeight());
|
|
||||||
int textWidth = (int) (rect.getWidth());
|
|
||||||
// Center text horizontally and vertically
|
|
||||||
Rectangle bounds = mainArea.getBounds();
|
|
||||||
int x = bounds.x + (bounds.width - textWidth) / 2;
|
|
||||||
int y = bounds.y + (bounds.height - textHeight) / 2 + fontMetrics.getAscent();
|
|
||||||
g2d.drawString(label, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
|
||||||
int margin = 2 * width / 32;
|
|
||||||
Area area = new Area(new Ellipse2D.Double(margin / 2, margin, width - 2 * margin, width - 2 * margin));
|
|
||||||
g2d.setColor(BODY_COLOR);
|
|
||||||
g2d.fill(area);
|
|
||||||
g2d.setColor(BORDER_COLOR);
|
|
||||||
g2d.draw(area);
|
|
||||||
g2d.setColor(PIN_COLOR);
|
|
||||||
int pinSize = 2 * width / 32;
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
g2d.fillOval((i == 1 ? width * 3 / 8 : width / 2) - pinSize / 2, (height / 4) * (i + 1), pinSize, pinSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Body")
|
|
||||||
public Color getBodyColor() {
|
|
||||||
return bodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBodyColor(Color bodyColor) {
|
|
||||||
this.bodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Base")
|
|
||||||
public Color getBaseColor() {
|
|
||||||
return baseColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBaseColor(Color baseColor) {
|
|
||||||
this.baseColor = baseColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @EditableProperty(name = "Pin spacing")
|
|
||||||
// public Size getPinSpacing() {
|
|
||||||
// return pinSpacing;
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public void setPinSpacing(Size pinSpacing) {
|
// @EditableProperty
|
||||||
// this.pinSpacing = pinSpacing;
|
// public org.diylc.core.measures.Voltage getVoltage() {
|
||||||
|
// return voltage;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setVoltage(org.diylc.core.measures.Voltage voltage) {
|
||||||
|
// this.voltage = voltage;
|
||||||
|
// }
|
||||||
|
////
|
||||||
|
//// @EditableProperty
|
||||||
|
//// public CanSections getSections() {
|
||||||
|
//// return sections;
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// public void setSections(CanSections sections) {
|
||||||
|
//// this.sections = sections;
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// @EditableProperty
|
||||||
|
// public Size getDiameter() {
|
||||||
|
// return diameter;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setDiameter(Size diameter) {
|
||||||
|
// this.diameter = diameter;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @EditableProperty
|
||||||
|
// public Orientation getOrientation() {
|
||||||
|
// return orientation;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setOrientation(Orientation orientation) {
|
||||||
|
// this.orientation = orientation;
|
||||||
// updateControlPoints();
|
// updateControlPoints();
|
||||||
// // Reset body shape;
|
// // Reset body shape;
|
||||||
// body = null;
|
// body = null;
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
@EditableProperty(name = "Border")
|
// @Override
|
||||||
public Color getBorderColor() {
|
// public int getControlPointCount() {
|
||||||
return borderColor;
|
// return controlPoints.length;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setBorderColor(Color borderColor) {
|
// @Override
|
||||||
this.borderColor = borderColor;
|
// public Point getControlPoint(int index) {
|
||||||
}
|
// return controlPoints[index];
|
||||||
|
// }
|
||||||
@EditableProperty(name = "Label")
|
//
|
||||||
public Color getLabelColor() {
|
// @Override
|
||||||
return labelColor;
|
// public boolean isControlPointSticky(int index) {
|
||||||
}
|
// return true;
|
||||||
|
// }
|
||||||
public void setLabelColor(Color labelColor) {
|
//
|
||||||
this.labelColor = labelColor;
|
// @Override
|
||||||
}
|
// public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
|
// return VisibilityPolicy.NEVER;
|
||||||
@EditableProperty
|
// }
|
||||||
public Display getDisplay() {
|
//
|
||||||
if (display == null) {
|
// @Override
|
||||||
display = Display.NAME;
|
// public void setControlPoint(Point point, int index) {
|
||||||
}
|
// controlPoints[index].setLocation(point);
|
||||||
return display;
|
// body = null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDisplay(Display display) {
|
// private void updateControlPoints() {
|
||||||
this.display = display;
|
//// int pinSpacing = (int) getPinSpacing().convertToPixels();
|
||||||
}
|
// int pinSpacing = (int) getDiameter().convertToPixels();
|
||||||
|
//// switch (getS)
|
||||||
public enum CanSections {
|
//
|
||||||
_1, _2, _3, _4, _5;
|
// // Update control points.
|
||||||
|
// int x = controlPoints[0].x;
|
||||||
@Override
|
// int y = controlPoints[0].y;
|
||||||
public String toString() {
|
// switch (orientation) {
|
||||||
return name().substring(1);
|
// case DEFAULT:
|
||||||
}
|
// controlPoints[1].setLocation(x - pinSpacing, y + pinSpacing);
|
||||||
}
|
// controlPoints[2].setLocation(x, y + 2 * pinSpacing);
|
||||||
}
|
// break;
|
||||||
|
// case _90:
|
||||||
|
// controlPoints[1].setLocation(x - pinSpacing, y - pinSpacing);
|
||||||
|
// controlPoints[2].setLocation(x - 2 * pinSpacing, y);
|
||||||
|
// break;
|
||||||
|
// case _180:
|
||||||
|
// controlPoints[1].setLocation(x + pinSpacing, y - pinSpacing);
|
||||||
|
// controlPoints[2].setLocation(x, y - 2 * pinSpacing);
|
||||||
|
// break;
|
||||||
|
// case _270:
|
||||||
|
// controlPoints[1].setLocation(x + pinSpacing, y + pinSpacing);
|
||||||
|
// controlPoints[2].setLocation(x + 2 * pinSpacing, y);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Area getBody() {
|
||||||
|
// if (body == null) {
|
||||||
|
// int x = (controlPoints[0].x + controlPoints[1].x + controlPoints[2].x) / 3;
|
||||||
|
// int y = (controlPoints[0].y + controlPoints[1].y + controlPoints[2].y) / 3;
|
||||||
|
// int bodyDiameter = getClosestOdd(getDiameter().convertToPixels());
|
||||||
|
//
|
||||||
|
// body = new Area(new Ellipse2D.Double(x - bodyDiameter / 2, y - bodyDiameter / 2, bodyDiameter, bodyDiameter));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// return body;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
|
// IDrawingObserver drawingObserver) {
|
||||||
|
// if (checkPointsClipped(g2d.getClip())) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||||
|
// Area mainArea = getBody();
|
||||||
|
// Composite oldComposite = g2d.getComposite();
|
||||||
|
// if (alpha < MAX_ALPHA) {
|
||||||
|
// g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
|
// }
|
||||||
|
// g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||||
|
// g2d.fill(mainArea);
|
||||||
|
// g2d.setComposite(oldComposite);
|
||||||
|
// Color finalBorderColor;
|
||||||
|
// Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||||
|
// if (outlineMode) {
|
||||||
|
// finalBorderColor =
|
||||||
|
// componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|
// : theme.getOutlineColor();
|
||||||
|
// } else {
|
||||||
|
// finalBorderColor =
|
||||||
|
// componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|
// : borderColor;
|
||||||
|
// }
|
||||||
|
// g2d.setColor(finalBorderColor);
|
||||||
|
// g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
// g2d.draw(mainArea);
|
||||||
|
//
|
||||||
|
// for (Point point : controlPoints) {
|
||||||
|
// if (!outlineMode) {
|
||||||
|
// g2d.setColor(PIN_COLOR);
|
||||||
|
// g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
||||||
|
// }
|
||||||
|
// g2d.setColor(outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
|
||||||
|
// g2d.drawOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Draw label.
|
||||||
|
// g2d.setFont(project.getFont());
|
||||||
|
// Color finalLabelColor;
|
||||||
|
// if (outlineMode) {
|
||||||
|
// finalLabelColor =
|
||||||
|
// componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||||
|
// : theme.getOutlineColor();
|
||||||
|
// } else {
|
||||||
|
// finalLabelColor =
|
||||||
|
// componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||||
|
// : getLabelColor();
|
||||||
|
// }
|
||||||
|
// g2d.setColor(finalLabelColor);
|
||||||
|
// String label = "";
|
||||||
|
// label = (getDisplay() == Display.NAME) ? getName() : getValue().toString();
|
||||||
|
// if (getDisplay() == Display.NONE) {
|
||||||
|
// label = "";
|
||||||
|
// }
|
||||||
|
// if (getDisplay() == Display.BOTH) {
|
||||||
|
// label = getName() + " " + (getValue() == null ? "" : getValue().toString());
|
||||||
|
// }
|
||||||
|
// FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
|
// Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
|
// int textHeight = (int) (rect.getHeight());
|
||||||
|
// int textWidth = (int) (rect.getWidth());
|
||||||
|
// // Center text horizontally and vertically
|
||||||
|
// Rectangle bounds = mainArea.getBounds();
|
||||||
|
// int x = bounds.x + (bounds.width - textWidth) / 2;
|
||||||
|
// int y = bounds.y + (bounds.height - textHeight) / 2 + fontMetrics.getAscent();
|
||||||
|
// g2d.drawString(label, x, y);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
// int margin = 2 * width / 32;
|
||||||
|
// Area area = new Area(new Ellipse2D.Double(margin / 2, margin, width - 2 * margin, width - 2 * margin));
|
||||||
|
// g2d.setColor(BODY_COLOR);
|
||||||
|
// g2d.fill(area);
|
||||||
|
// g2d.setColor(BORDER_COLOR);
|
||||||
|
// g2d.draw(area);
|
||||||
|
// g2d.setColor(PIN_COLOR);
|
||||||
|
// int pinSize = 2 * width / 32;
|
||||||
|
// for (int i = 0; i < 3; i++) {
|
||||||
|
// g2d.fillOval((i == 1 ? width * 3 / 8 : width / 2) - pinSize / 2, (height / 4) * (i + 1), pinSize, pinSize);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @EditableProperty(name = "Body")
|
||||||
|
// public Color getBodyColor() {
|
||||||
|
// return bodyColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setBodyColor(Color bodyColor) {
|
||||||
|
// this.bodyColor = bodyColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @EditableProperty(name = "Base")
|
||||||
|
// public Color getBaseColor() {
|
||||||
|
// return baseColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setBaseColor(Color baseColor) {
|
||||||
|
// this.baseColor = baseColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// @EditableProperty(name = "Pin spacing")
|
||||||
|
//// public Size getPinSpacing() {
|
||||||
|
//// return pinSpacing;
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// public void setPinSpacing(Size pinSpacing) {
|
||||||
|
//// this.pinSpacing = pinSpacing;
|
||||||
|
//// updateControlPoints();
|
||||||
|
//// // Reset body shape;
|
||||||
|
//// body = null;
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// @EditableProperty(name = "Border")
|
||||||
|
// public Color getBorderColor() {
|
||||||
|
// return borderColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setBorderColor(Color borderColor) {
|
||||||
|
// this.borderColor = borderColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @EditableProperty(name = "Label")
|
||||||
|
// public Color getLabelColor() {
|
||||||
|
// return labelColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setLabelColor(Color labelColor) {
|
||||||
|
// this.labelColor = labelColor;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @EditableProperty
|
||||||
|
// public Display getDisplay() {
|
||||||
|
// if (display == null) {
|
||||||
|
// display = Display.NAME;
|
||||||
|
// }
|
||||||
|
// return display;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setDisplay(Display display) {
|
||||||
|
// this.display = display;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public enum CanSections {
|
||||||
|
// _1, _2, _3, _4, _5;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// return name().substring(1);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|||||||
@@ -276,7 +276,11 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
}
|
}
|
||||||
if (!outlineMode) {
|
if (!outlineMode) {
|
||||||
|
if (i == 3)
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
g2d.fill(shape);
|
g2d.fill(shape);
|
||||||
|
if (i == 3)
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
}
|
}
|
||||||
g2d.setComposite(oldComposite);
|
g2d.setComposite(oldComposite);
|
||||||
Color finalBorderColor;
|
Color finalBorderColor;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user