Changeset 35622 in osm for applications/editors/josm


Ignore:
Timestamp:
2020-10-26T09:32:12+01:00 (4 years ago)
Author:
simon04
Message:

Add PasteLevel0LAction

Location:
applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/Comfort0Plugin.java

    r35619 r35622  
    2323        MainMenu.add(menu.editMenu, new EditLevel0LAction());
    2424        MainMenu.addAfter(menu.editMenu, new CopyLevel0LAction(), false, menu.copy);
     25        MainMenu.addAfter(menu.editMenu, new PasteLevel0LAction(), false, menu.paste);
    2526
    2627    }
  • applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/EditLevel0LAction.java

    r35621 r35622  
    77import java.io.BufferedReader;
    88import java.io.IOException;
     9import java.io.Reader;
    910import java.nio.charset.Charset;
    1011import java.nio.file.Files;
     
    9899
    99100    private void readLevel0(Path path, final DataSet dataSet) throws IOException, ParseException {
    100         final List<PrimitiveData> primitives;
    101101        try (BufferedReader reader = Files.newBufferedReader(path, CHARSET)) {
    102             primitives = new Level0LParser(reader).primitives();
     102            final List<PrimitiveData> primitives = readLevel0(reader, dataSet);
     103            Logging.info("Comfort0: Reading file {0} yielded {1} primitives", path, primitives.size());
    103104        }
    104         Logging.info("Comfort0: Reading file {0} yielded {1} primitives", path, primitives.size());
    105 
    106         buildChangeCommands(dataSet, primitives);
    107105    }
    108106
    109     private void buildChangeCommands(DataSet dataSet, List<PrimitiveData> primitives) {
     107    static List<PrimitiveData> readLevel0(Reader reader, final DataSet dataSet) throws ParseException {
     108        final List<PrimitiveData> primitives = new Level0LParser(reader).primitives();
     109        buildChangeCommands(dataSet, primitives);
     110        return primitives;
     111    }
     112
     113    static void buildChangeCommands(DataSet dataSet, List<PrimitiveData> primitives) {
    110114        final List<Command> commands = new ArrayList<>();
    111115        for (PrimitiveData fromLevel0L : primitives) {
Note: See TracChangeset for help on using the changeset viewer.