프로젝트

일반

사용자정보

개정판 379c1d2d

ID379c1d2d47dc9fb32462392fb37dd7a5a99b3614
상위 9aaebab3
하위 789d0d3a

함의성이(가) 약 6년 전에 추가함

issue #663: add column flip on db symbol table

Change-Id: Ic764cffed619d9f74f181ebb75cf785807409960

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
453 453
            conn = sqlite3.connect(dbPath)
454 454
            
455 455
            INSERT_SYMBOL_SQL = """
456
                INSERT INTO Symbol(name, SymbolType_UID, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, width, height) 
457
                VALUES(?, (select UID from SymbolType where Type=?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
456
                INSERT INTO Symbol(name, SymbolType_UID, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, width, height, flip) 
457
                VALUES(?, (select UID from SymbolType where Type=?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
458 458
            """
459 459

  
460 460
            cursor = conn.cursor()
......
463 463
                           , symbol.getOcrOption(), symbol.getIsContainChild()
464 464
                           , symbol.getOriginalPoint(), symbol.getConnectionPoint()
465 465
                           , symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel()
466
                           , symbol.width, symbol.height)
466
                           , symbol.width, symbol.height, symbol.detectFlip)
467 467
            cursor.execute(INSERT_SYMBOL_SQL, query)
468 468
            conn.commit()
469 469
            isAdded = True
......
492 492
                SET
493 493
                    name = ?, SymbolType_UID=(select UID from SymbolType where Type=?), threshold = ?, minMatchPoint = ?, isDetectOrigin = ?,
494 494
                    rotationCount = ?, ocrOption = ?, isContainChild = ?, originalPoint = ?, connectionPoint = ?,
495
                    baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ?, width = ?, height = ?
495
                    baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ?, width = ?, height = ?, flip = ?
496 496
                WHERE uid = ?
497 497
            """
498 498
            
......
501 501
                           , symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount()
502 502
                           , symbol.getOcrOption(), symbol.getIsContainChild()
503 503
                           , symbol.getOriginalPoint(), symbol.getConnectionPoint()
504
                           , symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.getUid())
504
                           , symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.detectFlip, symbol.getUid())
505 505
            cursor.execute(UPDATE_SYMBOL_SQL, query)
506 506
            conn.commit()
507 507
            isUpdated = True
......
1511 1511
            conn = sqlite3.connect(dbPath)
1512 1512
            cursor = conn.cursor()
1513 1513
            sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
1514
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE """ + "a." + fieldName + '=?'
1514
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE """ + "a." + fieldName + '=?'
1515 1515
            try:
1516 1516
                cursor.execute(sql, (param,))
1517 1517
                rows = cursor.fetchall()
......
1519 1519
                    symbolTuple = rows[0]
1520 1520
                    ret = symbol.SymbolBase(symbolTuple[1], symbolTuple[2], symbolTuple[3]
1521 1521
                                            , symbolTuple[4], symbolTuple[5], symbolTuple[6], symbolTuple[7], symbolTuple[8]
1522
                                            , symbolTuple[9], symbolTuple[10], symbolTuple[11], symbolTuple[12], symbolTuple[13], symbolTuple[14], symbolTuple[0]) ## uid is last item
1522
                                            , symbolTuple[9], symbolTuple[10], symbolTuple[11], symbolTuple[12], symbolTuple[13], symbolTuple[14], symbolTuple[0], detectFlip=symbolTuple[15]) ## uid is last item
1523 1523
            except Exception as ex:
1524 1524
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
1525 1525
        finally:
......
1540 1540
            cursor = conn.cursor()
1541 1541
            if fieldName is not None and param is not None:
1542 1542
                sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
1543
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel 
1543
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip
1544 1544
                        FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE SymbolType_UID = (select UID from SymbolType where Type=?)"""
1545 1545
            else:
1546 1546
                sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint,
1547
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID"""
1547
                        a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel,a.flip FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID"""
1548 1548
            try:
1549 1549
                cursor.execute(sql, (param,)) if param is not None else cursor.execute(sql)
1550 1550
                rows = cursor.fetchall()
......
1552 1552
                    for symbolTuple in rows:
1553 1553
                        sym = symbol.SymbolBase(symbolTuple[1], symbolTuple[2], symbolTuple[3], symbolTuple[4]
1554 1554
                                                , symbolTuple[5], symbolTuple[6], symbolTuple[7], symbolTuple[8], symbolTuple[9]
1555
                                                , symbolTuple[10], symbolTuple[11], symbolTuple[12], symbolTuple[13], symbolTuple[14], symbolTuple[0]) ## uid is last item
1555
                                                , symbolTuple[10], symbolTuple[11], symbolTuple[12], symbolTuple[13], symbolTuple[14], symbolTuple[0], detectFlip=symbolTuple[15]) ## uid is last item
1556 1556
                        ret.append(sym)
1557 1557
            except Exception as ex:
1558 1558
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
DTI_PID/DTI_PID/RecognitionDialog.py
573 573
            baseSymbol = targetSymbol.getBaseSymbol()
574 574
            additionalSymbol = targetSymbol.getAdditionalSymbol()
575 575
            isExceptDetect = targetSymbol.getIsExceptDetect()
576
            detectFlip = 1#targetSymbol.getDetectFlip()
576
            targetSymbol.getDetectFlip()
577 577
    
578 578
            # check if symbol file is target or not
579 579
            if isExceptDetect == 1:
DTI_PID/DTI_PID/SymbolEditorDialog.py
207 207
            self.ui.typeComboBox.setCurrentIndex(self.ui.typeComboBox.findText(self.selectedSymbol.getType()))
208 208
            self.ui.baseSymbolComboBox.setCurrentIndex(self.ui.baseSymbolComboBox.findText(self.selectedSymbol.getBaseSymbol()))
209 209
            self.ui.isExceptDetectCheckBox.setChecked(True if self.selectedSymbol.getIsExceptDetect() else False)
210
            self.ui.makeFlipCheckBox.setChecked(True if self.selectedSymbol.getDetectFlip() else False)
210 211
            
211 212
            self.ui.hasInstrumentLabelCheckBox.setChecked(True if self.selectedSymbol.getHasInstrumentLabel() else False)
212 213

  
......
376 377

  
377 378
        hasInstrumentLabel = 1 if self.ui.hasInstrumentLabelCheckBox.isChecked() else 0
378 379

  
380
        detectFlip = 1 if self.ui.makeFlipCheckBox.isChecked() else 0
381

  
379 382
        convertedThreshold = int(threshold) / 100.0
380 383

  
381 384
        imageWidth = width
382 385
        iamgeHeight = height
383 386

  
384 387
        self.newSym = symbol.SymbolBase(fileName, type, convertedThreshold, int(minMatchPoint), True, 
385
                        rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, uid, imageWidth, iamgeHeight)
388
                        rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, uid, imageWidth, iamgeHeight, detectFlip=detectFlip)
386 389

  
387 390
        return self.newSym
388 391
    

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)