Esempio n. 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();
        }
Esempio n. 2
0
 /// <summary>
 /// Adds the virtual piece to the container
 /// </summary>
 /// <param name="piece">A virtual piece defining an unusable area of the container</param>
 public void AddVirtualPiece(VirtualPiece piece)
 {
     piece.ID = _virtualPieceID++;
     VirtualPieces.Add(piece);
 }