Changeset 32556 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Address.java
- Timestamp:
- 2016-07-04T14:18:17+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Address.java
r32425 r32556 1 // License: GPL. For details, see LICENSE file. 1 2 package cadastre_fr; 2 3 … … 113 114 // dialog.setVisible(false); 114 115 // kill the window completely to fix an issue on some linux distro and full screen mode. 115 if(dialog != null) { 116 if (dialog != null) { 116 117 dialog.dispose(); 117 118 dialog = null; … … 156 157 } 157 158 if (currentMouseNode.get(tagHouseStreet) != null) { 158 if(Main.pref.getBoolean("cadastrewms.addr.dontUseRelation", false)) { 159 if (Main.pref.getBoolean("cadastrewms.addr.dontUseRelation", false)) { 159 160 inputStreet.setText(currentMouseNode.get(tagHouseStreet)); 160 161 if (ctrl) { … … 164 165 applyInputNumberChange(); 165 166 } 166 setSelectedWay((Way)null); 167 setSelectedWay((Way) null); 167 168 } 168 169 } else { … … 184 185 } else { 185 186 List<WaySegment> wss = mv.getNearestWaySegments(mousePos, OsmPrimitive.isSelectablePredicate); 186 for(WaySegment ws : wss) { 187 for (WaySegment ws : wss) { 187 188 if (ws.way.get(tagHighway) != null && ws.way.get(tagHighwayName) != null) 188 189 mouseOnExistingWays.add(ws.way); … … 220 221 for (OsmPrimitive osm : l) { 221 222 if (osm instanceof Relation && osm.hasKey("type") && osm.get("type").equals(relationAddrType)) { 222 for (RelationMember rm : ((Relation)osm).getMembers()) { 223 for (RelationMember rm : ((Relation) osm).getMembers()) { 223 224 if (rm.getRole().equals(relationAddrStreetRole)) { 224 225 OsmPrimitive osp = rm.getMember(); 225 226 if (osp instanceof Way && osp.hasKey(tagHighwayName)) { 226 return (Way)osp; 227 return (Way) osp; 227 228 } 228 229 } … … 264 265 for (OsmPrimitive osm : l) { 265 266 if (osm instanceof Relation && osm.hasKey("type") && osm.get("type").equals(relationAddrType)) { 266 return (Relation)osm; 267 return (Relation) osm; 267 268 } 268 269 } … … 310 311 is.add(ws.lowerIndex); 311 312 } 312 Set<Pair<Node,Node>> segSet = new HashSet<>(); 313 Set<Pair<Node, Node>> segSet = new HashSet<>(); 313 314 ArrayList<Way> replacedWays = new ArrayList<>(); 314 315 ArrayList<Way> reuseWays = new ArrayList<>(); … … 333 334 } 334 335 335 private static void adjustNode(Collection<Pair<Node,Node>> segs, Node n) { 336 private static void adjustNode(Collection<Pair<Node, Node>> segs, Node n) { 336 337 337 338 switch (segs.size()) { … … 341 342 // This computes the intersection between 342 343 // the two segments and adjusts the node position. 343 Iterator<Pair<Node,Node>> i = segs.iterator(); 344 Pair<Node,Node> seg = i.next(); 344 Iterator<Pair<Node, Node>> i = segs.iterator(); 345 Pair<Node, Node> seg = i.next(); 345 346 EastNorth A = seg.a.getEastNorth(); 346 347 EastNorth B = seg.b.getEastNorth(); … … 349 350 EastNorth D = seg.b.getEastNorth(); 350 351 351 double u =det(B.east() - A.east(), B.north() - A.north(), C.east() - D.east(), C.north() - D.north());352 double u = det(B.east() - A.east(), B.north() - A.north(), C.east() - D.east(), C.north() - D.north()); 352 353 353 354 // Check for parallel segments and do nothing if they are … … 366 367 367 368 int snapToIntersectionThreshold 368 = Main.pref.getInteger("edit.snap-intersection-threshold",10); 369 = Main.pref.getInteger("edit.snap-intersection-threshold", 10); 369 370 370 371 // only adjust to intersection if within snapToIntersectionThreshold pixel of mouse click; otherwise … … 462 463 inputNumber.setText(""); 463 464 inputStreet.setText(""); 464 setSelectedWay((Way)null); 465 setSelectedWay((Way) null); 465 466 } 466 467 }); … … 495 496 Main.pref.put("cadastrewms.addr.bounds", dialog.getX()+","+dialog.getY()+","+dialog.getWidth()+","+dialog.getHeight()); 496 497 } 498 497 499 @Override public void componentMoved(ComponentEvent e) { 498 500 rememberGeometry(); 499 501 } 502 500 503 @Override public void componentResized(ComponentEvent e) { 501 504 rememberGeometry(); … … 506 509 public void windowClosing(WindowEvent arg) { 507 510 exitMode(); 508 Main.map.selectMapMode((MapMode)Main.map.getDefaultButtonAction()); 511 Main.map.selectMapMode((MapMode) Main.map.getDefaultButtonAction()); 509 512 } 510 513 }); 511 String bounds = Main.pref.get("cadastrewms.addr.bounds",null); 514 String bounds = Main.pref.get("cadastrewms.addr.bounds", null); 512 515 if (bounds != null) { 513 516 String[] b = bounds.split(","); 514 517 dialog.setBounds(new Rectangle( 515 Integer.parseInt(b[0]),Integer.parseInt(b[1]),Integer.parseInt(b[2]),Integer.parseInt(b[3]))); 518 Integer.parseInt(b[0]), Integer.parseInt(b[1]), Integer.parseInt(b[2]), Integer.parseInt(b[3]))); 516 519 } 517 520 }
Note:
See TracChangeset
for help on using the changeset viewer.
