Changeset 24061 in osm for applications/editors/josm/plugins/pdfimport/src/pdfimport/PdfPath.java
- Timestamp:
- 2010-11-04T16:14:43+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pdfimport/src/pdfimport/PdfPath.java
r23702 r24061 7 7 public List<Point2D> points; 8 8 public double length; 9 9 10 10 LayerContents layer; 11 11 public int nr; 12 13 12 13 14 14 public PdfPath(List<Point2D> nodes) { 15 points = nodes; 15 points = nodes; 16 16 } 17 17 18 public boolean isClosed() { 19 return points.size() > 1 && points.get(0) == points.get(points.size() - 1); 18 public boolean isClosed() { 19 return points.size() > 1 && points.get(0) == points.get(points.size() - 1); 20 20 } 21 21 22 22 public Point2D firstPoint() { 23 return points.get(0); 23 return points.get(0); 24 24 } 25 25 26 26 public Point2D lastPoint() { 27 return points.get(points.size() - 1); 27 return points.get(points.size() - 1); 28 28 } 29 29 30 30 public void calculateLength() { 31 31 double len = 0; 32 32 33 33 for(int pos =1; pos < points.size(); pos ++) { 34 34 len += points.get(pos).distance(points.get(pos -1)); 35 35 } 36 36 37 37 this.length = len; 38 38 } 39 40 public Point2D getOtherEnd(Point2D endPoint) { 41 if (this.firstPoint() == endPoint) { 42 return this.lastPoint(); 43 } 44 45 if (this.lastPoint() == endPoint) { 46 return this.firstPoint(); 47 } 48 49 throw new RuntimeException("Unexpected point"); 50 51 } 39 52 }
Note:
See TracChangeset
for help on using the changeset viewer.