예제 #1
0
        /// <summary>
        /// Called by the main form to set the new raster image and OCR page
        /// </summary>
        /// <param name="image"></param>
        /// <param name="ocrPage"></param>
        public void SetImageAndPage(RasterImage image, IOcrPage ocrPage)
        {
            _ocrPage = ocrPage;
            var options = _rasterImageViewer.AutoResetOptions; // save

            _rasterImageViewer.AutoResetOptions = ImageViewerAutoResetOptions.None;
            _rasterImageViewer.Image            = image;
            _rasterImageViewer.AutoResetOptions = options;

            if (image != null)
            {
                AnnContainerMapper saveMapper     = _annAutomation.Container.Mapper.Clone();
                AnnContainerMapper identityMapper = new AnnContainerMapper(saveMapper.SourceDpiX, saveMapper.SourceDpiY, saveMapper.SourceDpiX, saveMapper.SourceDpiY);
                identityMapper.UpdateTransform(LeadMatrix.Identity);

                _annAutomation.Container.Mapper = identityMapper;

                //Set Container Size
                if (_annAutomation != null)
                {
                    _annAutomation.Container.Size = identityMapper.SizeToContainerCoordinates(LeadSizeD.Create(image.ImageWidth, image.ImageHeight));
                }

                _annAutomation.Container.Mapper = saveMapper;

                // Converts the zones to annotation objects
                ZonesUpdated();

                _rasterImageViewer.ViewBorderThickness = 1;
            }
            else
            {
                _rasterImageViewer.ViewBorderThickness = 0;
            }

            UpdateTitle();
            UpdateUIState();
        }