[Uml-devel] KDE/kdesdk/umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Mon Apr 16 13:43:27 UTC 2012


SVN commit 1289937 by fischer:

Differences to gsoc-branch reduced. Unused functions removed.

 M  +1 -1      umlscene.cpp  
 M  +37 -45    widgets/associationwidget.cpp  
 M  +12 -46    widgets/associationwidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.cpp #1289936:1289937
@@ -1307,7 +1307,7 @@
 
     foreach(AssociationWidget* assoc_obj, m_AssociationList) {
         // get the rectangle around all segments of the assoc
-        rect = assoc_obj->getAssocLineRectangle();
+        rect = assoc_obj->boundingRect();
 
         if (startx >= rect.x())
             startx = rect.x();
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationwidget.cpp #1289936:1289937
@@ -1219,14 +1219,18 @@
     return true;
 }
 
-/** Returns true if this association associates WidgetA to WidgetB, otherwise it returns
-    false */
+/**
+ * Returns true if this association associates WidgetA to WidgetB,
+ * otherwise it returns false.
+ */
 bool AssociationWidget::checkAssoc(UMLWidget * widgetA, UMLWidget *widgetB)
 {
     return (widgetA == m_role[A].umlWidget && widgetB == m_role[B].umlWidget);
 }
 
-/** CleansUp all the association's data in the related widgets  */
+/**
+ * CleansUp all the association's data in the related widgets.
+ */
 void AssociationWidget::cleanup()
 {
     //let any other associations know we are going so they can tidy their positions up
@@ -1729,13 +1733,17 @@
     updateAssociations( regionCount, region, role );
 }
 
-/** Read property of bool m_activated. */
+/**
+ * Read property of bool m_activated.
+ */
 bool AssociationWidget::isActivated()
 {
     return m_activated;
 }
 
