/** * This will setup the class ready to display the line correctly. * This MUST be called before you can use this class. */ void LinePath::setAssociation(AssociationWidget * association) { if( !association ) return; cleanup(); m_pAssociation = association; createHeadLines(); createSubsetSymbol(); if( getAssocType() == Uml::at_Coll_Message ) setupParallelLine(); UMLView * view = (UMLView *)m_pAssociation -> parent(); connect( view, SIGNAL( sigColorChanged( Uml::IDType ) ), this, SLOT( slotLineColorChanged( Uml::IDType ) ) ); connect( view, SIGNAL( sigLineWidthChanged( Uml::IDType ) ), this, SLOT( slotLineWidthChanged( Uml::IDType ) ) ); }
/** * This will setup the class ready to display the line correctly. * This MUST be called before you can use this class. */ void AssociationLine::setAssociation(AssociationWidget * association) { if( !association ) return; cleanup(); m_pAssociation = association; createHeadLines(); createSubsetSymbol(); if( getAssocType() == Uml::AssociationType::Coll_Message ) setupParallelLine(); UMLView * view = (UMLView *)m_pAssociation->parent(); if (view) { connect(view, SIGNAL(sigColorChanged(Uml::IDType)), this, SLOT(slotLineColorChanged(Uml::IDType))); connect(view, SIGNAL(sigLineWidthChanged(Uml::IDType)), this, SLOT(slotLineWidthChanged(Uml::IDType))); } else { uWarning() << "Parent is null. Can not connect SIGNAL/SLOT."; } }
/** * Sets the Association type. */ void LinePath::setAssocType( Uml::Association_Type type ) { QList<Q3CanvasLine*>::Iterator it = m_LineList.begin(); QList<Q3CanvasLine*>::Iterator end = m_LineList.end(); for( ; it != end; ++it ) (*it) -> setPen( getPen() ); delete m_pClearPoly; m_pClearPoly = 0; if( type == Uml::at_Coll_Message ) { setupParallelLine(); } else { createHeadLines(); createSubsetSymbol(); } update(); }
/** * Calls a group of methods to update the line. Used to save you calling multiple methods. */ void LinePath::update() { if (getAssocType() == Uml::at_Coll_Message) { if (m_bParallelLineCreated) { calculateParallelLine(); updateParallelLine(); } else setupParallelLine(); } else if (m_bHeadCreated) { calculateHead(); updateHead(); } else { createHeadLines(); } if ( m_bSubsetSymbolCreated ) { updateSubsetSymbol(); } else { createSubsetSymbol(); } }
/** * This method creates, deletes symbols and collaboration lines based on * m_associationWidget->associationType(). * * Call this method when associationType of m_associationWidget changes. */ void AssociationLine::reconstructSymbols() { switch( m_associationWidget->associationType() ) { case Uml::AssociationType::State: case Uml::AssociationType::Activity: case Uml::AssociationType::Exception: case Uml::AssociationType::UniAssociation: case Uml::AssociationType::Dependency: setStartSymbol(Symbol::None); setEndSymbol(Symbol::OpenArrow); removeSubsetSymbol(); removeCollaborationLine(); break; case Uml::AssociationType::Relationship: setStartSymbol(Symbol::None); setEndSymbol(Symbol::CrowFeet); removeSubsetSymbol(); removeCollaborationLine(); break; case Uml::AssociationType::Generalization: case Uml::AssociationType::Realization: setStartSymbol(Symbol::None); setEndSymbol(Symbol::ClosedArrow); removeSubsetSymbol(); removeCollaborationLine(); break; case Uml::AssociationType::Composition: case Uml::AssociationType::Aggregation: setStartSymbol(Symbol::Diamond); setEndSymbol(Symbol::None); removeSubsetSymbol(); removeCollaborationLine(); break; case Uml::AssociationType::Containment: setStartSymbol(Symbol::Circle); setEndSymbol(Symbol::None); removeSubsetSymbol(); removeCollaborationLine(); break; case Uml::AssociationType::Child2Category: setStartSymbol(Symbol::None); setEndSymbol(Symbol::None); createSubsetSymbol(); removeCollaborationLine(); break; case Uml::AssociationType::Coll_Message_Synchronous: case Uml::AssociationType::Coll_Message_Asynchronous: case Uml::AssociationType::Coll_Message_Self: setStartSymbol(Symbol::None); setEndSymbol(Symbol::None); removeSubsetSymbol(); createCollaborationLine(); break; default: break; } alignSymbols(); }