Beispiel #1
0
        /// <summary>
        /// 绘制某位置的选中状态(使用一个矩形);
        /// </summary>
        /// <param name="point"></param>
        public static void DrawSelectedPointState(Vector2D point, ICanvas canvas, ICanvasScreenConvertable canvasProxy)
        {
            if (point == null)
            {
                throw new ArgumentNullException(nameof(point));
            }

            if (canvas == null)
            {
                throw new ArgumentNullException(nameof(canvas));
            }

            if (canvasProxy == null)
            {
                throw new ArgumentNullException(nameof(canvasProxy));
            }


            //得到以某点为中心的视图矩形;
            var rect = NativeGeometryExtensions.GetNativeSuroundingScreenRect(
                canvasProxy.ToScreen(point),
                TolerantedScreenLength,
                TolerantedScreenLength
                );

            canvas.NativeDrawRectangle(
                rect,
                HighLightRectColorBrush,
                HighLightLinePen
                );
        }
Beispiel #2
0
        /// <summary>
        /// 判断视图坐标中某个位置是否在另一个位置的附近;
        /// </summary>
        /// <param name="screenPosition0"></param>
        /// <param name="screenPosition1"></param>
        /// <returns></returns>
        public static bool GetIsSurround(Vector2D screenPosition0, Vector2D screenPosition1)
        {
            var screenRect = NativeGeometryExtensions.GetNativeSuroundingScreenRect(
                screenPosition1,
                TolerantedScreenLength,
                TolerantedScreenLength
                );

            return(screenRect.Contains(screenPosition0));
        }