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

Ralf Habacker ralf.habacker at gmail.com
Wed Feb 1 21:13:32 UTC 2012


SVN commit 1277473 by habacker:

Renamed onLinePath() to closestPointIndex(), which reduces the differences to the soc-umbrello branch.

 M  +1 -1      toolbarstateassociation.cpp  
 M  +7 -4      widgets/associationline.cpp  
 M  +1 -1      widgets/associationline.h  
 M  +3 -3      widgets/associationwidget.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstateassociation.cpp #1277472:1277473
@@ -117,7 +117,7 @@
 
     getCurrentAssociation()->createAssocClassLine(
             static_cast<ClassifierWidget*>(m_firstWidget),
-            getCurrentAssociation()->getLinePath()->onLinePath(m_pMouseEvent->pos()));
+            getCurrentAssociation()->getLinePath()->closestPointIndex(m_pMouseEvent->pos()));
     m_firstWidget->addAssoc( getCurrentAssociation() );
     cleanAssociation();
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationline.cpp #1277472:1277473
@@ -343,11 +343,14 @@
 }
 
 /**
- * Returns -1 if the given point is not on the line.
- * else returns the line segment the point is on.
- * Use the value to insert points at the point position.
+ * Return index of closest point.
+ * 
+ * @param point The point which is to be tested for closeness.
+ *
+ * @retval "Index" of the linepoint closest to the \a point passed.
+ * @retval -1 If no linepoint is closer to passed in \a point.
  */
-int AssociationLine::onLinePath( const QPoint &position )
+int AssociationLine::closestPointIndex( const QPoint &position )
 {
     UMLSceneItemList list = getScene()->collisions( position );
     int index = -1;
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationline.h #1277472:1277473
@@ -69,7 +69,7 @@
 
     int count() const;
 
-    int onLinePath( const QPoint &position );
+    int closestPointIndex( const QPoint &position );
 
     void setAssocType( Uml::AssociationType type );
 
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationwidget.cpp #1277472:1277473
@@ -1425,7 +1425,7 @@
 {
     if (me->button() != Qt::RightButton && me->button() != Qt::LeftButton)
         return;
-    int i = m_LinePath.onLinePath(me->pos());
+    int i = m_LinePath.closestPointIndex(me->pos());
     if (i == -1) {
         m_LinePath.setSelected(false);
         return;
@@ -3190,7 +3190,7 @@
     if (m_nMovingPoint == -1)
     {
         //create moving point near the mouse on the line
-        int i = m_LinePath.onLinePath(me->pos());
+        int i = m_LinePath.closestPointIndex(me->pos());
 
         if (i == -1)
             return;
@@ -3762,7 +3762,7 @@
  */
 bool AssociationWidget::onAssociation(const QPoint & point)
 {
-    if (m_LinePath.onLinePath(point) != -1)
+    if (m_LinePath.closestPointIndex(point) != -1)
         return true;
     return onAssocClassLine(point);
 }




More information about the umbrello-devel mailing list