Exemplo n.º 1
0
 /// <summary>
 /// Добавляет новую связь между сущностями
 /// </summary>
 /// <param name="essenceIndex1">Индекс 1 сущности</param>
 /// <param name="essenceIndex2">Индекс 2 сущности</param>
 public void AddRelationship(int essenceIndex1, int essenceIndex2)
 {
     if (ErEssence.CanHaveRelationship(Essences[essenceIndex1], Essences[essenceIndex2]))
     {
         ErRelationship newRelationship = new ErRelationship();
         DiagramGraf[essenceIndex1, essenceIndex2] = newRelationship;
         DiagramGraf[essenceIndex2, essenceIndex1] = newRelationship;
     }
     else
     {
         throw new ErDiagramNotCreateRelationshipExeption("This Essences cann't have Relationship");
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Добавляет новую связь между сущностями
 /// </summary>
 /// <param name="relationship">Связь</param>
 public void AddRelationship(ErRelationship relationship)
 {
     int essenceIndex1 = Essences.IndexOf(relationship.FirstPair.Essence);
     int essenceIndex2 = Essences.IndexOf(relationship.SecondPair.Essence);
     if (ErEssence.CanHaveRelationship(Essences[essenceIndex1], Essences[essenceIndex2]))
     {
         DiagramGraf[essenceIndex1, essenceIndex2] = relationship;
         DiagramGraf[essenceIndex2, essenceIndex1] = relationship;
     }
     else
     {
         throw new ErDiagramNotCreateRelationshipExeption("This Essences cann't have Relationship");
     }
 }
Exemplo n.º 3
0
        public RelationshipView(Control.ControlCollection collection, Essenishial one, Essenishial two, 
            ErRelationshipConnectType firsType, ErRelationshipConnectType secType,
            ErDiagram Diagram
            )
        {
            targetDiagram = Diagram;
            ErConnectEssencePair firstPair = new ErConnectEssencePair(one.Essence, firsType);
            ErConnectEssencePair secondPair = new ErConnectEssencePair(two.Essence, secType);
            targetRelationship = new ErRelationship(firstPair, secondPair);
            targetDiagram.AddRelationship(targetRelationship);

            oneEssenishial = one;
            twoEssenishial = two;
            one.OneOrTwoList.Add(1);
            two.OneOrTwoList.Add(2);
            OnePoint = one.GetCentralPoint();
            TwoPoint = two.GetCentralPoint();
            one.RelationshipViewList.Add(this);
            two.RelationshipViewList.Add(this);

            MiddlePoint = new Point((OnePoint.X + TwoPoint.X) / 2, (OnePoint.Y + TwoPoint.Y) / 2);
            containerOne = new ShapeContainer();
            OneToMiddleLine = new LineShape(OnePoint.X, OnePoint.Y, MiddlePoint.X, MiddlePoint.Y);
            OneToMiddleLine.DoubleClick += OpenRelationshipEditorWindow;
            OneToMiddleLine.BorderWidth = 3;
            OneToMiddleLine.BorderStyle = GetLineStyle(firsType.ModalType);
            MiddelToTwoLine = new LineShape(MiddlePoint.X, MiddlePoint.Y, TwoPoint.X, TwoPoint.Y);
            MiddelToTwoLine.BorderWidth = 3;
            MiddelToTwoLine.DoubleClick += OpenRelationshipEditorWindow;
            MiddelToTwoLine.BorderStyle = GetLineStyle(secType.ModalType);

            containerOne.Shapes.Add(OneToMiddleLine);
            containerOne.Shapes.Add(MiddelToTwoLine);
            //shape.
            collection.Add(containerOne);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Удаляет связь между сущностями
        /// </summary>
        /// <param name="relationship">Связь</param>
        public void DeleteRelationship(ErRelationship relationship)
        {
            int essenceIndex1 = Essences.IndexOf(relationship.FirstPair.Essence);
            int essenceIndex2 = Essences.IndexOf(relationship.SecondPair.Essence);

            DiagramGraf[essenceIndex1, essenceIndex2] = null;
            DiagramGraf[essenceIndex2, essenceIndex1] = null;
        }