Changeset 33585 in osm for applications/editors
- Timestamp:
- 2017-09-08T02:37:56+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/rasterfilters
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/rasterfilters/build.xml
r32680 r33585 10 10 11 11 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 12 <property name="plugin.main.version" value="1 0580" />13 <property name="plugin.version" value="1.0. 1"/>12 <property name="plugin.main.version" value="12782" /> 13 <property name="plugin.version" value="1.0.2"/> 14 14 15 15 <property name="plugin.icon" value="images/josm_filters_48.png"/> -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/RasterFiltersPlugin.java
r33269 r33585 8 8 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.gui.MainApplication; 10 11 import org.openstreetmap.josm.gui.MapFrame; 11 12 import org.openstreetmap.josm.gui.SideButton; … … 25 26 import org.openstreetmap.josm.plugins.rasterfilters.preferences.FiltersDownloader; 26 27 import org.openstreetmap.josm.plugins.rasterfilters.preferences.RasterFiltersPreferences; 27 28 import org.openstreetmap.josm.tools.Logging; 28 29 29 30 /** … … 41 42 public RasterFiltersPlugin(PluginInformation info) { 42 43 super(info); 43 Main.debug("Loading RasterFiltersPlugin");44 Logging.debug("Loading RasterFiltersPlugin"); 44 45 45 46 File file = new File(getPluginDir()); … … 52 53 file.createNewFile(); 53 54 } catch (IOException e) { 54 Main.debug("Cannot create file" + file.getAbsolutePath() + "\n" + e.getMessage());55 Logging.debug("Cannot create file" + file.getAbsolutePath() + "\n" + e.getMessage()); 55 56 } 56 57 } … … 62 63 @Override 63 64 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 64 if (Main .isDisplayingMapView()) {65 Main .getLayerManager().addLayerChangeListener(this);66 Main .getLayerManager().addActiveLayerChangeListener(this);65 if (MainApplication.isDisplayingMapView()) { 66 MainApplication.getLayerManager().addLayerChangeListener(this); 67 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 67 68 } 68 69 } … … 70 71 @Override 71 72 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 72 if (!(Main .getLayerManager().getActiveLayer() instanceof ImageryLayer)) {73 if (!(MainApplication.getLayerManager().getActiveLayer() instanceof ImageryLayer)) { 73 74 filterButton.setEnabled(false); 74 75 } else { … … 121 122 } 122 123 123 if (Main .getLayerManager().getLayers().isEmpty()) {124 if (MainApplication.getLayerManager().getLayers().isEmpty()) { 124 125 Container container = filterButton.getParent(); 125 126 if (container != null) { … … 131 132 } 132 133 133 Main .getLayerManager().removeLayerChangeListener(this);134 Main .getLayerManager().removeActiveLayerChangeListener(this);134 MainApplication.getLayerManager().removeLayerChangeListener(this); 135 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 135 136 } 136 137 -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/actions/ShowFiltersDialogAction.java
r33269 r33585 10 10 import javax.swing.JMenuItem; 11 11 12 import org.openstreetmap.josm. Main;12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.gui.layer.ImageryLayer; 14 14 import org.openstreetmap.josm.gui.layer.Layer; … … 16 16 import org.openstreetmap.josm.plugins.rasterfilters.gui.FiltersDialog; 17 17 import org.openstreetmap.josm.tools.ImageProvider; 18 import org.openstreetmap.josm.tools.Logging; 18 19 19 20 import static org.openstreetmap.josm.tools.I18n.tr; … … 48 49 public void actionPerformed(ActionEvent e) { 49 50 50 Layer layer = Main .getLayerManager().getActiveLayer();51 Layer layer = MainApplication.getLayerManager().getActiveLayer(); 51 52 52 53 if (layer instanceof ImageryLayer) { … … 64 65 } 65 66 } else { 66 Main.debug("The layer is not the instance of " + ImageryLayer.class.getCanonicalName());67 Logging.debug("The layer is not the instance of " + ImageryLayer.class.getCanonicalName()); 67 68 } 68 69 } -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/gui/FilterPanel.java
r33269 r33585 31 31 import org.openstreetmap.josm.Main; 32 32 import org.openstreetmap.josm.plugins.rasterfilters.model.FiltersManager; 33 import org.openstreetmap.josm.tools.Logging; 33 34 34 35 import static org.openstreetmap.josm.tools.I18n.tr; … … 245 246 int initValue = json.getInt("default"); 246 247 247 Main.debug("Slider is integer\n");248 Main.debug("minValue: " + String.valueOf(minValue)248 Logging.debug("Slider is integer\n"); 249 Logging.debug("minValue: " + String.valueOf(minValue) 249 250 + "maxValue: " + String.valueOf(maxValue)); 250 251 try { … … 265 266 } else if (valueType.equals("float")) { 266 267 267 Main.debug("Slider is float\n");268 Logging.debug("Slider is float\n"); 268 269 // every value is supplied by 10 to be integer for slider 269 270 double minValueDouble = array.getJsonNumber(0).doubleValue(); 270 271 double maxValueDouble = array.getJsonNumber(1).doubleValue(); 271 Main.debug("DminValue: " + String.valueOf(minValueDouble)272 Logging.debug("DminValue: " + String.valueOf(minValueDouble) 272 273 + "DmaxValue: " + String.valueOf(maxValueDouble)); 273 274 -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/model/FiltersManager.java
r33269 r33585 25 25 26 26 import com.bric.swing.ColorPicker; 27 import org.openstreetmap.josm.Main; 28 import org.openstreetmap.josm.gui.layer.ImageProcessor; 27 import org.openstreetmap.josm.gui.MainApplication; 29 28 import org.openstreetmap.josm.plugins.rasterfilters.filters.Filter; 30 29 import org.openstreetmap.josm.plugins.rasterfilters.gui.FilterGuiListener; … … 32 31 import org.openstreetmap.josm.plugins.rasterfilters.gui.FiltersDialog; 33 32 import org.openstreetmap.josm.plugins.rasterfilters.preferences.FiltersDownloader; 33 import org.openstreetmap.josm.tools.ImageProcessor; 34 import org.openstreetmap.josm.tools.Logging; 34 35 35 36 … … 75 76 76 77 try { 77 Main.debug("ClassName for loading " + filterState.getFilterClassName());78 Logging.debug("ClassName for loading " + filterState.getFilterClassName()); 78 79 clazz = FiltersDownloader.loader.loadClass(filterState 79 80 .getFilterClassName()); … … 81 82 82 83 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { 83 e.printStackTrace();84 Logging.error(e); 84 85 } 85 86 … … 130 131 filter.changeFilterState(filterState.encodeJson()); 131 132 } 132 Main .getLayerManager().getActiveLayer().setFilterStateChanged();133 MainApplication.getLayerManager().getActiveLayer().setFilterStateChanged(); 133 134 134 135 fp.createBottomPanel(this); … … 136 137 filterListener.setFilterState(filterState); 137 138 138 Main.debug("The number of elems in the Filters map is equal \n"139 Logging.debug("The number of elems in the Filters map is equal \n" 139 140 + filtersMap.size()); 140 141 … … 154 155 } 155 156 156 if (Main .getLayerManager().getActiveLayer() != null) {157 Main .getLayerManager().getActiveLayer().setFilterStateChanged();157 if (MainApplication.getLayerManager().getActiveLayer() != null) { 158 MainApplication.getLayerManager().getActiveLayer().setFilterStateChanged(); 158 159 } 159 160 … … 238 239 } 239 240 240 Main .getLayerManager().getActiveLayer().setFilterStateChanged();241 MainApplication.getLayerManager().getActiveLayer().setFilterStateChanged(); 241 242 242 243 } … … 254 255 disabledFilters.add(filtersMap.get(filterId)); 255 256 256 Main .getLayerManager().getActiveLayer().setFilterStateChanged();257 MainApplication.getLayerManager().getActiveLayer().setFilterStateChanged(); 257 258 258 259 } else { … … 261 262 disabledFilters.remove(filtersMap.get(filterId)); 262 263 263 Main .getLayerManager().getActiveLayer().setFilterStateChanged();264 MainApplication.getLayerManager().getActiveLayer().setFilterStateChanged(); 264 265 265 266 } -
applications/editors/josm/plugins/rasterfilters/src/org/openstreetmap/josm/plugins/rasterfilters/preferences/FiltersDownloader.java
r33269 r33585 38 38 import org.jsoup.select.Elements; 39 39 import org.openstreetmap.josm.Main; 40 import org.openstreetmap.josm.tools.Logging; 40 41 41 42 /** … … 225 226 public static void initFilters() { 226 227 File file = new File(pluginDir, "urls.map"); 227 Main.debug("EXIST FILE? " + file.exists());228 Logging.debug("EXIST FILE? " + file.exists()); 228 229 229 230 try (BufferedReader br = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) { … … 237 238 try { 238 239 url = new URL("jar", "", fileUrl.toURI().toURL() + "!/"); 239 Main.debug("binaryUrl: " + url.toString());240 Logging.debug("binaryUrl: " + url.toString()); 240 241 binariesLocalUrls.add(url); 241 242 } catch (MalformedURLException e) { 242 Main.debug("Initializing filters with unknown protocol. \n"243 Logging.debug("Initializing filters with unknown protocol. \n" 243 244 + e.getMessage()); 244 245 } … … 249 250 } 250 251 251 Main.debug("BinariesLocal : " + binariesLocalUrls.toString());252 Logging.debug("BinariesLocal : " + binariesLocalUrls.toString()); 252 253 253 254 loader = new URLClassLoader( … … 286 287 287 288 File file = new File(pluginDir, "urls.map"); 288 Main.debug("pluginDir and urls map" + file.getAbsoluteFile());289 Logging.debug("pluginDir and urls map" + file.getAbsoluteFile()); 289 290 290 291 try (BufferedWriter writer = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) { … … 317 318 public static String loadBinaryToFile(String fromUrl) { 318 319 319 // Main.debug("Need to load binary from " + fromUrl);320 // Logging.debug("Need to load binary from " + fromUrl); 320 321 321 322 URL url = null; … … 327 328 String localFile = null; 328 329 File plugin = new File(pluginDir); 329 Main.debug("plugin dir" + plugin.getAbsolutePath());330 Logging.debug("plugin dir" + plugin.getAbsolutePath()); 330 331 331 332 if (m.find()) { 332 333 333 if (plugin.exists()) { 334 335 334 localFile = fromUrl.substring(m.end()); 336 Main.debug("localFile: " + localFile);335 Logging.debug("localFile: " + localFile); 337 336 } 338 337 } … … 343 342 String plugDir = plugin.getAbsolutePath(); 344 343 File file = new File(plugDir, localFile); 345 Main.debug("Binary file: " + file.getAbsolutePath());344 Logging.debug("Binary file: " + file.getAbsolutePath()); 346 345 347 346 if (file.exists()) { 348 Main.debug("File " + localFile + " already exists");347 Logging.debug("File " + localFile + " already exists"); 349 348 350 349 return file.getAbsolutePath();
Note:
See TracChangeset
for help on using the changeset viewer.