private static ChangeAlongCurves PopulateReshapeAlongCurves( [NotNull] IList <Feature> sourceFeatures, [NotNull] IList <Feature> targetFeatures, IEnumerable <ReshapeLineMsg> reshapeLineMsgs, ReshapeAlongCurveUsability cutSubcurveUsability) { IList <CutSubcurve> resultSubcurves = new List <CutSubcurve>(); foreach (var reshapeLineMsg in reshapeLineMsgs) { CutSubcurve cutSubcurve = FromReshapeLineMsg(reshapeLineMsg); Assert.NotNull(cutSubcurve); if (reshapeLineMsg.Source != null) { var sourceRef = new GdbObjectReference(reshapeLineMsg.Source.ClassHandle, reshapeLineMsg.Source.ObjectId); cutSubcurve.Source = sourceFeatures.First(f => sourceRef.References(f)); } resultSubcurves.Add(cutSubcurve); } return(new ChangeAlongCurves(resultSubcurves, cutSubcurveUsability) { TargetFeatures = targetFeatures }); }
protected bool Equals([NotNull] CutSubcurve other) { return(IsReshapeMemberCandidate == other.IsReshapeMemberCandidate && IsFiltered == other.IsFiltered && CanReshape == other.CanReshape && Equals(other.Source?.Handle, Source?.Handle) && ToPointIsStitchPoint == other.ToPointIsStitchPoint && FromPointIsStitchPoint == other.FromPointIsStitchPoint && Path.IsEqual(other.Path)); }
private static CutSubcurve FromReshapeLineMsg(ReshapeLineMsg reshapeLineMsg) { var path = (Polyline)ProtobufConversionUtils.FromShapeMsg(reshapeLineMsg.Path); var targetSegmentAtFrom = (Polyline)ProtobufConversionUtils.FromShapeMsg(reshapeLineMsg.TargetSegmentAtFrom); var targetSegmentAtTo = (Polyline)ProtobufConversionUtils.FromShapeMsg(reshapeLineMsg.TargetSegmentAtTo); var extraInsertPoints = ProtobufConversionUtils.FromShapeMsg(reshapeLineMsg.ExtraTargetInsertPoints); var result = new CutSubcurve(Assert.NotNull(path), reshapeLineMsg.CanReshape, reshapeLineMsg.IsCandidate, reshapeLineMsg.IsFiltered, targetSegmentAtFrom, targetSegmentAtTo, extraInsertPoints); return(result); }
private static ReshapeLineMsg ToReshapeLineMsg(CutSubcurve subcurve) { var result = new ReshapeLineMsg(); result.Path = ProtobufConversionUtils.ToShapeMsg(subcurve.Path); result.CanReshape = subcurve.CanReshape; result.IsCandidate = subcurve.IsReshapeMemberCandidate; result.IsFiltered = subcurve.IsFiltered; if (subcurve.Source != null) { result.Source = ProtobufConversionUtils.ToGdbObjRefMsg(subcurve.Source); } result.TargetSegmentAtFrom = ProtobufConversionUtils.ToShapeMsg(subcurve.TargetSegmentAtFromPoint); result.TargetSegmentAtTo = ProtobufConversionUtils.ToShapeMsg(subcurve.TargetSegmentAtToPoint); result.ExtraTargetInsertPoints = ProtobufConversionUtils.ToShapeMsg(subcurve.ExtraTargetInsertPoints); return(result); }