diff --git a/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java b/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
index bdc4aad..d072cb3 100644
|
a
|
b
|
import java.awt.Color;
|
| 11 | 11 | import java.awt.Cursor; |
| 12 | 12 | import java.awt.Graphics2D; |
| 13 | 13 | import java.awt.Point; |
| | 14 | import java.awt.RenderingHints; |
| 14 | 15 | import java.awt.Stroke; |
| 15 | 16 | import java.awt.event.ActionEvent; |
| 16 | 17 | import java.awt.event.KeyEvent; |
| … |
… |
import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
| 51 | 52 | import org.openstreetmap.josm.data.osm.Way; |
| 52 | 53 | import org.openstreetmap.josm.data.osm.WaySegment; |
| 53 | 54 | import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; |
| | 55 | import org.openstreetmap.josm.data.osm.visitor.paint.MapRendererFactory; |
| | 56 | import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; |
| | 57 | import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; |
| 54 | 58 | import org.openstreetmap.josm.gui.MainMenu; |
| 55 | 59 | import org.openstreetmap.josm.gui.MapFrame; |
| 56 | 60 | import org.openstreetmap.josm.gui.MapView; |
| … |
… |
import org.openstreetmap.josm.tools.Utils;
|
| 71 | 75 | /** |
| 72 | 76 | * Mapmode to add nodes, create and extend ways. |
| 73 | 77 | */ |
| 74 | | public class DrawAction extends MapMode implements MapViewPaintable, SelectionChangedListener, KeyPressReleaseListener, ModifierListener { |
| | 78 | public class DrawAction extends MapMode implements MapViewPaintable, SelectionChangedListener, KeyPressReleaseListener, ModifierListener, PreferenceChangedListener { |
| 75 | 79 | |
| 76 | 80 | private static final Color ORANGE_TRANSPARENT = new Color(Color.ORANGE.getRed(), Color.ORANGE.getGreen(), Color.ORANGE.getBlue(), 128); |
| 77 | 81 | private static final double PHI = Math.toRadians(90); |
| … |
… |
public class DrawAction extends MapMode implements MapViewPaintable, SelectionCh
|
| 117 | 121 | private static final BasicStroke BASIC_STROKE = new BasicStroke(1); |
| 118 | 122 | |
| 119 | 123 | private static int snapToIntersectionThreshold; |
| | 124 | private boolean antialiasing; |
| 120 | 125 | |
| 121 | 126 | /** |
| 122 | 127 | * Constructs a new {@code DrawAction}. |
| … |
… |
public class DrawAction extends MapMode implements MapViewPaintable, SelectionCh
|
| 137 | 142 | backspaceAction = new BackSpaceAction(); |
| 138 | 143 | cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode"); |
| 139 | 144 | cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway"); |
| 140 | | |
| | 145 | Main.pref.addPreferenceChangeListener(this); |
| 141 | 146 | readPreferences(); |
| 142 | 147 | snapHelper.init(); |
| 143 | 148 | } |
| … |
… |
public class DrawAction extends MapMode implements MapViewPaintable, SelectionCh
|
| 213 | 218 | if (!isEnabled()) |
| 214 | 219 | return; |
| 215 | 220 | super.enterMode(); |
| 216 | | readPreferences(); |
| 217 | 221 | |
| 218 | 222 | // determine if selection is suitable to continue drawing. If it |
| 219 | 223 | // isn't, set wayIsFinished to true to avoid superfluous repaints. |
| … |
… |
public class DrawAction extends MapMode implements MapViewPaintable, SelectionCh
|
| 246 | 250 | drawHelperLine = Main.pref.getBoolean("draw.helper-line", true); |
| 247 | 251 | drawTargetHighlight = Main.pref.getBoolean("draw.target-highlight", true); |
| 248 | 252 | snapToIntersectionThreshold = Main.pref.getInteger("edit.snap-intersection-threshold", 10); |
| | 253 | |
| | 254 | if (MapRendererFactory.getInstance().isWireframeMapRendererActive()) { |
| | 255 | antialiasing = Main.pref.getBoolean("mappaint.wireframe.use-antialiasing", false); |
| | 256 | } else { |
| | 257 | antialiasing = Main.pref.getBoolean("mappaint.use-antialiasing", true); |
| | 258 | } |
| 249 | 259 | } |
| 250 | 260 | |
| 251 | 261 | @Override |
| … |
… |
public class DrawAction extends MapMode implements MapViewPaintable, SelectionCh
|
| 1126 | 1136 | return; |
| 1127 | 1137 | |
| 1128 | 1138 | Graphics2D g2 = g; |
| | 1139 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antialiasing ? |
| | 1140 | RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); |
| | 1141 | |
| 1129 | 1142 | snapHelper.drawIfNeeded(g2, mv); |
| 1130 | 1143 | if (!drawHelperLine || wayIsFinished || shift) |
| 1131 | 1144 | return; |
| … |
… |
public class DrawAction extends MapMode implements MapViewPaintable, SelectionCh
|
| 1794 | 1807 | setEnabled(Main.map != null && Main.map.mapMode instanceof DrawAction); |
| 1795 | 1808 | } |
| 1796 | 1809 | } |
| | 1810 | |
| | 1811 | @Override |
| | 1812 | public void preferenceChanged(PreferenceChangeEvent e) { |
| | 1813 | readPreferences(); |
| | 1814 | } |
| 1797 | 1815 | } |