Changeset 1165 in josm
- Timestamp:
- 2008-12-23T14:05:09+01:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r1086 r1165 386 386 boolean colored = Main.pref.getBoolean("draw.rawgps.colors"); // color the lines 387 387 boolean alternatedirection = Main.pref.getBoolean("draw.rawgps.alternatedirection"); // paint direction arrow with alternate math. may be faster 388 int delta = 0; 389 try { 390 delta = Integer.parseInt(Main.pref.get("draw.rawgps.min-arrow-distance", "0")); // don't draw arrows nearer to each other than this 391 } catch (java.lang.NumberFormatException e) { 392 Main.pref.put("draw.rawgps.min-arrow-distance", "0"); 393 } 388 394 389 395 /**************************************************************** … … 472 478 if (lines && direction && !alternatedirection) { 473 479 Point old = null; 480 Point oldA = null; // last arrow painted 474 481 for (GpxTrack trk : data.tracks) { 475 482 for (Collection<WayPoint> segment : trk.trackSegs) { … … 480 487 Point screen = mv.getPoint(trkPnt.eastNorth); 481 488 // skip points that are on the same screenposition 482 if (old != null && ( (old.x != screen.x) || (old.y != screen.y))) {489 if (old != null && (oldA == null || screen.x < oldA.x-delta || screen.x > oldA.x+delta || screen.y < oldA.y-delta || screen.y > oldA.y+delta)) { 483 490 g.setColor(trkPnt.speedLineColor); 484 491 double t = Math.atan2(screen.y-old.y, screen.x-old.x) + Math.PI; … … 487 494 g.drawLine(screen.x,screen.y, (int)(screen.x + 10*Math.cos(t+PHI)), (int)(screen.y 488 495 + 10*Math.sin(t+PHI))); 496 oldA = screen; 489 497 } 490 498 old = screen; … … 500 508 if (lines && direction && alternatedirection) { 501 509 Point old = null; 510 Point oldA = null; // last arrow painted 502 511 for (GpxTrack trk : data.tracks) { 503 512 for (Collection<WayPoint> segment : trk.trackSegs) { … … 508 517 Point screen = mv.getPoint(trkPnt.eastNorth); 509 518 // skip points that are on the same screenposition 510 if (old != null && ( (old.x != screen.x) || (old.y != screen.y))) {519 if (old != null && (oldA == null || screen.x < oldA.x-delta || screen.x > oldA.x+delta || screen.y < oldA.y-delta || screen.y > oldA.y+delta)) { 511 520 g.setColor(trkPnt.speedLineColor); 512 521 g.drawLine(screen.x, screen.y, screen.x + dir[trkPnt.dir][0], screen.y + dir[trkPnt.dir][1]); 513 522 g.drawLine(screen.x, screen.y, screen.x + dir[trkPnt.dir][2], screen.y + dir[trkPnt.dir][3]); 523 oldA = screen; 514 524 } 515 525 old = screen; -
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r1082 r1165 8 8 import java.awt.Component; 9 9 import java.awt.Dimension; 10 import java.awt.GridBagLayout; 10 11 import java.awt.event.ActionEvent; 11 12 import java.awt.event.ActionListener; … … 22 23 import javax.swing.JLabel; 23 24 import javax.swing.JOptionPane; 25 import javax.swing.JPanel; 24 26 import javax.swing.JScrollPane; 25 27 import javax.swing.JTable; … … 27 29 import javax.swing.table.DefaultTableModel; 28 30 import javax.swing.table.TableCellRenderer; 31 import javax.swing.BorderFactory; 32 import javax.swing.Box; 29 33 30 34 import org.openstreetmap.josm.Main; … … 105 109 } 106 110 }; 107 colors.setPreferredSize(new Dimension(200,200));108 111 colors.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 109 112 final TableCellRenderer oldColorsRenderer = colors.getDefaultRenderer(Object.class); … … 137 140 colors.setToolTipText(tr("Colors used by different objects in JOSM.")); 138 141 colors.setPreferredScrollableViewportSize(new Dimension(100,112)); 139 gui.display.add(new JLabel(tr("Colors")), GBC.eol()); 140 gui.display.add(new JScrollPane(colors), GBC.eol().fill(GBC.BOTH)); 141 gui.display.add(colorEdit, GBC.eol().anchor(GBC.EAST)); 142 143 JPanel panel = new JPanel(new GridBagLayout()); 144 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 145 JScrollPane scrollpane = new JScrollPane(colors); 146 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 147 panel.add(scrollpane, GBC.eol().fill(GBC.BOTH)); 148 panel.add(colorEdit, GBC.eol().anchor(GBC.EAST)); 149 gui.displaycontent.addTab(tr("Colors"), panel); 142 150 } 143 151 -
trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
r1053 r1165 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.ActionListener; 9 import java.awt.GridBagLayout; 9 10 11 import javax.swing.BorderFactory; 10 12 import javax.swing.JCheckBox; 11 13 import javax.swing.JLabel; 12 14 import javax.swing.JTextField; 15 import javax.swing.JScrollPane; 16 import javax.swing.JPanel; 17 import javax.swing.Box; 13 18 14 19 import org.openstreetmap.josm.Main; … … 25 30 private JCheckBox drawGpsArrows = new JCheckBox(tr("Draw Direction Arrows")); 26 31 private JCheckBox drawGpsArrowsFast = new JCheckBox(tr("Fast drawing (looks uglier)")); 32 private JTextField drawGpsArrowsMinDist = new JTextField(8); 27 33 private JCheckBox interestingDirections = new JCheckBox(tr("Only interesting direction hints (e.g. with oneway tag).")); 28 34 private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers")); … … 31 37 private JCheckBox inactive = new JCheckBox(tr("Draw inactive layers in other color")); 32 38 private JCheckBox useAntialiasing = new JCheckBox(tr("Smooth map graphics (antialiasing)")); 33 private JCheckBox showSplashScreen = new JCheckBox(tr("Show splash screen at startup"));34 39 35 40 public void addGui(PreferenceDialog gui) { 36 41 gui.display.setPreferredSize(new Dimension(400,600)); 42 JPanel panel = new JPanel(new GridBagLayout()); 43 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 44 37 45 // drawRawGpsLines 38 46 drawRawGpsLines.addActionListener(new ActionListener(){ … … 42 50 drawGpsArrows.setEnabled(drawRawGpsLines.isSelected()); 43 51 drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 52 drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 44 53 colorTracks.setEnabled(drawRawGpsLines.isSelected()); 45 54 } … … 47 56 drawRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines")); 48 57 drawRawGpsLines.setToolTipText(tr("If your gps device draw too few lines, select this to draw lines along your way.")); 49 gui.display.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0));58 panel.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0)); 50 59 51 60 // drawRawGpsMaxLineLength 52 drawRawGpsMaxLineLength.setText( Main.pref.get("draw.rawgps.max-line-length", "-1"));61 drawRawGpsMaxLineLength.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.max-line-length", -1))); 53 62 drawRawGpsMaxLineLength.setToolTipText(tr("Maximum length (in meters) to draw lines. Set to '-1' to draw all lines.")); 54 63 drawRawGpsMaxLineLength.setEnabled(drawRawGpsLines.isSelected()); 55 gui.display.add(new JLabel(tr("Maximum length (meters)")), GBC.std().insets(40,0,0,0));56 gui.display.add(drawRawGpsMaxLineLength, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));64 panel.add(new JLabel(tr("Maximum length (meters)")), GBC.std().insets(40,0,0,0)); 65 panel.add(drawRawGpsMaxLineLength, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 57 66 58 67 // forceRawGpsLines … … 60 69 forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force")); 61 70 forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected()); 62 gui.display.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0));71 panel.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0)); 63 72 64 73 // drawGpsArrows … … 66 75 public void actionPerformed(ActionEvent e) { 67 76 drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 77 drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 68 78 } 69 79 }); … … 71 81 drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction")); 72 82 drawGpsArrows.setEnabled(drawRawGpsLines.isSelected()); 73 gui.display.add(drawGpsArrows, GBC.eop().insets(40,0,0,0));83 panel.add(drawGpsArrows, GBC.eop().insets(40,0,0,0)); 74 84 75 85 // drawGpsArrowsFast … … 77 87 drawGpsArrowsFast.setSelected(Main.pref.getBoolean("draw.rawgps.alternatedirection")); 78 88 drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 79 gui.display.add(drawGpsArrowsFast, GBC.eop().insets(60,0,0,0)); 89 panel.add(drawGpsArrowsFast, GBC.eop().insets(60,0,0,0)); 90 91 // drawGpsArrowsMinDist 92 drawGpsArrowsMinDist.setToolTipText(tr("Don't draw arrows if they are not at least this distance away from the last one.")); 93 drawGpsArrowsMinDist.setText(Integer.toString(Main.pref.getInteger("draw.rawgps.min-arrow-distance", 0))); 94 drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 95 panel.add(new JLabel(tr("Minimum distance (pixels)")), GBC.std().insets(60,0,0,0)); 96 panel.add(drawGpsArrowsMinDist, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 80 97 81 98 // colorTracks … … 83 100 colorTracks.setToolTipText(tr("Choose the hue for the track color by the velocity at that point.")); 84 101 colorTracks.setEnabled(drawRawGpsLines.isSelected()); 85 gui.display.add(colorTracks, GBC.eop().insets(40,0,0,0));102 panel.add(colorTracks, GBC.eop().insets(40,0,0,0)); 86 103 87 104 // largeGpsPoints 88 105 largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large")); 89 106 largeGpsPoints.setToolTipText(tr("Draw larger dots for the GPS points.")); 90 gui.display.add(largeGpsPoints, GBC.eop().insets(20,0,0,0));107 panel.add(largeGpsPoints, GBC.eop().insets(20,0,0,0)); 91 108 109 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 110 JScrollPane scrollpane = new JScrollPane(panel); 111 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 112 gui.displaycontent.addTab(tr("GPS Points"), scrollpane); 113 panel = new JPanel(new GridBagLayout()); 114 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 115 92 116 // directionHint 93 117 directionHint.addActionListener(new ActionListener(){ … … 103 127 directionHint.setToolTipText(tr("Draw direction hints for way segments.")); 104 128 directionHint.setSelected(Main.pref.getBoolean("draw.segment.direction")); 105 gui.display.add(directionHint, GBC.eop().insets(20,0,0,0));129 panel.add(directionHint, GBC.eop().insets(20,0,0,0)); 106 130 107 131 // only interesting directions … … 109 133 interestingDirections.setSelected(Main.pref.getBoolean("draw.segment.relevant_directions_only")); 110 134 interestingDirections.setEnabled(directionHint.isSelected()); 111 gui.display.add(interestingDirections, GBC.eop().insets(40,0,0,0));135 panel.add(interestingDirections, GBC.eop().insets(40,0,0,0)); 112 136 113 137 // segment order number 114 138 segmentOrderNumber.setToolTipText(tr("Draw the order numbers of all segments within their way.")); 115 139 segmentOrderNumber.setSelected(Main.pref.getBoolean("draw.segment.order_number")); 116 gui.display.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0));140 panel.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0)); 117 141 118 142 // antialiasing 119 143 useAntialiasing.setToolTipText(tr("Apply antialiasing to the map view resulting in a smoother appearance.")); 120 144 useAntialiasing.setSelected(Main.pref.getBoolean("mappaint.use-antialiasing")); 121 gui.display.add(useAntialiasing, GBC.eop().insets(20,0,0,0));145 panel.add(useAntialiasing, GBC.eop().insets(20,0,0,0)); 122 146 123 147 // downloaded area 124 148 sourceBounds.setToolTipText(tr("Draw the boundaries of data loaded from the server.")); 125 149 sourceBounds.setSelected(Main.pref.getBoolean("draw.data.downloaded_area", true)); 126 gui.display.add(sourceBounds, GBC.eop().insets(20,0,0,0));150 panel.add(sourceBounds, GBC.eop().insets(20,0,0,0)); 127 151 128 152 // virtual nodes 129 153 virtualNodes.setToolTipText(tr("Draw virtual nodes in select mode for easy way modification.")); 130 154 virtualNodes.setSelected(Main.pref.getInteger("mappaint.node.virtual-size", 8) != 0); 131 gui.display.add(virtualNodes, GBC.eop().insets(20,0,0,0));155 panel.add(virtualNodes, GBC.eop().insets(20,0,0,0)); 132 156 133 157 // background layers in inactive color 134 158 inactive.setToolTipText(tr("Draw the inactive data layers in a different color.")); 135 159 inactive.setSelected(Main.pref.getBoolean("draw.data.inactive_color", true)); 136 gui.display.add(inactive, GBC.eop().insets(20,0,0,0));160 panel.add(inactive, GBC.eop().insets(20,0,0,0)); 137 161 138 // Show splash screen on startup 139 showSplashScreen.setToolTipText(tr("Show splash screen at startup"));140 showSplashScreen.setSelected(Main.pref.getBoolean("draw.splashscreen", true));141 gui.display.add(showSplashScreen, GBC.eop().insets(20, 0, 0, 0));162 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 163 scrollpane = new JScrollPane(panel); 164 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 165 gui.displaycontent.addTab(tr("OSM Data"), scrollpane); 142 166 } 143 167 … … 148 172 Main.pref.put("draw.rawgps.direction", drawGpsArrows.isSelected()); 149 173 Main.pref.put("draw.rawgps.alternatedirection", drawGpsArrowsFast.isSelected()); 174 Main.pref.put("draw.rawgps.min-arrow-distance", drawGpsArrowsMinDist.getText()); 150 175 Main.pref.put("draw.rawgps.colors", colorTracks.isSelected()); 151 176 Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected()); … … 156 181 Main.pref.put("draw.data.inactive_color", inactive.isSelected()); 157 182 Main.pref.put("mappaint.use-antialiasing", useAntialiasing.isSelected()); 158 Main.pref.put("draw.splashscreen", showSplashScreen.isSelected());159 183 int vn = Main.pref.getInteger("mappaint.node.virtual-size", 8); 160 184 if(virtualNodes.isSelected()) { if (vn < 1) vn = 8; } -
trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java
r1053 r1165 5 5 6 6 import java.awt.Component; 7 import java.awt.GridBagLayout; 7 8 9 import javax.swing.BorderFactory; 10 import javax.swing.Box; 8 11 import javax.swing.DefaultListCellRenderer; 12 import javax.swing.JCheckBox; 9 13 import javax.swing.JComboBox; 10 14 import javax.swing.JLabel; 11 15 import javax.swing.JList; 16 import javax.swing.JPanel; 17 import javax.swing.JScrollPane; 12 18 import javax.swing.ListCellRenderer; 13 19 import javax.swing.UIManager; … … 23 29 */ 24 30 private JComboBox lafCombo; 31 public JPanel panel = new JPanel(new GridBagLayout()); 32 private JCheckBox showSplashScreen = new JCheckBox(tr("Show splash screen at startup")); 33 private JCheckBox showID = new JCheckBox(tr("Show object ID in selection lists")); 25 34 26 35 public void addGui(PreferenceDialog gui) { … … 56 65 lafCombo.addActionListener(gui.requireRestartAction); 57 66 58 gui.display.add(new JLabel(tr("Look and Feel")), GBC.std()); 59 gui.display.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 60 gui.display.add(lafCombo, GBC.eol().fill(GBC.HORIZONTAL)); 67 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 68 69 // Show splash screen on startup 70 showSplashScreen.setToolTipText(tr("Show splash screen at startup")); 71 showSplashScreen.setSelected(Main.pref.getBoolean("draw.splashscreen", true)); 72 panel.add(showSplashScreen, GBC.eop().insets(20, 0, 0, 0)); 73 74 // Show ID in selection 75 showID.setToolTipText(tr("Show object ID in selection lists")); 76 showID.setSelected(Main.pref.getBoolean("osm-primitives.showid", false)); 77 panel.add(showID, GBC.eop().insets(20, 0, 0, 0)); 78 79 panel.add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0)); 80 81 panel.add(new JLabel(tr("Look and Feel")), GBC.std().insets(20, 0, 0, 0)); 82 panel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 83 panel.add(lafCombo, GBC.eol().fill(GBC.HORIZONTAL)); 84 85 JScrollPane scrollpane = new JScrollPane(panel); 86 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 87 gui.displaycontent.addTab(tr("Look and Feel"), scrollpane); 61 88 } 62 89 63 90 public void ok() { 64 91 Main.pref.put("laf", ((LookAndFeelInfo)lafCombo.getSelectedItem()).getClassName()); 92 Main.pref.put("draw.splashscreen", showSplashScreen.isSelected()); 93 Main.pref.put("osm-primitives.showid", showID.isSelected()); 65 94 } 66 95 -
trunk/src/org/openstreetmap/josm/gui/preferences/LanguagePreference.java
r1066 r1165 7 7 import java.util.Locale; 8 8 9 import javax.swing.Box; 9 10 import javax.swing.DefaultListCellRenderer; 10 11 import javax.swing.JComboBox; 11 12 import javax.swing.JLabel; 12 13 import javax.swing.JList; 14 import javax.swing.JPanel; 13 15 import javax.swing.ListCellRenderer; 14 16 … … 53 55 langCombo.addActionListener(gui.requireRestartAction); 54 56 55 gui.display.add(new JLabel(tr("Language")), GBC.std()); 56 gui.display.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 57 gui.display.add(langCombo, GBC.eol().fill(GBC.HORIZONTAL)); 57 JPanel panel = null; 58 for(PreferenceSetting s : gui.settings) 59 { 60 if(s instanceof LafPreference) 61 panel = ((LafPreference)s).panel; 62 } 63 panel.add(new JLabel(tr("Language")), GBC.std().insets(20, 0, 0, 0)); 64 panel.add(GBC.glue(5,0), GBC.std().fill(GBC.HORIZONTAL)); 65 panel.add(langCombo, GBC.eol().fill(GBC.HORIZONTAL)); 66 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 58 67 } 59 68 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r1065 r1165 44 44 public final JPanel map = createPreferenceTab("map", I18n.tr("Map Settings"), I18n.tr("Settings for the map projection and data interpretation.")); 45 45 public final JPanel audio = createPreferenceTab("audio", I18n.tr("Audio Settings"), I18n.tr("Settings for the audio player and audio markers.")); 46 47 public final javax.swing.JTabbedPane displaycontent = new javax.swing.JTabbedPane(); 46 48 47 49 /** … … 111 113 public PreferenceDialog() { 112 114 super(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT); 115 display.add(displaycontent, GBC.eol().fill(GBC.BOTH)); 113 116 for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) { 114 117 try { … … 122 125 static { 123 126 // order is important! 127 settings.add(new DrawingPreference()); 128 settings.add(new ColorPreference()); 124 129 settings.add(new LafPreference()); 125 130 settings.add(new LanguagePreference()); 126 settings.add(new DrawingPreference());127 settings.add(new ColorPreference());128 131 settings.add(new MapPaintPreference()); 129 132 settings.add(new ServerAccessPreference());
Note:
See TracChangeset
for help on using the changeset viewer.