-/** Set the m_activated flag of a widget but does not perform the Activate method */
+/**
+ * Set the m_activated flag of a widget but does not perform the Activate method.
+ */
 void AssociationWidget::setActivated(bool active /*=true*/)
 {
     m_activated = active;
@@ -2081,23 +2089,23 @@
  * Returns the total length of the association's AssociationLine:
  * result = segment_1_length + segment_2_length + ... + segment_n_length
  */
-float AssociationWidget::totalLength()
-{
-    uint size = m_associationLine->count();
-    float total_length = 0;
+//float AssociationWidget::totalLength()
+//{
+//    uint size = m_associationLine->count();
+//    float total_length = 0;
 
-    for(uint i = 0; i < size - 1; ++i) {
-        QPoint pi = m_associationLine->point( i );
-        QPoint pj = m_associationLine->point( i+1 );
-        int xi = pi.y();
-        int xj = pj.y();
-        int yi = pi.x();
-        int yj = pj.x();
-        total_length +=  sqrt( double(((xj - xi)*(xj - xi)) + ((yj - yi)*(yj - yi))) );
-    }
+//    for(uint i = 0; i < size - 1; ++i) {
+//        QPoint pi = m_associationLine->point( i );
+//        QPoint pj = m_associationLine->point( i+1 );
+//        int xi = pi.y();
+//        int xj = pj.y();
+//        int yi = pi.x();
+//        int yj = pj.x();
+//        total_length +=  sqrt( double(((xj - xi)*(xj - xi)) + ((yj - yi)*(yj - yi))) );
+//    }
 
-    return total_length;
-}
+//    return total_length;
+//}
 
 /**
  * Calculates which point of segment P1P2 has a distance equal to
@@ -3266,14 +3274,14 @@
  * region for the same widget will mean the lines will need to be
  * spread out across the region.
  */
-AssociationWidget::Region AssociationWidget::getWidgetRegion(AssociationWidget * widget) const
-{
-    if(widget->widgetForRole(A) == m_role[A].umlWidget)
-        return m_role[A].m_WidgetRegion;
-    if(widget->widgetForRole(B) == m_role[B].umlWidget)
-        return m_role[B].m_WidgetRegion;
-    return Error;
-}
+//AssociationWidget::Region AssociationWidget::getWidgetRegion(AssociationWidget * widget) const
+//{
+//    if(widget->widgetForRole(A) == m_role[A].umlWidget)
+//        return m_role[A].m_WidgetRegion;
+//    if(widget->widgetForRole(B) == m_role[B].umlWidget)
+//        return m_role[B].m_WidgetRegion;
+//    return Error;
+//}
 
 /**
  * Returns the number of lines there are on the given region for
@@ -3851,7 +3859,7 @@
 /**
  * Returns the bounding rectangle of all segments of the association.
  */
-QRect AssociationWidget::getAssocLineRectangle()
+QRect AssociationWidget::boundingRect()
 {
     QRect rectangle;
 
@@ -3940,22 +3948,6 @@
     return m_role[role].m_nIndex;
 }
 
-/**
- * Sets the total count on the Association region for widgetB.
- */
-void AssociationWidget::setTotalCount(int count, Uml::Role_Type role)
-{
-    m_role[role].m_nTotalCount = count;
-}
-
-/**
- * Returns the total count on the Association region.
- */
-int AssociationWidget::getTotalCount(Uml::Role_Type role) const
-{
-    return  m_role[role].m_nTotalCount;
-}
-
 void AssociationWidget::clipSize()
 {
     if( m_nameWidget )
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationwidget.h #1289936:1289937
@@ -156,6 +156,7 @@
     AssociationLine* associationLine() const;
 
     virtual bool activate();
+    QRect boundingRect();
 
     void widgetMoved(UMLWidget* widget, int x, int y);
 
@@ -180,8 +181,6 @@
     void moveMidPointsBy(int x, int y);
     void moveEntireAssoc(int x, int y);
 
-    QRect getAssocLineRectangle();
-
     QFont font() const;
 
     virtual void setTextColor(const QColor &color);
@@ -191,15 +190,9 @@
     void setIndex(int index, Uml::Role_Type role);
     int getIndex(Uml::Role_Type role) const;
 
-    void setTotalCount(int count, Uml::Role_Type role);
-    int getTotalCount(Uml::Role_Type role) const;
-
-    void setTotalCount(int count);
-
     void calculateEndingPoints();
 
     void removeAssocClassLine();
-
     void computeAssocClassLine();
 
     void clipSize();
@@ -246,12 +239,12 @@
 
     Uml::TextRole calculateNameType(Uml::TextRole defaultRoleType);
 
-    bool isPointInsideBoundaries(int PosX, int PosY, QPoint & SPoint,
-                                 uint & StartSegmentIndex, uint & EndSegmentIndex);
+//    bool isPointInsideBoundaries(int PosX, int PosY, QPoint & SPoint,
+//                                 uint & StartSegmentIndex, uint & EndSegmentIndex);
 
     static QPoint swapXY(const QPoint &p);
 
-    float totalLength();
+//    float totalLength();
 
     static QPoint calculatePointAtDistance(const QPoint &P1, const QPoint &P2, float Distance);
     static QPoint calculatePointAtDistanceOnPerpendicular(const QPoint &P1, const QPoint &P2, float Distance);
@@ -260,7 +253,7 @@
 
     static QPoint midPoint(const QPoint& p0, const QPoint& p1);
 
-    Region getWidgetRegion(AssociationWidget * widget) const;
+//    Region getWidgetRegion(AssociationWidget * widget) const;
 
     /**
      * The WidgetRole struct gathers all information pertaining to the role.
@@ -324,40 +317,13 @@
     bool                m_selected;
     int                 m_nMovingPoint;
 
-    /**
-     * Position of Name floatingtext saved by saveIdealTextPositions()
-     */
-    QPoint m_oldNamePoint;
-    /**
-     * Position of role A multiplicity floatingtext saved by
-     * saveIdealTextPositions()
-     */
-    QPoint m_oldMultiAPoint;
-    /**
-     * Position of role B multiplicity floatingtext saved by
-     * saveIdealTextPositions()
-     */
-    QPoint m_oldMultiBPoint;
-    /**
-     * Position of role A changeability floatingtext saved by
-     * saveIdealTextPositions()
-     */
-    QPoint m_oldChangeAPoint;
-    /**
-     * Position of role B changeability floatingtext saved by
-     * saveIdealTextPositions()
-     */
-    QPoint m_oldChangeBPoint;
-    /**
-     * Position of role A name floatingtext saved by
-     * saveIdealTextPositions()
-     */
-    QPoint m_oldRoleAPoint;
-    /**
-     * Position of role B name floatingtext saved by
-     * saveIdealTextPositions()
-     */
-    QPoint m_oldRoleBPoint;
+    QPoint m_oldNamePoint;    ///< Position of name floatingtext saved by saveIdealTextPositions()
+    QPoint m_oldMultiAPoint;  ///< Position of role A multiplicity floatingtext saved by saveIdealTextPositions()
+    QPoint m_oldMultiBPoint;  ///< Position of role B multiplicity floatingtext saved by saveIdealTextPositions()
+    QPoint m_oldChangeAPoint; ///< Position of role A changeability floatingtext saved by saveIdealTextPositions()
+    QPoint m_oldChangeBPoint; ///< Position of role B changeability floatingtext saved by saveIdealTextPositions()
+    QPoint m_oldRoleAPoint;   ///< Position of role A name floatingtext saved by saveIdealTextPositions()
+    QPoint m_oldRoleBPoint;   ///< Position of role B name floatingtext saved by saveIdealTextPositions()
 
     int         m_nLinePathSegmentIndex; ///< anchor for m_pAssocClassLine
     UMLSceneLineItem *m_pAssocClassLine;  ///< used for connecting assoc. class




More information about the umbrello-devel mailing list