Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public void setBounding(int frameNumber, int glyphSize, List<List<PointF>> glyphBounds, List<GlyphFace> faces, float scale = 1, PointF translation = new PointF())
 {
     List<List<PointF>> inversedScaledGlyphBounds = glyphBounds.Select(glyphBound => glyphBound.scaleBound(1 / scale, new PointF(-translation.X / scale, -translation.Y / scale))).ToList();
     LocationMark2D ob = new GlyphBoxLocationMark2D(frameNumber, glyphSize, inversedScaledGlyphBounds, faces);
     objectMarks[frameNumber] = ob;
 }