コード例 #1
0
ファイル: GlyphBoxObject.cs プロジェクト: tuandnvn/ecat
        protected override void loadObjectAdditionalFromXml(XmlNode objectNode)
        {
            XmlNode markersNode = objectNode.SelectSingleNode(MARKERS);
            if (markersNode != null)
                foreach (XmlNode markerNode in markersNode.SelectNodes(MARKER))
                {
                    int frame = int.Parse(markerNode.Attributes[FRAME].Value);
                    String markType = markerNode.Attributes[TYPE].Value;

                    switch (markType)
                    {
                        case "LOCATION":
                            var lm = new GlyphBoxLocationMark2D(frame);
                            lm.readFromXml(markerNode);
                            setBounding(frame, lm);
                            break;
                        case "DELETE":
                            delete(frame);
                            break;
                    }
                }

            XmlNode markers3DNodes = objectNode.SelectSingleNode(MARKERS3D);

            if (markers3DNodes != null)
                foreach (XmlNode markerNode in markers3DNodes.SelectNodes(MARKER))
                {
                    int frame = int.Parse(markerNode.Attributes[FRAME].Value);
                    var lm = new GlyphBoxLocationMark3D(frame);
                    lm.readFromXml(markerNode);
                    set3DBounding(frame, lm);
                }

            boxPrototype = getPrototype();
        }
コード例 #2
0
ファイル: GlyphBoxPrototype.cs プロジェクト: tuandnvn/ecat
        static GlyphBoxPrototype(){
            var indexToGlyphFaces = new Dictionary<int, GlyphFace>();
            indexToGlyphFaces[0] = new GlyphFace(new bool[,] {  { true, true,  true},
                                                                { true, false, false },
                                                                { false,true,  false } }, 3);
            indexToGlyphFaces[1] = new GlyphFace(new bool[,] {  { false, true, false},
                                                                { true,  true, true },
                                                                { true,  false,true } }, 3);
            indexToGlyphFaces[2] = new GlyphFace(new bool[,] {  { false, true,  true},
                                                                { true,  false, true },
                                                                { false, true,  true } }, 3);
            indexToGlyphFaces[3] = new GlyphFace(new bool[,] {  { true, false, false},
                                                                { true, true,  true },
                                                                { true, true,  false } }, 3);
            indexToGlyphFaces[4] = new GlyphFace(new bool[,] {  { false, true,  true},
                                                                { true,  true,  true },
                                                                { false, true,  true } }, 3);
            indexToGlyphFaces[5] = new GlyphFace(new bool[,] {  { true, false, false},
                                                                { false,true,  true },
                                                                { true, true,  false } }, 3);


            prototype1 = new GlyphBoxPrototype("", indexToGlyphFaces, 3);

            indexToGlyphFaces = new Dictionary<int, GlyphFace>();
            indexToGlyphFaces[0] = new GlyphFace(new bool[,] {  { false, false, false, false, true},
                                                                { false, false, false, false, true},
                                                                { false, false, false, false, true},
                                                                { true, true, true, false, true},
                                                                { true, true, true, false, true}, }, 5);
            indexToGlyphFaces[1] = indexToGlyphFaces[2] = indexToGlyphFaces[3] = indexToGlyphFaces[4] = indexToGlyphFaces[5] = indexToGlyphFaces[0];

            prototype2 = new GlyphBoxPrototype("Stella Artois", indexToGlyphFaces, 5);

            indexToGlyphFaces = new Dictionary<int, GlyphFace>();
            indexToGlyphFaces[0] = new GlyphFace(new bool[,] {  { true, true, true, true, false},
                                                                { false, false, false, false, true},
                                                                { false, false, false, true, false},
                                                                { false, false, false, true, false},
                                                                { false, false, false, true, true}, }, 5);
            indexToGlyphFaces[1] = indexToGlyphFaces[2] = indexToGlyphFaces[3] = indexToGlyphFaces[4] = indexToGlyphFaces[5] = indexToGlyphFaces[0];

            prototype3 = new GlyphBoxPrototype("Pepsi", indexToGlyphFaces, 5);

            indexToGlyphFaces = new Dictionary<int, GlyphFace>();
            indexToGlyphFaces[0] = new GlyphFace(new bool[,] {  { false, true, false, true, false},
                                                                { true, true, false, true, false},
                                                                { true, true, false, true, false},
                                                                { true, false, false, false, false},
                                                                { false, true, true, true, true}, }, 5);
            indexToGlyphFaces[1] = indexToGlyphFaces[2] = indexToGlyphFaces[3] = indexToGlyphFaces[4] = indexToGlyphFaces[5] = indexToGlyphFaces[0];

            prototype4 = new GlyphBoxPrototype("", indexToGlyphFaces, 5);
        }