프로젝트

일반

사용자정보

개정판 d2114d3b

IDd2114d3b43eba86003919f41890e541e9e88a4ba
상위 6b518442
하위 018e77ac

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

issue #923: add OnMoveCtrlPoint method to interface

Change-Id: If3b10f5b54eaecd8bd8fa299d702e70e05d4b97e

차이점 보기:

MarkupToPDF/Controls/Etc/SignControl.cs
337 337
        }
338 338

  
339 339
        /// <summary>
340
        /// move control point has same location of given pt along given delta
341
        /// </summary>
342
        /// <author>humkyung</author>
343
        /// <date>2019.06.20</date>
344
        /// <param name="pt"></param>
345
        /// <param name="dx"></param>
346
        /// <param name="dy"></param>
347
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy)
348
        {
349
            IPath path = (this as IPath);
350

  
351
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
352
            selected.X += dx;
353
            selected.Y += dy;
354
            int i = 0;
355
            for (i = 0; i < (this as IPath).PointSet.Count; i++)
356
            {
357
                if (pt.Equals((this as IPath).PointSet[i]))
358
                {
359
                    path.PointSet[i] = selected;
360
                    break;
361
                }
362
            }
363

  
364
            var ReverseP = (i + path.PointSet.Count() / 2) % path.PointSet.Count();
365
            var PreviousP = (i + (path.PointSet.Count() - 1)) % path.PointSet.Count();
366
            var NextP = (i + 1) % path.PointSet.Count();
367

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

  
370
            var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]);
371
            var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X,
372
                path.PointSet[i].Y - path.PointSet[ReverseP].Y);
373
            path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l);
374

  
375
            var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]);
376
            l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet
377
                [i].Y - path.PointSet[ReverseP].Y);
378
            path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l);
379

  
380
            this.updateControl();
381
        }
382

  
383
        /// <summary>
340 384
        /// return SignControl's area
341 385
        /// </summary>
342 386
        /// <author>humkyung</author>

내보내기 Unified diff