コード例 #1
0
 //-------------------------------------------------------
 public override void Draw(CContextDessinObjetGraphique ctx)
 {
     base.Draw(ctx);
     if (SourceEntites is CSourceEntitesPourTableDataChampDeTable)
     {
         string            strIdTable  = ((CSourceEntitesPourTableDataChampDeTable)SourceEntites).IdTable;
         IObjetDeEasyQuery tableSource = null;
         foreach (IObjetDeEasyQuery objet in Query.Childs)
         {
             CODEQBase o = objet as CODEQBase;
             if (o != null && o.Id == strIdTable)
             {
                 tableSource = o;
                 break;
             }
         }
         if (tableSource != null)
         {
             Pen           pen  = new Pen(Brushes.Black, 2);
             CLienTracable lien = CTraceurLienDroit.GetLienPourLier(tableSource.RectangleAbsolu, RectangleAbsolu, EModeSortieLien.Automatic);
             lien.RendVisibleAvecLesAutres(ctx.Liens);
             ctx.AddLien(lien);
             pen.DashStyle = DashStyle.Dot;
             AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
             pen.CustomEndCap = cap;
             lien.Draw(ctx.Graphic, pen);
             pen.Dispose();
             cap.Dispose();
         }
     }
 }
コード例 #2
0
        //---------------------------------------------------
        protected override void MyDraw(CContextDessinObjetGraphique ctx)
        {
            base.MyDraw(ctx);
            IObjetDeEasyQuery source = TableSource;

            if (source != null)
            {
                Pen           pen  = new Pen(Brushes.Black, 2);
                CLienTracable lien = CTraceurLienDroit.GetLienPourLier(source.RectangleAbsolu, RectangleAbsolu, EModeSortieLien.Automatic);
                lien.RendVisibleAvecLesAutres(ctx.Liens);
                ctx.AddLien(lien);
                AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
                pen.CustomEndCap = cap;
                lien.Draw(ctx.Graphic, pen);
                pen.Dispose();
                cap.Dispose();
            }
        }
コード例 #3
0
 //----------------------------------------------------------------------------------------
 public void Draw(IObjetDeEasyQuery objetPossedant, CContextDessinObjetGraphique ctxDessin)
 {
     if (objetPossedant != null && objetPossedant.Query != null)
     {
         IObjetDeEasyQuery objet = objetPossedant.Query.GetObjet(SourceTableId);
         if (objet != null)
         {
             Color c   = Color.FromArgb(128, 0, 0, 255);
             Pen   pen = new Pen(c, 1);
             AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
             pen.CustomEndCap = cap;
             CLienTracable lien = CTraceurLienDroit.GetLienPourLier(objet.RectangleAbsolu, objetPossedant.RectangleAbsolu, EModeSortieLien.Automatic);
             lien.RendVisibleAvecLesAutres(ctxDessin.Liens);
             ctxDessin.AddLien(lien);
             lien.Draw(ctxDessin.Graphic, pen);
             pen.Dispose();
             cap.Dispose();
         }
     }
 }
コード例 #4
0
 protected void DrawLien(
     CContextDessinObjetGraphique ctx, 
     Pen pen, 
     Font ft,
     CRepresentationExpressionGraphique de, 
     CRepresentationExpressionGraphique vers,
     string strText )
 {
     CLienTracable lien = CTraceurLienDroit.GetLienPourLier(de.RectangleAbsolu, vers.RectangleAbsolu, EModeSortieLien.Automatic);
     lien.RendVisibleAvecLesAutres(ctx.Liens);
     ctx.AddLien(lien);
     ctx.Graphic.DrawLines(pen, lien.Points.ToArray());
     if (strText != "" && lien.Points.Count() > 0)
     {
         CSegmentDroite segment = lien.Segments[0];
         Point ptMilieu = segment.Milieu;
         Brush br = new SolidBrush(pen.Color);
         ctx.Graphic.DrawString(strText, ft, br, ptMilieu);
         br.Dispose();
     }
 }
