mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
cleanup component area map on loading
fixed lead area mapping bug
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastPath</string>
|
<string>metric</string>
|
||||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles</string>
|
<boolean>true</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>zoom</string>
|
<string>zoom</string>
|
||||||
<double>1.0</double>
|
<double>1.0</double>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>metric</string>
|
<string>lastPath</string>
|
||||||
<boolean>true</boolean>
|
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles</string>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>showTemplatesAtStartup</string>
|
<string>showTemplatesAtStartup</string>
|
||||||
|
|||||||
+1
@@ -63,6 +63,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
double distance = points[0].distance(points[1]);
|
double distance = points[0].distance(points[1]);
|
||||||
Shape shape = getBodyShape();
|
Shape shape = getBodyShape();
|
||||||
|
// If there's no body, just draw the line connecting the ending points.
|
||||||
if (shape == null) {
|
if (shape == null) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
|
||||||
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
|
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
|
||||||
|
|||||||
+4
@@ -314,6 +314,10 @@ public class DrawingManager {
|
|||||||
return componentAreaMap.get(component);
|
return componentAreaMap.get(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearComponentAreaMap() {
|
||||||
|
componentAreaMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
|
|||||||
+1
@@ -179,6 +179,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
|||||||
width, thickness);
|
width, thickness);
|
||||||
Area area = new Area(rect);
|
Area area = new Area(rect);
|
||||||
area.transform(AffineTransform.getRotateInstance(theta, midX, midY));
|
area.transform(AffineTransform.getRotateInstance(theta, midX, midY));
|
||||||
|
area.transform(currentTx);
|
||||||
appendShape(area);
|
appendShape(area);
|
||||||
// Set the prev point to line end
|
// Set the prev point to line end
|
||||||
prevPoint = nextPoint;
|
prevPoint = nextPoint;
|
||||||
|
|||||||
+1
@@ -180,6 +180,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
public void loadProject(Project project, boolean freshStart) {
|
public void loadProject(Project project, boolean freshStart) {
|
||||||
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();
|
||||||
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);
|
||||||
|
|||||||
+13
-1
@@ -32,6 +32,7 @@ import org.diylc.components.passive.RadialFilmCapacitor;
|
|||||||
import org.diylc.components.passive.Resistor;
|
import org.diylc.components.passive.Resistor;
|
||||||
import org.diylc.components.semiconductors.DIL_IC;
|
import org.diylc.components.semiconductors.DIL_IC;
|
||||||
import org.diylc.components.semiconductors.DiodePlastic;
|
import org.diylc.components.semiconductors.DiodePlastic;
|
||||||
|
import org.diylc.components.semiconductors.LED;
|
||||||
import org.diylc.components.semiconductors.TransistorTO92;
|
import org.diylc.components.semiconductors.TransistorTO92;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
@@ -302,7 +303,7 @@ public class ProjectFileManager {
|
|||||||
}
|
}
|
||||||
String sizeAttr = node.getAttributes().getNamedItem("Size").getNodeValue();
|
String sizeAttr = node.getAttributes().getNamedItem("Size").getNodeValue();
|
||||||
if (sizeAttr.equalsIgnoreCase("small")) {
|
if (sizeAttr.equalsIgnoreCase("small")) {
|
||||||
capacitor.setLength(new Size(3d, SizeUnit.mm));
|
capacitor.setLength(new Size(3.5d, SizeUnit.mm));
|
||||||
} else if (sizeAttr.equalsIgnoreCase("medium")) {
|
} else if (sizeAttr.equalsIgnoreCase("medium")) {
|
||||||
capacitor.setLength(new Size(5d, SizeUnit.mm));
|
capacitor.setLength(new Size(5d, SizeUnit.mm));
|
||||||
} else if (sizeAttr.equalsIgnoreCase("large")) {
|
} else if (sizeAttr.equalsIgnoreCase("large")) {
|
||||||
@@ -327,6 +328,17 @@ public class ProjectFileManager {
|
|||||||
capacitor.setControlPoint(point1, 0);
|
capacitor.setControlPoint(point1, 0);
|
||||||
capacitor.setControlPoint(point2, 1);
|
capacitor.setControlPoint(point2, 1);
|
||||||
component = capacitor;
|
component = capacitor;
|
||||||
|
} else if (nodeName.equalsIgnoreCase("led")) {
|
||||||
|
LOG.debug("Recognized " + nodeName);
|
||||||
|
LED led = new LED();
|
||||||
|
led.setName(nameAttr);
|
||||||
|
led.setValue(valueAttr);
|
||||||
|
led.setBodyColor(Color.red);
|
||||||
|
led.setBorderColor(Color.red.darker());
|
||||||
|
led.setLength(new Size(3d, SizeUnit.mm));
|
||||||
|
led.setControlPoint(point1, 0);
|
||||||
|
led.setControlPoint(point2, 1);
|
||||||
|
component = led;
|
||||||
} else if (nodeName.equalsIgnoreCase("transistor")) {
|
} else if (nodeName.equalsIgnoreCase("transistor")) {
|
||||||
LOG.debug("Recognized " + nodeName);
|
LOG.debug("Recognized " + nodeName);
|
||||||
TransistorTO92 transistor = new TransistorTO92();
|
TransistorTO92 transistor = new TransistorTO92();
|
||||||
|
|||||||
@@ -151,6 +151,10 @@
|
|||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Copy/paste doesn't work for some components (potentiometer, transistor, etc)</description>
|
<description>Copy/paste doesn't work for some components (potentiometer, transistor, etc)</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Resistor color codes are sometimes wrong</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
<com.diyfever.gui.update.Change>
|
<com.diyfever.gui.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Resistors can specify power handling</description>
|
<description>Resistors can specify power handling</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user