Пример #1
0
        private void AssurePositionOk()
        {
            if (!m_bPositionInvalide)            //Vérifie que le départ et l'arrivé n'ont pas bougé
            {
                if (TypePhaseDepart != null && TypePhaseDepart.RectangleAbsolu != m_lastRectangleDepart ||
                    TypePhaseArrivee != null && TypePhaseArrivee.RectangleAbsolu != m_lastRectangleArrivee)
                {
                    m_bPositionInvalide = true;
                }
            }
            if (m_bPositionInvalide)
            {
                Point pt1;
                CWndTypeTypeTicket_TypePhase typePhaseDepart = TypePhaseDepart;
                if (typePhaseDepart == null)
                {
                    pt1 = m_lastPointDepart;
                }
                else
                {
                    pt1 = GetCentreRect(typePhaseDepart.RectangleAbsolu);
                }

                Point pt2;
                CWndTypeTypeTicket_TypePhase typePhaseArrivee = TypePhaseArrivee;
                if (typePhaseArrivee == null)
                {
                    pt2 = m_lastPointArrivee;
                }
                else
                {
                    pt2 = GetCentreRect(typePhaseArrivee.RectangleAbsolu);
                }

                if (typePhaseDepart != null)
                {
                    if (!new CSegmentDroite(pt1, pt2).GetIntersectionPoint(typePhaseDepart.GetPolygoneDessin(), ref pt1))
                    {
                        //Ca ne se peut pas !!!
                        pt1 = GetCentreRect(typePhaseDepart.RectangleAbsolu);
                    }
                }
                if (typePhaseArrivee != null)
                {
                    if (!new CSegmentDroite(pt1, pt2).GetIntersectionPoint(typePhaseArrivee.GetPolygoneDessin(), ref pt2))
                    {
                        //Ca ne se peut pas
                        pt2 = GetCentreRect(typePhaseArrivee.RectangleAbsolu);
                    }
                }
                m_lastPointDepart  = pt1;
                m_lastPointArrivee = pt2;
            }
        }
Пример #2
0
        //--------------------------------------------------
        public static CWndTypeTicket GetNewWnd(CTypeTicket typeTicket)
        {
            CWndTypeTicket wnd = new CWndTypeTicket(typeTicket);
            Dictionary <CTypeTicket_TypePhase, CWndTypeTypeTicket_TypePhase> tablePhases = new Dictionary <CTypeTicket_TypePhase, CWndTypeTypeTicket_TypePhase>();

            foreach (CTypeTicket_TypePhase typePhase in typeTicket.RelationsTypesPhases)
            {
                CWndTypeTypeTicket_TypePhase wndTypePhase = new CWndTypeTypeTicket_TypePhase(typePhase);
                tablePhases[typePhase] = wndTypePhase;
                wnd.AddChild(wndTypePhase);
            }
            foreach (CTypeTicket_TypePhase typePhase in typeTicket.RelationsTypesPhases)
            {
                foreach (CLienTypePhase lien in typePhase.RelationsTypesPhasesSuivantes)
                {
                    CWndLienTypePhase_TypePhase wndLien = new CWndLienTypePhase_TypePhase();
                    wndLien.TypePhaseDepart  = tablePhases[typePhase];
                    wndLien.TypePhaseArrivee = tablePhases[lien.ToTypePhase];
                    wndLien.Lien             = lien;
                    wnd.AddChild(wndLien);
                }
            }
            return(wnd);
        }