Changeset 26522 in osm for applications/editors/josm
- Timestamp:
- 2011-08-11T16:54:57+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/FastDraw
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/build.xml
r26520 r26522 30 30 <project name="FastDraw" default="dist" basedir="."> 31 31 <!-- enter the SVN commit message --> 32 <property name="commit.message" value="FastDraw: snapping fixed, do not save degenerate lines"/>32 <property name="commit.message" value="FastDraw: I = drawn line info"/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 34 <property name="plugin.main.version" value="4201"/> -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java
r26501 r26522 32 32 boolean isFixed(LatLon pp2) { 33 33 return fixed.contains(pp2); 34 } 35 36 double getLength() { 37 List<LatLon> pts = getPoints(); 38 Iterator<LatLon> it1,it2; 39 LatLon pp1,pp2; 40 if (pts.size()<2) return 0; 41 it1=pts.listIterator(0); 42 it2=pts.listIterator(1); 43 double len=0; 44 for (int i = 0; i < pts.size() - 1; i++) { 45 pp1 = it1.next(); 46 pp2 = it2.next(); 47 len+=pp1.greatCircleDistance(pp2); 48 } 49 return len; 34 50 } 35 51 … … 348 364 double pkm=0,maxpkm=0; 349 365 double len=0; 366 int seg=0; // averaged segments counts 350 367 for (int i = 1; i < n; i++) { 351 368 len+=lens[i-1]; // add next next point 352 369 // remove old segment 353 if (i>k) len-=lens[i-k-1]; 354 if (i>=k) { 370 if (i>k) {seg=k; len-=lens[i-k-1];} else seg=i; 371 if (i>=k || i==n-1) { 355 372 // len is length of points[i-windowSize] .. points[i] 356 if (len>0) pkm = k/ len * 1000;373 if (len>0) pkm = seg / len * 1000; 357 374 //System.out.println("i="+i+" pkm="+len+" pkm="+pkm); 358 375 if (pkm > maxpkm) maxpkm=pkm; -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r26520 r26522 498 498 tryToLoadWay(); 499 499 break; 500 case KeyEvent.VK_I: 501 JOptionPane.showMessageDialog(Main.parent, 502 tr("{0} m - length of the line\n{1} nodes\n{2} points per km (maximum)\n{3} points per km (average)", 503 line.getLength(),line.getPoints().size(),line.getNodesPerKm(settings.pkmBlockSize), 504 line.getNodesPerKm(1000000)), 505 tr("Line information"),JOptionPane.INFORMATION_MESSAGE); 506 break; 500 507 case KeyEvent.VK_Q: 501 508 // less details
Note:
See TracChangeset
for help on using the changeset viewer.