Changeset 5391 in josm for trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
- Timestamp:
- 2012-08-04T16:33:49+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r5389 r5391 121 121 protected boolean settingsChanged; 122 122 protected ImageryInfo info; 123 protected finalMapView mv;123 protected MapView mv; 124 124 public WmsCache cache; 125 125 private AttributionSupport attribution = new AttributionSupport(); … … 160 160 super(info); 161 161 imageSize = PROP_IMAGE_SIZE.get(); 162 mv = Main.map.mapView;163 162 setBackgroundLayer(true); /* set global background variable */ 164 163 initializeImages(); 164 this.info = new ImageryInfo(info); 165 166 attribution.initialize(this.info); 167 168 if(info.getUrl() != null) { 169 startGrabberThreads(); 170 } 171 172 Main.pref.addPreferenceChangeListener(this); 173 } 174 175 @Override 176 public void hookUpMapView() { 177 mv = Main.map.mapView; 165 178 if (info.getUrl() != null) { 166 179 for (WMSLayer layer: Main.map.mapView.getLayersOfType(WMSLayer.class)) { … … 175 188 } 176 189 } 177 this.info = new ImageryInfo(info);178 190 if(this.info.getPixelPerDegree() == 0.0) { 179 191 this.info.setPixelPerDegree(getPPD()); … … 181 193 resolution = mv.getDist100PixelText(); 182 194 183 attribution.initialize(this.info); 184 185 if(info.getUrl() != null) { 186 startGrabberThreads(); 187 } 188 189 190 Main.pref.addPreferenceChangeListener(this); 191 192 SwingUtilities.invokeLater(new Runnable() { 195 final MouseAdapter adapter = new MouseAdapter() { 193 196 @Override 194 public void run() { 195 final MouseAdapter adapter = new MouseAdapter() { 196 @Override 197 public void mouseClicked(MouseEvent e) { 198 if (!isVisible()) return; 199 if (e.getButton() == MouseEvent.BUTTON1) { 200 attribution.handleAttribution(e.getPoint(), true); 201 } 202 } 203 }; 204 Main.map.mapView.addMouseListener(adapter); 205 206 MapView.addLayerChangeListener(new LayerChangeListener() { 207 @Override 208 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 209 // 210 } 211 212 @Override 213 public void layerAdded(Layer newLayer) { 214 // 215 } 216 217 @Override 218 public void layerRemoved(Layer oldLayer) { 219 if (oldLayer == WMSLayer.this) { 220 Main.map.mapView.removeMouseListener(adapter); 221 MapView.removeLayerChangeListener(this); 222 } 223 } 224 }); 197 public void mouseClicked(MouseEvent e) { 198 if (!isVisible()) return; 199 if (e.getButton() == MouseEvent.BUTTON1) { 200 attribution.handleAttribution(e.getPoint(), true); 201 } 202 } 203 }; 204 Main.map.mapView.addMouseListener(adapter); 205 206 MapView.addLayerChangeListener(new LayerChangeListener() { 207 @Override 208 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 209 // 210 } 211 212 @Override 213 public void layerAdded(Layer newLayer) { 214 // 215 } 216 217 @Override 218 public void layerRemoved(Layer oldLayer) { 219 if (oldLayer == WMSLayer.this) { 220 Main.map.mapView.removeMouseListener(adapter); 221 MapView.removeLayerChangeListener(this); 222 } 225 223 } 226 224 });
Note:
See TracChangeset
for help on using the changeset viewer.