Esempio n. 1
0
 internal Polygon(Polygon p)
     : this()
 {
     foreach (Vector x in p.Vertices)
     {
         Vertices.Add(x.Clone());
     }
     Mark          = PolygonMark.None;
     IsGrass       = p.IsGrass;
     Decomposition = p.Decomposition;
 }
Esempio n. 2
0
        /// <summary>
        /// バーコード読み取り結果表示
        /// </summary>
        /// <param name="result"></param>
        private void ShowResult(ZXing.Result result)
        {
            // テキスト表示
            BarcodeFormatText.Text = result.BarcodeFormat.ToString();
            TextText.Text          = result.Text;

            // 認識エリア表示
            ZXing.ResultPoint[] points = result.ResultPoints;
            PolygonMark.BeginInit();
            {
                PolygonMark.Points.Clear();
                foreach (var p in points)
                {
                    PolygonMark.Points.Add(new System.Windows.Point(p.X, p.Y));
                }
            }
            PolygonMark.EndInit();

            // 回転
            int orientaion = (int)result.ResultMetadata[ZXing.ResultMetadataType.ORIENTATION];

            switch (orientaion)
            {
            case 180:
                orientaion = 0;
                break;

            case 270:
                orientaion = 90;
                break;
            }

            BitmapSource bitmapSource = picture.Source as BitmapSource;

            PolygonMark.RenderTransform = new RotateTransform(orientaion, bitmapSource.PixelWidth / 2.0, bitmapSource.PixelHeight / 2.0);

            // マーク表示
            OverlayCanvas.Visibility = Visibility.Visible;
            AdjustOverlay();
        }