Changeset 26984 in osm for applications/editors/josm/plugins/livegps/src
- Timestamp:
- 2011-10-29T11:39:29+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
r26542 r26984 111 111 112 112 Point screen = mv.getPoint(lastPoint.getCoor()); 113 g.setColor(Main.pref.getColor(C_LIVEGPS_COLOR_POSITION, Color.RED));114 113 115 114 int TriaHeight = Main.pref.getInteger(C_CURSOR_H, 20); 116 115 int TriaWidth = Main.pref.getInteger(C_CURSOR_W, 10); 116 117 /* 118 * Draw a bold triangle. 119 * In case of deep zoom draw also a thin DOP oval. 120 */ 121 122 g.setColor(Main.pref.getColor(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN)); 123 int w, h; 124 double ppm = 100 / mv.getDist100Pixel(); /* pixels per metre */ 125 126 w = (int )Math.round(lastData.getEpx() * ppm); 127 h = (int )Math.round(lastData.getEpy() * ppm); 128 129 if (w > TriaWidth || h > TriaWidth) { 130 int xo, yo; 131 132 yo = screen.y - Math.round(h/2); 133 xo = screen.x - Math.round(w/2); 134 135 g.drawOval(xo, yo, w, h); 136 } 117 137 118 138 int[] x = new int[4]; 119 139 int[] y = new int[4]; 120 140 float course = lastData.getCourse(); 121 122 x[0] = screen.x + Math.round(TriaHeight * (float )Math.sin(Math.toRadians(course))); 123 y[0] = screen.y - Math.round(TriaHeight * (float )Math.cos(Math.toRadians(course))); 124 x[1] = screen.x + Math.round(TriaWidth * (float )Math.sin(Math.toRadians(course + 120))); 125 y[1] = screen.y - Math.round(TriaWidth * (float )Math.cos(Math.toRadians(course + 120))); 126 x[2] = screen.x; 127 y[2] = screen.y; 128 x[3] = screen.x + Math.round(TriaWidth * (float )Math.sin(Math.toRadians(course + 240))); 129 y[3] = screen.y - Math.round(TriaWidth * (float )Math.cos(Math.toRadians(course + 240))); 130 131 g.drawPolygon(x, y, 4); 132 133 g.setColor(Main.pref.getColor(C_LIVEGPS_COLOR_POSITION_ESTIMATE, Color.CYAN)); 134 135 int w, h; 136 double ppm = 100 / mv.getDist100Pixel(); /* pixels per metre */ 137 138 w = (int )Math.round(lastData.getEpx() * ppm); 139 h = (int )Math.round(lastData.getEpy() * ppm); 140 141 if (w > TriaWidth || h > TriaWidth) { 142 int xo, yo; 143 144 yo = screen.y - Math.round(h/2); 145 xo = screen.x - Math.round(w/2); 146 147 g.drawOval(xo, yo, w, h); 141 float csin = (float )Math.sin(Math.toRadians(course)); 142 float ccos = (float )Math.cos(Math.toRadians(course)); 143 float csin120 = (float )Math.sin(Math.toRadians(course + 120)); 144 float ccos120 = (float )Math.cos(Math.toRadians(course + 120)); 145 float csin240 = (float )Math.sin(Math.toRadians(course + 240)); 146 float ccos240 = (float )Math.cos(Math.toRadians(course + 240)); 147 148 g.setColor(Main.pref.getColor(C_LIVEGPS_COLOR_POSITION, Color.RED)); 149 150 for (int i = 0; i <= 3; i++, TriaHeight--, TriaWidth--) { 151 152 x[0] = screen.x + Math.round(TriaHeight * csin); 153 y[0] = screen.y - Math.round(TriaHeight * ccos); 154 x[1] = screen.x + Math.round(TriaWidth * csin120); 155 y[1] = screen.y - Math.round(TriaWidth * ccos120); 156 x[2] = screen.x; 157 y[2] = screen.y; 158 x[3] = screen.x + Math.round(TriaWidth * csin240); 159 y[3] = screen.y - Math.round(TriaWidth * ccos240); 160 161 g.drawPolygon(x, y, 4); 148 162 } 163 149 164 } 150 165
Note:
See TracChangeset
for help on using the changeset viewer.