コード例 #1
0
ファイル: CalibrationPlane.cs プロジェクト: jfpk/kinoveaIDS
        private void ParseQuadrilateral(XmlReader r, PointF scale)
        {
            r.ReadStartElement();

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "A":
                    quadImage.A = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                case "B":
                    quadImage.B = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                case "C":
                    quadImage.C = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                case "D":
                    quadImage.D = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            quadImage.Scale(scale.X, scale.Y);

            r.ReadEndElement();
        }
コード例 #2
0
        private QuadrilateralF ParseQuadrilateral(XmlReader r, PointF scale)
        {
            r.ReadStartElement();
            PointF a = PointF.Empty;
            PointF b = PointF.Empty;
            PointF c = PointF.Empty;
            PointF d = PointF.Empty;

            while (r.NodeType == XmlNodeType.Element)
            {
                switch (r.Name)
                {
                case "A":
                    a = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                case "B":
                    b = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                case "C":
                    c = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                case "D":
                    d = XmlHelper.ParsePointF(r.ReadElementContentAsString());
                    break;

                default:
                    string unparsed = r.ReadOuterXml();
                    log.DebugFormat("Unparsed content in KVA XML: {0}", unparsed);
                    break;
                }
            }

            QuadrilateralF quad = new QuadrilateralF(a, b, c, d);

            quad.Scale(scale.X, scale.Y);

            r.ReadEndElement();

            return(quad);
        }