Changeset 18256 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
- Timestamp:
- 2009-10-22T23:31:48+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r18207 r18256 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.awt.Color; 5 6 import java.awt.Component; 6 7 import java.awt.Graphics; 7 8 import java.awt.Graphics2D; 8 9 import java.awt.Image; 10 import java.awt.Point; 9 11 import java.awt.Toolkit; 10 12 import java.awt.image.BufferedImage; … … 19 21 import javax.swing.Icon; 20 22 import javax.swing.ImageIcon; 21 import javax.swing.JDialog;22 23 import javax.swing.JMenuItem; 23 24 import javax.swing.JOptionPane; … … 25 26 import org.openstreetmap.josm.Main; 26 27 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 27 import org.openstreetmap.josm.data.projection.Lambert;28 28 import org.openstreetmap.josm.data.projection.LambertCC9Zones; 29 29 import org.openstreetmap.josm.data.Bounds; … … 203 203 img.paint((Graphics2D) g, mv, CadastrePlugin.backgroundTransparent, 204 204 CadastrePlugin.transparency, CadastrePlugin.drawBoundaries); 205 } 206 if (this.isRaster) { 207 paintCrosspieces(g, mv); 205 208 } 206 209 } … … 527 530 } 528 531 532 public EastNorth getRasterCenter() { 533 return new EastNorth((images.get(0).max.east()+images.get(0).min.east())/2, 534 (images.get(0).max.north()+images.get(0).min.north())/2); 535 } 536 537 public void displace(double dx, double dy) { 538 this.rasterMin = new EastNorth(rasterMin.east() + dx, rasterMin.north() + dy); 539 images.get(0).shear(dx, dy); 540 } 541 542 public void resize(EastNorth rasterCenter, double proportion) { 543 this.rasterMin = rasterMin.interpolate(rasterCenter, proportion); 544 images.get(0).scale(rasterCenter, proportion); 545 } 546 547 public void rotate(EastNorth rasterCenter, double angle) { 548 this.rasterMin = rasterMin.rotate(rasterCenter, angle); 549 images.get(0).rotate(rasterCenter, angle); 550 } 551 552 private void paintCrosspieces(Graphics g, MapView mv) { 553 String crosspieces = Main.pref.get("cadastrewms.crosspieces", "0"); 554 if (!crosspieces.equals("0")) { 555 int modulo = 50; 556 if (crosspieces.equals("2")) modulo = 100; 557 EastNorthBound currentView = new EastNorthBound(mv.getEastNorth(0, mv.getHeight()), 558 mv.getEastNorth(mv.getWidth(), 0)); 559 int minX = ((int)currentView.min.east()/modulo+1)*modulo; 560 int minY = ((int)currentView.min.north()/modulo+1)*modulo; 561 int maxX = ((int)currentView.max.east()/modulo)*modulo; 562 int maxY = ((int)currentView.max.north()/modulo)*modulo; 563 int size=(maxX-minX)/modulo; 564 if (size<20) { 565 int px= size > 10 ? 2 : Math.abs(12-size); 566 g.setColor(Color.green); 567 for (int x=minX; x<=maxX; x+=modulo) { 568 for (int y=minY; y<=maxY; y+=modulo) { 569 Point p = mv.getPoint(new EastNorth(x,y)); 570 g.drawLine(p.x-px, p.y, p.x+px, p.y); 571 g.drawLine(p.x, p.y-px, p.x, p.y+px); 572 } 573 } 574 } 575 } 576 } 577 529 578 }
Note:
See TracChangeset
for help on using the changeset viewer.
