public override void Read(XmlNode xml) { ids.Clear(); if (Enum.GetNames(optionInternal.GetType()).Length >= 2) { Enum output = optionInternal; xml.Attributes["chirality"].Value.ToEnum(ref output); optionInternal = output; } foreach (XmlNode node in xml.ChildNodes) { if (node.Name != "entity" && node.Name != "link") { continue; } var path = IdPath.From(node.Attributes["path"].Value); ICADObject o = null; if (sketch.idMapping != null) { o = sketch.GetChild(sketch.idMapping[path.path.Last()]); } else { o = sketch.feature.detail.GetObjectById(path); } AddObject(o); } base.Read(xml); }
public void ReadXml(string str, bool readView, out IdPath active) { Clear(); var xml = new XmlDocument(); xml.LoadXml(str); if (xml.DocumentElement.Attributes["id"] != null) { guid_ = idGenerator.Create(0); } if (readView) { if (xml.DocumentElement.Attributes["viewPos"] != null) { Camera.main.transform.position = xml.DocumentElement.Attributes["viewPos"].Value.ToVector3(); } if (xml.DocumentElement.Attributes["viewRot"] != null) { Camera.main.transform.rotation = xml.DocumentElement.Attributes["viewRot"].Value.ToQuaternion(); } if (xml.DocumentElement.Attributes["viewSize"] != null) { Camera.main.orthographicSize = xml.DocumentElement.Attributes["viewSize"].Value.ToFloat(); } } if (xml.DocumentElement.Attributes["activeFeature"] != null) { active = IdPath.From(xml.DocumentElement.Attributes["activeFeature"].Value); } else { active = null; } foreach (XmlNode node in xml.DocumentElement) { if (node.Name != "feature") { continue; } var type = node.Attributes["type"].Value; var item = Type.GetType(type).GetConstructor(new Type[0]).Invoke(new object[0]) as Feature; AddFeature(item); item.Read(node); } }
public override void Read(XmlNode xml) { ids.Clear(); foreach (XmlNode node in xml.ChildNodes) { if (node.Name != "entity") { continue; } var path = IdPath.From(node.Attributes["path"].Value); var e = sketch.feature.detail.GetObjectById(path) as IEntity; AddEntity(e); } base.Read(xml); }
public override void Read(XmlNode xml) { ids.Clear(); if (Enum.GetNames(optionInternal.GetType()).Length >= 2) { Enum output = optionInternal; xml.Attributes["chirality"].Value.ToEnum(ref output); optionInternal = output; } foreach (XmlNode node in xml.ChildNodes) { if (node.Name != "entity") { continue; } var path = IdPath.From(node.Attributes["path"].Value); var o = sketch.feature.detail.GetObjectById(path); AddObject(o); } base.Read(xml); }