Ejemplo n.º 1
0
        public override AnnObject Clone()
        {
            ZoneAnnotationObject obj = base.Clone() as ZoneAnnotationObject;

            obj._ocrPage   = _ocrPage;
            obj._zoneIndex = _zoneIndex;
            obj.CellPen    = CellPen != null?CellPen.Clone() as AnnStroke : null;

            return(obj);
        }
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            ZoneAnnotationObject zoneObject = annObject as ZoneAnnotationObject;
             if (_ocrPage != null && zoneObject.ZoneIndex >= 0 && zoneObject.ZoneIndex < _ocrPage.Zones.Count)
             {
            AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine;

            if (engine != null && engine.Context != null && zoneObject != null && zoneObject.Cells != null)
            {
               Graphics graphics = engine.Context;
               OcrZone zone = _ocrPage.Zones[zoneObject.ZoneIndex];
               OcrZoneCell[] cells = null;
               cells = _ocrPage.Zones.GetZoneCells(zone);

               if (_ocrPage.TableZoneManager != null && zone.ZoneType == OcrZoneType.Table && cells != null && cells.Length > 0 && CellPen != null)
               {
                  GraphicsState gState = graphics.Save();
                  if (gState != null)
                  {
                     foreach (OcrZoneCell cell in zoneObject.Cells)
                     {
                        LeadRectD rc = new LeadRectD(cell.Bounds.X, cell.Bounds.Y, cell.Bounds.Width, cell.Bounds.Height);
                        rc = mapper.RectFromContainerCoordinates(rc, AnnFixedStateOperations.None);

                        if (!rc.IsEmpty)
                        {
                           // Draw cells borders as lines in order not to draw the borders with 0 width
                           DrawLine(graphics, OcrCellBorder.Left, cell.LeftBorderStyle, cell.LeftBorderWidth, (float)rc.Left, (float)rc.Top, (float)rc.Left, (float)rc.Bottom);
                           DrawLine(graphics, OcrCellBorder.Top, cell.TopBorderStyle, cell.TopBorderWidth, (float)rc.Left, (float)rc.Top, (float)rc.Right, (float)rc.Top);
                           DrawLine(graphics, OcrCellBorder.Right, cell.RightBorderStyle, cell.RightBorderWidth, (float)rc.Right, (float)rc.Top, (float)rc.Right, (float)rc.Bottom);
                           DrawLine(graphics, OcrCellBorder.Bottom, cell.BottomBorderStyle, cell.BottomBorderWidth, (float)rc.Left, (float)rc.Bottom, (float)rc.Right, (float)rc.Bottom);
                        }
                     }

                     graphics.Restore(gState);
                  }
               }
            }
             }

             base.Render(mapper, annObject);
        }
 public ZoneAnnotationObjectEditDesigner(IAnnAutomationControl automationControl, AnnContainer container, ZoneAnnotationObject zoneAnnotationObject)
     : base(automationControl, container, zoneAnnotationObject)
 {
 }