/// <summary> /// Clone all the time-dependent components, share the others. /// </summary> /// <returns></returns> public virtual object Clone() { AnimatedRayScene sc = new AnimatedRayScene(); ITimeDependent intersectable = Intersectable as ITimeDependent; sc.Intersectable = (intersectable == null) ? Intersectable : (IIntersectable)intersectable.Clone(); sc.BackgroundColor = (double[])BackgroundColor.Clone(); ITimeDependent camera = Camera as ITimeDependent; sc.Camera = (camera == null) ? Camera : (ICamera)camera.Clone(); ILightSource[] tmp = new ILightSource[Sources.Count]; Sources.CopyTo(tmp, 0); for (int i = 0; i < tmp.Length; i++) { ITimeDependent source = tmp[i] as ITimeDependent; if (source != null) { tmp[i] = (ILightSource)source.Clone(); } } sc.Sources = new LinkedList <ILightSource>(tmp); sc.Start = Start; sc.End = End; sc.setTime(Time); // propagates the current time to all time-dependent components.. return(sc); }
protected internal override ExcelDxfFill Clone() { return(new ExcelDxfFill(_styles) { PatternType = PatternType, PatternColor = PatternColor.Clone(), BackgroundColor = BackgroundColor.Clone() }); }