fixed point visibility on curved trace

added option to hide color bands on the resistor
This commit is contained in:
bancika
2011-01-28 17:48:46 +00:00
parent 11b7756a59
commit 7de327b9bd
7 changed files with 38 additions and 12 deletions
@@ -1,15 +1,15 @@
<map> <map>
<entry> <entry>
<string>metric</string> <string>lastPath</string>
<boolean>true</boolean> <string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
</entry> </entry>
<entry> <entry>
<string>zoom</string> <string>zoom</string>
<double>1.0</double> <double>1.0</double>
</entry> </entry>
<entry> <entry>
<string>lastPath</string> <string>metric</string>
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string> <boolean>true</boolean>
</entry> </entry>
<entry> <entry>
<string>default.org.diylc.components.misc.Label:Color</string> <string>default.org.diylc.components.misc.Label:Color</string>
@@ -2,10 +2,13 @@ package org.diylc.common;
public enum ResistorColorCode { public enum ResistorColorCode {
_4_BAND, _5_BAND; NONE, _4_BAND, _5_BAND;
@Override @Override
public String toString() { public String toString() {
return name().substring(1).replace("_", " ").toLowerCase(); if (name().startsWith("_")) {
return name().substring(1).replace("_", " ").toLowerCase();
}
return name().substring(0, 1).toUpperCase() + name().substring(1).toLowerCase();
} }
} }
@@ -82,5 +82,30 @@
<url>http://code.google.com/p/diy-layout-creator/downloads/list <url>http://code.google.com/p/diy-layout-creator/downloads/list
</url> </url>
</com.diyfever.gui.update.Version> </com.diyfever.gui.update.Version>
<com.diyfever.gui.update.Version>
<versionNumber>
<major>3</major>
<minor>0</minor>
<build>5</build>
</versionNumber>
<releaseDate>2011-01-27 21:00:00.000 CET</releaseDate>
<name></name>
<changes>
<com.diyfever.gui.update.Change>
<changeType>BUG_FIX</changeType>
<description>Curved trace does not show control points</description>
</com.diyfever.gui.update.Change>
<com.diyfever.gui.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Resistor can show color bands</description>
</com.diyfever.gui.update.Change>
<com.diyfever.gui.update.Change>
<changeType>NEW_FEATURE</changeType>
<description></description>
</com.diyfever.gui.update.Change>
</changes>
<url>http://code.google.com/p/diy-layout-creator/downloads/list
</url>
</com.diyfever.gui.update.Version>
</a> </a>
</java.util.Arrays_-ArrayList> </java.util.Arrays_-ArrayList>
@@ -38,11 +38,6 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
g2d.draw(curve); g2d.draw(curve);
} }
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.NEVER;
}
@EditableProperty(name = "Width") @EditableProperty(name = "Width")
public Size getSize() { public Size getSize() {
return size; return size;
@@ -91,6 +91,9 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
@Override @Override
protected void decorateComponentBody(Graphics2D g2d) { protected void decorateComponentBody(Graphics2D g2d) {
// int width = getWidth().convertToPixels(); // int width = getWidth().convertToPixels();
if (colorCode == ResistorColorCode.NONE) {
return;
}
int height = getClosestOdd(getHeight().convertToPixels()); int height = getClosestOdd(getHeight().convertToPixels());
Color[] bands = value.getColorCode(colorCode); Color[] bands = value.getColorCode(colorCode);
int x = 4; int x = 4;