Changeset 805 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2008-08-18T01:27:58+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r804 r805 182 182 } 183 183 184 private Boolean virtualnodes = false; 185 public void enableVirtualNodes(Boolean state) 186 { 187 if(virtualnodes != state) 188 { 189 virtualnodes = state; 190 repaint(); 191 } 192 } 193 public Boolean useVirtualNodes() 194 { 195 return virtualnodes; 196 } 197 184 198 /** 185 199 * Moves the layer to the given new position. No event is fired. -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r794 r805 32 32 public class NavigatableComponent extends JComponent implements Helpful { 33 33 34 35 34 public static final EastNorth world = Main.proj.latlon2eastNorth(new LatLon(Projection.MAX_LAT, Projection.MAX_LON)); 36 35 public static final int snapDistance = sqr(Main.pref.getInteger("node.snap-distance", 10)); 36 37 private static int sqr(int a) { return a*a;} 37 38 /** 38 39 * The scale factor in x or y-units per pixel. This means, if scale = 10, … … 141 142 Point sp = getPoint(n.eastNorth); 142 143 double dist = p.distanceSq(sp); 143 if (minDistanceSq > dist && dist < 100) {144 if (minDistanceSq > dist && dist < snapDistance) { 144 145 minDistanceSq = p.distanceSq(sp); 145 146 minPrimitive = n; … … 180 181 double b = p.distanceSq(A); 181 182 double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared 182 if (perDist < 100&& a < c+100&& b < c+100) {183 if (perDist < snapDistance && a < c+snapDistance && b < c+snapDistance) { 183 184 List<WaySegment> l; 184 185 if (nearest.containsKey(perDist)) { … … 228 229 WaySegment nearestWaySeg = getNearestWaySegment(p); 229 230 return nearestWaySeg == null ? null : nearestWaySeg.way; 230 231 } 231 232 232 233 /** … … 240 241 * If nothing is found, return <code>null</code>. 241 242 * 242 * @param p 243 * @return 243 * @param p The point on screen. 244 * @return The primitive that is nearest to the point p. 244 245 */ 245 246 public OsmPrimitive getNearest(Point p) { 246 247 OsmPrimitive osm = getNearestNode(p); 247 248 if (osm == null) 249 { 248 250 osm = getNearestWay(p); 251 } 249 252 return osm; 250 253 } … … 258 261 return Collections.emptySet(); 259 262 return Collections.singleton(osm); 260 }261 262 @Deprecated263 public OsmPrimitive getNearest(Point p, boolean segmentInsteadWay) {264 return getNearest(p);265 263 } 266 264 … … 290 288 double b = p.distanceSq(A); 291 289 double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared 292 if (perDist < 100&& a < c+100&& b < c+100) {290 if (perDist < snapDistance && a < c+snapDistance && b < c+snapDistance) { 293 291 nearest.add(w); 294 292 break; … … 299 297 for (Node n : Main.ds.nodes) { 300 298 if (!n.deleted && !n.incomplete 301 && getPoint(n.eastNorth).distanceSq(p) < 100) {299 && getPoint(n.eastNorth).distanceSq(p) < snapDistance) { 302 300 nearest.add(n); 303 301 } … … 318 316 for (Node n : Main.ds.nodes) { 319 317 if (!n.deleted && !n.incomplete 320 && getPoint(n.eastNorth).distanceSq(p) < 100) {318 && getPoint(n.eastNorth).distanceSq(p) < snapDistance) { 321 319 nearest.add(n); 322 320 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r804 r805 148 148 @Override public void paint(final Graphics g, final MapView mv) { 149 149 boolean inactive = Main.map.mapView.getActiveLayer() != this && Main.pref.getBoolean("draw.data.inactive_color", true); 150 boolean virtual = !inactive && Main.map.mapView.useVirtualNodes(); 150 151 if (Main.pref.getBoolean("draw.data.downloaded_area", true)) { 151 152 // FIXME this is inefficient; instead a proper polygon has to be built, and instead … … 169 170 wireframeMapPainter.setNavigatableComponent(mv); 170 171 wireframeMapPainter.inactive = inactive; 171 wireframeMapPainter.visitAll(data); 172 wireframeMapPainter.visitAll(data, virtual); 172 173 } 173 174 else … … 176 177 standardMapPainter.setNavigatableComponent(mv); 177 178 standardMapPainter.inactive = inactive; 178 standardMapPainter.visitAll(data); 179 standardMapPainter.visitAll(data, virtual); 179 180 } 180 181 Main.map.conflictDialog.paintConflicts(g, mv); -
trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
r781 r805 27 27 private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers")); 28 28 private JCheckBox sourceBounds = new JCheckBox(tr("Draw boundaries of downloaded data")); 29 private JCheckBox virtualNodes = new JCheckBox(tr("Draw virtual nodes in select mode")); 29 30 private JCheckBox inactive = new JCheckBox(tr("Draw inactive layers in other color")); 30 31 private JCheckBox useAntialiasing = new JCheckBox(tr("Smooth map graphics (antialiasing)")); … … 121 122 sourceBounds.setSelected(Main.pref.getBoolean("draw.data.downloaded_area", true)); 122 123 gui.display.add(sourceBounds, GBC.eop().insets(20,0,0,0)); 123 124 125 // virtual nodes 126 virtualNodes.setToolTipText(tr("Draw virtual nodes in select mode for easy way modification.")); 127 virtualNodes.setSelected(Main.pref.getInteger("mappaint.node.virtual-size", 4) != 0); 128 gui.display.add(virtualNodes, GBC.eop().insets(20,0,0,0)); 129 124 130 // background layers in inactive color 125 131 inactive.setToolTipText(tr("Draw the inactive data layers in a different color.")); … … 142 148 Main.pref.put("draw.data.inactive_color", inactive.isSelected()); 143 149 Main.pref.put("mappaint.use-antialiasing", useAntialiasing.isSelected()); 150 Main.pref.put("mappaint.node.virtual-size", virtualNodes.isSelected() ? "4" : "0"); 144 151 } 145 152 }
Note:
See TracChangeset
for help on using the changeset viewer.