Пример #1
0
        public override void Load(XmlElement xmlNode)
        {
            base.Load(xmlNode);

            if (xmlNode.HasAttribute("Optimize"))
            {
                optimize = bool.Parse(xmlNode.GetAttribute("Optimize"));
            }
            if (xmlNode.HasAttribute("MaxDropouts"))
            {
                maxDropouts = int.Parse(xmlNode.GetAttribute("MaxDropouts"));
            }
            foreach (XmlElement xmlChild in xmlNode.ChildNodes)
            {
                Type classType = Type.GetType(xmlChild.Name);
                try
                {
                    Smoother = (ISmoother)Activator.CreateInstance(classType);
                    smoother.Load(xmlChild);
                }
                catch (Exception)
                {
                    try
                    {
                        Predictor = (IPredictor)Activator.CreateInstance(classType);
                        predictor.Load(xmlChild);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Пример #2
0
        public override void Load(XmlElement xmlNode)
        {
            base.Load(xmlNode);

            if (xmlNode.HasAttribute("DeviceIdentifier"))
            {
                deviceIdentifier = xmlNode.GetAttribute("DeviceIdentifier");
            }

            if (!InputMapper.Instance.Contains6DOFInputDevice(deviceIdentifier))
            {
                throw new GoblinException(deviceIdentifier + " is not recognized. Only 6DOF devices " +
                                          "are allowed to be used with TrackerNode.");
            }

            foreach (XmlElement xmlChild in xmlNode.ChildNodes)
            {
                Type classType = Type.GetType(xmlChild.Name);
                try
                {
                    Smoother = (ISmoother)Activator.CreateInstance(classType);
                    smoother.Load(xmlChild);
                }
                catch (Exception)
                {
                    try
                    {
                        Predictor = (IPredictor)Activator.CreateInstance(classType);
                        predictor.Load(xmlChild);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }