示例#1
0
        public void LoadXML(XmlNode node)
        {
            // ID
            this.ID = int.Parse(node.Attributes[Helper.Check(() => this.ID)].Value, ExportationConstants.XML_FORMATTER);

            // Mesh
            MeshCube mesh = new MeshCube();

            mesh.LoadXML(node.SelectSingleNode(ExportationConstants.XML_MESHCUBE_IDENT));
            Mesh = mesh;

            // Virtual pieces
            VirtualPieces = new List <VirtualPiece>();
            if (node.SelectSingleNode(ExportationConstants.XML_VIRTUAL_PIECE_COLLECTION_IDENT) != null)
            {
                foreach (var virtualPieceNode in node.SelectSingleNode(ExportationConstants.XML_VIRTUAL_PIECE_COLLECTION_IDENT).ChildNodes.OfType <XmlNode>())
                {
                    VirtualPiece virtualPiece = new VirtualPiece();
                    virtualPiece.LoadXML(virtualPieceNode);
                    virtualPiece.Container = this;
                    VirtualPieces.Add(virtualPiece);
                }
            }

            // Slants
            Slants = new List <Slant>();
            if (node.SelectSingleNode(ExportationConstants.XML_SLANT_COLLECTION_IDENT) != null)
            {
                foreach (var slantNode in node.SelectSingleNode(ExportationConstants.XML_SLANT_COLLECTION_IDENT).ChildNodes.OfType <XmlNode>())
                {
                    Slant slant = new Slant();
                    slant.LoadXML(slantNode);
                    slant.Container = this;
                    Slants.Add(slant);
                }
            }

            // Seal
            this.Seal();
        }
示例#2
0
 /// <summary>
 /// Adds the slant to the container
 /// </summary>
 /// <param name="slant">A slant defining an unusable area of the container</param>
 public void AddSlant(Slant slant)
 {
     slant.ID = _slantID++;
     Slants.Add(slant);
 }