개정판 47ce8e9c
issue #501: symbol db size update
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
439 | 439 |
conn = sqlite3.connect(dbPath) |
440 | 440 |
|
441 | 441 |
INSERT_SYMBOL_SQL = ''' |
442 |
INSERT INTO Symbol(name, type, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel) |
|
443 |
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); |
|
442 |
INSERT INTO Symbol(name, type, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, width, height)
|
|
443 |
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
|
444 | 444 |
''' |
445 | 445 |
|
446 | 446 |
cursor = conn.cursor() |
... | ... | |
448 | 448 |
, symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount() |
449 | 449 |
, symbol.getOcrOption(), symbol.getIsContainChild() |
450 | 450 |
, symbol.getOriginalPoint(), symbol.getConnectionPoint() |
451 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel()) |
|
451 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel() |
|
452 |
, symbol.width, symbol.height) |
|
452 | 453 |
cursor.execute(INSERT_SYMBOL_SQL, query) |
453 | 454 |
conn.commit() |
454 | 455 |
isAdded = True |
... | ... | |
477 | 478 |
SET |
478 | 479 |
name = ?, type = ?, threshold = ?, minMatchPoint = ?, isDetectOrigin = ?, |
479 | 480 |
rotationCount = ?, ocrOption = ?, isContainChild = ?, originalPoint = ?, connectionPoint = ?, |
480 |
baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ? |
|
481 |
baseSymbol = ?, additionalSymbol = ?, isExceptDetect = ?, hasInstrumentLabel = ?, width = ?, height = ?
|
|
481 | 482 |
WHERE uid = ? |
482 | 483 |
''' |
483 | 484 |
|
... | ... | |
486 | 487 |
, symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount() |
487 | 488 |
, symbol.getOcrOption(), symbol.getIsContainChild() |
488 | 489 |
, symbol.getOriginalPoint(), symbol.getConnectionPoint() |
489 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel(), symbol.getUid()) |
|
490 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getIsExceptDetect(), symbol.getHasInstrumentLabel(), symbol.width, symbol.height, symbol.getUid())
|
|
490 | 491 |
cursor.execute(UPDATE_SYMBOL_SQL, query) |
491 | 492 |
conn.commit() |
492 | 493 |
isUpdated = True |
DTI_PID/DTI_PID/SymbolBase.py | ||
---|---|---|
6 | 6 |
def __init__(self, sName, sType, threshold = None, minMatchCount = 0 |
7 | 7 |
, isDetectOnOrigin = False, rotationCount = 4, ocrOption = OCR_OPTION_NOT_EXEC, isContainChild = 0 |
8 | 8 |
, originalPoint = None, connectionPoint = None, baseSymbol = None, additionalSymbol = None |
9 |
, isExceptDetect = 0, hasInstrumentLabel = 0, uid = None): |
|
9 |
, isExceptDetect = 0, hasInstrumentLabel = 0, uid = None, width = None, height = None):
|
|
10 | 10 |
self.uid = uid ## Auto increased Unique Id |
11 | 11 |
self.sName = sName |
12 | 12 |
self.sType = sType |
... | ... | |
23 | 23 |
self.isExceptDetect = isExceptDetect |
24 | 24 |
self.hasInstrumentLabel = hasInstrumentLabel |
25 | 25 |
self._owner = None |
26 |
self.width = width |
|
27 |
self.height = height |
|
26 | 28 |
|
27 | 29 |
def setUid(self, uid): |
28 | 30 |
self.uid = uid |
DTI_PID/DTI_PID/SymbolEditorDialog.py | ||
---|---|---|
310 | 310 |
@brief Make symbol object for saving on DB |
311 | 311 |
@history 2018.05.02 Jeongwoo newSym object changed self.newSym |
312 | 312 |
''' |
313 |
def makeSymbolData(self): |
|
313 |
def makeSymbolData(self, width, height):
|
|
314 | 314 |
uid = -1 |
315 | 315 |
if self.selectedSymbol is not None: |
316 | 316 |
uid = self.selectedSymbol.getUid() |
... | ... | |
341 | 341 |
|
342 | 342 |
convertedThreshold = int(threshold) / 100.0 |
343 | 343 |
|
344 |
imageWidth = width |
|
345 |
iamgeHeight = height |
|
346 |
|
|
344 | 347 |
self.newSym = symbol.SymbolBase(fileName, type, convertedThreshold, int(minMatchPoint), True, |
345 |
rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, uid) |
|
348 |
rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol, isExceptDetect, hasInstrumentLabel, uid, imageWidth, iamgeHeight)
|
|
346 | 349 |
|
347 | 350 |
return self.newSym |
348 | 351 |
|
... | ... | |
392 | 395 |
isValid, exceptionMsg = self.isValidSymbolInfo() |
393 | 396 |
if isValid: |
394 | 397 |
if self.selectedSymbol is None: |
395 |
isSuccess, fileType, fileName, imagePath = AppDocData.instance().insertSymbol(self.makeSymbolData()) |
|
398 |
isSuccess, fileType, fileName, imagePath = AppDocData.instance().insertSymbol(self.makeSymbolData(self.ui.imageView.image().width(), self.ui.imageView.image().height()))
|
|
396 | 399 |
else: |
397 |
isSuccess, fileType, fileName, imagePath = AppDocData.instance().updateSymbol(self.makeSymbolData()) |
|
400 |
isSuccess, fileType, fileName, imagePath = AppDocData.instance().updateSymbol(self.makeSymbolData(self.ui.imageView.image().width(), self.ui.imageView.image().height()))
|
|
398 | 401 |
|
399 | 402 |
if isSuccess: |
400 | 403 |
try: |
내보내기 Unified diff