Changeset 29922 in osm for applications


Ignore:
Timestamp:
2013-09-10T21:04:07+02:00 (11 years ago)
Author:
pieren
Message:

#9052 add load/save sessions feature

Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java

    r29732 r29922  
    146146            fis = new FileInputStream(file);
    147147            ois = new ObjectInputStream(fis);
    148             successfulRead = wmsLayer.read(ois, currentLambertZone);
     148            successfulRead = wmsLayer.read(file, ois, currentLambertZone);
    149149        } catch (Exception ex) {
    150150            ex.printStackTrace(System.out);
     
    195195                        ObjectOutputStream oos = new ObjectOutputStream(
    196196                                new BufferedOutputStream(new FileOutputStream(file)));
    197                         wmsLayer.write(oos);
     197                        wmsLayer.write(file, oos);
    198198                        for (int i=0; i < size; i++) {
    199199                            oos.writeObject(imagesToSave.get(i));
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r29829 r29922  
    55import static org.openstreetmap.josm.tools.I18n.marktr;
    66import static org.openstreetmap.josm.tools.I18n.tr;
     7import static org.openstreetmap.josm.io.session.SessionWriter.registerSessionLayerExporter;
     8import static org.openstreetmap.josm.io.session.SessionReader.registerSessionLayerImporter;
    79
    810import java.awt.event.ActionEvent;
     
    138140 *                 - workaround on address help tool when switching to full screen
    139141 *                 - improvement when clicking on existing node address street in mode relation
    140  *                 - option to simplify raster images in 2 bits colors (like images served in the past).                   
     142 *                 - option to simplify raster images in 2 bits colors (like images served in the past).
     143 * 2.6 10-Sep-2013 - add JOSM "sessions" feature support (list of layers stored in a file)                   
    141144 */
    142145public class CadastrePlugin extends Plugin {
     
    208211
    209212        UploadAction.registerUploadHook(new CheckSourceUploadHook());
     213       
     214        registerSessionLayerExporter(WMSLayer.class , CadastreSessionExporter.class);
     215        registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class);
    210216
    211217    }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r29828 r29922  
    1515import java.awt.image.ImageObserver;
    1616import java.io.EOFException;
     17import java.io.File;
    1718import java.io.IOException;
    1819import java.io.ObjectInputStream;
     
    131132    public void destroy() {
    132133        // if the layer is currently saving the images in the cache, wait until it's finished
    133         grabThread.cancel();
     134        if(grabThread != null)
     135                        grabThread.cancel();
    134136        grabThread = null;
    135137        super.destroy();
     
    439441     * @throws IOException
    440442     */
    441     public void write(ObjectOutputStream oos) throws IOException {
     443    public void write(File associatedFile, ObjectOutputStream oos) throws IOException {
    442444        currentFormat = this.serializeFormatVersion;
     445        setAssociatedFile(associatedFile);
    443446        oos.writeInt(this.serializeFormatVersion);
    444447        oos.writeObject(this.location);    // String
     
    467470     * @throws ClassNotFoundException
    468471     */
    469     public boolean read(ObjectInputStream ois, int currentLambertZone) throws IOException, ClassNotFoundException {
     472    public boolean read(File associatedFile, ObjectInputStream ois, int currentLambertZone) throws IOException, ClassNotFoundException {
    470473        currentFormat = ois.readInt();;
    471474        if (currentFormat < 2) {
     
    478481        this.lambertZone = ois.readInt();
    479482        this.setRaster(ois.readBoolean());
     483        setAssociatedFile(associatedFile);
    480484        if (currentFormat >= 4)
    481485            ois.readBoolean();
Note: See TracChangeset for help on using the changeset viewer.