Exemple #1
0
 public Association(Point location, Size size, Color couleurBordure, int épaisseur, Entité S, Entité D, Lien lS, Lien lD) : base(location, size, couleurBordure, épaisseur)
 {
     texte             = "Association";
     entitéSource      = S;
     entitéDestination = D;
     lienSource        = lS;
     lienDestination   = lD;
     //A calculer : Point Location
     //             Size size
 }
Exemple #2
0
 public Association(Point location, Size size, Color couleurBordure, int épaisseur, Entité S, Entité D, Lien lS, Lien lD)
     : base(location, size, couleurBordure, épaisseur)
 {
     texte = "Association";
     entitéSource = S;
     entitéDestination = D;
     lienSource = lS;
     lienDestination = lD;
     //A calculer : Point Location
     //             Size size
 }
Exemple #3
0
 public EditionLien(Lien li)
 {
     InitializeComponent();
     lien             = li;
     Cardinalité.Text = lien.Cardinalité;
 }
Exemple #4
0
        private void DessinObjets_MouseUp(object sender, MouseEventArgs e)
        {
            if (this.Bounds.Contains((e.Location)))
            {
                if (dessinTrait)
                {
                    if (noeudCourant != null)
                    {
                        #region Création d'une arête
                        Point pointInModel = ScreenToModel(e.Location);
                        Noeud fin = TrouveNoeudCourant(pointInModel);
                        Action subAction = null;
                        if (fin == null)
                        {
                            fin = NoeudParDéfaut(pointInModel, Option.Type_schéma);
                            subAction = new Action(Type_Action.Créer, new List<object>() { fin });
                        }
                        Trait trait = null;
                        Trait trait_1 = null;
                        if (fin != null)
                        {
                            switch (Option.Type_schéma)
                            {
                                case TypeSchéma.Graphe:
                                    trait = new Trait(noeudCourant, fin, option.Couleur_Lien, option.Épaisseur_Lien);
                                    break;
                                case TypeSchéma.Relationnel:
                                    trait = new Contrainte(noeudCourant, fin, option.Couleur_Lien, option.Épaisseur_Lien);                  
                                    EditionContrainte pa = new EditionContrainte((Contrainte)trait, (Relation)noeudCourant, (Relation)fin);
                                    pa.ShowDialog();
                                    break;
                                case TypeSchéma.EntitéAssociation:
                                    
                                    if (noeudCourant.GetType() != typeof(Association) && fin.GetType() != typeof(Association))
                                    {
                                        Point pos = new Point(Math.Abs(noeudCourant.Position.X + fin.Position.X)/2, Math.Abs(noeudCourant.Position.Y + fin.Position.Y)/2);
                                        Association asso = new Association(pos, new Size(8, 8), option.Couleur_Lien, option.Épaisseur_Lien, (Entité)noeudCourant, (Entité)fin);

                                        trait = new Lien(noeudCourant, asso, option.Couleur_Lien, option.Épaisseur_Lien);
                                        trait_1 = new Lien(asso, fin, option.Couleur_Lien, option.Épaisseur_Lien);

                                        asso.LienSource = (Lien)trait;
                                        asso.LienDestination = (Lien)trait_1;

                                        EditionAssociation eA = new EditionAssociation(asso);

                                        if (eA.ShowDialog() == DialogResult.OK)
                                        {
                                            noeuds.Add(asso);
                                        }
                                        else
                                        {
                                            trait = null; //si on clique sur annuler, on ne veut plus ajouter le lien
                                            trait_1 = null;
                                        }
                                    }
                                    break;
                            }
                        }
                        if (trait_1 != null)
                        {
                            traits.Add(trait_1);
                            Action action = new Action(Type_Action.Créer, new List<object>() { trait_1 });
                            PushUndo(action);
                            if (subAction != null)
                                action.AddSubAction(subAction);
                        }
                        if (trait != null)
                        {
                            traits.Add(trait);
                            Action action = new Action(Type_Action.Créer, new List<object>() { trait });
                            PushUndo(action);
                            if (subAction != null)
                                action.AddSubAction(subAction);
                        }
                        pointCourant = Point.Empty;
                        Refresh();
                        dessinTrait = false;
                        #endregion
                    }
                }
                else
                {
                    #region Déplacement
                    Point pointInModel = ScreenToModel(e.Location);
                    if (Déplacement_Simple)
                    {
                        #region Mode modification
                        if (noeudCourant != null)
                        {
                            noeudCourant.Déplace(pointInModel);
                            PushUndo(new Action(Type_Action.Déplacer, new List<object>() { noeudCourant, origineDéplacement, pointInModel }));
                        }
                        #endregion
                    }
                    else
                    {
                        if (sélection != Rectangle.Empty)
                        {
                            if (DéplacementMultipleEncours)
                            {
                                #region Déplacement_Bloc
                                Action act = new Action(Type_Action.EnBloc, new List<object>());
                                foreach (Noeud n in noeuds)
                                {
                                    if (n.IsSelected)
                                    {
                                        Point offset = new Point(e.Location.X - StartBlockMovement.X, e.Location.Y - StartBlockMovement.Y);
                                        n.DéplaceVers(offset);
                                        Point offsetGlobal = new Point(e.Location.X - origineDéplacement.X, e.Location.Y - origineDéplacement.Y);
                                        Action ac = new Action(Type_Action.EnBloc, new List<object>() { n, offsetGlobal });
                                        act.AddSubAction(ac);
                                    }
                                }
                                PushUndo(act);
                                annulerToolStripMenuItem.Enabled = true;
                                sélection = new Rectangle(sélection.X + e.Location.X - StartBlockMovement.X, sélection.Y + e.Location.Y - StartBlockMovement.Y, sélection.Width, sélection.Height);
                                StartBlockMovement = e.Location;
                                #endregion
                            }
                            else
                            {
                            }
                        }
                    }
                    #endregion
                }
                Déplacement_Simple = false;
            }
            else
            {
                pointCourant = Point.Empty;
                Refresh();
            }
        }
Exemple #5
0
 public EditionLien(Lien li)
 {
     InitializeComponent();
     lien = li;
     Cardinalité.Text = lien.Cardinalité;
 }