Exemple #1
0
        public void testBasicStructure()
        {
            Being b = new Being();
            b.Ident = "ALASTAIR";
            b.RightEye = new BeingEye();
            b.RightEye.EyeState = EyeState.FIXATION;
            b.RightEye.GazeVector = new Pose6D();
            CommunicationHelper.setPose6D( b.RightEye.GazeVector, 23.5678549M, 92.64654864M, null, 45.765234560M, 60.34444124365M, null, 0.9M );

            GazeTrackData gt = new GazeTrackData();
            gt.Timestamp = DateTime.UtcNow;
            gt.SequenceNumber = 0;
            System.Collections.Generic.List<Being> beingList = new System.Collections.Generic.List<Being>();
            beingList.Add( b );
            gt.Beings = beingList.ToArray();

            System.Collections.Generic.List<GazeTrackData> gazeTrackDataList = new System.Collections.Generic.List<GazeTrackData>();
            gazeTrackDataList.Add( gt );

            GazeTrackDataSet gtd = new GazeTrackDataSet();
            gtd.GazeTrackData = gazeTrackDataList.ToArray();

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer( gtd.GetType() );
            TextWriter writer = new SpecificEncodingStringWriter( Encoding.UTF8 );
            XmlWriter xmlWriter = XmlWriter.Create( writer );
            x.Serialize( xmlWriter, gtd );
            Console.WriteLine( "XML:" );
            Console.WriteLine( writer.ToString() );
            Console.WriteLine( "Length: " + writer.ToString().Length );
            log.Debug( "Generated XML" );
            log.Debug( writer.ToString() );
            log.Debug( "Generated XML Length: " + writer.ToString().Length );
        }
Exemple #2
0
        public void testBasicStructure()
        {
            Being b = new Being();

            b.Ident               = "ALASTAIR";
            b.RightEye            = new BeingEye();
            b.RightEye.EyeState   = EyeState.FIXATION;
            b.RightEye.GazeVector = new Pose6D();
            CommunicationHelper.setPose6D(b.RightEye.GazeVector, 23.5678549M, 92.64654864M, null, 45.765234560M, 60.34444124365M, null, 0.9M);

            GazeTrackData gt = new GazeTrackData();

            gt.Timestamp      = DateTime.UtcNow;
            gt.SequenceNumber = 0;
            System.Collections.Generic.List <Being> beingList = new System.Collections.Generic.List <Being>();
            beingList.Add(b);
            gt.Beings = beingList.ToArray();

            System.Collections.Generic.List <GazeTrackData> gazeTrackDataList = new System.Collections.Generic.List <GazeTrackData>();
            gazeTrackDataList.Add(gt);

            GazeTrackDataSet gtd = new GazeTrackDataSet();

            gtd.GazeTrackData = gazeTrackDataList.ToArray();

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(gtd.GetType());
            TextWriter writer    = new SpecificEncodingStringWriter(Encoding.UTF8);
            XmlWriter  xmlWriter = XmlWriter.Create(writer);

            x.Serialize(xmlWriter, gtd);
            Console.WriteLine("XML:");
            Console.WriteLine(writer.ToString());
            Console.WriteLine("Length: " + writer.ToString().Length);
            log.Debug("Generated XML");
            log.Debug(writer.ToString());
            log.Debug("Generated XML Length: " + writer.ToString().Length);
        }