/// <summary> /// Clones paths. /// </summary> /// <returns></returns> public IPathContainer Clone() { PathContainer newContainer = new PathContainer(); IEnumerator <Path> pathsEnumerator = GetPathsEnumerator(); while (pathsEnumerator.MoveNext()) { newContainer.AddPath(pathsEnumerator.Current.Clone()); } newContainer.layeredPathIndices = new List <int> [3]; newContainer.layeredPathIndices[0] = new List <int>(layeredPathIndices[0]); newContainer.layeredPathIndices[1] = new List <int>(layeredPathIndices[1]); newContainer.layeredPathIndices[2] = new List <int>(layeredPathIndices[2]); newContainer.activeLayer = activeLayer; return(newContainer); }
/// <summary> /// Checks for equality of paths. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (this == obj) { return(true); } if (!(obj is PathContainer)) { return(false); } PathContainer containerObj = obj as PathContainer; bool layerIndicesEqual = true; layerIndicesEqual &= Enumerable.SequenceEqual(this.layeredPathIndices[0], containerObj.layeredPathIndices[0]); layerIndicesEqual &= Enumerable.SequenceEqual(this.layeredPathIndices[1], containerObj.layeredPathIndices[1]); layerIndicesEqual &= Enumerable.SequenceEqual(this.layeredPathIndices[2], containerObj.layeredPathIndices[2]); return(Enumerable.SequenceEqual(this.Paths, containerObj.Paths) && this.ActivePathsLayer == containerObj.ActivePathsLayer && layerIndicesEqual); }