Merge pull request #1256 from j9ac9k/Implement-PR-317

Implement diff from PR 317
This commit is contained in:
Ogi Moore 2020-06-13 21:49:33 -07:00 committed by GitHub
commit 362dc93a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2121,6 +2121,23 @@ class LineSegmentROI(ROI):
def listPoints(self): def listPoints(self):
return [p['item'].pos() for p in self.handles] return [p['item'].pos() for p in self.handles]
def getState(self):
state = ROI.getState(self)
state['points'] = [Point(h.pos()) for h in self.getHandles()]
return state
def saveState(self):
state = ROI.saveState(self)
state['points'] = [tuple(h.pos()) for h in self.getHandles()]
return state
def setState(self, state):
ROI.setState(self, state)
p1 = [state['points'][0][0]+state['pos'][0], state['points'][0][1]+state['pos'][1]]
p2 = [state['points'][1][0]+state['pos'][0], state['points'][1][1]+state['pos'][1]]
self.movePoint(self.getHandles()[0], p1, finish=False)
self.movePoint(self.getHandles()[1], p2)
def paint(self, p, *args): def paint(self, p, *args):
p.setRenderHint(QtGui.QPainter.Antialiasing) p.setRenderHint(QtGui.QPainter.Antialiasing)