Changeset 29457 in osm for applications/editors/josm/plugins/FastDraw/src/org/openstreetmap
- Timestamp:
- 2013-04-01T19:03:38+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
r29453 r29457 2 2 3 3 import java.awt.Color; 4 import java.awt.Stroke; 4 5 import java.io.IOException; 5 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.gui.util.GuiHelper; 6 8 import static org.openstreetmap.josm.tools.I18n.tr; 7 9 … … 36 38 public boolean drawClosed; 37 39 public int simplifyMode; 38 public float lineWidth;39 40 public String autoTags; 41 public Stroke normalStroke; 42 public Stroke simplifiedStroke; 43 public Stroke deleteStroke; 44 public int dotSize; 45 public int bigDotSize; 40 46 41 47 public void loadPrefs() { … … 46 52 COLOR_SELECTEDFRAGMENT = Main.pref.getColor("fastdraw.color.select", Color.blue); 47 53 COLOR_SIMPLIFIED = Main.pref.getColor("fastdraw.color.simplified", Color.orange); 54 55 normalStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.normal", "2")); 56 deleteStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.delete", "3")); 57 simplifiedStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.simplified", "2")); 58 59 bigDotSize = Main.pref.getInteger("fastdraw.point.bigsize", 7); 60 dotSize = Main.pref.getInteger("fastdraw.point.normalsize", 5); 61 48 62 maxDist = Main.pref.getDouble("fastdraw.maxdist", 5); 49 63 epsilonMult = Main.pref.getDouble("fastdraw.epsilonmult", 1.1); … … 59 73 drawClosed = Main.pref.getBoolean("fastdraw.drawclosed", false); 60 74 simplifyMode = Main.pref.getInteger("fastdraw.simplifymode", 0); 61 lineWidth = (float) Main.pref.getDouble("fastdraw.linewidth", 2);62 75 autoTags = Main.pref.get("fastdraw.autotags"); 63 76 } 64 77 65 78 public void savePrefs() { 66 Main.pref.putColor("fastdraw.color.delete", COLOR_DELETE );67 Main.pref.putColor("fastdraw.color.edit", COLOR_EDITEDFRAGMENT);68 Main.pref.putColor("fastdraw.color.fixed", COLOR_FIXED);69 Main.pref.putColor("fastdraw.color.normal", COLOR_NORMAL);70 Main.pref.putColor("fastdraw.color.select", COLOR_SELECTEDFRAGMENT);71 Main.pref.getColor("fastdraw.color.simplified", COLOR_SIMPLIFIED);72 79 Main.pref.putDouble("fastdraw.maxdist", maxDist); 73 80 Main.pref.putDouble("fastdraw.epsilonmult", epsilonMult); … … 83 90 Main.pref.put("fastdraw.drawclosed", drawClosed); 84 91 Main.pref.putInteger("fastdraw.simplifymode", simplifyMode); 85 Main.pref.putDouble("fastdraw.linewidth",(double)lineWidth);86 92 Main.pref.put("fastdraw.autotags", autoTags); 87 93 try {Main.pref.save();} catch (IOException e) { -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r29453 r29457 8 8 9 9 import java.awt.AWTEvent; 10 import java.awt.BasicStroke;11 10 import java.awt.Color; 12 11 import java.awt.Cursor; 13 12 import java.awt.Graphics2D; 14 13 import java.awt.Point; 15 import java.awt.Stroke;16 14 import java.awt.Toolkit; 17 15 import java.awt.event.*; … … 61 59 private boolean shift; 62 60 private double eps; 63 private Stroke strokeForSimplified;64 private Stroke strokeForOriginal;65 61 private final Cursor cursorDraw; 66 62 private final Cursor cursorCtrl; … … 72 68 private LatLon highlighted; 73 69 private int nearestIdx; 74 private Stroke strokeForDelete;75 70 private int dragNode=-1; 76 71 private SequenceCommand delCmd; … … 113 108 settings.savePrefs(); 114 109 115 strokeForOriginal = new BasicStroke(settings.lineWidth);116 strokeForDelete = new BasicStroke(3);117 //strokeForSimplified = new BasicStroke(1,BasicStroke.CAP_ROUND,BasicStroke.JOIN_BEVEL,5f,118 // new float[]{5.f,5f},0f);119 strokeForSimplified = strokeForOriginal;120 121 110 eps=settings.startingEps; 122 111 mv = Main.map.mapView; … … 187 176 if (line.wasSimplified()) { 188 177 // we are drawing simplified version, that exists 189 g.setStroke(s trokeForSimplified);178 g.setStroke(settings.simplifiedStroke); 190 179 } else { 191 g.setStroke(strokeForOriginal); 192 } 193 180 g.setStroke(settings.normalStroke); 181 } 182 183 int bigDotSize = settings.bigDotSize; 184 194 185 Point p1, p2; 195 186 LatLon pp1, pp2; 196 187 p1 = line.getPoint(pts.get(0)); 197 188 g.setColor(settings.COLOR_FIXED); 198 g.fillOval(p1.x - 3, p1.y - 3, 7, 7);189 g.fillOval(p1.x - bigDotSize/2, p1.y - bigDotSize/2, bigDotSize, bigDotSize); 199 190 Color lineColor,initLineColor; 200 191 initLineColor = line.wasSimplified() ? settings.COLOR_SIMPLIFIED: settings.COLOR_NORMAL; 201 192 lineColor = initLineColor; 202 193 int rp,dp; 203 dp=line.wasSimplified() ? 7:(int)(3+((int) settings.lineWidth)/2*2); rp=dp/2;194 dp=line.wasSimplified() ? settings.bigDotSize : settings.dotSize; rp=dp/2; 204 195 if (pts.size() > 1) { 205 196 Iterator<LatLon> it1,it2; … … 218 209 lineColor=initLineColor; 219 210 g.setColor(settings.COLOR_FIXED); 220 g.fillOval(p2.x - 3, p2.y - 3, 7, 7);211 g.fillOval(p2.x - bigDotSize/2, p2.y - bigDotSize/2, bigDotSize, bigDotSize); 221 212 } else { 222 213 g.fillRect(p2.x - rp, p2.y - rp, dp, dp); … … 226 217 if (shift) { 227 218 // highlight node to delete 228 g.setStroke(s trokeForDelete);219 g.setStroke(settings.deleteStroke); 229 220 g.setColor(settings.COLOR_DELETE); 230 221 g.drawLine(p2.x - 5, p2.y - 5,p2.x + 5, p2.y + 5); 231 222 g.drawLine(p2.x - 5, p2.y + 5,p2.x + 5, p2.y - 5); 232 g.setStroke(s trokeForOriginal);223 g.setStroke(settings.normalStroke); 233 224 } else if (ctrl) { 234 225 // highlight node to toggle fixation 235 g.setStroke(s trokeForDelete);226 g.setStroke(settings.deleteStroke); 236 227 g.setColor( line.isFixed(pp2) ? settings.COLOR_NORMAL: settings.COLOR_FIXED); 237 g. drawOval(p2.x - 5, p2.y - 5, 11, 11);238 g.setStroke(s trokeForOriginal);228 g.fillOval(p2.x - bigDotSize/2-2, p2.y - bigDotSize/2-2, bigDotSize+4, bigDotSize+4); 229 g.setStroke(settings.normalStroke); 239 230 } 240 231 }
Note:
See TracChangeset
for help on using the changeset viewer.