/// <summary> /// Moves branch features from <see cref="sourceBranch"/> to <see cref="targetBranch"/> /// </summary> /// <param name="targetBranch"></param> /// <param name="sourceBranch"></param> /// <param name="chainage"></param> public static void MergeBranchFeatures(IBranch sourceBranch, IBranch targetBranch, double chainage) { foreach (var branchFeature in sourceBranch.BranchFeatures.ToArray()) { sourceBranch.BranchFeatures.Remove(branchFeature); branchFeature.Chainage = BranchFeature.SnapChainage(targetBranch.Length, branchFeature.Chainage + chainage); AddBranchFeatureToBranch(branchFeature, targetBranch, branchFeature.Chainage); } }
public static void AddBranchFeatureToBranch(IBranchFeature branchFeature, IBranch branch, double chainage) { branchFeature.Branch = branch; // set branch in advance branchFeature.Chainage = BranchFeature.SnapChainage(branch.Length, chainage); if (!(branchFeature is INetworkLocation)) { branch.BranchFeatures.Add(branchFeature); } }
public static double CalculationChainage(IBranch branch, double mapChainage) { var chainage = mapChainage; if (branch.IsLengthCustom) { chainage = BranchFeature.SnapChainage(branch.Length, chainage * branch.Length / branch.Geometry.Length); } return(chainage); }
/// <summary> /// Calculates the map (geometry) chainage from a user chainage /// </summary> /// <param name="branch"></param> /// <param name="effectiveBranchGeometry">The branch geometry to calculate with. Useful in case the current /// Branch.Geometry is about to be updated and not yet changed</param> /// <param name="chainage"></param> /// <returns></returns> public static double MapChainage(IBranch branch, IGeometry effectiveBranchGeometry, double chainage) { if (branch != null && branch.IsLengthCustom) { if (effectiveBranchGeometry != null) { return(BranchFeature.SnapChainage(effectiveBranchGeometry.Length, (effectiveBranchGeometry.Length / branch.Length) * chainage)); } } return(chainage); }
private void UpdateBranchFeatureChainages(double factor, double newLength) { branchFeatures.ForEach(bf => bf.Chainage = BranchFeature.SnapChainage(newLength, factor * bf.Chainage)); }