Commit 5c2aa651da3f854761784d72aac59c08ca148ad3

Authored by Thiago Franco de Moraes
1 parent 95430b64

Better text positioning

Showing 1 changed file with 2 additions and 24 deletions   Show diff stats
invesalius/data/measures.py
... ... @@ -582,7 +582,7 @@ class LinearMeasure(object):
582 582 canvas.draw_line(p0, p1)
583 583  
584 584 txt = u"%.3f mm" % self.GetValue()
585   - canvas.draw_text_box(txt, (points[0][0], points[0][1]))
  585 + canvas.draw_text_box(txt, ((points[0][0]+points[1][0])/2.0, (points[0][1]+points[1][1])/2.0))
586 586  
587 587 def GetNumberOfPoints(self):
588 588 return len(self.points)
... ... @@ -843,30 +843,8 @@ class AngularMeasure(object):
843 843 if len(points) == 3:
844 844 txt = u"%.3f° / %.3f°" % (self.GetValue(), 360.0 - self.GetValue())
845 845  
846   - # path = gc.CreatePath()
847   -
848   - # c = np.array(lines[1])
849   - # v0 = np.array(lines[0]) - c
850   - # v1 = np.array(lines[2]) - c
851   -
852   - # s0 = np.linalg.norm(v0)
853   - # s1 = np.linalg.norm(v1)
854   -
855   - # a0 = np.arctan2(v0[1] , v0[0])
856   - # a1 = np.arctan2(v1[1] , v1[0])
857   -
858   - # if (a1 - a0) % (np.pi*2) < (a0 - a1) % (np.pi*2):
859   - # sa = a0
860   - # ea = a1
861   - # else:
862   - # sa = a1
863   - # ea = a0
864   -
865   - # path.AddArc((c[0], c[1]), min(s0, s1), sa, ea)
866   - # gc.StrokePath(path)
867   -
868 846 canvas.draw_arc(points[1], points[0], points[2])
869   - canvas.draw_text_box(txt, (points[0][0], points[0][1]))
  847 + canvas.draw_text_box(txt, (points[1][0], points[1][1]))
870 848  
871 849 def GetNumberOfPoints(self):
872 850 return self.number_of_points
... ...