Changeset 34522 in osm for applications/editors/josm/plugins/indoorhelper/src/model
- Timestamp:
- 2018-08-18T18:12:13+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/model/IndoorHelperModel.java
r34310 r34522 27 27 import javax.swing.JOptionPane; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.command.AddCommand; 31 30 import org.openstreetmap.josm.command.ChangePropertyCommand; 31 import org.openstreetmap.josm.data.UndoRedoHandler; 32 32 import org.openstreetmap.josm.data.osm.DataSet; 33 import org.openstreetmap.josm.data.osm.OsmDataManager; 33 34 import org.openstreetmap.josm.data.osm.OsmPrimitive; 34 35 import org.openstreetmap.josm.data.osm.Relation; … … 79 80 */ 80 81 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(); 84 86 List<Tag> tags = this.getObjectTags(object); 85 87 Collection<Relation> relations = ds.getRelations(); … … 97 99 //Add tags to relation 98 100 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())); 100 102 } 101 103 } else { 102 104 //Add tags to ways or nodes 103 105 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())); 105 108 } 106 109 } … … 119 122 public void addTagsToOSM(IndoorObject object) { 120 123 121 if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) { 124 if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && 125 !OsmDataManager.getInstance().getInProgressSelection().isEmpty()) { 122 126 List<Tag> tags = this.getObjectTags(object); 123 127 … … 127 131 //Add the tags to the current selection 128 132 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())); 130 135 } 131 136 //If the selected dataset ist empty … … 143 148 public void addTagsToOSM(List<Tag> userTags) { 144 149 145 if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) { 150 if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && 151 !OsmDataManager.getInstance().getInProgressSelection().isEmpty()) { 146 152 147 153 //Add the tags to the current selection 148 154 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())); 150 157 } 151 158 } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) { … … 163 170 Relation newRelation = new Relation(); 164 171 RelationMember newMember; 165 DataSet ds = Main.main.getEditDataSet();172 DataSet ds = OsmDataManager.getInstance().getEditDataSet(); 166 173 167 174 // Create new relation and add a new member with specific role … … 173 180 } 174 181 // 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)); 176 183 } 177 184 … … 186 193 187 194 RelationMember newMember; 188 DataSet ds = Main.main.getEditDataSet();195 DataSet ds = OsmDataManager.getInstance().getEditDataSet(); 189 196 Collection<Relation> relations = ds.getRelations(); 190 197 Relation relation = getRelationFromDataSet(ds, relations); 191 198 192 if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty() && 199 if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && 200 !OsmDataManager.getInstance().getInProgressSelection().isEmpty() && 193 201 !innerRelation.isEmpty() && getRole(ds, relations).equals("outer")) { 194 202
Note:
See TracChangeset
for help on using the changeset viewer.
