Changeset 34741 in osm
- Timestamp:
- 2018-11-25T22:05:36+01:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/indoorhelper
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/controller/IndoorHelperController.java
r34734 r34741 31 31 import java.util.ArrayList; 32 32 import java.util.Collection; 33 import java.util.Collections;34 33 import java.util.HashMap; 35 34 import java.util.List; … … 47 46 import org.openstreetmap.josm.data.osm.OsmPrimitive; 48 47 import org.openstreetmap.josm.data.osm.Tag; 49 import org.openstreetmap.josm.data.validation.OsmValidator;50 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;51 48 import org.openstreetmap.josm.gui.MainApplication; 52 49 import org.openstreetmap.josm.gui.MapFrame; … … 172 169 * The listener which provides the handling of the applyButton. 173 170 * Gets the texts which were written by the user and writes them to the OSM-data. 174 * After that it checks the tagged data with the built-in validator file.171 * After that it checks the tagged data. 175 172 * 176 173 * @author egru … … 622 619 623 620 /** 624 * Forces JOSM to load the validator andmappaint settings.621 * Forces JOSM to load the mappaint settings. 625 622 */ 626 623 private void updateSettings() { 627 624 Preferences.main().init(false); 628 MapCSSTagChecker tagChecker = OsmValidator.getTest(MapCSSTagChecker.class); 629 if (tagChecker != null) { 630 OsmValidator.initializeTests(Collections.singleton(tagChecker)); 631 } 632 633 MapPaintStyles.readFromPreferences(); 625 MapPaintStyles.readFromPreferences(); 634 626 } 635 627 636 628 /** 637 * Enables or disables the preferences for the mapcss-style and the validator.629 * Enables or disables the preferences for the mapcss-style. 638 630 * 639 631 * @param enabled Activates or disables the settings. … … 642 634 Map<String, Setting<?>> settings = Preferences.main().getAllSettings(); 643 635 644 MapListSetting validatorMapListSetting = (MapListSetting) settings.645 get("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries");646 List<Map<String, String>> validatorMaps = new ArrayList<>();647 if (validatorMapListSetting != null) {648 validatorMaps = validatorMapListSetting.getValue();649 }650 651 636 MapListSetting styleMapListSetting = (MapListSetting) settings. 652 637 get("mappaint.style.entries"); … … 657 642 658 643 if (enabled) { 659 //set the validator active660 661 List<Map<String, String>> validatorMapsNew = new ArrayList<>();662 if (!validatorMaps.isEmpty()) {663 validatorMapsNew.addAll(validatorMaps);664 }665 666 for (Map<String, String> map : validatorMapsNew) {667 if (map.containsValue(tr("Indoor"))) {668 validatorMapsNew.remove(map);669 break;670 }671 }672 673 Map<String, String> indoorValidator = new HashMap<>();674 indoorValidator.put("title", "Indoor");675 indoorValidator.put("active", "true");676 indoorValidator.put("url", Config.getDirs().getUserDataDirectory(true)+ sep +"validator" +677 sep + "indoorhelper.validator.mapcss");678 679 validatorMapsNew.add(indoorValidator);680 Config.getPref().putListOfMaps("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries",681 validatorMapsNew);682 683 644 //set mappaint active 684 645 … … 704 665 updateSettings(); 705 666 } else { 706 //set the validator inactive707 708 709 List<Map<String, String>> validatorMapsNew = new ArrayList<>();710 if (!validatorMaps.isEmpty()) {711 validatorMapsNew.addAll(validatorMaps);712 }713 714 for (Map<String, String> map : validatorMapsNew) {715 if (map.containsValue(tr("Indoor"))) {716 validatorMapsNew.remove(map);717 break;718 }719 }720 Map<String, String> indoorValidator = new HashMap<>();721 indoorValidator.put("title", tr("Indoor"));722 indoorValidator.put("active", "false");723 indoorValidator.put("url", Config.getDirs().getUserDataDirectory(true)+ sep +"validator" +724 sep + "indoorhelper.validator.mapcss");725 726 validatorMapsNew.add(indoorValidator);727 Config.getPref().putListOfMaps("validator.org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.entries",728 validatorMapsNew);729 730 731 667 //set mappaint inactive 732 733 668 734 669 List<Map<String, String>> styleMapsNew = new ArrayList<>();
Note:
See TracChangeset
for help on using the changeset viewer.