/// <summary> /// Initializes a new instance of the <see cref="TriangleAnnotationView"/> class. /// </summary> /// <param name="annotationData">Object that stores the annotation data.</param> public TriangleAnnotationView(TriangleAnnotationData annotationData) : base(annotationData) { FillBrush = null; // create a point-based builder Builder = new PointBasedAnnotationPointBuilder(this, 3, 3); // create a transformer for rectangular mode PointBasedAnnotationRectangularTransformer rectangleTransformer = new PointBasedAnnotationRectangularTransformer(this); // show bounding box area rectangleTransformer.BoundingBoxArea.IsVisible = true; RectangularTransformer = rectangleTransformer; // create a transformer for point mode PointBasedAnnotationPointTransformer pointsTransformer = new PointBasedAnnotationPointTransformer(this); // change interaction points color pointsTransformer.InteractionPointBackColor = Color.FromArgb(100, Color.Red); pointsTransformer.SelectedInteractionPointBackColor = Color.FromArgb(150, Color.Red); // change interaction points type pointsTransformer.PolygonPointTemplate = new TriangleAnnotationInteractionPoint(); PointTransformer = pointsTransformer; GripMode = GripMode.RectangularAndPoints; }
/// <summary> /// Sets the properties of specified interaction controller. /// </summary> /// <param name="controller">The controller of interaction areas.</param> protected override void SetTransformerProperties(IInteractionController controller) { base.SetTransformerProperties(controller); if (controller is PointBasedAnnotationRectangularTransformer) { SetResizePointSettings(((PointBasedAnnotationRectangularTransformer)controller).ResizePoints); } else if (controller is PointBasedAnnotationPointTransformer) { PointBasedAnnotationPointTransformer pointTransformer = (PointBasedAnnotationPointTransformer)controller; if (pointTransformer != null) { if (!(pointTransformer.PolygonPointTemplate is TriangleAnnotationInteractionPoint)) { InteractionPolygonPoint point = (InteractionPolygonPoint)pointTransformer.PolygonPointTemplate.Clone(); SetPolygonPointSettings(point); pointTransformer.PolygonPointTemplate = point; pointTransformer.InteractionPointBackColor = PolygonPointBackgroundColor; pointTransformer.SelectedInteractionPointBackColor = SelectedPolygonPointBackgroundColor; } } } }