Changeset 34522 in osm for applications/editors
- Timestamp:
- 2018-08-18T18:12:13+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/indoorhelper
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/build.xml
r34095 r34522 5 5 <property name="commit.message" value="Inital commit"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 3265"/>7 <property name="plugin.main.version" value="14153"/> 8 8 9 9 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/indoorhelper/src/controller/IndoorHelperController.java
r34309 r34522 40 40 import javax.swing.JOptionPane; 41 41 42 import org.openstreetmap.josm.Main;43 42 import org.openstreetmap.josm.actions.ValidateAction; 44 43 import org.openstreetmap.josm.actions.mapmode.DrawAction; 45 44 import org.openstreetmap.josm.actions.mapmode.SelectAction; 45 import org.openstreetmap.josm.data.Preferences; 46 import org.openstreetmap.josm.data.osm.OsmDataManager; 46 47 import org.openstreetmap.josm.data.osm.OsmPrimitive; 47 48 import org.openstreetmap.josm.data.osm.Tag; … … 52 53 import org.openstreetmap.josm.gui.help.HelpBrowser; 53 54 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 55 import org.openstreetmap.josm.spi.preferences.Config; 54 56 import org.openstreetmap.josm.spi.preferences.MapListSetting; 55 57 import org.openstreetmap.josm.spi.preferences.Setting; … … 572 574 public void unsetSpecificKeyFilter(String key) { 573 575 574 Collection<OsmPrimitive> p = Main.main.getEditDataSet().allPrimitives();576 Collection<OsmPrimitive> p = OsmDataManager.getInstance().getEditDataSet().allPrimitives(); 575 577 int level = Integer.parseInt(levelValue); 576 578 … … 623 625 */ 624 626 private void updateSettings() { 625 Main.pref.init(false);627 Preferences.main().init(false); 626 628 MapCSSTagChecker tagChecker = OsmValidator.getTest(MapCSSTagChecker.class); 627 629 if (tagChecker != null) { … … 638 640 */ 639 641 private void setPluginPreferences(boolean enabled) { 640 Map<String, Setting<?>> settings = Main.pref.getAllSettings();642 Map<String, Setting<?>> settings = Preferences.main().getAllSettings(); 641 643 642 644 MapListSetting validatorMapListSetting = (MapListSetting) settings. … … 672 674 indoorValidator.put("title", "Indoor"); 673 675 indoorValidator.put("active", "true"); 674 indoorValidator.put("url", Main.pref.getDirs().getUserDataDirectory(true)+ sep +"validator" +676 indoorValidator.put("url", Config.getDirs().getUserDataDirectory(true)+ sep +"validator" + 675 677 sep + "indoorhelper.validator.mapcss"); 676 678 677 679 validatorMapsNew.add(indoorValidator); 678 Main.pref.putListOfMaps("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries",680 Config.getPref().putListOfMaps("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries", 679 681 validatorMapsNew); 680 682 … … 695 697 indoorMapPaint.put("title", tr("Indoor")); 696 698 indoorMapPaint.put("active", "true"); 697 indoorMapPaint.put("url", Main.pref.getDirs().getUserDataDirectory(true) + sep + "styles"699 indoorMapPaint.put("url", Config.getDirs().getUserDataDirectory(true) + sep + "styles" 698 700 + sep + "sit.mapcss"); 699 701 styleMapsNew.add(indoorMapPaint); 700 Main.pref.putListOfMaps("mappaint.style.entries", styleMapsNew);702 Config.getPref().putListOfMaps("mappaint.style.entries", styleMapsNew); 701 703 702 704 updateSettings(); … … 719 721 indoorValidator.put("title", tr("Indoor")); 720 722 indoorValidator.put("active", "false"); 721 indoorValidator.put("url", Main.pref.getDirs().getUserDataDirectory(true)+ sep +"validator" +723 indoorValidator.put("url", Config.getDirs().getUserDataDirectory(true)+ sep +"validator" + 722 724 sep + "indoorhelper.validator.mapcss"); 723 725 724 726 validatorMapsNew.add(indoorValidator); 725 Main.pref.putListOfMaps("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries",727 Config.getPref().putListOfMaps("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries", 726 728 validatorMapsNew); 727 729 … … 743 745 indoorMapPaint.put("title", tr("Indoor")); 744 746 indoorMapPaint.put("active", "false"); 745 indoorMapPaint.put("url", Main.pref.getDirs().getUserDataDirectory(true) + sep + "styles"747 indoorMapPaint.put("url", Config.getDirs().getUserDataDirectory(true) + sep + "styles" 746 748 + sep + "sit.mapcss"); 747 749 styleMapsNew.add(indoorMapPaint); 748 Main.pref.putListOfMaps("mappaint.style.entries", styleMapsNew);750 Config.getPref().putListOfMaps("mappaint.style.entries", styleMapsNew); 749 751 750 752 updateSettings(); -
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 -
applications/editors/josm/plugins/indoorhelper/src/org/openstreetmap/josm/plugins/indoorhelper/IndoorHelperPlugin.java
r34310 r34522 26 26 import java.io.OutputStream; 27 27 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.gui.MainApplication; 30 29 import org.openstreetmap.josm.gui.MapFrame; … … 38 37 import org.openstreetmap.josm.plugins.Plugin; 39 38 import org.openstreetmap.josm.plugins.PluginInformation; 39 import org.openstreetmap.josm.spi.preferences.Config; 40 40 41 41 import controller.IndoorHelperController; … … 97 97 byte[] buffer = new byte[4096]; 98 98 99 String valDirPath = Main.pref.getDirs().getUserDataDirectory(true) + sep + "validator";99 String valDirPath = Config.getDirs().getUserDataDirectory(true) + sep + "validator"; 100 100 File valDir = new File(valDirPath); 101 101 valDir.mkdirs(); … … 126 126 byte[] buffer = new byte[4096]; 127 127 128 String valDirPath = Main.pref.getDirs().getUserDataDirectory(true) + sep + "styles";128 String valDirPath = Config.getDirs().getUserDataDirectory(true) + sep + "styles"; 129 129 File valDir = new File(valDirPath); 130 130 valDir.mkdirs(); … … 172 172 // private void setIndoorValidator() { 173 173 // //get the current validator settings 174 // Map<String, Setting<?>> settings = Main.pref.getAllSettings();174 // Map<String, Setting<?>> settings = Config.getPref().getAllSettings(); 175 175 // MapListSetting mapListSetting = (MapListSetting) settings. 176 176 // get("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries"); … … 199 199 // indoorValidator.put("title", "Indoor"); 200 200 // indoorValidator.put("active", "true"); 201 // indoorValidator.put("url", Main.pref.getUserDataDirectory()+ sep +"validator" +201 // indoorValidator.put("url", Config.getPref().getUserDataDirectory()+ sep +"validator" + 202 202 // sep + "indoorhelper.validator.mapcss"); 203 203 // 204 204 // validatorMapsNew.add(indoorValidator); 205 // Main.pref.putListOfStructs205 // Config.getPref().putListOfStructs 206 206 // ("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries", 207 207 // validatorMapsNew);
Note:
See TracChangeset
for help on using the changeset viewer.