@Test public void lengthTest() { Point point1 = new Point(0, 0); Point point2 = new Point(1, 0); Point point3 = new Point(1, 1); Point point4 = new Point(3, 1); LineString lineString = new LineString(); lineString.segments.add(new LineSegment(point1, point2)); lineString.segments.add(new LineSegment(point2, point3)); lineString.segments.add(new LineSegment(point3, point4)); Assert.assertEquals(4, lineString.length(), 0.0001); Assert.assertEquals(3, lineString.segments.size()); }
public double length() { double result = 0; for (LineSegment segment : this.segments) { result += segment.length(); } return result; }
LineString { public double length() { double result = 0; for (LineSegment segment : this.segments) { result += segment.length(); } return result; } }
LineString { public double length() { double result = 0; for (LineSegment segment : this.segments) { result += segment.length(); } return result; }  }
LineString { public double length() { double result = 0; for (LineSegment segment : this.segments) { result += segment.length(); } return result; }  void LineString(); @Override boolean equals(Object obj); LineString extractPart(double startDistance, double endDistance); Rectangle getBounds(); Point interpolate(double distance); double length(); }
LineString { public double length() { double result = 0; for (LineSegment segment : this.segments) { result += segment.length(); } return result; }  void LineString(); @Override boolean equals(Object obj); LineString extractPart(double startDistance, double endDistance); Rectangle getBounds(); Point interpolate(double distance); double length(); final List<LineSegment> segments; }