/// <summary>
        /// Gets the point on the <see cref="ImageGraphic"/> closest to the specified point.
        /// </summary>
        /// <param name="point">A point in either source or destination coordinates.</param>
        /// <returns>The point on the graphic closest to the given <paramref name="point"/>.</returns>
        /// <remarks>
        /// <para>
        /// Depending on the value of <see cref="Graphic.CoordinateSystem"/>,
        /// the computation will be carried out in either source
        /// or destination coordinates.</para>
        /// </remarks>
        public override PointF GetClosestPoint(PointF point)
        {
            RectangleF rect = this.BoundingBox;

            if (rect.Contains(point))
            {
                return(point);
            }
            return(RectanglePrimitive.GetClosestPoint(point, rect));
        }
        /// <summary>
        /// Performs a hit test on the <see cref="InvariantRectanglePrimitive"/>
        /// at a given point.
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public override bool HitTest(Point point)
        {
            this.CoordinateSystem = CoordinateSystem.Source;
            bool result = RectanglePrimitive.HitTest(
                this.SpatialTransform.ConvertToSource(point),
                this.Rectangle,
                this.SpatialTransform);

            this.ResetCoordinateSystem();

            return(result);
        }
Beispiel #3
0
 /// <summary>
 /// Gets the point on the <see cref="Graphic"/> closest to the specified point.
 /// </summary>
 /// <param name="point">A point in either source or destination coordinates.</param>
 /// <returns>The point on the graphic closest to the given <paramref name="point"/>.</returns>
 /// <remarks>
 /// <para>
 /// Depending on the value of <see cref="Graphic.CoordinateSystem"/>,
 /// the computation will be carried out in either source
 /// or destination coordinates.</para>
 /// </remarks>
 public virtual PointF GetClosestPoint(PointF point)
 {
     return(RectanglePrimitive.GetClosestPoint(point, this.BoundingBox));
 }
 /// <summary>
 /// Gets the point on the <see cref="Graphic"/> closest to the specified point.
 /// </summary>
 /// <param name="point">A point in either source or destination coordinates.</param>
 /// <returns>The point on the graphic closest to the given <paramref name="point"/>.</returns>
 /// <remarks>
 /// <para>
 /// Depending on the value of <see cref="Graphic.CoordinateSystem"/>,
 /// the computation will be carried out in either source
 /// or destination coordinates.</para>
 /// </remarks>
 public override PointF GetClosestPoint(PointF point)
 {
     return(RectanglePrimitive.GetClosestPoint(point, this.Rectangle));
 }