Ignore:
Timestamp:
2018-08-18T18:12:13+02:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 14153

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoorhelper/src/model/IndoorHelperModel.java

    r34310 r34522  
    2727import javax.swing.JOptionPane;
    2828
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.command.AddCommand;
    3130import org.openstreetmap.josm.command.ChangePropertyCommand;
     31import org.openstreetmap.josm.data.UndoRedoHandler;
    3232import org.openstreetmap.josm.data.osm.DataSet;
     33import org.openstreetmap.josm.data.osm.OsmDataManager;
    3334import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3435import org.openstreetmap.josm.data.osm.Relation;
     
    7980     */
    8081    public void addTagsToOSM(IndoorObject object, List<Tag> userTags) {
    81         if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
    82 
    83             DataSet ds = Main.main.getEditDataSet();
     82        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() &&
     83                !OsmDataManager.getInstance().getInProgressSelection().isEmpty()) {
     84
     85            DataSet ds = OsmDataManager.getInstance().getEditDataSet();
    8486            List<Tag> tags = this.getObjectTags(object);
    8587            Collection<Relation> relations = ds.getRelations();
     
    9799                //Add tags to relation
    98100                for (Tag t : tags) {
    99                         Main.main.undoRedo.add(new ChangePropertyCommand(relationToAdd, t.getKey(), t.getValue()));
     101                        UndoRedoHandler.getInstance().add(new ChangePropertyCommand(relationToAdd, t.getKey(), t.getValue()));
    100102                }
    101103            } else {
    102104                //Add tags to ways or nodes
    103105                for (Tag t : tags) {
    104                     Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
     106                    UndoRedoHandler.getInstance().add(new ChangePropertyCommand(
     107                            OsmDataManager.getInstance().getInProgressSelection(), t.getKey(), t.getValue()));
    105108                }
    106109            }
     
    119122    public void addTagsToOSM(IndoorObject object) {
    120123
    121         if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
     124        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() &&
     125                !OsmDataManager.getInstance().getInProgressSelection().isEmpty()) {
    122126            List<Tag> tags = this.getObjectTags(object);
    123127
     
    127131            //Add the tags to the current selection
    128132            for (Tag t : tags) {
    129                 Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
     133                UndoRedoHandler.getInstance().add(new ChangePropertyCommand(
     134                        OsmDataManager.getInstance().getInProgressSelection(), t.getKey(), t.getValue()));
    130135            }
    131136        //If the selected dataset ist empty
     
    143148    public void addTagsToOSM(List<Tag> userTags) {
    144149
    145         if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
     150        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() &&
     151                !OsmDataManager.getInstance().getInProgressSelection().isEmpty()) {
    146152
    147153            //Add the tags to the current selection
    148154            for (Tag t : userTags) {
    149                 Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
     155                UndoRedoHandler.getInstance().add(new ChangePropertyCommand(
     156                        OsmDataManager.getInstance().getInProgressSelection(), t.getKey(), t.getValue()));
    150157            }
    151158        } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
     
    163170        Relation newRelation = new Relation();
    164171        RelationMember newMember;
    165         DataSet ds = Main.main.getEditDataSet();
     172        DataSet ds = OsmDataManager.getInstance().getEditDataSet();
    166173
    167174        // Create new relation and add a new member with specific role
     
    173180        }
    174181        // Add relation to OSM data
    175         MainApplication.undoRedo.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newRelation));
     182        UndoRedoHandler.getInstance().add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newRelation));
    176183    }
    177184
     
    186193
    187194        RelationMember newMember;
    188         DataSet ds = Main.main.getEditDataSet();
     195        DataSet ds = OsmDataManager.getInstance().getEditDataSet();
    189196        Collection<Relation> relations = ds.getRelations();
    190197        Relation relation = getRelationFromDataSet(ds, relations);
    191198
    192         if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty() &&
     199        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() &&
     200                !OsmDataManager.getInstance().getInProgressSelection().isEmpty() &&
    193201                !innerRelation.isEmpty() && getRole(ds, relations).equals("outer")) {
    194202
Note: See TracChangeset for help on using the changeset viewer.