Example #1
0
 public void createFrame(EditorFrame frame)
 {
     if (!managingInput) {
         frameIndex++;
         frame = new EditorFrame(frame);
         frames.Add(frame);
         managingInput = true;
     }
 }
Example #2
0
 public EditorFrame(EditorFrame frame)
 {
     this.vertices = new List <Vertex>();
     this.edges    = new HashSet <Edge>();
     foreach (Edge edge in frame.edges)
     {
         Vertex start = createVertex(edge.start);
         Vertex end   = createVertex(edge.end);
         createEdge(start, end);
     }
     foreach (Vertex vertex in frame.vertices)
     {
         createVertex(vertex);
     }
 }
Example #3
0
 void LoadFrames()
 {
     string filePath = "";
     OpenFileDialog ofd = new OpenFileDialog();
     if (ofd.ShowDialog() == DialogResult.OK) {
         filePath = ofd.FileName;
     }
     else return;
     List<EditorFrame> loadedFrames = new List<EditorFrame>();
     EditorFrame loadedFrame;
     XmlReader xmlReader = XmlReader.Create(filePath);
     while (xmlReader.Read()) {
         loadedFrame = null;
         if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "frame")) {
             loadedFrame = new EditorFrame();
             xmlReader.Read();
             if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "vertices")) {
                 XmlReader innerReader = xmlReader.ReadSubtree();
                 while (innerReader.Read()) {
                     if ((innerReader.NodeType == XmlNodeType.Element) && (innerReader.Name == "vertex")) {
                         if (innerReader.HasAttributes) {
                             loadedFrame.loadVertex(int.Parse(innerReader.GetAttribute("X")), int.Parse(innerReader.GetAttribute("Y")));
                         }
                     }
                 }
             }
             xmlReader.Read();
             if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "edges")) {
                 XmlReader innerReader = xmlReader.ReadSubtree();
                 while (innerReader.Read()) {
                     if ((innerReader.NodeType == XmlNodeType.Element) && (innerReader.Name == "edge")) {
                         if (innerReader.HasAttributes) {
                             Vertex start = loadedFrame.loadVertex(int.Parse(innerReader.GetAttribute("startX")), int.Parse(innerReader.GetAttribute("startY")));
                             Vertex end = loadedFrame.loadVertex(int.Parse(innerReader.GetAttribute("endX")), int.Parse(innerReader.GetAttribute("endY")));
                             loadedFrame.createEdge(start, end);
                         }
                     }
                 }
             }
         }
         if (loadedFrame != null) { loadedFrames.Add(loadedFrame); }
     }
     frames = loadedFrames;
 }
Example #4
0
 public Vertex(EditorFrame parent, Point position)
 {
     this.parent = parent;
     this.color = Color.White;
     this.position = position;
 }
Example #5
0
 public EditorFrame(EditorFrame frame)
 {
     this.vertices = new List<Vertex>();
     this.edges = new HashSet<Edge>();
     foreach (Edge edge in frame.edges) {
         Vertex start = createVertex(edge.start);
         Vertex end = createVertex(edge.end);
         createEdge(start, end);
     }
     foreach (Vertex vertex in frame.vertices) {
         createVertex(vertex);
     }
 }
Example #6
0
 public Vertex(EditorFrame parent, Point position)
 {
     this.parent   = parent;
     this.color    = Color.White;
     this.position = position;
 }