예제 #1
0
    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);
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }