Exemple #1
0
        public CircuitPart Clone()
        {
            var clone = new CircuitPart(Start);

            foreach (var node in Drawables)
            {
                clone.AddDrawableBase(node);
            }

            foreach (var resistance in ResistancesList)
            {
                clone.AddResistance(resistance);
            }

            clone.EndPoints = new EndPointsClass()
            {
                End   = End,
                Start = Start,
            };

            clone.End             = End;
            clone.Start           = Start;
            clone.DebugColor      = DebugColor;
            clone.IsLooseEnd      = IsLooseEnd;
            clone.LinkedToBattery = LinkedToBattery;

            return(clone);
        }
Exemple #2
0
        public CircuitPart GetEquivalentCircuitPart()
        {
            var equivalentCircuitPart = new CircuitPart(Start)
            {
                End = End
            };

            CircuitParts.ForEach(c =>
            {
                var nodes = c.Drawables;
                foreach (var node in nodes)
                {
                    equivalentCircuitPart.AddDrawableBase(node);
                }

                equivalentCircuitPart.ChildCircuitParts.Add(c);
            });

            equivalentCircuitPart.AddResistance(EquivalentResistance);
            return(equivalentCircuitPart);
        }