개정판 dbce710e
issue #480: gap ongoing
Change-Id: I38c1917dc28cb0c7f22baec8f26cf4887b7897b8
DTI_PID/DTI_PID/LineDetector.py | ||
---|---|---|
77 | 77 |
qy = origin[1] + math.sin(angle) * dx + math.cos(angle) * dy |
78 | 78 |
return [qx, qy] |
79 | 79 |
|
80 |
def is_connected(self, lhs, rhs, toler=0): |
|
80 |
def is_connected(self, lhs, rhs, toler=20):
|
|
81 | 81 |
"""check if given two lines are connected""" |
82 |
length = [] |
|
83 | 82 |
|
84 | 83 |
try: |
84 |
''' |
|
85 |
len_x = [] |
|
86 |
len_y = [] |
|
87 |
|
|
88 |
dx = abs(lhs[0][0] - rhs[0][0]) |
|
89 |
dy = abs(lhs[0][1] - rhs[0][1]) |
|
90 |
len_x.append(dx) |
|
91 |
len_y.append(dy) |
|
92 |
dx = abs(lhs[1][0] - rhs[0][0]) |
|
93 |
dy = abs(lhs[1][1] - rhs[0][1]) |
|
94 |
len_x.append(dx) |
|
95 |
len_y.append(dy) |
|
96 |
dx = abs(lhs[0][0] - rhs[1][0]) |
|
97 |
dy = abs(lhs[0][1] - rhs[1][1]) |
|
98 |
len_x.append(dx) |
|
99 |
len_y.append(dy) |
|
100 |
dx = abs(lhs[1][0] - rhs[1][0]) |
|
101 |
dy = abs(lhs[1][1] - rhs[1][1]) |
|
102 |
len_x.append(dx) |
|
103 |
len_y.append(dy) |
|
104 |
|
|
105 |
for index in range(4): |
|
106 |
if (len_x[index] < toler and len_y[index] < toler * 5) or (len_x[index] < toler * 5 and len_y[index] < toler): |
|
107 |
return True |
|
108 |
|
|
109 |
return False |
|
110 |
''' |
|
111 |
|
|
112 |
|
|
113 |
length = [] |
|
85 | 114 |
# check if share one point |
86 | 115 |
dx = (lhs[0][0] - rhs[0][0]) |
87 | 116 |
dy = (lhs[0][1] - rhs[0][1]) |
... | ... | |
99 | 128 |
# up to here |
100 | 129 |
|
101 | 130 |
return len(matches) == 1 |
131 |
|
|
102 | 132 |
except Exception as ex: |
103 | 133 |
from App import App |
104 | 134 |
from AppDocData import MessageType |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
654 | 654 |
worker.displayLog.emit(MessageType.Error, message) |
655 | 655 |
# up to here |
656 | 656 |
|
657 |
# remove line has not connected item |
|
658 |
try: |
|
659 |
for line in reversed(app_doc_data.lines): |
|
660 |
if not line.has_connection: |
|
661 |
app_doc_data.lines.remove(line) |
|
662 |
except Exception as ex: |
|
663 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[ |
|
664 |
-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
665 |
worker.displayLog.emit(MessageType.Error, message) |
|
666 |
# up to here |
|
667 |
|
|
657 | 668 |
createUnknownItems(mainRes) |
658 | 669 |
|
659 | 670 |
worker.updateBatchProgress.emit(len(srcList), 1) |
내보내기 Unified diff