예제 #1
0
 public override OnElementMoveDelegate CanMove(Point p)
 {
     if (Element.IsPtCaptured(p, this.BasePoint))
     {
         return(new OnElementMoveDelegate(this.OnMove));
     }
     return(null);
 }
예제 #2
0
 public override int GetConnectionSourceID(Point p)
 {
     if (Element.IsPtCaptured(p, this.BasePoint))
     {
         return(0);
     }
     return(-1);
 }
예제 #3
0
파일: Track.cs 프로젝트: belsoft/traingraph
 public override int GetConnectionSourceID(Point p)
 {
     if (Element.IsPtCaptured(p, this.PointPlus))
     {
         return(1);
     }
     if (Element.IsPtCaptured(p, this.PointMinus))
     {
         return(2);
     }
     return(-1);
 }
예제 #4
0
 public override OnElementMoveDelegate CanMove(Point p)
 {
     if (Element.IsPtCaptured(p, this.PointPlus))
     {
         return(new OnElementMoveDelegate(this.OnMove1));
     }
     if (Element.IsPtCaptured(p, this.PointMinus))
     {
         return(new OnElementMoveDelegate(this.OnMove2));
     }
     return(null);
 }
예제 #5
0
        public override int CanConnect(Point p, Element e, int nSource, out Point pDest)
        {
            int num = -1;

            pDest = new Point(0.0, 0.0);
            if (e != this)
            {
                if (Element.IsPtCaptured(p, this.PointPlus))
                {
                    pDest = this.PointPlus;
                    num   = 1;
                }
                else if (Element.IsPtCaptured(p, this.PointMinus))
                {
                    pDest = this.PointMinus;
                    num   = 2;
                }
                if (num == -1)
                {
                    return(-1);
                }
                if (e is TrackPassive)
                {
                    foreach (Connection connection in base.m_Connections)
                    {
                        if (connection.IsConnected(this, e))
                        {
                            return(-1);
                        }
                    }
                    foreach (Connection connection in base.m_Connections)
                    {
                        if (connection.IsConnectedPath(this, num) != null)
                        {
                            return(-1);
                        }
                    }
                    return(num);
                }
            }
            return(-1);
        }
예제 #6
0
 public override OnElementMoveDelegate CanMove(Point p)
 {
     if (Element.IsPtCaptured(p, this.PointPlus))
     {
         return(new OnElementMoveDelegate(this.OnMovePlus));
     }
     if (Element.IsPtCaptured(p, this.PointMinus))
     {
         return(new OnElementMoveDelegate(this.OnMoveMinus));
     }
     if (Element.IsPtCaptured(p, this.PointPeak))
     {
         return(new OnElementMoveDelegate(this.OnMovePeak));
     }
     if (Element.IsPtCaptured(p, this.PointCore))
     {
         return(new OnElementMoveDelegate(this.OnMoveCenter));
     }
     return(null);
 }
예제 #7
0
        protected virtual bool FindActiveContext(Point p)
        {
            if (this.GetLayout() == null)
            {
                return(false);
            }
            string toolTipText = "";

            this.m_ActiveConnection = null;
            this.m_ActiveElement    = null;
            if (!this.m_bReadOnly)
            {
                foreach (Connection connection in this.GetLayout().Connections)
                {
                    if (connection.HasElement(this.m_alElTypes) && (connection.CanMove(p) != null))
                    {
                        this.m_ActiveConnection = connection;
                        toolTipText             = this.m_ActiveConnection.GetToolTipText(true, p);
                        break;
                    }
                }
            }
            foreach (Element element in this.GetLayout().Elements)
            {
                if (this.m_alElTypes.Contains(element.GetType()) && (Element.IsPtCaptured(p, element.GetCenterPoint()) || (element.CanMove(p) != null)))
                {
                    this.m_ActiveElement = element;
                    if (toolTipText.Length == 0)
                    {
                        toolTipText = this.m_ActiveElement.GetToolTipText(!this.m_bReadOnly, p);
                    }
                    break;
                }
            }
            return((this.m_ActiveConnection != null) || (this.m_ActiveElement != null));
        }