프로젝트

일반

사용자정보

개정판 d2114d3b

IDd2114d3b43eba86003919f41890e541e9e88a4ba
상위 6b518442
하위 018e77ac

백흠경이(가) 5년 이상 전에 추가함

issue #923: add OnMoveCtrlPoint method to interface

Change-Id: If3b10f5b54eaecd8bd8fa299d702e70e05d4b97e

차이점 보기:

MarkupToPDF/Controls/Etc/SymControl.cs
406 406
        }
407 407

  
408 408
        /// <summary>
409
        /// move control point has same location of given pt along given delta
410
        /// </summary>
411
        /// <author>humkyung</author>
412
        /// <date>2019.06.20</date>
413
        /// <param name="pt"></param>
414
        /// <param name="dx"></param>
415
        /// <param name="dy"></param>
416
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy)
417
        {
418
            IPath path = (this as IPath);
419

  
420
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
421
            selected.X += dx;
422
            selected.Y += dy;
423
            int i = 0;
424
            for (i = 0; i < (this as IPath).PointSet.Count; i++)
425
            {
426
                if (pt.Equals((this as IPath).PointSet[i]))
427
                {
428
                    path.PointSet[i] = selected;
429
                    break;
430
                }
431
            }
432

  
433
            var ReverseP = (i + path.PointSet.Count / 2) % path.PointSet.Count;
434
            var PreviousP = (i + (path.PointSet.Count - 1)) % path.PointSet.Count;
435
            var NextP = (i + 1) % path.PointSet.Count;
436

  
437
            var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]);
438

  
439
            var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]);
440
            var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X,
441
                path.PointSet[i].Y - path.PointSet[ReverseP].Y);
442
            path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l);
443

  
444
            var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]);
445
            l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet
446
                [i].Y - path.PointSet[ReverseP].Y);
447
            path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l);
448

  
449
            this.updateControl();
450
        }
451

  
452
        /// <summary>
409 453
        /// return SymControl's area
410 454
        /// </summary>
411 455
        /// <author>humkyung</author>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)