Changeset 28626 in osm for applications/editors/josm/plugins
- Timestamp:
- 2012-08-25T00:18:10+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java
r28610 r28626 28 28 public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener{ 29 29 30 31 32 33 34 35 36 37 38 39 40 30 private static final String COLORSCHEMEFILTERFILE = "/resources/xml/colorscheme.xml"; 31 private JunctionCheckDialog junctionCheckDialog; 32 private File pathDir; 33 private final RelationProducer relationproducer; 34 //Die benötigten Layer für JOSM 35 private OsmDataLayer osmlayer; //IN diesem Layer sind die Originaldaten gespiechert, aus denen der Channel-Digraph erzeugt wird 36 private ChannelDiGraphLayer channelDigraphLayer; 37 private final ColorSchemeXMLReader cXMLReaderMK; 38 private ChannelDiGraph channelDigraph; 39 private final JunctionCheckerMapMode jcMapMode; 40 private MapMode normalMapMode; 41 41 42 43 44 45 46 47 42 public JunctionCheckerPlugin(PluginInformation info) { 43 super(info); 44 jcMapMode = new JunctionCheckerMapMode(Main.map, "junctionchecking", tr("construct channel digraph and search for junctions")); 45 relationproducer = new RelationProducer(this); 46 cXMLReaderMK = new ColorSchemeXMLReader(COLORSCHEMEFILTERFILE); 47 } 48 48 49 50 51 52 53 54 55 56 57 58 49 @Override 50 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 51 jcMapMode.setFrame(newFrame); 52 if (newFrame != null) { 53 junctionCheckDialog = new JunctionCheckDialog(this); 54 newFrame.addToggleDialog(junctionCheckDialog); 55 MapView.addLayerChangeListener(this); 56 } else 57 MapView.removeLayerChangeListener(this); 58 } 59 59 60 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 61 if (newLayer instanceof OsmDataLayer) { 62 this.getJunctionCheckDialog().setActivateCreateDigraph(true); 63 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false); 64 if (normalMapMode != null) { 65 Main.map.selectMapMode(normalMapMode); 66 } 67 } 68 if (newLayer == channelDigraphLayer) { 69 this.getJunctionCheckDialog().setActivateCreateDigraph(false); 70 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(true); 71 Main.map.selectMapMode(jcMapMode); 72 } 73 } 60 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 61 if (newLayer instanceof OsmDataLayer) { 62 this.getJunctionCheckDialog().setActivateCreateDigraph(true); 63 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false); 64 if (normalMapMode != null) { 65 Main.map.selectMapMode(normalMapMode); 66 } 67 } else if (newLayer instanceof ChannelDiGraphLayer) { 68 this.getJunctionCheckDialog().setActivateCreateDigraph(false); 69 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(true); 70 Main.map.selectMapMode(jcMapMode); 71 } 72 } 74 73 75 76 74 public void layerAdded(Layer newLayer) { 75 } 77 76 78 79 80 81 82 83 84 85 86 87 77 public void layerRemoved(Layer oldLayer) { 78 if (oldLayer == channelDigraphLayer) { 79 channelDigraphLayer = null; 80 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false); 81 return; 82 } 83 else { 84 this.getJunctionCheckDialog().setActivateCreateDigraph(false); 85 } 86 } 88 87 89 90 91 92 93 94 88 public ChannelDiGraphLayer getChannelDigraphLayer() { 89 if (channelDigraphLayer == null) { 90 channelDigraphLayer = new ChannelDiGraphLayer(cXMLReaderMK); 91 } 92 return channelDigraphLayer; 93 } 95 94 96 97 98 95 public JunctionCheckDialog getJunctionCheckDialog() { 96 return junctionCheckDialog; 97 } 99 98 100 101 102 99 public File getPathDir() { 100 return pathDir; 101 } 103 102 104 105 106 103 public OsmDataLayer getOsmlayer() { 104 return osmlayer; 105 } 107 106 108 109 110 107 public void setOsmlayer(OsmDataLayer osmlayer) { 108 this.osmlayer = osmlayer; 109 } 111 110 112 113 114 111 public RelationProducer getRelationProducer() { 112 return relationproducer; 113 } 115 114 116 117 118 115 public ChannelDiGraph getChannelDigraph() { 116 return channelDigraph; 117 } 119 118 120 121 122 119 public void setChannelDigraph(ChannelDiGraph channelDigraph) { 120 this.channelDigraph = channelDigraph; 121 } 123 122 124 125 126 123 public JunctionCheckerMapMode getJcMapMode() { 124 return jcMapMode; 125 } 127 126 128 129 130 127 public void setNormalMapMode(MapMode mm) { 128 normalMapMode = mm; 129 } 131 130 }
Note:
See TracChangeset
for help on using the changeset viewer.