Changeset 26541 in osm for applications/editors/josm/plugins
- Timestamp:
- 2011-08-14T15:08:35+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
r25810 r26541 35 35 private static final String C_CENTER_INTERVAL = "livegps.center_interval_msec"; /* in msec */ 36 36 private static final String C_CENTER_FACTOR = "livegps.center_factor" /* in percent */; 37 private static final String C_CURSOR_H = "livegps.cursor_height"; /* in pixels */ 38 private static final String C_CURSOR_W = "livegps.cursor_width"; /* in pixels */ 37 39 private int refreshInterval; 38 40 private int centerInterval; … … 46 48 float speed; 47 49 float course; 48 // JLabel lbl;49 50 boolean autocenter; 50 51 private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); … … 121 122 super.paint(g, mv, bounds); 122 123 123 // int statusHeight = 50; 124 // Rectangle mvs = mv.getBounds(); 125 // mvs.y = mvs.y + mvs.height - statusHeight; 126 // mvs.height = statusHeight; 127 // g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.8f)); 128 // g.fillRect(mvs.x, mvs.y, mvs.width, mvs.height); 129 130 if (lastPoint != null) { 131 Point screen = mv.getPoint(lastPoint.getCoor()); 132 g.setColor(Main.pref.getColor(KEY_LIVEGPS_COLOR, Color.RED)); 133 g.drawOval(screen.x - 10, screen.y - 10, 20, 20); 134 g.drawOval(screen.x - 9, screen.y - 9, 18, 18); 135 } 136 137 // lbl.setText("gpsd: "+status+" Speed: " + speed + 138 // " Course: "+course); 139 // lbl.setBounds(0, 0, mvs.width-10, mvs.height-10); 140 // Graphics sub = g.create(mvs.x+5, mvs.y+5, mvs.width-10, 141 // mvs.height-10); 142 // lbl.paint(sub); 143 144 // if(status != null) { 145 // g.setColor(Color.WHITE); 146 // g.drawString("gpsd: " + status, 5, mv.getBounds().height - 15); 147 // // lower left corner 148 // } 124 if (lastPoint == null) 125 return; 126 127 Point screen = mv.getPoint(lastPoint.getCoor()); 128 g.setColor(Main.pref.getColor(KEY_LIVEGPS_COLOR, Color.RED)); 129 130 int TriaHeight = Main.pref.getInteger(C_CURSOR_H, 20); 131 int TriaWidth = Main.pref.getInteger(C_CURSOR_W, 10); 132 133 int[] x = new int[4]; 134 int[] y = new int[4]; 135 136 x[0] = screen.x + Math.round(TriaHeight * (float )Math.sin(Math.toRadians(course))); 137 y[0] = screen.y - Math.round(TriaHeight * (float )Math.cos(Math.toRadians(course))); 138 x[1] = screen.x + Math.round(TriaWidth * (float )Math.sin(Math.toRadians(course + 120))); 139 y[1] = screen.y - Math.round(TriaWidth * (float )Math.cos(Math.toRadians(course + 120))); 140 x[2] = screen.x; 141 y[2] = screen.y; 142 x[3] = screen.x + Math.round(TriaWidth * (float )Math.sin(Math.toRadians(course + 240))); 143 y[3] = screen.y - Math.round(TriaWidth * (float )Math.cos(Math.toRadians(course + 240))); 144 145 g.drawPolygon(x, y, 4); 149 146 } 150 147
Note:
See TracChangeset
for help on using the changeset viewer.