개정판 8ca39e87
issue #505: zoom testing
Change-Id: Ia8c0116746bb6374f5beea3b9d2240b6dbf1bb88
DTI_PID/DTI_PID/Commands/AreaZoomCommand.py | ||
---|---|---|
72 | 72 |
current_area = current_rect.width() * current_rect.height() |
73 | 73 |
new_area = rect.width() * rect.height() |
74 | 74 |
area_ratio = 100 - (new_area / current_area * 100) |
75 |
zoomStack_count = int(area_ratio / 25)
|
|
75 |
zoomStack_count = int(area_ratio / 40)
|
|
76 | 76 |
if zoomStack_count > 0: |
77 | 77 |
current_center = current_rect.center() |
78 | 78 |
new_center = rect.center() |
... | ... | |
94 | 94 |
|
95 | 95 |
x1 = add_center.x() - add_width / 2 |
96 | 96 |
y1 = add_center.y() - add_height / 2 |
97 |
x2 = add_center.x() + add_width / 2
|
|
98 |
y2 = add_center.y() + add_height / 2
|
|
97 |
w1 = add_width
|
|
98 |
h1 = add_height
|
|
99 | 99 |
|
100 |
add_stack = QRectF(x1, y1, x2,y2)
|
|
100 |
add_stack = QRectF(x1, y1, w1, h1)
|
|
101 | 101 |
self.imageViewer.zoomStack.append(add_stack) |
102 | 102 |
|
103 | 103 |
self.imageViewer.zoomStack.append(rect) |
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
291 | 291 |
"""Zoom in & out """ |
292 | 292 |
|
293 | 293 |
HALF_SIZE = 300 |
294 |
clickPos = event.pos() |
|
294 | 295 |
if isZoomIn: |
295 |
clickPos = event.pos() |
|
296 | 296 |
left_top = self.mapToScene(clickPos.x() - HALF_SIZE // adjust, clickPos.y() - HALF_SIZE // adjust) |
297 | 297 |
right_bottom = self.mapToScene(clickPos.x() + HALF_SIZE // adjust, clickPos.y() + HALF_SIZE // adjust) |
298 | 298 |
|
... | ... | |
303 | 303 |
self.updateViewer(zoomArea) |
304 | 304 |
else: |
305 | 305 |
zoomNewRect = None |
306 |
clickPos = self.mapToScene(clickPos.x() // adjust, clickPos.y() // adjust) |
|
306 | 307 |
self.scene.clearSelection() |
307 | 308 |
if self.zoomStack: |
308 | 309 |
zoomNewRect = self.zoomStack.pop() |
310 |
zoomNewRect = QRectF(clickPos.x() - zoomNewRect.width() / 2, clickPos.y() - zoomNewRect.height() / 2, zoomNewRect.width(), zoomNewRect.height()) |
|
309 | 311 |
self.updateViewer(zoomNewRect) |
310 | 312 |
|
311 | 313 |
''' |
내보내기 Unified diff