개정판 e115db8b
issue #663: opc must contain text item testing
Change-Id: I40d70d2b75083bc7d99085ff397a13a1a5abd3c5
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
355 | 355 |
|
356 | 356 |
pool = futures.ThreadPoolExecutor(max_workers=THREAD_MAX_WORKER) |
357 | 357 |
|
358 |
searchedOPCList = [] |
|
358 | 359 |
for sym in searchedSymbolList: |
360 |
if sym.getType() == 'Piping OPC\'s': |
|
361 |
searchedOPCList.append(sym) |
|
362 |
continue |
|
359 | 363 |
pool.submit(Worker.removeDetectedSymbol, sym, app_doc_data.imgSrc) |
360 | 364 |
pool.shutdown(wait=True) |
361 | 365 |
# print(searchedSymbolList[0].getOcrOption()) |
... | ... | |
477 | 481 |
|
478 | 482 |
worker.updateBatchProgress.emit(len(srcList), 2) |
479 | 483 |
|
484 |
# check opc validate |
|
485 |
valid_opc = [] |
|
486 |
for index in reversed(range(len(searchedOPCList))): |
|
487 |
opc_xmin = searchedOPCList[index].getSp()[0] |
|
488 |
opc_ymin = searchedOPCList[index].getSp()[1] |
|
489 |
opc_xmax = searchedOPCList[index].getSp()[0] + searchedOPCList[index].getWidth() |
|
490 |
opc_ymax = searchedOPCList[index].getSp()[0] + searchedOPCList[index].getHeight() |
|
491 |
for text_info in textInfoList: |
|
492 |
info_center = text_info.center |
|
493 |
if info_center[0] > opc_xmin and info_center[0] < opc_xmax and info_center[1] > opc_ymin and info_center[1] < opc_ymax: |
|
494 |
valid_opc.append(searchedOPCList[index]) |
|
495 |
continue |
|
496 |
searchedOPCList.pop(index) |
|
497 |
|
|
498 |
pool = futures.ThreadPoolExecutor(max_workers=THREAD_MAX_WORKER) |
|
499 |
|
|
500 |
for sym in valid_opc: |
|
501 |
pool.submit(Worker.removeDetectedSymbol, sym, app_doc_data.imgSrc) |
|
502 |
pool.shutdown(wait=True) |
|
503 |
# up to here |
|
504 |
|
|
480 | 505 |
removedSymbolImgPath = os.path.join(project.getTempPath(), os.path.basename(mainRes)) |
481 | 506 |
cv2.imwrite(removedSymbolImgPath, app_doc_data.imgSrc) |
482 | 507 |
|
... | ... | |
499 | 524 |
otherTextInfoList if otherTextInfoList is not None else [], |
500 | 525 |
titleBlockTextInfoList if titleBlockTextInfoList is not None else []) |
501 | 526 |
|
502 |
# check opc validate |
|
503 |
''' |
|
504 |
try: |
|
505 |
invalid_opcs = [] |
|
506 |
for symbol in [item for item in app_doc_data.symbols if type(item) is QEngineeringOPCItem]: |
|
507 |
invalid = True |
|
508 |
for text in app_doc_data.texts: |
|
509 |
if symbol.includes(text): |
|
510 |
invalid = False |
|
511 |
break |
|
512 |
if invalid: |
|
513 |
invalid_opcs.append(symbol) |
|
514 |
|
|
515 |
for index in reversed(range(len(app_doc_data.symbols))): |
|
516 |
for invalid_opc in invalid_opcs: |
|
517 |
if app_doc_data.symbols[index] is invalid_opc: |
|
518 |
app_doc_data.symbols.pop(app_doc_data.symbols.index(invalid_opc)) |
|
519 |
app_doc_data.allItems.pop(app_doc_data.allItems.index(invalid_opc)) |
|
520 |
#invalid_opc.transfer.onRemoved.emit(invalid_opc) |
|
521 |
break |
|
522 |
|
|
523 |
except Exception as ex: |
|
524 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[ |
|
525 |
-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
526 |
worker.displayLog.emit(MessageType.Error, message) |
|
527 |
''' |
|
528 |
|
|
529 | 527 |
if isLineChecked: |
530 | 528 |
Worker.recognizeLine(mainRes, listWidget, worker.graphicsView, worker, batch) |
531 | 529 |
else: |
DTI_PID/DTI_PID/Shapes/QEngineeringOPCItem.py | ||
---|---|---|
57 | 57 |
""" return To value """ |
58 | 58 |
return '' |
59 | 59 |
|
60 |
''' |
|
60 | 61 |
def includes(self, item): |
61 | 62 |
topLeft = [item.loc[0], item.loc[1]] |
62 | 63 |
bottomRight = [item.loc[0] + item.size[0], item.loc[1] + item.size[1]] |
... | ... | |
77 | 78 |
if pt[1] > minY: return False |
78 | 79 |
|
79 | 80 |
return True |
81 |
''' |
|
80 | 82 |
|
81 | 83 |
''' |
82 | 84 |
@brief connect attribute |
내보내기 Unified diff