public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || GetType() != o.GetType()) { return(false); } BufferedLine that = (BufferedLine)o; if (that.buf.CompareTo(buf) != 0) { return(false); } if (!pA.Equals(that.pA)) { return(false); } if (!pB.Equals(that.pB)) { return(false); } return(true); }
/// <summary> /// /// </summary> /// <param name="points">ordered control points. If empty then this shape is empty.</param> /// <param name="buf">Buffer >= 0</param> /// <param name="expandBufForLongitudeSkew"> /// See <see cref="BufferedLine.ExpandBufForLongitudeSkew(IPoint, IPoint, double)"/> /// If true then the buffer for each segment is computed. /// </param> /// <param name="ctx"></param> public BufferedLineString(IList <IPoint> points, double buf, bool expandBufForLongitudeSkew, SpatialContext ctx) { this.buf = buf; if (!points.Any()) { this.segments = ctx.MakeCollection(new List <IShape>()); } else { List <IShape> segments = new List <IShape>(points.Count - 1); IPoint prevPoint = null; foreach (IPoint point in points) { if (prevPoint != null) { double segBuf = buf; if (expandBufForLongitudeSkew) { //TODO this is faulty in that it over-buffers. See Issue#60. segBuf = BufferedLine.ExpandBufForLongitudeSkew(prevPoint, point, buf); } segments.Add(new BufferedLine(prevPoint, point, segBuf, ctx)); } prevPoint = point; } if (!segments.Any()) {//TODO throw exception instead? segments.Add(new BufferedLine(prevPoint, prevPoint, buf, ctx)); } this.segments = ctx.MakeCollection(segments); } }