Changeset 19928 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
- Timestamp:
- 2010-02-07T23:49:38+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r19894 r19928 23 23 import org.openstreetmap.josm.gui.MapFrame; 24 24 import org.openstreetmap.josm.gui.IconToggleButton; 25 import org.openstreetmap.josm.gui.layer.Layer; 25 26 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 26 27 import org.openstreetmap.josm.plugins.Plugin; … … 296 297 } 297 298 299 /** 300 * Adds the WMSLayer following this rule:<br/> 301 * - if a WMSLayer exists place this new layer just before this layer<br/> 302 * - Otherwise place it at the bottom 303 * @param wmsLayer the wmsLayer to add 304 */ 305 public static void addWMSLayer(WMSLayer wmsLayer) { 306 if (Main.map != null && Main.map.mapView != null) { 307 int wmsNewLayerPos = Main.map.mapView.getAllLayers().size(); 308 for(Layer l : Main.map.mapView.getLayersOfType(WMSLayer.class)) { 309 int wmsPos = Main.map.mapView.getLayerPos(l); 310 if (wmsPos < wmsNewLayerPos) wmsNewLayerPos = wmsPos; 311 } 312 Main.main.addLayer(wmsLayer); 313 // Move the layer to its new position 314 Main.map.mapView.moveLayer(wmsLayer, wmsNewLayerPos); 315 } else 316 Main.main.addLayer(wmsLayer); 317 } 318 298 319 private static String checkSourceMillesime() { 299 320 java.util.Calendar calendar = java.util.Calendar.getInstance(); … … 313 334 return src; 314 335 } 336 315 337 }
Note:
See TracChangeset
for help on using the changeset viewer.
