Changeset 18256 in osm for applications/editors
- Timestamp:
- 2009-10-22T23:31:48+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r18207 r18256 20 20 import org.openstreetmap.josm.gui.MainMenu; 21 21 import org.openstreetmap.josm.gui.MapFrame; 22 import org.openstreetmap.josm.gui.IconToggleButton; 22 23 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 23 24 import org.openstreetmap.josm.plugins.Plugin; … … 216 217 217 218 private static void setEnabledAll(boolean isEnabled) { 218 boolean isLambertCC9Zones = Main.proj instanceof LambertCC9Zones;219 219 for (int i = 0; i < cadastreJMenu.getItemCount(); i++) { 220 220 JMenuItem item = cadastreJMenu.getItem(i); … … 236 236 if (oldFrame == null && newFrame != null) { 237 237 setEnabledAll(true); 238 /*Main.map.addMapMode(new IconToggleButton239 (new WMSAdjustAction(Main.map))); */238 Main.map.addMapMode(new IconToggleButton 239 (new WMSAdjustAction(Main.map))); 240 240 } else if (oldFrame != null && newFrame == null) { 241 241 setEnabledAll(false); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java
r18207 r18256 44 44 45 45 private JRadioButton grabMultiplier4 = new JRadioButton("", true); 46 47 private JRadioButton crosspiece1 = new JRadioButton("off"); 48 49 private JRadioButton crosspiece2 = new JRadioButton("50m"); 50 51 private JRadioButton crosspiece3 = new JRadioButton("100m"); 46 52 47 53 static final int DEFAULT_SQUARE_SIZE = 100; … … 57 63 private JTextField rasterDivider = new JTextField(10); 58 64 65 static final int DEFAULT_CROSSPIECES = 0; 66 59 67 public void addGui(final PreferenceDialog gui) { 60 68 … … 115 123 JLabel jLabelScale = new JLabel(tr("Vector images grab multiplier:")); 116 124 cadastrewms.add(jLabelScale, GBC.std().insets(0, 5, 10, 0)); 117 ButtonGroup bg = new ButtonGroup();125 ButtonGroup bgGrabMultiplier = new ButtonGroup(); 118 126 ActionListener multiplierActionListener = new ActionListener() { 119 127 public void actionPerformed(ActionEvent actionEvent) { … … 137 145 grabMultiplier4.addActionListener( multiplierActionListener); 138 146 grabMultiplier4.setToolTipText(tr("Fixed size square (default is 100m)")); 139 bg .add(grabMultiplier1);140 bg .add(grabMultiplier2);141 bg .add(grabMultiplier3);142 bg .add(grabMultiplier4);147 bgGrabMultiplier.add(grabMultiplier1); 148 bgGrabMultiplier.add(grabMultiplier2); 149 bgGrabMultiplier.add(grabMultiplier3); 150 bgGrabMultiplier.add(grabMultiplier4); 143 151 String currentScale = Main.pref.get("cadastrewms.scale", "1"); 144 152 if (currentScale.equals(Scale.X1.value)) … … 173 181 disableImageCropping.setSelected(Main.pref.getBoolean("cadastrewms.noImageCropping", false)); 174 182 disableImageCropping.setToolTipText(tr("Disable image cropping during georeferencing.")); 175 cadastrewms.add(disableImageCropping, GBC.eop().insets(0, 0, 0, 5)); 183 cadastrewms.add(disableImageCropping, GBC.eop().insets(0, 0, 0, 0)); 184 // the crosspiece display 185 JLabel jLabelCrosspieces = new JLabel(tr("Display crosspieces:")); 186 cadastrewms.add(jLabelCrosspieces, GBC.std().insets(0, 0, 10, 0)); 187 ButtonGroup bgCrosspieces = new ButtonGroup(); 188 int crosspieces = getNumber("cadastrewms.crosspieces", DEFAULT_CROSSPIECES); 189 if (crosspieces == 0) crosspiece1.setSelected(true); 190 if (crosspieces == 1) crosspiece2.setSelected(true); 191 if (crosspieces == 2) crosspiece3.setSelected(true); 192 bgCrosspieces.add(crosspiece1); 193 bgCrosspieces.add(crosspiece2); 194 bgCrosspieces.add(crosspiece3); 195 cadastrewms.add(crosspiece1, GBC.std().insets(5, 0, 5, 0)); 196 cadastrewms.add(crosspiece2, GBC.std().insets(5, 0, 5, 0)); 197 cadastrewms.add(crosspiece3, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 5, 0, 5)); 176 198 177 199 // separator … … 230 252 } 231 253 Main.pref.put("cadastrewms.noImageCropping", disableImageCropping.isSelected()); 254 if (crosspiece1.isSelected()) Main.pref.put("cadastrewms.crosspieces", "0"); 255 else if (crosspiece2.isSelected()) Main.pref.put("cadastrewms.crosspieces", "1"); 256 else if (crosspiece3.isSelected()) Main.pref.put("cadastrewms.crosspieces", "2"); 232 257 Main.pref.put("cadastrewms.enableCaching", enableCache.isSelected()); 233 258 -
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.