Ejemplo n.º 1
0
        public ZoneAnnotationObject() :
            base()
        {
            _ocrPage   = null;
            _zoneIndex = 0;
            _cellPen   = null;
            SetId(AnnObject.UserObjectId);

            mylabel                 = this.Labels["AnnObjectName"];
            mylabel.Background      = AnnSolidColorBrush.Create("Black");
            mylabel.Foreground      = AnnSolidColorBrush.Create("White");
            mylabel.RestrictionMode = AnnLabelRestriction.None;
            mylabel.IsVisible       = true;
        }
        public override LeadRectD GetInvalidateRect(AnnContainerMapper mapper, IAnnObjectRenderer renderer)
        {
            LeadRectD invalidateRect = base.GetInvalidateRect(mapper, renderer);

            // Add angle label to the invalidate rect
            IAnnLabelRenderer labelRenderer = renderer.LabelRenderer;

            if (labelRenderer != null && labelRenderer.RenderingEngine != null && Labels.ContainsKey("CobbAngle"))
            {
                AnnLabel  label       = Labels["CobbAngle"];
                LeadRectD lablebounds = labelRenderer.GetBounds(mapper, label, FixedStateOperations);
                invalidateRect = LeadRectD.UnionRects(lablebounds, invalidateRect);
            }

            return(invalidateRect);
        }
