Esempio n. 1
0
        public int SaveFile(string filename, FaceLayer faceLayer, EdgeLayer edgeLayer, VertexLayer vertexLayer, ShadowSystem shadowSystem)
        {
            FileStream fs = new FileStream(filename, FileMode.Create);
            writer = new BinaryWriter(fs);

            // 魔数,用于表示这个文件是一个Clover文件
            writer.Write(201203100);

            ReAllocateVertexID(vertexLayer);

            SaveVertexLayer(fs, vertexLayer);

            SaveEdgeLayer(fs, edgeLayer);

            SaveFaceLayer(fs, faceLayer);

            SaveShadowSystem(fs, shadowSystem);

            fs.Close();

            return 0;
        }
Esempio n. 2
0
        public void LoadFile(string filename)
        {
            fs = new FileStream(filename, FileMode.Open);

            reader = new BinaryReader(fs);

            int magicNumber = reader.ReadInt32();

            vertexIDDict = new Dictionary<int, Vertex>();
            edgeIDDict = new Dictionary<int, Edge>();
            faceIDDict = new Dictionary<int, Face>();

            vertexLayer = new VertexLayer();
            edgeLayer = new EdgeLayer();
            faceLayer = new FaceLayer();
            shadowSystem = new ShadowSystem();

            Clover();

            faceLayer.UpdateLeaves();

            fs.Close();
        }
Esempio n. 3
0
        public void LoadFile(string filename)
        {
            fileLoader.LoadFromFile(filename);

            // 重置所有的数据结构
            faceLayer = fileLoader.FaceLayer;
            edgeLayer = fileLoader.EdgeLayer;
            vertexLayer = fileLoader.VertexLayer;
            shadowSystem = fileLoader.ShadowSystem;

            renderController.DeleteAll();
            //renderController.RedrawFoldLine();
            foreach (Face face in faceLayer.Leaves)
            {
                renderController.New(face);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 保存影子系统的数据
        /// </summary>
        /// <param name="fs"></param>
        /// <param name="shadowSystem"></param>
        void SaveShadowSystem(FileStream fs, ShadowSystem shadowSystem)
        {
            writer.Write("ShadowSystem");

            List<SnapshotNode> nodeList = shadowSystem.SnapshotList;

            writer.Write(nodeList.Count);
            foreach (SnapshotNode node in nodeList)
            {
                SaveSnapshotNode(node);
            }
        }