[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg Oliver.Kellogg at t-online.de
Thu May 22 13:01:04 UTC 2003


CVS commit by okellogg: 

Add method LinePath::activate. Fixes bug 54575 (display of anchor points.)


  M +1 -0      associationwidget.cpp   1.16
  M +15 -5     linepath.cpp   1.13
  M +11 -0     linepath.h   1.4


--- kdesdk/umbrello/umbrello/associationwidget.cpp  #1.15:1.16
@@ -528,4 +528,5 @@ bool AssociationWidget::activate() {
         }
 
+        m_LinePath.activate();
         calculateEndingPoints();
         FloatingText* ft = 0;

--- kdesdk/umbrello/umbrello/linepath.cpp  #1.12:1.13
@@ -45,8 +45,6 @@ void LinePath::setAssociation(Associatio
         if( !association )
                 return;
-        /* To be activated soon:
         if (m_pAssociation)
                 m_LineList.clear();
-         */
         m_pAssociation = association;
         cleanup();
@@ -745,5 +743,5 @@ QColor LinePath::getLineColor() {
 
 void LinePath::cleanup() {
-        m_LineList.clear();   // To be removed soon - see setAssociation()
+        //m_LineList.clear();   // Don't do this here - see setAssociation()
         m_HeadList.clear();
         m_RectList.clear();
@@ -828,8 +826,20 @@ bool LinePath::loadFromXMI( QDomElement 
 
 
+void LinePath::activate() {
+        int count = m_LineList.count();
+        if( count == 0 )
+                return;
 
+        LineList orphants = m_LineList;
+        m_LineList.clear();
+        //setup start end points
+        setStartEndPoints( orphants.at(0) -> startPoint(), orphants.last() -> endPoint() );
+        //now insert the rest
+        for( int i = 1; i < count ; i++ ) {
+                insertPoint( i, orphants.at( i ) -> startPoint() );
+        }
 
-
-
+        orphants.clear();
+}
 
 

--- kdesdk/umbrello/umbrello/linepath.h  #1.3:1.4
@@ -150,4 +150,15 @@ public:
 
         /**
+        *   Activates the line list.
+        *   This is needed because the m_pAssociation does not yet
+        *   exist at the time of the LinePath::loadFromXMI call.
+        *   However, this means that the points in the m_LineList
+        *   do not have a parent when they are loaded.
+        *   They need to be reparented by calling LinePath::activate()
+        *   once the m_pAssociation exists.
+        */
+        void activate();
+
+        /**
         *   Removes and item created that are no longer needed.
         */






More information about the umbrello-devel mailing list