mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
improve continuity highlighting
massively simplified outline tracing
This commit is contained in:
@@ -32,7 +32,6 @@ import java.awt.Shape;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.Observable;
|
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.common.Display;
|
import org.diylc.common.Display;
|
||||||
|
|||||||
@@ -392,6 +392,10 @@ public class DrawingManager {
|
|||||||
lastDrawnStateMap.clear();
|
lastDrawnStateMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearContinuityArea() {
|
||||||
|
this.continuityArea = null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<IDIYComponent<?>> findComponentsAt(Point point, Project project) {
|
public List<IDIYComponent<?>> findComponentsAt(Point point, Project project) {
|
||||||
List<IDIYComponent<?>> components = new ArrayList<IDIYComponent<?>>();
|
List<IDIYComponent<?>> components = new ArrayList<IDIYComponent<?>>();
|
||||||
for (int i = 0; i < project.getComponents().size(); i++) {
|
for (int i = 0; i < project.getComponents().size(); i++) {
|
||||||
|
|||||||
@@ -30,21 +30,18 @@ import java.awt.Paint;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
|
import java.awt.RenderingHints.Key;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.Stroke;
|
import java.awt.Stroke;
|
||||||
import java.awt.RenderingHints.Key;
|
|
||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.font.GlyphVector;
|
import java.awt.font.GlyphVector;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Arc2D;
|
import java.awt.geom.Arc2D;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.CubicCurve2D;
|
|
||||||
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Ellipse2D;
|
||||||
import java.awt.geom.Line2D;
|
import java.awt.geom.Line2D;
|
||||||
import java.awt.geom.NoninvertibleTransformException;
|
import java.awt.geom.NoninvertibleTransformException;
|
||||||
import java.awt.geom.PathIterator;
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.geom.QuadCurve2D;
|
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -88,8 +85,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
private AffineTransform currentTx;
|
private AffineTransform currentTx;
|
||||||
private AffineTransform initialTx;
|
private AffineTransform initialTx;
|
||||||
private Area currentArea;
|
private Area currentArea;
|
||||||
private List<Area> currentContinuityPositiveAreas;
|
private List<Area> continuityPositiveAreas;
|
||||||
private List<Area> currentContinuityNegativeAreas;
|
private List<Area> continuityNegativeAreas;
|
||||||
private Shape lastShape;
|
private Shape lastShape;
|
||||||
|
|
||||||
private double zoom;
|
private double zoom;
|
||||||
@@ -104,8 +101,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
this.canvasGraphics = canvasGraphics;
|
this.canvasGraphics = canvasGraphics;
|
||||||
this.zoom = zoom;
|
this.zoom = zoom;
|
||||||
currentArea = new Area();
|
currentArea = new Area();
|
||||||
currentContinuityPositiveAreas = new ArrayList<Area>();
|
continuityPositiveAreas = new ArrayList<Area>();
|
||||||
currentContinuityNegativeAreas = new ArrayList<Area>();
|
continuityNegativeAreas = new ArrayList<Area>();
|
||||||
currentTx = new AffineTransform();
|
currentTx = new AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,8 +112,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
public void startedDrawingComponent() {
|
public void startedDrawingComponent() {
|
||||||
drawingComponent = true;
|
drawingComponent = true;
|
||||||
currentArea = new Area();
|
currentArea = new Area();
|
||||||
currentContinuityPositiveAreas = new ArrayList<Area>();
|
continuityPositiveAreas = new ArrayList<Area>();
|
||||||
currentContinuityNegativeAreas = new ArrayList<Area>();
|
continuityNegativeAreas = new ArrayList<Area>();
|
||||||
originalStroke = canvasGraphics.getStroke();
|
originalStroke = canvasGraphics.getStroke();
|
||||||
originalColor = canvasGraphics.getColor();
|
originalColor = canvasGraphics.getColor();
|
||||||
originalTx = canvasGraphics.getTransform();
|
originalTx = canvasGraphics.getTransform();
|
||||||
@@ -140,7 +137,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
canvasGraphics.setTransform(originalTx);
|
canvasGraphics.setTransform(originalTx);
|
||||||
canvasGraphics.setComposite(originalComposite);
|
canvasGraphics.setComposite(originalComposite);
|
||||||
canvasGraphics.setFont(originalFont);
|
canvasGraphics.setFont(originalFont);
|
||||||
return new ComponentArea(currentArea, currentContinuityPositiveAreas, currentContinuityNegativeAreas);
|
return new ComponentArea(currentArea, continuityPositiveAreas, continuityNegativeAreas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -185,9 +182,9 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
|
|
||||||
if (trackingContinuityAllowed) {
|
if (trackingContinuityAllowed) {
|
||||||
if (trackingContinuityPositive)
|
if (trackingContinuityPositive)
|
||||||
currentContinuityPositiveAreas.add(area);
|
continuityPositiveAreas.add(area);
|
||||||
else
|
else
|
||||||
currentContinuityNegativeAreas.add(area);
|
continuityNegativeAreas.add(area);
|
||||||
}
|
}
|
||||||
lastShape = s;
|
lastShape = s;
|
||||||
}
|
}
|
||||||
@@ -203,95 +200,8 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
if (!drawingComponent || !trackingAllowed || s.equals(lastShape)) {
|
if (!drawingComponent || !trackingAllowed || s.equals(lastShape)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastShape = s;
|
|
||||||
PathIterator pathIterator = s.getPathIterator(null);
|
|
||||||
double thickness;
|
|
||||||
if (getStroke() instanceof BasicStroke) {
|
|
||||||
thickness = ((BasicStroke) getStroke()).getLineWidth() + 2 * LINE_SENSITIVITY_MARGIN;
|
|
||||||
} else {
|
|
||||||
thickness = 2 * LINE_SENSITIVITY_MARGIN;
|
|
||||||
}
|
|
||||||
Point2D prevPoint = null;
|
|
||||||
while (!pathIterator.isDone()) {
|
|
||||||
double[] coord = new double[6];
|
|
||||||
int type = pathIterator.currentSegment(coord);
|
|
||||||
switch (type) {
|
|
||||||
case PathIterator.SEG_MOVETO:
|
|
||||||
prevPoint = new Point2D.Double(coord[0], coord[1]);
|
|
||||||
break;
|
|
||||||
case PathIterator.SEG_LINETO:
|
|
||||||
// Represent straight line with a rectangle.
|
|
||||||
Point2D nextPoint = new Point2D.Double(coord[0], coord[1]);
|
|
||||||
Double theta = Math.atan2(nextPoint.getY() - prevPoint.getY(), nextPoint.getX() - prevPoint.getX());
|
|
||||||
double width =
|
|
||||||
Math.sqrt(Math.pow(nextPoint.getX() - prevPoint.getX(), 2)
|
|
||||||
+ Math.pow(nextPoint.getY() - prevPoint.getY(), 2));
|
|
||||||
double midX = (prevPoint.getX() + nextPoint.getX()) / 2;
|
|
||||||
double midY = (prevPoint.getY() + nextPoint.getY()) / 2;
|
|
||||||
Rectangle2D rect = new Rectangle2D.Double(midX - width / 2, midY - thickness / 2, width, thickness);
|
|
||||||
Area area = new Area(rect);
|
|
||||||
area.transform(AffineTransform.getRotateInstance(theta, midX, midY));
|
|
||||||
// area.transform(currentTx);
|
|
||||||
appendShape(area);
|
|
||||||
// Set the prev point to line end
|
|
||||||
prevPoint = nextPoint;
|
|
||||||
break;
|
|
||||||
case PathIterator.SEG_CUBICTO:
|
|
||||||
CubicCurve2D cubicCurve =
|
|
||||||
new CubicCurve2D.Double(prevPoint.getX(), prevPoint.getY(), coord[0], coord[1], coord[2], coord[3],
|
|
||||||
coord[4], coord[5]);
|
|
||||||
addCubicCurveArea(cubicCurve);
|
|
||||||
prevPoint = new Point2D.Double(coord[4], coord[5]);
|
|
||||||
break;
|
|
||||||
case PathIterator.SEG_QUADTO:
|
|
||||||
QuadCurve2D quadCurve =
|
|
||||||
new QuadCurve2D.Double(prevPoint.getX(), prevPoint.getY(), coord[0], coord[1], coord[2], coord[3]);
|
|
||||||
addQuadCurveArea(quadCurve);
|
|
||||||
prevPoint = new Point2D.Double(coord[3], coord[3]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pathIterator.next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
appendShape(getStroke().createStrokedShape(s));
|
||||||
* Adds a cubic curve to the component area. It uses subdivision to approximate the curve with a
|
|
||||||
* series of straight lines.
|
|
||||||
*
|
|
||||||
* @param curve
|
|
||||||
*/
|
|
||||||
private void addCubicCurveArea(CubicCurve2D curve) {
|
|
||||||
// When end points are close enough, approximate the curve with a
|
|
||||||
// straight line.
|
|
||||||
if (curve.getFlatness() < CURVE_SENSITIVITY) {
|
|
||||||
appendShapeOutline(new Line2D.Double(curve.getP1(), curve.getP2()));
|
|
||||||
} else {
|
|
||||||
CubicCurve2D leftSubcurve = new CubicCurve2D.Double();
|
|
||||||
CubicCurve2D rightSubcurve = new CubicCurve2D.Double();
|
|
||||||
curve.subdivide(leftSubcurve, rightSubcurve);
|
|
||||||
addCubicCurveArea(leftSubcurve);
|
|
||||||
addCubicCurveArea(rightSubcurve);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a quad curve to the component area. It uses subdivision to approximate the curve with a
|
|
||||||
* series of straight lines.
|
|
||||||
*
|
|
||||||
* @param curve
|
|
||||||
*/
|
|
||||||
private void addQuadCurveArea(QuadCurve2D curve) {
|
|
||||||
// When end points are close enough, approximate the curve with a
|
|
||||||
// straight line.
|
|
||||||
if (curve.getFlatness() < CURVE_SENSITIVITY) {
|
|
||||||
appendShapeOutline(new Line2D.Double(curve.getP1(), curve.getP2()));
|
|
||||||
} else {
|
|
||||||
QuadCurve2D leftSubcurve = new QuadCurve2D.Double();
|
|
||||||
QuadCurve2D rightSubcurve = new QuadCurve2D.Double();
|
|
||||||
curve.subdivide(leftSubcurve, rightSubcurve);
|
|
||||||
addQuadCurveArea(leftSubcurve);
|
|
||||||
addQuadCurveArea(rightSubcurve);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
LOG.info(String.format("loadProject(%s, %s)", project.getTitle(), freshStart));
|
LOG.info(String.format("loadProject(%s, %s)", project.getTitle(), freshStart));
|
||||||
this.currentProject = project;
|
this.currentProject = project;
|
||||||
drawingManager.clearComponentAreaMap();
|
drawingManager.clearComponentAreaMap();
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
updateSelection(EMPTY_SELECTION);
|
updateSelection(EMPTY_SELECTION);
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_LOADED, project, freshStart);
|
messageDispatcher.dispatchMessage(EventType.PROJECT_LOADED, project, freshStart);
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
@@ -598,6 +599,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Add "
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Add "
|
||||||
+ componentTypeSlot.getName());
|
+ componentTypeSlot.getName());
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
} else if (ConfigurationManager.getInstance().readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
} else if (ConfigurationManager.getInstance().readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||||
@@ -689,6 +691,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
"Rotate Selection");
|
"Rotate Selection");
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -917,6 +920,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
moveComponents(controlPointMap, dx, dy, false);
|
moveComponents(controlPointMap, dx, dy, false);
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Move Selection");
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Move Selection");
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1198,6 +1202,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
rotateComponents(this.selectedComponents, direction, isSnapToGrid());
|
rotateComponents(this.selectedComponents, direction, isSnapToGrid());
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
"Rotate Selection");
|
"Rotate Selection");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1308,6 +1313,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
"Mirror Selection");
|
"Mirror Selection");
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1420,6 +1426,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
|
|
||||||
if (!preDragProject.equals(currentProject)) {
|
if (!preDragProject.equals(currentProject)) {
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, preDragProject, currentProject.clone(), "Drag");
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, preDragProject, currentProject.clone(), "Drag");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
@@ -1469,6 +1476,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
updateSelection(newSelection);
|
updateSelection(newSelection);
|
||||||
|
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Duplicate");
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Duplicate");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
@@ -1489,6 +1497,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
currentProject.getComponents().removeAll(selectedComponents);
|
currentProject.getComponents().removeAll(selectedComponents);
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Delete");
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), "Delete");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
updateSelection(EMPTY_SELECTION);
|
updateSelection(EMPTY_SELECTION);
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
@@ -1985,6 +1994,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
"Edit Selection");
|
"Edit Selection");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
@@ -2022,6 +2032,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
"Edit Project");
|
"Edit Project");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
drawingManager.fireZoomChanged();
|
drawingManager.fireZoomChanged();
|
||||||
@@ -2200,6 +2211,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
"Edit Selection");
|
"Edit Selection");
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
|||||||
Binary file not shown.
@@ -1,24 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
|
*
|
||||||
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.components.connectivity;
|
package org.diylc.components.connectivity;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@@ -43,7 +39,8 @@ import org.diylc.core.measures.SizeUnit;
|
|||||||
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity",
|
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity",
|
||||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "Trace",
|
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "Trace",
|
||||||
description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW,
|
description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW,
|
||||||
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB",
|
||||||
|
transformer = SimpleComponentTransformer.class)
|
||||||
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -160,4 +157,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
|||||||
protected Size getDefaultLength() {
|
protected Size getDefaultLength() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean IsCopperArea() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ public class Eyelet extends AbstractComponent<String> {
|
|||||||
int diameter = getClosestOdd((int) size.convertToPixels());
|
int diameter = getClosestOdd((int) size.convertToPixels());
|
||||||
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
||||||
g2d.setColor(color);
|
g2d.setColor(color);
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
: color.darker());
|
: color.darker());
|
||||||
g2d.drawOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
g2d.drawOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -102,7 +102,7 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
.createConfigAction(plugInPort, "Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU);
|
.createConfigAction(plugInPort, "Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(
|
swingUI.injectMenuAction(
|
||||||
ActionFactory.getInstance()
|
ActionFactory.getInstance()
|
||||||
.createConfigAction(plugInPort, "Highlighted Connected Areas", IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false), CONFIG_MENU);
|
.createConfigAction(plugInPort, "Highlight Connected Areas", IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false), CONFIG_MENU);
|
||||||
|
|
||||||
File themeDir = new File("themes");
|
File themeDir = new File("themes");
|
||||||
if (themeDir.exists()) {
|
if (themeDir.exists()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user