Пример #1
0
    public static void Main()
    {
        test_list Mouse = new test_list();
        test_list Eye   = new test_list();

        for (int i = 0; i < 10; i++)
        {
            Mouse.set_point(i, 20 - i);
        }
        Console.WriteLine(" < Mouse > ");
        Console.WriteLine("elements: {0}", Mouse.get_count());
        Console.WriteLine("contents: ");
        for (int i = 0; i < Mouse.get_count(); i++)
        {
            Console.WriteLine("({0},{1})", Mouse.get_pointX(i), Mouse.get_pointY(i));
        }
        for (int i = 0; i < 10; i++)
        {
            Eye.set_point(i * 10, 20 - i * 10);
        }
        Console.WriteLine(" < EYE > ");
        Console.WriteLine("elements: {0}", Eye.get_count());
        Console.WriteLine("contents: ");
        for (int i = 0; i < Eye.get_count(); i++)
        {
            Console.WriteLine("({0},{1})", Eye.get_pointX(i), Eye.get_pointY(i));
        }
    }
Пример #2
0
    void readXML()
    {
        FaceXml.Load("sample-2.xml");
        XmlNode root  = FaceXml.DocumentElement;
        XmlNode faces = root.FirstChild;

        Console.WriteLine(((XmlElement)faces).GetAttribute("id"));
        XmlNode bounds = faces.SelectSingleNode("bounds");

        Console.WriteLine(((XmlElement)bounds).GetAttribute("width"));
        XmlNode righteye = faces.SelectSingleNode("right-eye");
        XmlNode lefteye  = faces.SelectSingleNode("left-eye");
        XmlNode features = faces.SelectSingleNode("features");


        //featuresの子供Points一斉走査
        XmlNodeList featuresChildren = features.ChildNodes;
        string      Point_X;
        string      Point_Y;

        foreach (XmlNode featurechild in featuresChildren)
        {
            Console.WriteLine(" id={1}, X=  {0},Y={2}", ((XmlElement)featurechild).GetAttribute("x"), ((XmlElement)featurechild).GetAttribute("id"), ((XmlElement)featurechild).GetAttribute("y"));
            Point_X = ((XmlElement)featurechild).GetAttribute("x");
            Point_Y = ((XmlElement)featurechild).GetAttribute("y");
            facePoints.set_point(int.Parse(Point_X), int.Parse(Point_Y), ((XmlElement)featurechild).GetAttribute("id"));
        }
        Console.WriteLine("debug:facesPoints_count:{0}", facePoints.get_count());
        Console.WriteLine("debug: [20]'s number id is {0}", facePoints.get_PointLabel(20));

        Console.WriteLine(facePoints.find_label_point_X("N2"));

        //XmlNodeList bounds = facesElement.GetElementsByTagName("bounds");
        //XmlElement boundsElement = (XmlElement)bounds.Item(0);
        //Console.WriteLine("X={0},Y={1},width = {2},height = {3}", boundsElement.GetAttribute("x"), boundsElement.GetAttribute("y"), boundsElement.GetAttribute("width"), boundsElement.GetAttribute("height"));
    }