/// <summary> /// Gets or creates a new node on the branch by splitting the branch /// </summary> private static INode GetOrCreateNodeOnBranch(double offset, IBranchFeature node, IBranch branch) { var splitNode = SplitBranchAtNode(branch, offset); if (null != splitNode) { splitNode.Name = node.ToString(); } else { //no split so it must be the end or the start of the node //find out if it was start or end using geometry of the startNode splitNode = (branch.Source.Geometry.Equals(node.Geometry)) ? branch.Source : branch.Target; } splitNode.Attributes["OriginalFeature"] = node; return(splitNode); }
/// <summary> /// Gets or creates a new node on the branch by splitting the branch /// /// HACK, TODO: node is of type IBranchFeature?!? node / branch feature are messed-up here. /// </summary> private static INode GetOrCreateNodeOnBranch(double chainage, IBranchFeature node, IBranch branch) { var splitResult = SplitBranchAtNode(branch, chainage); var splitNode = (splitResult != null) ? splitResult.NewNode : null; if (null != splitNode) { splitNode.Name = node.ToString(); splitResult.NewBranch.Network = branch.Network; } else { //no split so it must be the end or the start of the node //find out if it was start or end using geometry of the startNode var isSource = branch.Source.Geometry.Coordinate.X == node.Geometry.Coordinate.X && branch.Source.Geometry.Coordinate.Y == node.Geometry.Coordinate.Y; splitNode = isSource ? branch.Source : branch.Target; } splitNode.Attributes["OriginalFeature"] = node; return(splitNode); }