예제 #1
0
        public virtual void SetElement(URDFElement externalElement)
        {
            if (externalElement.GetType() != GetType())
            {
                throw new Exception("URDFElements need to be the same type to set the internal values");
            }

            foreach (Tuple <URDFAttribute, URDFAttribute> pair in
                     Enumerable.Zip(Attributes, externalElement.Attributes, Tuple.Create))
            {
                if (pair.Item2.Value != null && pair.Item2.Value.GetType() == typeof(double[]))
                {
                    double[] valueArray = (double[])pair.Item2.Value;
                    pair.Item1.Value = valueArray.Clone();
                }
                else
                {
                    pair.Item1.Value = pair.Item2.Value;
                }
            }

            foreach (Tuple <URDFElement, URDFElement> pair in
                     Enumerable.Zip(ChildElements, externalElement.ChildElements, Tuple.Create))
            {
                pair.Item1.SetElement(pair.Item2);
            }
        }