コード例 #5
0
ファイル: CLienAction.cs プロジェクト: ykebaili/sc2idlls
        private void AssurePositionOk( )
        {
            if (!m_bPositionInvalide)//Vérifie que le départ et l'arrivé n'ont pas bougé
            {
                if (ActionDepart != null && ActionDepart.RectangleAbsolu != m_lastRectangleDepart ||
                    ActionArrivee != null && ActionArrivee.RectangleAbsolu != m_lastRectangleArrivee)
                {
                    m_bPositionInvalide = true;
                }
            }
            if (m_bPositionInvalide)
            {
                Point   pt1;
                CAction actionDepart = ActionDepart;
                if (actionDepart == null)
                {
                    pt1 = m_lastPointDepart;
                }
                else
                {
                    m_lastRectangleDepart = actionDepart.RectangleAbsolu;
                    pt1 = GetCentreRect(m_lastRectangleDepart);
                }

                Point   pt2;
                CAction actionArrivee = ActionArrivee;
                if (actionArrivee == null)
                {
                    pt2 = m_lastPointArrivee;
                }
                else
                {
                    m_lastRectangleArrivee = actionArrivee.RectangleAbsolu;
                    pt2 = GetCentreRect(m_lastRectangleArrivee);
                }


                m_lienTracable = CTraceurLienDroit.GetLien(pt1, pt2, ModeSortieDuLien);

                if (actionDepart != null)
                {
                    Point[] pts1 = actionDepart.GetPolygoneDessin();

                    //Suppression des segments inutiles
                    int nLastIntersect        = 0;
                    CSegmentDroite[] segments = m_lienTracable.Segments;
                    for (nLastIntersect = segments.Count() - 1; nLastIntersect > 0; nLastIntersect--)
                    {
                        Point dummy = new Point(0, 0);
                        if (segments[nLastIntersect].GetIntersectionPoint(pts1, ref dummy))
                        {
                            break;
                        }
                    }
                    for (int n = 0; n < nLastIntersect; n++)
                    {
                        m_lienTracable.RemovePoint(0);
                    }

                    if (m_lienTracable.Points.Count() > 1)
                    {
                        CSegmentDroite segment = new CSegmentDroite(m_lienTracable.Points.ElementAt(0), m_lienTracable.Points.ElementAt(1));
                        if (segment.GetIntersectionPoint(pts1, ref pt1))
                        {
                            m_lienTracable.RemplacePoint(0, pt1);
                        }
                    }
                }
                if (actionArrivee != null)
                {
                    Point[] pts2 = actionArrivee.GetPolygoneDessin();

                    //Suppression des segments inutiles
                    CSegmentDroite[] segments = m_lienTracable.Segments;
                    int nLastIntersect        = segments.Count() - 1;
                    for (nLastIntersect = 0; nLastIntersect < segments.Count() - 1; nLastIntersect++)
                    {
                        Point dummy = new Point(0, 0);
                        if (segments[nLastIntersect].GetIntersectionPoint(pts2, ref dummy))
                        {
                            break;
                        }
                    }
                    for (int n = nLastIntersect + 1; n < segments.Count(); n++)
                    {
                        m_lienTracable.RemovePoint(m_lienTracable.Points.Count() - 1);
                    }

                    if (m_lienTracable.Points.Count() > 1)
                    {
                        CSegmentDroite segment = new CSegmentDroite(
                            m_lienTracable.Points.ElementAt(m_lienTracable.Points.Count() - 2),
                            m_lienTracable.Points.ElementAt(m_lienTracable.Points.Count() - 1));
                        if (segment.GetIntersectionPoint(pts2, ref pt2))
                        {
                            m_lienTracable.RemplacePoint(m_lienTracable.Points.Count() - 1, pt2);
                        }
                    }
                }
                m_lastPointDepart   = m_lienTracable.Points.ElementAt(0);;
                m_lastPointArrivee  = m_lienTracable.Points.ElementAt(m_lienTracable.Points.Count() - 1);
                m_bPositionInvalide = false;
            }
        }