Changeset 4273 in josm for trunk/src/org
- Timestamp:
- 2011-07-28T18:32:13+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/GPXSettingsPanel.java
r4270 r4273 48 48 private JComboBox waypointLabel = new JComboBox(new String[] {tr("Auto"), /* gpx data field name */ trc("gpx_field", "Name"), 49 49 /* gpx data field name */ trc("gpx_field", "Desc(ription)"), tr("Both"), tr("None")}); 50 private String spec; 51 private String specSp = ""; 50 private String layerName; 52 51 53 52 public GPXSettingsPanel(String layerName) { 54 53 super(new GridBagLayout()); 55 this.spec="layer "+layerName; 56 specSp = ".layer "+spec; 54 this.layerName = "layer "+layerName; 57 55 initComponents(); 58 56 loadPreferences(); … … 73 71 // drawRawGpsLines 74 72 ButtonGroup gpsLinesGroup = new ButtonGroup(); 75 if ( spec!=null) gpsLinesGroup.add(drawRawGpsLinesGlobal);73 if (layerName!=null) gpsLinesGroup.add(drawRawGpsLinesGlobal); 76 74 gpsLinesGroup.add(drawRawGpsLinesNone); 77 75 gpsLinesGroup.add(drawRawGpsLinesLocal); … … 81 79 82 80 add(new JLabel(tr("Draw lines between raw GPS points")), GBC.eol().insets(20,0,0,0)); 83 if ( spec!=null) add(drawRawGpsLinesGlobal, GBC.eol().insets(40,0,0,0));81 if (layerName!=null) add(drawRawGpsLinesGlobal, GBC.eol().insets(40,0,0,0)); 84 82 add(drawRawGpsLinesNone, GBC.eol().insets(40,0,0,0)); 85 83 add(drawRawGpsLinesLocal, GBC.eol().insets(40,0,0,0)); … … 146 144 // colorTracks 147 145 colorGroup = new ButtonGroup(); 148 if ( spec!=null) colorGroup.add(colorTypeGlobal);146 if (layerName!=null) colorGroup.add(colorTypeGlobal); 149 147 colorGroup.add(colorTypeNone); 150 148 colorGroup.add(colorTypeVelocity); … … 177 175 178 176 add(new JLabel(tr("Track and Point Coloring")), GBC.eol().insets(20,0,0,0)); 179 if ( spec!=null) add(colorTypeGlobal, GBC.eol().insets(40,0,0,0));177 if (layerName!=null) add(colorTypeGlobal, GBC.eol().insets(40,0,0,0)); 180 178 add(colorTypeNone, GBC.eol().insets(40,0,0,0)); 181 179 add(colorTypeVelocity, GBC.std().insets(40,0,0,0)); … … 191 189 add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0)); 192 190 add(new JLabel(tr("Waypoint labelling")), GBC.std().insets(20,0,0,0)); 193 if( spec!= null)191 if(layerName!= null) 194 192 waypointLabel.addItem(tr("Global settings")); 195 193 add(waypointLabel, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); … … 202 200 public void loadPreferences () { 203 201 makeAutoMarkers.setSelected(Main.pref.getBoolean("marker.makeautomarkers", true)); 204 if( spec!=null && !Main.pref.hasKey("draw.rawgps.lines."+spec)205 && !Main.pref.hasKey("draw.rawgps.lines.local"+ spec)){202 if(layerName!=null && !Main.pref.hasKey("draw.rawgps.lines."+layerName) 203 && !Main.pref.hasKey("draw.rawgps.lines.local"+layerName)){ 206 204 // no line preferences for layer is found 207 205 drawRawGpsLinesGlobal.setSelected(true); 208 206 } else { 209 Boolean lf = Main.pref.getBoolean("draw.rawgps.lines.local", spec, true);210 if(Main.pref.getBoolean("draw.rawgps.lines", spec, true)) {207 Boolean lf = Main.pref.getBoolean("draw.rawgps.lines.local",layerName, true); 208 if(Main.pref.getBoolean("draw.rawgps.lines",layerName, true)) { 211 209 drawRawGpsLinesAll.setSelected(true); 212 210 } else if (lf) { … … 217 215 } 218 216 219 drawRawGpsMaxLineLengthLocal.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length.local", spec, -1)));220 drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length", spec, 200)));221 forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force", spec, false));222 drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction", spec, false));223 drawGpsArrowsFast.setSelected(Main.pref.getBoolean("draw.rawgps.alternatedirection", spec, false));224 drawGpsArrowsMinDist.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.min-arrow-distance", spec, 40)));225 hdopCircleGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.hdopcircle", spec, false));226 largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large", spec, false));217 drawRawGpsMaxLineLengthLocal.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length.local",layerName, -1))); 218 drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length",layerName, 200))); 219 forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force",layerName, false)); 220 drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction",layerName, false)); 221 drawGpsArrowsFast.setSelected(Main.pref.getBoolean("draw.rawgps.alternatedirection",layerName, false)); 222 drawGpsArrowsMinDist.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.min-arrow-distance",layerName, 40))); 223 hdopCircleGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.hdopcircle",layerName, false)); 224 largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large",layerName, false)); 227 225 drawRawGpsLinesActionListener.actionPerformed(null); 228 226 229 if( spec!=null && !Main.pref.hasKey("draw.rawgps.colors."+spec)) {227 if(layerName!=null && !Main.pref.hasKey("draw.rawgps.colors."+layerName)) { 230 228 colorTypeGlobal.setSelected(true); 231 229 colorDynamic.setSelected(false); 232 230 colorDynamic.setEnabled(false); 233 231 } else { 234 switch(Main.pref.getInteger("draw.rawgps.colors", spec, 0)) {232 switch(Main.pref.getInteger("draw.rawgps.colors",layerName, 0)) { 235 233 case 0: colorTypeNone.setSelected(true); break; 236 234 case 1: colorTypeVelocity.setSelected(true); break; … … 239 237 case 4: colorTypeTime.setSelected(true); break; 240 238 } 241 int ccts = Main.pref.getInteger("draw.rawgps.colorTracksTune", spec, 45);239 int ccts = Main.pref.getInteger("draw.rawgps.colorTracksTune",layerName, 45); 242 240 colorTypeVelocityTune.setSelectedIndex(ccts==10 ? 2 : (ccts==20 ? 1 : 0)); 243 241 colorTypeVelocityTune.setEnabled(colorTypeVelocity.isSelected() && colorTypeVelocity.isEnabled()); 244 colorDynamic.setSelected(Main.pref.getBoolean("draw.rawgps.colors.dynamic", spec, false));242 colorDynamic.setSelected(Main.pref.getBoolean("draw.rawgps.colors.dynamic",layerName, false)); 245 243 colorDynamic.setEnabled(colorTypeVelocity.isSelected() || colorTypeDilution.isSelected()); 246 244 } 247 if( spec!= null)248 waypointLabel.setSelectedIndex(Main.pref.getInteger("draw.rawgps.layer.wpt "+specSp, 5));245 if(layerName != null) 246 waypointLabel.setSelectedIndex(Main.pref.getInteger("draw.rawgps.layer.wpt."+layerName, 5)); 249 247 else 250 248 waypointLabel.setSelectedIndex(Main.pref.getInteger("draw.rawgps.layer.wpt", 0)); … … 253 251 254 252 /** 255 * Save preferences from UI controls for specified layer256 * if spec==null, global preferences are written253 * Save preferences from UI controls for layerNameified layer 254 * if layerName==null, global preferences are written 257 255 */ 258 public boolean savePreferences (String spec) { 259 Main.pref.put("marker.makeautomarkers"+specSp, makeAutoMarkers.isSelected()); 256 public boolean savePreferences (String layerName) { 257 String layerNameDot = ".layer "+layerName; 258 Main.pref.put("marker.makeautomarkers"+layerNameDot, makeAutoMarkers.isSelected()); 260 259 if (drawRawGpsLinesGlobal.isSelected()) { 261 Main.pref.put("draw.rawgps.lines"+ specSp, null);262 Main.pref.put("draw.rawgps.lines.local"+ specSp, null);263 Main.pref.put("draw.rawgps.max-line-length"+ specSp, null);264 Main.pref.put("draw.rawgps.max-line-length.local"+ specSp, null);265 Main.pref.put("draw.rawgps.lines.force"+ specSp, null);266 Main.pref.put("draw.rawgps.direction"+ specSp, null);267 Main.pref.put("draw.rawgps.alternatedirection"+ specSp, null);268 Main.pref.put("draw.rawgps.min-arrow-distance"+ specSp, null);260 Main.pref.put("draw.rawgps.lines"+layerNameDot, null); 261 Main.pref.put("draw.rawgps.lines.local"+layerNameDot, null); 262 Main.pref.put("draw.rawgps.max-line-length"+layerNameDot, null); 263 Main.pref.put("draw.rawgps.max-line-length.local"+layerNameDot, null); 264 Main.pref.put("draw.rawgps.lines.force"+layerNameDot, null); 265 Main.pref.put("draw.rawgps.direction"+layerNameDot, null); 266 Main.pref.put("draw.rawgps.alternatedirection"+layerNameDot, null); 267 Main.pref.put("draw.rawgps.min-arrow-distance"+layerNameDot, null); 269 268 } else { 270 Main.pref.put("draw.rawgps.lines"+ specSp, drawRawGpsLinesAll.isSelected());271 Main.pref.put("draw.rawgps.lines.local"+ specSp, drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected());272 Main.pref.put("draw.rawgps.max-line-length"+ specSp, drawRawGpsMaxLineLength.getText());273 Main.pref.put("draw.rawgps.max-line-length.local"+ specSp, drawRawGpsMaxLineLengthLocal.getText());274 Main.pref.put("draw.rawgps.lines.force"+ specSp, forceRawGpsLines.isSelected());275 Main.pref.put("draw.rawgps.direction"+ specSp, drawGpsArrows.isSelected());276 Main.pref.put("draw.rawgps.alternatedirection"+ specSp, drawGpsArrowsFast.isSelected());277 Main.pref.put("draw.rawgps.min-arrow-distance"+ specSp, drawGpsArrowsMinDist.getText());269 Main.pref.put("draw.rawgps.lines"+layerNameDot, drawRawGpsLinesAll.isSelected()); 270 Main.pref.put("draw.rawgps.lines.local"+layerNameDot, drawRawGpsLinesAll.isSelected() || drawRawGpsLinesLocal.isSelected()); 271 Main.pref.put("draw.rawgps.max-line-length"+layerNameDot, drawRawGpsMaxLineLength.getText()); 272 Main.pref.put("draw.rawgps.max-line-length.local"+layerNameDot, drawRawGpsMaxLineLengthLocal.getText()); 273 Main.pref.put("draw.rawgps.lines.force"+layerNameDot, forceRawGpsLines.isSelected()); 274 Main.pref.put("draw.rawgps.direction"+layerNameDot, drawGpsArrows.isSelected()); 275 Main.pref.put("draw.rawgps.alternatedirection"+layerNameDot, drawGpsArrowsFast.isSelected()); 276 Main.pref.put("draw.rawgps.min-arrow-distance"+layerNameDot, drawGpsArrowsMinDist.getText()); 278 277 } 279 278 280 Main.pref.put("draw.rawgps.hdopcircle"+ specSp, hdopCircleGpsPoints.isSelected());281 Main.pref.put("draw.rawgps.large"+ specSp, largeGpsPoints.isSelected());282 if (waypointLabel.getSelectedIndex()==5) Main.pref.put("draw.rawgps.layer.wpt"+ specSp,null);283 else Main.pref.putInteger("draw.rawgps.layer.wpt"+ specSp, waypointLabel.getSelectedIndex());279 Main.pref.put("draw.rawgps.hdopcircle"+layerNameDot, hdopCircleGpsPoints.isSelected()); 280 Main.pref.put("draw.rawgps.large"+layerNameDot, largeGpsPoints.isSelected()); 281 if (waypointLabel.getSelectedIndex()==5) Main.pref.put("draw.rawgps.layer.wpt"+layerNameDot,null); 282 else Main.pref.putInteger("draw.rawgps.layer.wpt"+layerNameDot, waypointLabel.getSelectedIndex()); 284 283 285 284 if(colorTypeGlobal.isSelected()) { 286 Main.pref.put("draw.rawgps.colors"+ specSp, null);287 Main.pref.put("draw.rawgps.colors.dynamic"+ specSp, null);288 Main.pref.put("draw.rawgps.colorTracksTunec"+ specSp, null);285 Main.pref.put("draw.rawgps.colors"+layerNameDot, null); 286 Main.pref.put("draw.rawgps.colors.dynamic"+layerNameDot, null); 287 Main.pref.put("draw.rawgps.colorTracksTunec"+layerNameDot, null); 289 288 return false; 290 289 } else if(colorTypeVelocity.isSelected()) { 291 Main.pref.putInteger("draw.rawgps.colors"+ specSp, 1);290 Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 1); 292 291 } else if(colorTypeDilution.isSelected()) { 293 Main.pref.putInteger("draw.rawgps.colors"+ specSp, 2);292 Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 2); 294 293 } else if(colorTypeDirection.isSelected()) { 295 Main.pref.putInteger("draw.rawgps.colors"+ specSp, 3);294 Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 3); 296 295 } else if(colorTypeTime.isSelected()) { 297 Main.pref.putInteger("draw.rawgps.colors"+ specSp, 4);296 Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 4); 298 297 } else { 299 Main.pref.putInteger("draw.rawgps.colors"+ specSp, 0);298 Main.pref.putInteger("draw.rawgps.colors"+layerNameDot, 0); 300 299 } 301 Main.pref.put("draw.rawgps.colors.dynamic"+ specSp, colorDynamic.isSelected());300 Main.pref.put("draw.rawgps.colors.dynamic"+layerNameDot, colorDynamic.isSelected()); 302 301 int ccti=colorTypeVelocityTune.getSelectedIndex(); 303 Main.pref.putInteger("draw.rawgps.colorTracksTune"+ specSp, ccti==2 ? 10 : (ccti==1 ? 20 : 45));302 Main.pref.putInteger("draw.rawgps.colorTracksTune"+layerNameDot, ccti==2 ? 10 : (ccti==1 ? 20 : 45)); 304 303 return false; 305 304 }
Note:
See TracChangeset
for help on using the changeset viewer.