Changeset 17397 in osm for applications/editors/josm
- Timestamp:
- 2009-08-31T09:48:53+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/build.xml
r17390 r17397 32 32 <property name="ant.build.javac.target" value="1.5"/> 33 33 <property name="commit.message" value="fixing JOSM issue #3186" /> 34 <property name="josm.reference.release" value="20 12" />34 <property name="josm.reference.release" value="2020" /> 35 35 36 36 <target name="init"> -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
r16872 r17397 144 144 max = (EastNorth) in.readObject(); 145 145 min = (EastNorth) in.readObject(); 146 image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in)); 146 boolean hasImage = in.readBoolean(); 147 if (hasImage) 148 image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in)); 149 else { 150 in.readObject(); // read null from input stream 151 image = null; 152 } 147 153 } 148 154 … … 150 156 out.writeObject(max); 151 157 out.writeObject(min); 152 if(image == null) 158 if(image == null) { 159 out.writeBoolean(false); 153 160 out.writeObject(null); 154 else 161 } else { 162 out.writeBoolean(true); 155 163 ImageIO.write(image, "png", ImageIO.createImageOutputStream(out)); 164 } 156 165 } 157 166 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r17390 r17397 1 1 package wmsplugin; 2 2 3 import org.openstreetmap.josm.io.CacheFiles;4 3 import static org.openstreetmap.josm.tools.I18n.tr; 5 4 … … 35 34 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 36 35 import org.openstreetmap.josm.gui.layer.Layer; 36 import org.openstreetmap.josm.io.CacheFiles; 37 37 import org.openstreetmap.josm.tools.ImageProvider; 38 38 … … 61 61 protected String baseURL; 62 62 protected String cookies; 63 protected final int serializeFormatVersion = 4;63 protected final int serializeFormatVersion = 5; 64 64 65 65 private ExecutorService executor = null; … … 212 212 startstop, 213 213 alphaChannel, 214 new JMenuItem(new changeResolutionAction()),215 new JMenuItem(new reloadErrorTilesAction()),216 new JMenuItem(new downloadAction()),214 new JMenuItem(new ChangeResolutionAction()), 215 new JMenuItem(new ReloadErrorTilesAction()), 216 new JMenuItem(new DownloadAction()), 217 217 new JSeparator(), 218 218 new JMenuItem(new LayerListPopup.InfoAction(this)) … … 230 230 } 231 231 232 public class downloadAction extends AbstractAction {233 public downloadAction() {232 public class DownloadAction extends AbstractAction { 233 public DownloadAction() { 234 234 super(tr("Download visible tiles")); 235 235 } … … 239 239 } 240 240 241 public class changeResolutionAction extends AbstractAction {242 public changeResolutionAction() {241 public class ChangeResolutionAction extends AbstractAction { 242 public ChangeResolutionAction() { 243 243 super(tr("Change resolution")); 244 244 } … … 251 251 } 252 252 253 public class reloadErrorTilesAction extends AbstractAction {254 public reloadErrorTilesAction() {253 public class ReloadErrorTilesAction extends AbstractAction { 254 public ReloadErrorTilesAction() { 255 255 super(tr("Reload erroneous tiles")); 256 256 } … … 294 294 } 295 295 } 296 296 297 297 public class SaveWmsAction extends AbstractAction { 298 298 public SaveWmsAction() { … … 302 302 File f = SaveActionBase.createAndOpenSaveFileChooser( 303 303 tr("Save WMS layer"), ".wms"); 304 try 305 {306 FileOutputStream fos = new FileOutputStream(f);307 ObjectOutputStream oos = new ObjectOutputStream(fos);308 oos.writeInt(serializeFormatVersion);309 oos.writeInt(dax);310 oos.writeInt(day);311 oos.writeInt(ImageSize);312 oos.writeDouble(pixelPerDegree);313 oos.writeObject(getName());314 oos.writeObject(baseURL);315 oos.writeObject(images);316 oos.close();317 fos.close();318 }319 catch (Exception ex) {304 try { 305 if (f != null) { 306 ObjectOutputStream oos = new ObjectOutputStream( 307 new FileOutputStream(f) 308 ); 309 oos.writeInt(serializeFormatVersion); 310 oos.writeInt(dax); 311 oos.writeInt(day); 312 oos.writeInt(ImageSize); 313 oos.writeDouble(pixelPerDegree); 314 oos.writeObject(getName()); 315 oos.writeObject(baseURL); 316 oos.writeObject(images); 317 oos.close(); 318 } 319 } catch (Exception ex) { 320 320 ex.printStackTrace(System.out); 321 321 } … … 329 329 public void actionPerformed(ActionEvent ev) { 330 330 JFileChooser fc = DiskAccessAction.createAndOpenFileChooser(true, 331 false, tr("Load WMS layer") );331 false, tr("Load WMS layer"), "wms"); 332 332 if(fc == null) return; 333 333 File f = fc.getSelectedFile(); -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r17340 r17397 24 24 25 25 import org.openstreetmap.josm.Main; 26 import org.openstreetmap.josm.actions.ExtensionFileFilter; 26 27 import org.openstreetmap.josm.actions.JosmAction; 27 28 import org.openstreetmap.josm.data.ProjectionBounds; … … 35 36 import org.openstreetmap.josm.plugins.Plugin; 36 37 38 import wmsplugin.io.WMSLayerExporter; 39 import wmsplugin.io.WMSLayerImporter; 40 37 41 public class WMSPlugin extends Plugin { 38 42 static CacheFiles cache = new CacheFiles("wmsplugin"); … … 46 50 // remember state of menu item to restore on changed preferences 47 51 static private boolean menuEnabled = false; 52 53 protected void initExporterAndImporter() { 54 ExtensionFileFilter.exporters.add(new WMSLayerExporter()); 55 ExtensionFileFilter.importers.add(new WMSLayerImporter()); 56 } 48 57 49 58 public WMSPlugin() { … … 51 60 cache.setExpire(CacheFiles.EXPIRE_MONTHLY, false); 52 61 cache.setMaxSize(70, false); 62 initExporterAndImporter(); 53 63 } 54 64
Note:
See TracChangeset
for help on using the changeset viewer.