Changeset 20701 in osm for applications
- Timestamp:
- 2010-03-27T16:51:44+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/turnrestrictions
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/data/test-data-set-1.osm
r20489 r20701 2 2 <osm version='0.6' generator='JOSM'> 3 3 <bounds minlat='46.9185552' minlon='7.3901081' maxlat='46.9271138' maxlon='7.4086475' origin='OpenStreetMap server' /> 4 <node id='-106' action='modify' visible='true' lat='46.92028078273882' lon='7.401045898188405' /> 5 <node id='-104' action='modify' visible='true' lat='46.919302014885396' lon='7.401068288768116'> 4 <node id='-56' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920401695281015' lon='7.392672484176534' /> 5 <node id='-54' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.394608244994619' /> 6 <node id='-52' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.392692440473628' /> 7 <node id='-50' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.9194611876982' lon='7.391036067814855' /> 8 <node id='-48' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920906018634135' lon='7.399118368137783' /> 9 <node id='-46' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.40135347341227' /> 10 <node id='-44' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.39909841184069' /> 11 <node id='-42' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.3971426947255114' /> 12 <node id='-40' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92280059638277' lon='7.392991784930033' /> 13 <node id='-38' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036751' lon='7.394767895371367' /> 14 <node id='-36' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036752' lon='7.393011741227126' /> 15 <node id='-34' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284014' lon='7.390916330032293' /> 16 <node id='-32' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92375467491946' lon='7.391245608934339' /> 17 <node id='-30' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92378193405656' lon='7.394298922389664' /> 18 <node id='-28' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92450429613562' lon='7.394298922389665' /> 19 <node id='-26' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.924517925515175' lon='7.391285521528527' /> 20 <node id='-24' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925969434589156' lon='7.404077507965554' /> 21 <node id='-22' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.401802490096877' /> 22 <node id='-20' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.39940773444564' /> 23 <node id='-18' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92569685372496' lon='7.3913653467169' /> 24 <node id='-16' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92566959556225' lon='7.393261194940797' /> 25 <node id='-14' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92654852689992' lon='7.393198680597321' /> 26 <node id='-12' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.395296737244347' /> 27 <node id='-10' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.397511886221743' /> 28 <node id='-8' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.925560562772716' lon='7.397471973627557' /> 29 <node id='-6' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true' lat='46.91930201488541' lon='7.399142698913044' /> 30 <node id='-4' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true' lat='46.919302014885396' lon='7.401068288768116'> 6 31 <tag k='name' v='node 8.3' /> 7 32 </node> 8 <node id='-103' action='modify' visible='true' lat='46.91930201488541' lon='7.399142698913044' /> 9 <node id='-50' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.925560562772716' lon='7.397471973627557' /> 10 <node id='-48' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.397511886221743' /> 11 <node id='-46' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.395296737244347' /> 12 <node id='-44' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92662362300419' lon='7.39328115123789' /> 13 <node id='-42' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92566959556225' lon='7.393261194940797' /> 14 <node id='-40' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92569685372496' lon='7.3913653467169' /> 15 <node id='-38' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.39940773444564' /> 16 <node id='-36' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925955805578894' lon='7.401802490096877' /> 17 <node id='-34' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.925969434589156' lon='7.404077507965554' /> 18 <node id='-32' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.924517925515175' lon='7.391285521528527' /> 19 <node id='-30' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92450429613562' lon='7.394298922389665' /> 20 <node id='-28' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92378193405656' lon='7.394298922389664' /> 21 <node id='-26' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92375467491946' lon='7.391245608934339' /> 22 <node id='-24' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284014' lon='7.390916330032293' /> 23 <node id='-22' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036752' lon='7.393011741227126' /> 24 <node id='-20' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92175109036751' lon='7.394767895371367' /> 25 <node id='-18' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.92280059638277' lon='7.392991784930033' /> 26 <node id='-16' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.3971426947255114' /> 27 <node id='-14' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.39909841184069' /> 28 <node id='-12' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.921737460284035' lon='7.40135347341227' /> 29 <node id='-10' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920906018634135' lon='7.399118368137783' /> 30 <node id='-8' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.9194611876982' lon='7.391036067814855' /> 31 <node id='-6' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.392692440473628' /> 32 <node id='-4' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.91947481836078' lon='7.394608244994619' /> 33 <node id='-2' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true' lat='46.920401695281015' lon='7.392672484176534' /> 34 <way id='-107' action='modify' visible='true'> 35 <nd ref='-104' /> 36 <nd ref='-106' /> 37 <tag k='name' v='way.8.2' /> 33 <node id='-2' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true' lat='46.92028078273882' lon='7.401045898188405' /> 34 <way id='-96' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 35 <nd ref='-52' /> 36 <nd ref='-54' /> 37 <tag k='name' v='way 7.2' /> 38 38 </way> 39 <way id='-105' action='modify' visible='true'> 40 <nd ref='-103' /> 41 <nd ref='-104' /> 42 <tag k='name' v='way.8.1' /> 39 <way id='-94' timestamp='2010-03-15T09:31:53Z' visible='true'> 40 <nd ref='-52' /> 41 <nd ref='-56' /> 43 42 </way> 44 <way id='-86' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 43 <way id='-92' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 44 <nd ref='-50' /> 45 <nd ref='-52' /> 46 <tag k='name' v='way 7.1' /> 47 </way> 48 <way id='-90' timestamp='2010-03-15T09:31:53Z' visible='true'> 49 <nd ref='-44' /> 50 <nd ref='-46' /> 51 </way> 52 <way id='-88' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 53 <nd ref='-44' /> 45 54 <nd ref='-48' /> 46 <nd ref='-50' /> 47 <tag k='name' v='Weg 2.2' /> 55 <tag k='name' v='way 6.2' /> 48 56 </way> 49 <way id='-84' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 50 <nd ref='-46' /> 51 <nd ref='-48' /> 52 <tag k='name' v='Weg 2.1' /> 53 </way> 54 <way id='-82' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 57 <way id='-86' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 55 58 <nd ref='-42' /> 56 59 <nd ref='-44' /> 57 <tag k='name' v=' Weg 1.2' />60 <tag k='name' v='way 6.1' /> 58 61 </way> 59 <way id='-80' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 62 <way id='-84' timestamp='2010-03-15T09:31:53Z' visible='true'> 63 <nd ref='-36' /> 64 <nd ref='-38' /> 65 </way> 66 <way id='-82' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 67 <nd ref='-36' /> 60 68 <nd ref='-40' /> 61 <nd ref='-42' /> 62 <tag k='name' v='Weg 1.1' /> 69 <tag k='name' v='way 5.2' /> 63 70 </way> 64 <way id='- 78' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>65 <nd ref='-3 8' />71 <way id='-80' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 72 <nd ref='-34' /> 66 73 <nd ref='-36' /> 67 <tag k='name' v='Weg 3.1' /> 74 <tag k='name' v='way 5.1' /> 75 </way> 76 <way id='-78' timestamp='2010-03-15T09:31:53Z' visible='true'> 77 <nd ref='-28' /> 78 <nd ref='-30' /> 68 79 </way> 69 80 <way id='-76' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 70 <nd ref='-3 6' />71 <nd ref='-3 4' />72 <tag k='name' v=' Weg 3.2' />81 <nd ref='-30' /> 82 <nd ref='-32' /> 83 <tag k='name' v='way 4.2' /> 73 84 </way> 74 85 <way id='-74' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 75 <nd ref='- 32' />76 <nd ref='- 30' />86 <nd ref='-26' /> 87 <nd ref='-28' /> 77 88 <tag k='name' v='way 4.1' /> 78 89 </way> 79 90 <way id='-72' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 80 <nd ref='-2 8' />81 <nd ref='-2 6' />82 <tag k='name' v=' way 4.2' />91 <nd ref='-22' /> 92 <nd ref='-24' /> 93 <tag k='name' v='Weg 3.2' /> 83 94 </way> 84 <way id='-70' timestamp='2010-03-15T09:31:53Z' visible='true'> 85 <nd ref='-30' /> 86 <nd ref='-28' /> 95 <way id='-70' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 96 <nd ref='-20' /> 97 <nd ref='-22' /> 98 <tag k='name' v='Weg 3.1' /> 87 99 </way> 88 <way id='-68' action='modify' timestamp='2010-03- 15T09:31:53Z' visible='true'>89 <nd ref='- 24' />90 <nd ref='- 22' />91 <tag k='name' v=' way 5.1' />100 <way id='-68' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 101 <nd ref='-18' /> 102 <nd ref='-16' /> 103 <tag k='name' v='Weg 1.1' /> 92 104 </way> 93 <way id='-66' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 94 <nd ref='-22' /> 95 <nd ref='-18' /> 96 <tag k='name' v='way 5.2' /> 97 </way> 98 <way id='-64' timestamp='2010-03-15T09:31:53Z' visible='true'> 99 <nd ref='-22' /> 100 <nd ref='-20' /> 101 </way> 102 <way id='-62' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 105 <way id='-66' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 103 106 <nd ref='-16' /> 104 107 <nd ref='-14' /> 105 <tag k='name' v=' way 6.1' />108 <tag k='name' v='Weg 1.2' /> 106 109 </way> 107 <way id='-6 0' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'>108 <nd ref='-1 4' />110 <way id='-64' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 111 <nd ref='-12' /> 109 112 <nd ref='-10' /> 110 <tag k='name' v=' way 6.2' />113 <tag k='name' v='Weg 2.1' /> 111 114 </way> 112 <way id='-58' timestamp='2010-03-15T09:31:53Z' visible='true'> 113 <nd ref='-14' /> 114 <nd ref='-12' /> 115 <way id='-62' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 116 <nd ref='-10' /> 117 <nd ref='-8' /> 118 <tag k='name' v='Weg 2.2' /> 115 119 </way> 116 <way id='-56' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 117 <nd ref='-8' /> 118 <nd ref='-6' /> 119 <tag k='name' v='way 7.1' /> 120 </way> 121 <way id='-54' timestamp='2010-03-15T09:31:53Z' visible='true'> 122 <nd ref='-6' /> 123 <nd ref='-2' /> 124 </way> 125 <way id='-52' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 120 <way id='-60' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true'> 126 121 <nd ref='-6' /> 127 122 <nd ref='-4' /> 128 <tag k='name' v='way 7.2' />123 <tag k='name' v='way.8.1' /> 129 124 </way> 130 <relation id='-100' timestamp='2010-03-09T09:06:53Z' visible='true'> 131 <member type='way' ref='-84' role='from' /> 132 <member type='way' ref='-86' role='to' /> 125 <way id='-58' action='modify' timestamp='2010-03-15T22:32:09Z' visible='true'> 126 <nd ref='-4' /> 127 <nd ref='-2' /> 128 <tag k='name' v='way.8.2' /> 129 </way> 130 <relation id='-114' visible='true'> 131 <member type='way' ref='-60' role='from' /> 132 <member type='way' ref='-58' role='to' /> 133 <member type='node' ref='-4' role='via' /> 134 <tag k='restriction' v='no_left_turn' /> 135 <tag k='type' v='restriction' /> 136 </relation> 137 <relation id='-110' timestamp='2010-03-15T09:31:53Z' visible='true'> 138 <member type='way' ref='-92' role='from' /> 139 <member type='way' ref='-96' role='to' /> 140 <member type='node' ref='-52' role='via' /> 141 <tag k='restriction' v='only_straight_on' /> 142 <tag k='type' v='restriction' /> 143 </relation> 144 <relation id='-108' timestamp='2010-03-15T09:31:53Z' visible='true'> 145 <member type='way' ref='-86' role='from' /> 146 <member type='way' ref='-88' role='to' /> 147 <member type='node' ref='-44' role='via' /> 148 <tag k='restriction' v='only_right_turn' /> 149 <tag k='type' v='restriction' /> 150 </relation> 151 <relation id='-106' timestamp='2010-03-15T09:31:53Z' visible='true'> 152 <member type='way' ref='-80' role='from' /> 153 <member type='way' ref='-82' role='to' /> 154 <member type='node' ref='-36' role='via' /> 155 <tag k='restriction' v='only_left_turn' /> 156 <tag k='type' v='restriction' /> 157 </relation> 158 <relation id='-104' timestamp='2010-03-15T09:31:53Z' visible='true'> 159 <member type='way' ref='-74' role='from' /> 160 <member type='way' ref='-76' role='to' /> 161 <member type='way' ref='-78' role='via' /> 162 <tag k='restriction' v='no_u_turn' /> 163 <tag k='type' v='restriction' /> 164 </relation> 165 <relation id='-102' action='modify' timestamp='2010-03-15T09:31:53Z' visible='true'> 166 <member type='way' ref='-70' role='from' /> 167 <member type='way' ref='-72' role='to' /> 168 <member type='node' ref='-22' role='via' /> 169 <tag k='restriction' v='no_straight_on' /> 170 <tag k='type' v='restriction' /> 171 </relation> 172 <relation id='-100' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 173 <member type='way' ref='-68' role='from' /> 174 <member type='way' ref='-66' role='to' /> 175 <member type='node' ref='-16' role='via' /> 176 <tag k='restriction' v='no_left_turn' /> 177 <tag k='type' v='restriction' /> 178 </relation> 179 <relation id='-98' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'> 180 <member type='way' ref='-64' role='from' /> 181 <member type='way' ref='-62' role='to' /> 182 <member type='node' ref='-10' role='via' /> 133 183 <tag k='restriction' v='no_right_turn' /> 134 184 <tag k='type' v='restriction' /> 135 185 </relation> 136 <relation id='-98' timestamp='2010-03-09T09:06:53Z' visible='true'>137 <member type='way' ref='-80' role='from' />138 <member type='way' ref='-82' role='to' />139 <tag k='restriction' v='no_left_turn' />140 <tag k='type' v='restriction' />141 </relation>142 <relation id='-96' timestamp='2010-03-15T09:31:53Z' visible='true'>143 <member type='way' ref='-78' role='from' />144 <member type='way' ref='-76' role='to' />145 <tag k='restriction' v='no_straight_on' />146 <tag k='type' v='restriction' />147 </relation>148 <relation id='-94' timestamp='2010-03-15T09:31:53Z' visible='true'>149 <member type='way' ref='-74' role='from' />150 <member type='way' ref='-72' role='to' />151 <member type='way' ref='-70' role='via' />152 <tag k='restriction' v='no_u_turn' />153 <tag k='type' v='restriction' />154 </relation>155 <relation id='-92' timestamp='2010-03-15T09:31:53Z' visible='true'>156 <member type='way' ref='-68' role='from' />157 <member type='way' ref='-66' role='to' />158 <member type='node' ref='-22' role='via' />159 <tag k='restriction' v='only_left_turn' />160 <tag k='type' v='restriction' />161 </relation>162 <relation id='-90' timestamp='2010-03-15T09:31:53Z' visible='true'>163 <member type='way' ref='-62' role='from' />164 <member type='way' ref='-60' role='to' />165 <member type='node' ref='-14' role='via' />166 <tag k='restriction' v='only_right_turn' />167 <tag k='type' v='restriction' />168 </relation>169 <relation id='-88' timestamp='2010-03-15T09:31:53Z' visible='true'>170 <member type='way' ref='-56' role='from' />171 <member type='way' ref='-52' role='to' />172 <member type='node' ref='-6' role='via' />173 <tag k='restriction' v='only_straight_on' />174 <tag k='type' v='restriction' />175 </relation>176 186 </osm> -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java
r20556 r20701 4 4 5 5 import java.awt.event.ActionEvent; 6 import java.awt.event.KeyEvent;7 6 import java.util.Collection; 8 7 import java.util.logging.Logger; 8 9 import javax.swing.ActionMap; 10 import javax.swing.InputMap; 11 import javax.swing.JComponent; 12 import javax.swing.KeyStroke; 9 13 10 14 import org.openstreetmap.josm.Main; … … 15 19 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorManager; 16 20 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionSelectionPopupPanel; 17 import org.openstreetmap.josm. tools.Shortcut;21 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys; 18 22 19 23 /** … … 26 30 public class CreateOrEditTurnRestrictionAction extends JosmAction { 27 31 static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName()); 28 public CreateOrEditTurnRestrictionAction() { 32 33 /** 34 * Installs the global key stroke with which creating/editing a turn restriction 35 * is triggered. 36 * 37 * @param keyStroke the key stroke 38 */ 39 static public void install(KeyStroke keyStroke){ 40 InputMap im = Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); 41 Object actionMapKey = im.get(keyStroke); 42 if (actionMapKey != null && !actionMapKey.toString().equals("turnrestrictions:create-or-edit")) { 43 System.out.println(tr("Warning: turnrestrictions plugin replaces already existing action ''{0}'' behind shortcut ''{1}'' by action ''{2}''", actionMapKey.toString(), keyStroke.toString(), "turnrestrictions:create-or-edit")); 44 } 45 KeyStroke[] keys = im.keys(); 46 if (keys != null){ 47 for(KeyStroke ks: im.keys()){ 48 if (im.get(ks).equals("turnrestrictions:create-or-edit")) { 49 im.remove(ks); 50 } 51 } 52 } 53 im.put(keyStroke, "turnrestrictions:create-or-edit"); 54 ActionMap am = Main.contentPane.getActionMap(); 55 am.put("turnrestrictions:create-or-edit", getInstance()); 56 } 57 58 /** 59 * Installs global key stroke configured in the preferences. 60 * 61 * @param keyStroke the key stroke 62 */ 63 static public void install(){ 64 String value = Main.pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T"); 65 KeyStroke key = KeyStroke.getKeyStroke(value); 66 if (key == null){ 67 System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT)); 68 key = KeyStroke.getKeyStroke("shift ctrl T"); 69 } 70 install(key); 71 } 72 73 /** the singleton instance of this action */ 74 private static CreateOrEditTurnRestrictionAction instance; 75 76 /** 77 * Replies the unique instance of this action 78 * 79 * @return 80 */ 81 public static CreateOrEditTurnRestrictionAction getInstance() { 82 if (instance == null){ 83 instance = new CreateOrEditTurnRestrictionAction(); 84 } 85 return instance; 86 } 87 88 protected CreateOrEditTurnRestrictionAction() { 29 89 super( 30 90 tr("Create/Edit turn restriction..."), 31 91 null, 32 92 tr("Create or edit a turn restriction."), 33 Shortcut.registerShortcut( 34 "turnrestrictions:create-or-edit", 35 tr("Turnrestrictions: Create or Edit"), 36 // results in Shift-Ctrl-T on windows 37 KeyEvent.VK_T, 38 Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY, 39 Shortcut.SHIFT_DEFAULT 40 ), 41 true /* register action */ 93 null, // shortcut is going to be registered later 94 false 42 95 ); 43 96 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java
r20556 r20701 9 9 10 10 /** 11 * This is the main class for the turnrestriction plugin.11 * This is the main class for the turnrestrictions plugin. 12 12 * 13 13 */ 14 14 public class TurnRestrictionsPlugin extends Plugin{ 15 15 16 private CreateOrEditTurnRestrictionAction actCreateOrEditTurnRestriction;17 18 16 public TurnRestrictionsPlugin(PluginInformation info) { 19 super(info); 20 actCreateOrEditTurnRestriction = new CreateOrEditTurnRestrictionAction(); 17 super(info); 21 18 } 22 19 … … 30 27 // add the dialog 31 28 newFrame.addToggleDialog(dialog); 29 CreateOrEditTurnRestrictionAction.install(); 32 30 } 33 31 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java
r20586 r20701 156 156 lblOsmObject.setFont(UIManager.getFont("Label.font").deriveFont(Font.ITALIC)); 157 157 lblOsmObject.setIcon(null); 158 lblOsmObject.setText(tr("multiple objects with role ''{0}''",this.role. toString()));158 lblOsmObject.setText(tr("multiple objects with role ''{0}''",this.role.getOsmRole())); 159 159 lblOsmObject.setToolTipText(null); 160 160 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java
r20666 r20701 96 96 */ 97 97 protected ImageIcon getIcon(String restrictionType) { 98 if (!isValidRestrictionType(restrictionType)) return null; 98 if (!isValidRestrictionType(restrictionType)) { 99 return ImageProvider.get("types", "non-standard-type"); 100 } 99 101 return ImageProvider.get(buildImageName(restrictionType)); 100 102 } … … 146 148 protected void renderIcon(Relation tr) { 147 149 String restrictionType = tr.get("restriction"); 148 if (!isValidRestrictionType(restrictionType)) {149 icon.setIcon(null);150 return;151 }152 150 icon.setIcon(getIcon(restrictionType)); 153 151 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceKeys.java
r20675 r20701 1 1 package org.openstreetmap.josm.plugins.turnrestrictions.preferences; 2 3 import javax.swing.KeyStroke; 2 4 3 5 /** … … 29 31 */ 30 32 String SHOW_VIAS_IN_BASIC_EDITOR = "turnrestrictions.show-vias-in-basic-editor"; 33 34 /** 35 * The shortcut which triggers creating a new or editing and existing turn 36 * restriction. The value must be parseable by {@see KeyStroke#getKeyStroke(String)}. 37 * If missing, the default value "ctrl shift T" is assumed. 38 */ 39 String EDIT_SHORTCUT= "turnrestrictions.edit-shortcut"; 31 40 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java
r20675 r20701 16 16 import javax.swing.JPanel; 17 17 import javax.swing.JRadioButton; 18 import javax.swing.JSeparator; 18 19 19 20 import org.openstreetmap.josm.data.Preferences; … … 34 35 private ButtonGroup bgIconSet; 35 36 private JCheckBox cbShowViaListInBasicEditor; 37 private ShortcutPreferencePanel pnlShortcutPreference; 36 38 37 39 protected JPanel buildShowViaListInBasicEditorPanel() { … … 47 49 msg.setText("<html><body>" 48 50 + tr("The Basic Editor can optionally display the list of via-objects " 49 + "of a turn restriction s. If enabled, one can alsoedit them "50 + "in the Basic editor . If disabled, editing of via-objects is only"51 + "possible in the Advanced Editor ."51 + "of a turn restriction. If enabled, one can edit them " 52 + "in the Basic editor too. If disabled, editing of via-objects is " 53 + "possible in the Advanced Editor only." 52 54 ) 53 55 + "</body></html>" … … 153 155 add(buildSetBPanel(), gc); 154 156 gc.gridy++; 157 add(new JSeparator(), gc); 158 gc.gridy++; 155 159 add(buildShowViaListInBasicEditorPanel(), gc); 160 gc.gridy++; 161 add(new JSeparator(), gc); 162 gc.gridy++; 163 add(pnlShortcutPreference = new ShortcutPreferencePanel(), gc); 156 164 157 165 // filler - just grab remaining space … … 189 197 boolean b = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false); 190 198 cbShowViaListInBasicEditor.setSelected(b); 199 200 pnlShortcutPreference.initFromPreferences(prefs); 191 201 } 192 202 … … 213 223 prefs.put(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, newValue); 214 224 } 225 226 pnlShortcutPreference.saveToPreferences(prefs); 215 227 } 216 228 -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IdenticalTurnRestrictionLegsError.java
r20622 r20701 27 27 @Override 28 28 public String getText() { 29 return tr("This turn restriction uses the OSM way <span class=\"object-name\">{0}</span> with role ''from'' <strong>and</strong> with role ''to''. "30 + "In a turn restriction, the way with role ''from'' should be different from the way with role ''to'', though.",29 return tr("This turn restriction uses the OSM way <span class=\"object-name\">{0}</span> with role <tt>from</tt> <strong>and</strong> with role <tt>to</tt>. " 30 + "In a turn restriction, the way with role <tt>from</tt> should be different from the way with role <tt>to</tt>, though.", 31 31 leg.getDisplayName(DefaultNameFormatter.getInstance()) 32 32 ); -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IntersectionMissingAsViaError.java
r20622 r20701 37 37 String msg = tr("The <strong>from</strong>-way <span class=\"object-name\">{0}</span> and the <strong>to</strong>-way <span class=\"object-name\">{1}</span> " 38 38 + "interesect at node <span class=\"object-name\">{2}</span> but <span class=\"object-name\">{2}</span> isn''t a <strong>via</strong>-object.<br> " 39 + "It is recommended to set <span class=\"object-name\">{2}</span> as only<strong>via</strong>-object.",39 + "It is recommended to set <span class=\"object-name\">{2}</span> as unique <strong>via</strong>-object.", 40 40 this.from.getDisplayName(DefaultNameFormatter.getInstance()), 41 41 this.to.getDisplayName(DefaultNameFormatter.getInstance()), -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MultipleTurnRestrictionLegError.java
r20622 r20701 20 20 * Create the issue 21 21 * 22 * @param parent the par ant model22 * @param parent the parent model 23 23 * @param role the role of the turn restriction leg with multiple entries 24 24 * @param numLegs the number of legs … … 34 34 public String getText() { 35 35 switch(role){ 36 case FROM: return37 tr("A turn restriction requires exactly one way with role <tt>from</tt>. "36 case FROM: 37 return tr("A turn restriction requires exactly one way with role <tt>from</tt>. " 38 38 + "This turn restriction has {0} ways in this role. Please remove " 39 39 + "{1} of them.", … … 42 42 ); 43 43 case TO: 44 tr("A turn restriction requires exactly one way with role <tt>from</tt>. "44 return tr("A turn restriction requires exactly one way with role <tt>to</tt>. " 45 45 + "This turn restriction has {0} ways in this role. Please remove " 46 46 + "{1} of them.",
Note:
See TracChangeset
for help on using the changeset viewer.