Changeset 3834 in osm
- Timestamp:
- 2007-07-29T01:03:37+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/SegmentEdge.java
r3686 r3834 6 6 import org.jgrapht.graph.DefaultWeightedEdge; 7 7 import org.openstreetmap.josm.data.osm.Segment; 8 import org.openstreetmap.josm.data.osm.Way; 8 9 9 10 /** 10 11 * @author cdaller 11 * 12 * 12 13 */ 13 14 public class SegmentEdge extends DefaultWeightedEdge { 14 private Segment segment; 15 16 public SegmentEdge() { 17 super(); 18 System.out.println("warning: edge without segment!"); 19 } 15 private Segment segment; 16 private boolean inverted; 17 private Way way; 20 18 21 /** 22 * @param segment 23 */ 24 public SegmentEdge(Segment segment) { 25 super(); 26 this.segment = segment; 27 } 19 public SegmentEdge() { 20 super(); 21 System.out.println("warning: edge without segment!"); 22 } 28 23 29 /** 30 * @return the segment 31 */ 32 public Segment getSegment() { 33 return this.segment; 34 } 24 /** 25 * @param segment 26 */ 27 public SegmentEdge(Segment segment) { 28 this(segment, false); 29 } 30 31 /** 32 * @param segment 33 * @param inverted 34 * if <code>true</code> the edge is the other direction as the contained segment. 35 */ 36 public SegmentEdge(Segment segment, boolean inverted) { 37 super(); 38 this.segment = segment; 39 this.inverted = inverted; 40 } 41 42 /** 43 * @return the segment 44 */ 45 public Segment getSegment() { 46 return this.segment; 47 } 48 49 /** 50 * @return the way 51 */ 52 public Way getWay() { 53 return this.way; 54 } 55 56 /** 57 * @param way 58 * the way to set 59 */ 60 public void setWay(Way way) { 61 this.way = way; 62 } 63 64 /** 65 * @return the inverted 66 */ 67 public boolean isInverted() { 68 return this.inverted; 69 } 70 71 /** 72 * Returns length of segment in meters (correct only on equator!) 73 * @return length of semgent in meters. 74 */ 75 public double getLengthInM() { 76 return Math.sqrt(segment.from.coor.distance(segment.to.coor)) * 111000; 77 } 35 78 36 79 }
Note:
See TracChangeset
for help on using the changeset viewer.