Ejemplo n.º 3
0
 public AnnCobbAngleObject()
 {
     SetId(-1007);
     Labels["CobbAngle"] = new AnnLabel();
 }
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            IAnnDrawEngine engine = RenderingEngine as IAnnDrawEngine;

            if (engine != null)
            {
                base.Render(mapper, annObject);

                AnnCobbAngleObject annCobbAngleObject = annObject as AnnCobbAngleObject;
                if (annCobbAngleObject != null)
                {
                    int count = annCobbAngleObject.Points.Count;
                    if (count < 2)
                    {
                        return;
                    }

                    LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annCobbAngleObject.Points.ToArray(), annCobbAngleObject.FixedStateOperations);

                    if (annCobbAngleObject.SupportsStroke && annCobbAngleObject.Stroke != null)
                    {
                        AnnStroke stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), annCobbAngleObject.Stroke.StrokeThickness);
                        stroke.StrokeDashArray = new double[] { 4, 2, 2, 2, 2, 2 };
                        IAnnDrawPen pen = engine.ToPen(mapper.StrokeFromContainerCoordinates(annCobbAngleObject.Stroke, annCobbAngleObject.FixedStateOperations), annCobbAngleObject.Opacity);
                        try
                        {
                            if (leadPoints.Length > 3)
                            {
                                AnnCobbAngleData cobbAngleData     = annCobbAngleObject.CobbAngleData;
                                LeadPointD       firstPoint        = mapper.PointFromContainerCoordinates(cobbAngleData.FirstPoint, annCobbAngleObject.FixedStateOperations);
                                LeadPointD       secondPoint       = mapper.PointFromContainerCoordinates(cobbAngleData.SecondPoint, annCobbAngleObject.FixedStateOperations);
                                LeadPointD       intersectionPoint = mapper.PointFromContainerCoordinates(cobbAngleData.IntersectionPoint, annCobbAngleObject.FixedStateOperations);

                                engine.DrawLine(pen, firstPoint, intersectionPoint);
                                engine.DrawLine(pen, secondPoint, intersectionPoint);

                                //Draw angle label
                                if (annCobbAngleObject.Labels.ContainsKey("CobbAngle"))
                                {
                                    AnnLabel label = annCobbAngleObject.Labels["CobbAngle"];
                                    if (label != null)
                                    {
                                        string precisionFormat = string.Format("XXX:F{0}", annCobbAngleObject.AnglePrecision);
                                        precisionFormat = precisionFormat.Replace("XXX", "{0");
                                        precisionFormat = string.Format("{0}{1}", precisionFormat, "}");

                                        string angle = string.Format(precisionFormat, cobbAngleData.Angle);

                                        label.Text             = angle;
                                        label.Foreground       = AnnSolidColorBrush.Create("Blue");
                                        label.OriginalPosition = cobbAngleData.IntersectionPoint;
                                    }
                                }
                            }
                        }
                        finally
                        {
                            engine.Destroy(pen);
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
 public LabelRestrictionDescriptor(AnnLabel annLabel, string category)
 {
     _annLabel = annLabel;
     _category = category;
 }
Ejemplo n.º 6
0
 public LabelRestrictionProxy(AnnLabel annLabel)
 {
     _annLabel = annLabel;
 }
Ejemplo n.º 7
0
 public LabelProxy(AnnLabel annLabel, AnnAutomation automation)
 {
     _annLabel   = annLabel;
     _automation = automation;
 }
Ejemplo n.º 8
0
 public LabelDescriptor(AnnLabel label, string category, AnnAutomation automation)
 {
     _label      = label;
     _category   = category;
     _automation = automation;
 }
Ejemplo n.º 9
0
        public override void Render(AnnContainerMapper mapper, AnnObject annObject)
        {
            if (mapper == null)
            {
                ExceptionHelper.ArgumentNullException("mapper");
            }
            if (annObject == null)
            {
                ExceptionHelper.ArgumentNullException("annObject");
            }

            AnnWinFormsRenderingEngine engine = RenderingEngine as AnnWinFormsRenderingEngine;

            if (engine != null && engine.Context != null)
            {
                base.Render(mapper, annObject);

                AnnCobbAngleObject annCobbAngleObject = annObject as AnnCobbAngleObject;
                if (annCobbAngleObject != null)
                {
                    base.LinesAsRulers = annCobbAngleObject.LinesAsRulers;

                    int count = annCobbAngleObject.Points.Count;
                    if (count < 2)
                    {
                        return;
                    }

                    LeadPointD[] leadPoints = mapper.PointsFromContainerCoordinates(annCobbAngleObject.Points.ToArray(), annCobbAngleObject.FixedStateOperations);
                    PointF[]     points     = AnnWinFormsRenderingEngine.ToPoints(leadPoints);

                    if (annCobbAngleObject.SupportsStroke && annCobbAngleObject.Stroke != null)
                    {
                        using (Pen pen = AnnWinFormsRenderingEngine.ToPen(mapper.StrokeFromContainerCoordinates(annCobbAngleObject.Stroke, annCobbAngleObject.FixedStateOperations), annCobbAngleObject.Opacity))
                        {
                            if (points.Length > 3)
                            {
                                AnnCobbAngleData cobbAngleData     = annCobbAngleObject.CobbAngleData;
                                LeadPointD       firstPoint        = mapper.PointFromContainerCoordinates(cobbAngleData.FirstPoint, annCobbAngleObject.FixedStateOperations);
                                LeadPointD       secondPoint       = mapper.PointFromContainerCoordinates(cobbAngleData.SecondPoint, annCobbAngleObject.FixedStateOperations);
                                LeadPointD       intersectionPoint = mapper.PointFromContainerCoordinates(cobbAngleData.IntersectionPoint, annCobbAngleObject.FixedStateOperations);

                                pen.Brush       = Brushes.Blue;
                                pen.DashPattern = new float[] { 4, 2, 2, 2, 2, 2 };
                                engine.Context.DrawLine(pen, new PointF((float)firstPoint.X, (float)firstPoint.Y), new PointF((float)intersectionPoint.X, (float)intersectionPoint.Y));
                                engine.Context.DrawLine(pen, new PointF((float)secondPoint.X, (float)secondPoint.Y), new PointF((float)intersectionPoint.X, (float)intersectionPoint.Y));

                                //Draw angle label
                                if (annCobbAngleObject.Labels.ContainsKey("CobbAngle"))
                                {
                                    AnnLabel label = annCobbAngleObject.Labels["CobbAngle"];
                                    if (label != null)
                                    {
                                        string precisionFormat = string.Format("XXX:F{0}", annCobbAngleObject.AnglePrecision);
                                        precisionFormat = precisionFormat.Replace("XXX", "{0");
                                        precisionFormat = string.Format("{0}{1}", precisionFormat, "}");

                                        string angle = string.Format(precisionFormat, cobbAngleData.Angle);
                                        angle = string.Format("{0} {1}", angle, "\u00B0");

                                        label.Text             = angle;
                                        label.Foreground       = AnnSolidColorBrush.Create("White");
                                        label.Background       = AnnSolidColorBrush.Create("Blue");
                                        label.OriginalPosition = cobbAngleData.IntersectionPoint;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
 public AnnCobbAngleObject()
 {
     SetId(-1007);
     Labels["CobbAngle"]  = new AnnLabel();
     FixedStateOperations = AnnFixedStateOperations.FontSize;
 }