public void testWriteXML() { Sketch.Sketch sketch = new Sketch.Sketch(); sketch.XmlAttrs.Id = System.Guid.NewGuid(); Sketch.Shape shape = new Sketch.Shape(); shape.XmlAttrs.Id = System.Guid.NewGuid(); shape.XmlAttrs.Name = "shapeName"; shape.XmlAttrs.Type = "shape"; shape.XmlAttrs.Time = "111"; Sketch.Stroke stroke; Sketch.Substroke substroke; Sketch.Point point; ulong h; ulong i; ulong j; for (h = 0; h < 3; ++h) { stroke = new Sketch.Stroke(); stroke.XmlAttrs.Id = System.Guid.NewGuid(); stroke.XmlAttrs.Name = "strokeName"; stroke.XmlAttrs.Type = "stroke"; stroke.XmlAttrs.Time = h; for (i = 0; i < 5; ++i) { substroke = new Sketch.Substroke(); substroke.XmlAttrs.Id = System.Guid.NewGuid(); substroke.XmlAttrs.Name = "substrokeName"; substroke.XmlAttrs.Type = "substroke"; substroke.XmlAttrs.Time = i; for (j = 0; j < 10; ++j) { point = new Sketch.Point(); point.XmlAttrs.X = (float)random.NextDouble(); point.XmlAttrs.Y = (float)random.NextDouble(); point.XmlAttrs.Id = System.Guid.NewGuid(); point.XmlAttrs.Pressure = (ushort)(random.NextDouble() * 256); point.XmlAttrs.Name = "point" + j.ToString(); point.XmlAttrs.Time = j; substroke.AddPoint(point); } stroke.AddSubstroke(substroke); shape.AddSubstroke(substroke); } sketch.AddStroke(stroke); } sketch.AddShape(shape); sketch.Strokes[0].SplitStrokeAt(new int[] { 7, 14, 16, 21 }); ConverterXML.MakeXML xml = new ConverterXML.MakeXML(sketch); xml.WriteXML("test.xml"); }
/// <summary> /// A quick hacky main function to test this. /// Uses hard-coded paths for input and output files. /// </summary> /// <param name="args">unused</param> public static void Main(String[] args) { String filename = @"c:\documents and settings\christine\my documents\sketch\data\e85\new labeled documents\labeled summer 2007\0268_1.6.1.labeled.xml"; string outfile = @"c:\documents and settings\christine\my documents\out.xml"; Sketch.Sketch sketch = new ConverterXML.ReadXML(filename).Sketch; sketch.RemoveShapes(); Console.WriteLine("beginning to find neighborhood graph"); NeighborhoodMap graph = new NeighborhoodMap(sketch, 100, false, 5); Console.WriteLine("done"); AddDebuggingLines(ref sketch, graph); Console.WriteLine("writing xml"); ConverterXML.MakeXML mx = new ConverterXML.MakeXML(sketch); mx.WriteXML(outfile); Console.Read(); }