public CoordinateSequence GetLinearizedCoordinateSequence(double tolerance) { // collect all the points of all components GrowableOrdinateArray gar = new GrowableOrdinateArray(); CoordinateSequence cs; foreach (ILineal component in Components) { // the last point of the previous element is the first point of the next one, // remove the duplication if (gar.Count > 0) { gar.Capacity = gar.Count - 2; } // linearize with tolerance the circular strings, take the linear ones as is if (component is ICurvedLineGeometry <LineString> cg) { cs = cg.GetLinearizedCoordinateSequence(tolerance); gar.Add(cs); } else if (component is LineString ls) { cs = ls.CoordinateSequence; for (int i = 0; i < cs.Count; i++) { gar.Add(new Models.Vector8Float(cs.GetX(i), cs.GetY(i), cs.GetZ(i), cs.GetM(i))); } } } cs = gar.ToCoordinateSequence(Factory); return(cs); }
internal ArcVisitor(Action <Arc> onVisitArc, GrowableOrdinateArray array) => (this.onVisitArc, ordinates) = (onVisitArc, array);
/// <summary> /// Calls <see cref="Visit"/> /// </summary> /// <param name="circularString"></param> /// <param name="ordinates"></param> internal ArcVisitor(CircularString circularString, Action <Arc> onVisitArc, GrowableOrdinateArray ordinates = null) : this(onVisitArc, ordinates ?? new GrowableOrdinateArray()) { tolerance = circularString.tolerance; Factory = circularString.Factory; controlPoints = circularString.controlPoints; Visit(); }