Changeset 32370 in osm for applications/editors/josm/plugins/seachartedit/src
- Timestamp:
- 2016-06-23T00:47:48+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/seachartedit/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachartedit/src/panels/PanelS57.java
r31736 r32370 185 185 186 186 OsmDataLayer layer = new OsmDataLayer(data, "S-57 Import", null); 187 Main. map.mapView.addLayer(layer);187 Main.getLayerManager().addLayer(layer); 188 188 Main.map.mapView.zoomTo(new Bounds(Math.toDegrees(map.bounds.minlat), Math.toDegrees(map.bounds.minlon), Math.toDegrees(map.bounds.maxlat), Math.toDegrees(map.bounds.maxlon))); 189 189 PanelMain.setStatus("Import done", Color.green); -
applications/editors/josm/plugins/seachartedit/src/scedit/SCeditAction.java
r31156 r32370 10 10 package scedit; 11 11 12 import java.awt.*; 13 import java.awt.event.*; 14 import java.util.*; 12 import static org.openstreetmap.josm.tools.I18n.tr; 13 14 import java.awt.Color; 15 import java.awt.Dimension; 16 import java.awt.event.ActionEvent; 17 import java.util.Collection; 15 18 import java.util.Map.Entry; 16 19 17 import javax.swing.*; 18 19 import static org.openstreetmap.josm.tools.I18n.tr; 20 20 import javax.swing.JFrame; 21 import javax.swing.SwingUtilities; 22 import javax.swing.WindowConstants; 23 24 import org.openstreetmap.josm.Main; 21 25 import org.openstreetmap.josm.actions.JosmAction; 22 import org.openstreetmap.josm.gui.MapView;23 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;24 import org.openstreetmap.josm.gui.layer.*;25 26 import org.openstreetmap.josm.data.Bounds; 26 27 import org.openstreetmap.josm.data.SelectionChangedListener; 27 28 import org.openstreetmap.josm.data.coor.LatLon; 28 import org.openstreetmap.josm.data.osm.*; 29 import org.openstreetmap.josm.data.osm.event.*; 30 import org.openstreetmap.josm.Main; 31 29 import org.openstreetmap.josm.data.osm.DataSet; 30 import org.openstreetmap.josm.data.osm.Node; 31 import org.openstreetmap.josm.data.osm.OsmPrimitive; 32 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 33 import org.openstreetmap.josm.data.osm.Relation; 34 import org.openstreetmap.josm.data.osm.RelationMember; 35 import org.openstreetmap.josm.data.osm.Way; 36 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; 37 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; 38 import org.openstreetmap.josm.data.osm.event.DataSetListener; 39 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 40 import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; 41 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 42 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 43 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 44 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 45 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 46 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 47 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 48 49 import panels.PanelMain; 50 import panels.PanelS57; 51 import panels.ShowFrame; 32 52 import s57.S57map; 33 import s57.S57map.*; 34 import panels.PanelS57; 35 import panels.PanelMain; 36 import panels.ShowFrame; 37 38 public class SCeditAction extends JosmAction implements EditLayerChangeListener, SelectionChangedListener { 53 import s57.S57map.Feature; 54 55 public class SCeditAction extends JosmAction implements ActiveLayerChangeListener, SelectionChangedListener { 39 56 private static String title = tr("SeaChart Editor"); 40 57 public static JFrame editFrame = null; … … 133 150 showFrame.setVisible(false); 134 151 135 // System.out.println("hello"); 136 MapView.addEditLayerChangeListener(this); 152 Main.getLayerManager().addAndFireActiveLayerChangeListener(this); 137 153 DataSet.addSelectionListener(this); 138 editLayerChanged(Main.main.getEditLayer(), Main.main.getEditLayer());139 154 } 140 155 141 156 public void closeDialog() { 142 157 if (isOpen) { 143 MapView.removeEditLayerChangeListener(this);158 Main.getLayerManager().removeActiveLayerChangeListener(this); 144 159 editFrame.setVisible(false); 145 160 editFrame.dispose(); … … 151 166 152 167 @Override 153 public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) { 154 if (oldLayer != null) { 155 oldLayer.data.removeDataSetListener(dataSetListener); 156 } 168 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 169 if (e.getPreviousEditLayer() != null) { 170 e.getPreviousEditLayer().data.removeDataSetListener(dataSetListener); 171 } 172 OsmDataLayer newLayer = Main.getLayerManager().getEditLayer(); 157 173 if (newLayer != null) { 158 174 newLayer.data.addDataSetListener(dataSetListener);
Note:
See TracChangeset
for help on using the changeset viewer.