Changeset 33974 in osm for applications/editors/josm/plugins/indoorhelper/src/org
- Timestamp:
- 2018-01-04T11:05:03+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/org/openstreetmap/josm/plugins/indoorhelper/IndoorHelperPlugin.java
r33887 r33974 25 25 26 26 import org.openstreetmap.josm.Main; 27 import org.openstreetmap.josm.gui.MainApplication; 27 28 import org.openstreetmap.josm.gui.MapFrame; 29 import org.openstreetmap.josm.gui.autofilter.AutoFilter; 30 import org.openstreetmap.josm.gui.autofilter.AutoFilterManager; 31 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 32 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 33 import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationEvent; 34 import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationListener; 35 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 36 import org.openstreetmap.josm.plugins.Plugin; 29 37 import org.openstreetmap.josm.plugins.PluginInformation; … … 36 44 * 37 45 * @author egru 46 * @author rebsc 38 47 * 39 48 */ 40 public class IndoorHelperPlugin extends Plugin { 41 42 43 49 public class IndoorHelperPlugin extends Plugin implements PaintableInvalidationListener, ActiveLayerChangeListener { 50 51 52 @SuppressWarnings("unused") 44 53 private IndoorHelperController controller; 45 54 String sep = System.getProperty("file.separator"); … … 54 63 public IndoorHelperPlugin(PluginInformation info) throws Exception { 55 64 super(info); 56 65 MainApplication.getLayerManager().addAndFireActiveLayerChangeListener(this); 57 66 this.exportValidator("/data/indoorhelper.validator.mapcss"); 58 this.exportStyleFile(" indoor.mapcss");67 this.exportStyleFile("sit.mapcss"); 59 68 this.exportStyleFile("entrance_door_icon.png"); 60 69 this.exportStyleFile("entrance_icon.png"); 61 // this.setIndoorValidator(); 62 } 70 this.exportStyleFile("elevator_icon.png"); 71 72 //this.setIndoorValidator(); 73 } 74 63 75 64 76 /** … … 74 86 } 75 87 88 76 89 /** 77 90 * Exports the mapcss validator file to the preferences directory. 78 91 */ 79 private void exportValidator(String resourceName) throws Exception { 92 @SuppressWarnings("deprecation") 93 private void exportValidator(String resourceName) throws Exception { 80 94 InputStream stream = null; 81 95 OutputStream resStreamOut = null; 82 83 96 84 97 try { … … 93 106 byte[] buffer = new byte[4096]; 94 107 95 String valDirPath = Main.pref.get Dirs().getUserDataDirectory(false) + sep + "validator";108 String valDirPath = Main.pref.getUserDataDirectory() + sep + "validator"; 96 109 File valDir = new File(valDirPath); 97 110 valDir.mkdirs(); … … 129 142 byte[] buffer = new byte[4096]; 130 143 131 String valDirPath = Main.pref.getDirs().getUserDataDirectory(false) + sep + "styles"; 144 @SuppressWarnings("deprecation") 145 String valDirPath = Main.pref.getUserDataDirectory() + sep + "styles"; 132 146 File valDir = new File(valDirPath); 133 147 valDir.mkdirs(); … … 146 160 } 147 161 } 162 163 @Override 164 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 165 OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer(); 166 if (editLayer != null) { 167 editLayer.addInvalidationListener(this); 168 } 169 } 170 171 @Override 172 public void paintableInvalidated(PaintableInvalidationEvent event){ 173 AutoFilter currentAutoFilter = AutoFilterManager.getInstance().getCurrentAutoFilter(); 174 String currentFilterValue = new String(); 175 176 if(currentAutoFilter != null) { 177 currentFilterValue = currentAutoFilter.getFilter().text.split("=")[1]; 178 179 this.controller.setIndoorLevel(currentFilterValue); 180 this.controller.getIndoorLevel(currentFilterValue); 181 this.controller.unsetSpecificKeyFilter("repeat_on"); 182 183 }else{ 184 currentFilterValue = ""; 185 this.controller.setIndoorLevel(currentFilterValue); 186 this.controller.getIndoorLevel(currentFilterValue); 187 }; 188 189 } 148 190 149 191 /** … … 189 231 // } 190 232 // } 233 234 /** 235 * 236 * 237 * 238 * 239 * 240 * 241 * 242 * 243 * 244 */ 191 245 }
Note:
See TracChangeset
for help on using the changeset viewer.