Changeset 16294 in osm for applications/editors/josm/plugins/validator/src
- Timestamp:
- 2009-07-03T23:35:00+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java
r16159 r16294 23 23 /** 24 24 * A debug layer for testing the grid cells a way crosses. 25 * 25 * 26 26 * @author frsantos 27 27 */ … … 29 29 { 30 30 /** 31 * Constructor 31 * Constructor 32 32 * @param name 33 33 */ 34 public GridLayer(String name) 34 public GridLayer(String name) 35 35 { 36 36 super(name); … … 47 47 * Draw the grid and highlight all cells acuppied by any selected primitive. 48 48 */ 49 @Override 50 public void paint(final Graphics g, final MapView mv) 49 @Override 50 public void paint(final Graphics g, final MapView mv) 51 51 { 52 52 if( !Main.pref.hasKey(PreferenceEditor.PREF_DEBUG + ".grid") ) 53 53 return; 54 54 55 55 int gridWidth = Integer.parseInt(Main.pref.get(PreferenceEditor.PREF_DEBUG + ".grid") ); 56 56 int width = mv.getWidth(); … … 67 67 for(OsmPrimitive p : Main.ds.getSelected() ) 68 68 p.visit(visitor); 69 69 70 70 long x0 = (long)Math.floor(origin.east() * gridWidth); 71 71 long x1 = (long)Math.floor(border.east() * gridWidth); 72 72 long y0 = (long)Math.floor(origin.north() * gridWidth) + 1; 73 long y1 = (long)Math.floor(border.north() * gridWidth) + 1; 73 long y1 = (long)Math.floor(border.north() * gridWidth) + 1; 74 74 long aux; 75 75 if( x0 > x1 ) { aux = x0; x0 = x1; x1 = aux; } 76 76 if( y0 > y1 ) { aux = y0; y0 = y1; y1 = aux; } 77 77 78 78 g.setColor(Color.RED.brighter().brighter()); 79 79 for( double x = x0; x <= x1; x++) … … 90 90 } 91 91 92 @Override 93 public String getToolTipText() 92 @Override 93 public String getToolTipText() 94 94 { 95 95 return null; 96 96 } 97 97 98 @Override 98 @Override 99 99 public void mergeFrom(Layer from) {} 100 100 101 @Override 101 @Override 102 102 public boolean isMergable(Layer other) { 103 103 return false; 104 104 } 105 105 106 @Override 106 @Override 107 107 public void visitBoundingBox(BoundingXYVisitor v) {} 108 108 109 @Override 110 public Object getInfoComponent() 109 @Override 110 public Object getInfoComponent() 111 111 { 112 112 return getToolTipText(); 113 113 } 114 114 115 @Override 116 public Component[] getMenuEntries() 115 @Override 116 public Component[] getMenuEntries() 117 117 { 118 118 return new Component[]{ … … 126 126 127 127 @Override public void destroy() { } 128 128 129 129 /** 130 130 * Visitor that highlights all cells the selected primitives go through … … 152 152 this.mv = mv; 153 153 this.gridDetail = gridDetail; 154 154 155 155 Point p = mv.getPoint( new EastNorth(0, 0) ); 156 156 Point p2 = mv.getPoint( new EastNorth(1d/gridDetail, 1d/gridDetail) ); … … 158 158 } 159 159 160 public void visit(Node n) 160 public void visit(Node n) 161 161 { 162 162 double x = n.getEastNorth().east() * gridDetail; … … 166 166 } 167 167 168 public void visit(Way w) 168 public void visit(Way w) 169 169 { 170 170 Node lastN = null; … … 182 182 183 183 public void visit(Relation r) {} 184 185 /** 184 185 /** 186 186 * Draws a solid cell at the (x,y) location 187 187 * @param x -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/TestError.java
r16159 r16294 280 280 */ 281 281 public void drawNode(Node n, Color color) { 282 Point p = mv.getPoint(n .getEastNorth());282 Point p = mv.getPoint(n); 283 283 g.setColor(color); 284 284 if (selected) { … … 295 295 */ 296 296 public void drawSegment(Node n1, Node n2, Color color) { 297 Point p1 = mv.getPoint(n1 .getEastNorth());298 Point p2 = mv.getPoint(n2 .getEastNorth());297 Point p1 = mv.getPoint(n1); 298 Point p2 = mv.getPoint(n2); 299 299 g.setColor(color); 300 300 … … 365 365 */ 366 366 protected boolean isNodeVisible(Node n) { 367 Point p = mv.getPoint(n .getEastNorth());367 Point p = mv.getPoint(n); 368 368 return !((p.x < 0) || (p.y < 0) || (p.x > mv.getWidth()) || (p.y > mv.getHeight())); 369 369 } … … 377 377 */ 378 378 protected boolean isSegmentVisible(Node n1, Node n2) { 379 Point p1 = mv.getPoint(n1 .getEastNorth());380 Point p2 = mv.getPoint(n2 .getEastNorth());379 Point p1 = mv.getPoint(n1); 380 Point p2 = mv.getPoint(n2); 381 381 if ((p1.x < 0) && (p2.x < 0)) 382 382 return false;
Note:
See TracChangeset
for help on using the changeset viewer.