154 if startP.x() != -1 and startP.y() != -1 and \ |
154 if startP.x() != -1 and startP.y() != -1 and \ |
155 endP.x() != -1 and endP.y() != -1: |
155 endP.x() != -1 and endP.y() != -1: |
156 self.setPoints(startP.x(), startP.y(), endP.x(), endP.y()) |
156 self.setPoints(startP.x(), startP.y(), endP.x(), endP.y()) |
157 |
157 |
158 def __calculateEndingPoints_rectangle(self): |
158 def __calculateEndingPoints_rectangle(self): |
159 """ |
159 r""" |
160 Private method to calculate the ending points of the association item. |
160 Private method to calculate the ending points of the association item. |
161 |
161 |
162 The ending points are calculated by the following method. |
162 The ending points are calculated by the following method. |
163 |
163 |
164 For each item the diagram is divided in four Regions by its diagonals |
164 For each item the diagram is divided in four Regions by its diagonals |
183 To calculate the start point we have to find out in which |
183 To calculate the start point we have to find out in which |
184 region (defined by itemA's diagonals) is itemB's TopLeft corner |
184 region (defined by itemA's diagonals) is itemB's TopLeft corner |
185 (lets call it region M). After that the start point will be |
185 (lets call it region M). After that the start point will be |
186 the middle point of rectangle's side contained in region M. |
186 the middle point of rectangle's side contained in region M. |
187 |
187 |
188 To calculate the end point we repeat the above but in the opposite direction |
188 To calculate the end point we repeat the above but in the opposite |
189 (from itemB to itemA) |
189 direction (from itemB to itemA) |
190 """ |
190 """ |
191 if self.itemA is None or self.itemB is None: |
191 if self.itemA is None or self.itemB is None: |
192 return |
192 return |
193 |
193 |
194 self.prepareGeometryChange() |
194 self.prepareGeometryChange() |