source: josm/trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java@ 3734

Last change on this file since 3734 was 3557, checked in by bastiK, 14 years ago

applied #5427 (patch by extropy) - Extrude leaves unnecessary nodes and 'antennae' segments when extruding again in a direction

  • Property svn:eol-style set to native
File size: 953 bytes
Line 
1// License: GPL. Copyright 2007 by Gabriel Ebner
2package org.openstreetmap.josm.data.osm;
3
4/**
5 * A segment consisting of 2 consecutive nodes out of a way.
6 */
7public final class WaySegment {
8 /**
9 * The way.
10 */
11 public Way way;
12
13 /**
14 * The index of one of the 2 nodes in the way. The other node has the
15 * index <code>lowerIndex + 1</code>.
16 */
17 public int lowerIndex;
18
19 public WaySegment(Way w, int i) {
20 way = w;
21 lowerIndex = i;
22 }
23
24 public Node getFirstNode(){
25 return way.getNode(lowerIndex);
26 }
27
28 public Node getSecondNode(){
29 return way.getNode(lowerIndex + 1);
30 }
31
32 @Override public boolean equals(Object o) {
33 return o != null && o instanceof WaySegment
34 && ((WaySegment) o).way == way
35 && ((WaySegment) o).lowerIndex == lowerIndex;
36 }
37
38 @Override public int hashCode() {
39 return way.hashCode() ^ lowerIndex;
40 }
41}
Note: See TracBrowser for help on using the repository browser.