Esempio n. 1
0
        private void vertical_ContactPoint(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            int expectedXPos = _Bounds.X + _Bounds.Width / 2;
            int currentXPos  = glyph.Bounds.X + glyph.Bounds.Width / 2;

            offsetEventArgs.Offset = new Point(expectedXPos - currentXPos, offsetEventArgs.Offset.Y);
        }
Esempio n. 2
0
 protected override void OnBeforeOffsetChanged(OffsetEventArgs offsetArgs)
 {
     if (_PositionAlg != null)
     {
         _PositionAlg(this, offsetArgs);
     }
 }
Esempio n. 3
0
        private void horizontal_ContactPoint(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            int expectedYPos = _Bounds.Y + _Bounds.Height / 2;
            int currentYPos  = glyph.Bounds.Y + glyph.Bounds.Height / 2;

            offsetEventArgs.Offset = new Point(offsetEventArgs.Offset.X, expectedYPos - currentYPos);
        }
Esempio n. 4
0
        public override void Offset(System.Drawing.Point offset)
        {
            OffsetEventArgs offsetArgs = new OffsetEventArgs(offset);

            OnBeforeOffsetChanged(offsetArgs);
            _Centre.Offset(offsetArgs.Offset.X, offsetArgs.Offset.Y);
            DoOffsetChanged(offsetArgs);
        }
Esempio n. 5
0
        protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            Point offset = offsetEventArgs.Offset;
            int   index  = _ContactPoints.IndexOf(glyph);

            if (glyph is IOperationPortGlyph)
            {
                _Bounds.Offset(offset);
                foreach (IGlyph contactPoint in ContactPoints)
                {
                    if (contactPoint is IOperationContactPointGlyph)
                    {
                        ReOffsetContactPoint(contactPoint, offset);
                    }
                }
            }
            else
            {
                switch (index)
                {
                case 0:
                {
                    _Bounds.X      += offset.X;
                    _Bounds.Width  -= offset.X;
                    _Bounds.Height += offset.Y;
                    ReOffsetContactPoint(2, offset);
                    ReOffsetContactPoint(3, offset);
                } break;

                case 1:
                {
                    _Bounds.Width  += offset.X;
                    _Bounds.Height += offset.Y;
                    ReOffsetContactPoint(2, offset);
                    ReOffsetContactPoint(3, offset);
                } break;

                case 2:
                {
                    _Bounds.Y      += offset.Y;
                    _Bounds.Height -= offset.Y;
                    _Bounds.Width  += offset.X;
                    ReOffsetContactPoint(0, offset);
                    ReOffsetContactPoint(1, offset);
                } break;

                case 3:
                {
                    _Bounds.Height += offset.Y;
                    _Bounds.Width  += offset.X;
                    ReOffsetContactPoint(0, offset);
                    ReOffsetContactPoint(1, offset);
                } break;
                }
            }
        }
Esempio n. 6
0
 protected void DoOffsetChanged(OffsetEventArgs offsetArgs)
 {
     if (OnOffsetChanged(offsetArgs))
     {
         if (OffsetChanged != null)
         {
             OffsetChanged(this, offsetArgs);
         }
     }
 }
Esempio n. 7
0
        protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            int index = _ContactPoints.IndexOf(glyph);

            switch (index)
            {
            case 0:
            {
                _From.Offset(offsetEventArgs.Offset.X, offsetEventArgs.Offset.Y);
            } break;

            case 1:
            {
                _To.Offset(offsetEventArgs.Offset.X, offsetEventArgs.Offset.Y);
            } break;
            }
        }
Esempio n. 8
0
        protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            Point offset = offsetEventArgs.Offset;
            int   index  = _ContactPoints.IndexOf(glyph);

            switch (index)
            {
            case 0:
            {
                _Bounds.X      += offset.X;
                _Bounds.Width  -= offset.X;
                _Bounds.Height += offset.Y;
                ReOffsetContactPoint(2, offset);
                ReOffsetContactPoint(3, offset);
            } break;

            case 1:
            {
                _Bounds.Width  += offset.X;
                _Bounds.Height += offset.Y;
                ReOffsetContactPoint(2, offset);
                ReOffsetContactPoint(3, offset);
            } break;

            case 2:
            {
                _Bounds.Y      += offset.Y;
                _Bounds.Height -= offset.Y;
                _Bounds.Width  += offset.X;
                ReOffsetContactPoint(0, offset);
                ReOffsetContactPoint(1, offset);
            } break;

            case 3:
            {
                _Bounds.Height += offset.Y;
                _Bounds.Width  += offset.X;
                ReOffsetContactPoint(0, offset);
                ReOffsetContactPoint(1, offset);
            } break;
            }
        }
Esempio n. 9
0
 protected abstract void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs);
Esempio n. 10
0
 protected virtual bool OnOffsetChanged(OffsetEventArgs offsetArgs)
 {
     return(true);
 }
Esempio n. 11
0
 protected virtual void OnBeforeOffsetChanged(OffsetEventArgs offsetArgs)
 {
 }