Exemplo n.º 1
0
        /// <summary>
        /// This method establishes a link between current thumb and target thumb using a predefined line geometry
        /// Note: this is commonly to be used for drawing links with mouse when the line object is predefined outside this class
        /// </summary>
        /// <param name="target">target thumb</param>
        /// <param name="line">Line Geometry </param>
        /// <returns>true or false</returns>
        public bool LinkTo(RoiThumb target, LineGeometry line)
        {
            // Save as starting line for current thumb
            this.StartLines.Add(line);

            // Save as ending line for target thumb
            target.EndLines.Add(line);

            // Ensure both tumbs the latest layout
            this.UpdateLayout();

            target.UpdateLayout();

            // Update line position
            line.StartPoint = new Point(Canvas.GetLeft(this) + (this.ActualWidth / 2), Canvas.GetTop(this) + (this.ActualHeight / 2));

            line.EndPoint = new Point(Canvas.GetLeft(target) + (target.ActualWidth / 2), Canvas.GetTop(target) + (target.ActualHeight / 2));

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a line geometry with updated positions to be processed outside.
        /// This method establishes a link between current thumb and specified thumb.
        /// </summary>
        /// <param name="target">target thumb</param>
        /// <returns>Line Geometry </returns>
        public LineGeometry LinkTo(RoiThumb target)
        {
            // Create new line geometry
            var line = new LineGeometry();

            // Save as starting line for current thumb
            this.StartLines.Add(line);

            // Save as ending line for target thumb
            target.EndLines.Add(line);

            // Ensure both tumbs the latest layout
            this.UpdateLayout();
            target.UpdateLayout();

            // Update line position
            line.StartPoint = new Point(Canvas.GetLeft(this) + (this.ActualWidth / 2), Canvas.GetTop(this) + (this.ActualHeight / 2));

            line.EndPoint = new Point(Canvas.GetLeft(target) + (target.ActualWidth / 2), Canvas.GetTop(target) + (target.ActualHeight / 2));

            // return line for further processing
            return(line);
        }