Esempio n. 1
0
        public bool SetStartMovePoint(UnitPoint unitPoint)
        {
            float thresholdWidth = UCCanvas.GetThresholdWidth();

            if (this.PointInObject(unitPoint))
            {
                if (HitUtil.IsPointInLine(this.LeftTopPoint, this.RightTopPoint, unitPoint, thresholdWidth))
                {
                    unitPoint              = this.HandleSideBoundError(unitPoint, LeftTopPoint, RightTopPoint, thresholdWidth);
                    this.StartMovePoint    = HitUtil.FindApparentIntersectPoint(this.CenterPoint, unitPoint, this.LeftTopPoint, this.RightTopPoint);
                    this.StartMovePosition = NodePosition.LeftTop;
                }
                else if (HitUtil.IsPointInLine(this.RightTopPoint, this.RightBottomPoint, unitPoint, thresholdWidth))
                {
                    unitPoint              = this.HandleSideBoundError(unitPoint, RightTopPoint, RightBottomPoint, thresholdWidth);
                    this.StartMovePoint    = HitUtil.FindApparentIntersectPoint(this.CenterPoint, unitPoint, this.RightTopPoint, this.RightBottomPoint);
                    this.StartMovePosition = NodePosition.RightTop;
                }
                else if (HitUtil.IsPointInLine(this.RightBottomPoint, this.LeftBottomPoint, unitPoint, thresholdWidth))
                {
                    unitPoint              = this.HandleSideBoundError(unitPoint, RightBottomPoint, LeftBottomPoint, thresholdWidth);
                    this.StartMovePoint    = HitUtil.FindApparentIntersectPoint(this.CenterPoint, unitPoint, this.RightBottomPoint, this.LeftBottomPoint);
                    this.StartMovePosition = NodePosition.RightBottom;
                }
                else if (HitUtil.IsPointInLine(this.LeftBottomPoint, this.LeftTopPoint, unitPoint, thresholdWidth))
                {
                    unitPoint              = this.HandleSideBoundError(unitPoint, LeftBottomPoint, LeftTopPoint, thresholdWidth);
                    this.StartMovePoint    = HitUtil.FindApparentIntersectPoint(this.CenterPoint, unitPoint, this.LeftBottomPoint, this.LeftTopPoint);
                    this.StartMovePosition = NodePosition.LeftBottom;
                }
                this.OverCutting();
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public bool PointInObject(UnitPoint unitPoint)
        {
            float thresholdWidth = UCCanvas.GetThresholdWidth();

            for (int i = 0; i < this.SideCount - 1; i++)
            {
                if (HitUtil.IsPointInLine(this.hexagonPoints[i], this.hexagonPoints[i + 1], unitPoint, thresholdWidth))
                {
                    return(true);
                }
            }
            if (HitUtil.IsPointInLine(this.hexagonPoints[0], this.hexagonPoints[SideCount - 1], unitPoint, thresholdWidth))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public bool PointInObject(ICanvas canvas, UnitPoint point)
        {
            if (m_allPts == null || m_allPts.Count < 1)
            {
                return(false);
            }
            float thWidth = Line.ThresholdWidth(canvas, Width, ThresholdPixel);

            for (int ii = 0; ii < m_allPts.Count - 1; ++ii)
            {
                if (HitUtil.IsPointInLine(m_allPts[ii], m_allPts[ii + 1], point, thWidth))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 4
0
        public bool PointInObject2(ref UnitPoint unitPoint)
        {
            float thresholdWidth = UCCanvas.GetThresholdWidth();

            for (int i = 0; i < this.SideCount - 1; i++)
            {
                if (HitUtil.IsPointInLine(this.hexagonPoints[i], this.hexagonPoints[i + 1], unitPoint, thresholdWidth))
                {
                    this.StartMovePointIndex = i;
                    unitPoint = HandleSideBoundError(unitPoint, this.hexagonPoints[i], this.hexagonPoints[i + 1], thresholdWidth);
                    return(true);
                }
            }
            if (HitUtil.IsPointInLine(this.hexagonPoints[0], this.hexagonPoints[SideCount - 1], unitPoint, thresholdWidth))
            {
                this.StartMovePointIndex = this.SideCount - 1;
                unitPoint = HandleSideBoundError(unitPoint, this.hexagonPoints[0], this.hexagonPoints[SideCount - 1], thresholdWidth);
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public void UpdateStartMovePoint(UnitPoint unitPoint)
        {
            float threshWidth = UCCanvas.GetThresholdWidth();

            if (HitUtil.IsPointInLine(this.LeftTopPoint, this.RightTopPoint, unitPoint, threshWidth))
            {
                this.StartMovePosition = NodePosition.LeftTop;
            }
            if (HitUtil.IsPointInLine(this.RightTopPoint, this.RightBottomPoint, unitPoint, threshWidth))
            {
                this.StartMovePosition = NodePosition.RightTop;
            }
            if (HitUtil.IsPointInLine(this.RightBottomPoint, this.LeftBottomPoint, unitPoint, threshWidth))
            {
                this.StartMovePosition = NodePosition.RightBottom;
            }
            if (HitUtil.IsPointInLine(this.LeftBottomPoint, this.LeftTopPoint, unitPoint, threshWidth))
            {
                this.StartMovePosition = NodePosition.LeftBottom;
            }
        }
Esempio n. 6
0
        public bool PointInObject(UnitPoint unitPoint)
        {
            float thresholdWidth = UCCanvas.GetThresholdWidth();

            if (HitUtil.IsPointInLine(this.LeftTopPoint, this.RightTopPoint, unitPoint, thresholdWidth))
            {
                return(true);
            }
            if (HitUtil.IsPointInLine(this.RightTopPoint, this.RightBottomPoint, unitPoint, thresholdWidth))
            {
                return(true);
            }
            if (HitUtil.IsPointInLine(this.RightBottomPoint, this.LeftBottomPoint, unitPoint, thresholdWidth))
            {
                return(true);
            }
            if (HitUtil.IsPointInLine(this.LeftBottomPoint, this.LeftTopPoint, unitPoint, thresholdWidth))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
 public bool PointInObject(ICanvas canvas, UnitPoint point)
 {
     try
     {
         float thWidth = ThresholdWidth(canvas, Width);
         return(HitUtil.IsPointInLine(m_p1, m_p2, point, thWidth));
         //if (Type == LineType.Line)
         //{ return HitUtil.IsPointInLine(m_p1, m_p2, point, thWidth); }
         //else
         //{
         //    bool PointInLine = HitUtil.IsPointInLine(m_p1, m_p2, point, thWidth);
         //    if(!PointInLine)
         //    {
         //        GraphicsPath path = new GraphicsPath();
         //        float ScrtopY = canvas.ToScreen(m_p2.X);
         //        float ScrtopX = canvas.ToScreen(m_p2.Y);
         //        float ScrRightX = canvas.ToScreen(0.03);
         //        float ScrRightY = canvas.ToScreen(-0.08);
         //        float ScrLeftX = canvas.ToScreen(-0.03);
         //        float ScrLeftY = canvas.ToScreen(-0.08);
         //        path.AddLine(new PointF(ScrtopX, ScrLeftY), new PointF(ScrRightX, ScrRightY));
         //        path.AddLine(new PointF(ScrRightX, ScrRightY), new PointF(ScrtopX, ScrtopY));
         //        path.AddLine(new PointF(ScrtopX, ScrtopY), new PointF(ScrLeftX, ScrLeftY));
         //        path.CloseFigure();
         //        RectangleF boundingrect = path.GetBounds();
         //        if (boundingrect != RectangleF.Empty)
         //        {
         //            return boundingrect.Contains((float)point.X,(float)point.Y);
         //        }
         //    }
         //    return PointInLine;
         //}
     }
     catch (Exception ex)
     { throw ex; }
 }
Esempio n. 8
0
        public bool PointInObject(UnitPoint unitPoint)
        {
            float thresholdWidth = UCCanvas.GetThresholdWidth();

            return(HitUtil.IsPointInLine(this.P1, this.P2, unitPoint, thresholdWidth));
        }
Esempio n. 9
0
        public bool PointInObject(ICanvas canvas, UnitPoint point)
        {
            float thWidth = ThresholdWidth(canvas, Width);

            return(HitUtil.IsPointInLine(m_p1, m_p2, point, thWidth));
        }