개정판 789d0d3a
issue #663: flip svg(valve) only
Change-Id: I83cea82a03d454bd3e2407fddf6f8a1dc99fede8
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
529 | 529 |
conn = sqlite3.connect(dbPath) |
530 | 530 |
cursor = conn.cursor() |
531 | 531 |
sql = """SELECT a.UID,a.Name,b.Type,a.Threshold,a.MinMatchPoint,a.IsDetectOrigin,a.RotationCount,a.OCROption,a.IsContainChild,a.OriginalPoint,a.ConnectionPoint, |
532 |
a.BaseSymbol,a.AdditionalSymbol,a.IsExceptDetect,a.HasInstrumentLabel FROM Symbol a inner join SymbolType b on a.SymbolType_UID=b.UID WHERE a.IsExceptDetect = 0 order by width * height desc""" |
|
532 |
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.IsExceptDetect = 0 order by width * height desc"""
|
|
533 | 533 |
try: |
534 | 534 |
cursor.execute(sql) |
535 | 535 |
rows = cursor.fetchall() |
536 | 536 |
for row in rows: |
537 |
sym = symbol.SymbolBase(row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[0]) ## uid is last item |
|
537 |
sym = symbol.SymbolBase(row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[0], detectFlip=row[15]) ## uid is last item
|
|
538 | 538 |
targetSymbolList.append(sym) |
539 | 539 |
except Exception as ex: |
540 | 540 |
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/MainWindow.py | ||
---|---|---|
1638 | 1638 |
svg = SymbolSvgItem.createItem(_type, svgFilePath, flip=flip) |
1639 | 1639 |
#print(pt) |
1640 | 1640 |
#print(origin) |
1641 |
svg.buildItem(name, _type, angle, pt, size, origin, connPts, parentSymbol, childSymbol, hasInstrumentLabel, flip=flip)
|
|
1641 |
svg.buildItem(name, _type, angle, pt, size, origin, connPts, parentSymbol, childSymbol, hasInstrumentLabel) |
|
1642 | 1642 |
svg.reCalculationRotatedItem() |
1643 | 1643 |
svg.area = 'Drawing' |
1644 | 1644 |
|
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
573 | 573 |
baseSymbol = targetSymbol.getBaseSymbol() |
574 | 574 |
additionalSymbol = targetSymbol.getAdditionalSymbol() |
575 | 575 |
isExceptDetect = targetSymbol.getIsExceptDetect() |
576 |
targetSymbol.getDetectFlip() |
|
576 |
detectFlip = targetSymbol.getDetectFlip()
|
|
577 | 577 |
|
578 | 578 |
# check if symbol file is target or not |
579 | 579 |
if isExceptDetect == 1: |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
191 | 191 |
@history 2018.05.09 Jeongwoo Clear self.connectors |
192 | 192 |
2018.05.30 Jeongwoo Add parameters (parentSymbol, childSymbol) |
193 | 193 |
''' |
194 |
def buildItem(self, name, type, angle, loc, size, origin, connPts, parentSymbol, childSymbol, hasInstrumentLabel, flip=None):
|
|
194 |
def buildItem(self, name, type, angle, loc, size, origin, connPts, parentSymbol, childSymbol, hasInstrumentLabel): |
|
195 | 195 |
try: |
196 | 196 |
docData = AppDocData.instance() |
197 | 197 |
self.name = name |
... | ... | |
203 | 203 |
symbolInfo = docData.getSymbolByQuery('name', name) |
204 | 204 |
originalPoint = symbolInfo.getOriginalPoint().split(',') |
205 | 205 |
self.symbolOrigin = [float(originalPoint[0]), float(originalPoint[1])] |
206 |
if flip is 1: |
|
206 |
if self.flip is 1:
|
|
207 | 207 |
self.symbolOrigin[0] = self.size[0] - self.symbolOrigin[0] |
208 | 208 |
|
209 | 209 |
# setting connectors |
... | ... | |
783 | 783 |
areaNode.text = self.area |
784 | 784 |
node.append(areaNode) |
785 | 785 |
|
786 |
flipNode = Element('FLIP') |
|
787 |
flipNode.text = str(self.flip) |
|
788 |
node.append(flipNode) |
|
789 |
#print('a') |
|
790 |
|
|
786 | 791 |
attributesNode = Element('SYMBOLATTRIBUTES') |
787 | 792 |
_attrs = self.getAttributes() |
788 | 793 |
for attr in _attrs: |
... | ... | |
855 | 860 |
hasInstrumentLabelNode = node.find('HASINSTRUMENTLABEL') |
856 | 861 |
hasInstrumentLabel = hasInstrumentLabelNode.text if hasInstrumentLabelNode is not None else 'False' |
857 | 862 |
|
863 |
flipLabelNode = node.find('FLIP') |
|
864 |
flipLabel = int(flipLabelNode.text) if flipLabelNode is not None else None |
|
865 |
|
|
858 | 866 |
appDocData = AppDocData.instance() |
859 | 867 |
project = appDocData.getCurrentProject() |
860 | 868 |
svgFilePath = os.path.join(project.getSvgFilePath(), _type, name + '.svg') |
861 | 869 |
if os.path.isfile(svgFilePath): |
862 |
item[0] = SymbolSvgItem.createItem(_type, svgFilePath, uid) |
|
870 |
item[0] = SymbolSvgItem.createItem(_type, svgFilePath, uid, flip=flipLabel)
|
|
863 | 871 |
item[0].setVisible(False) |
864 | 872 |
item[0].buildItem(name, _type, angle, pt, size, origin, connPts, baseSymbol, childSymbol, hasInstrumentLabel) |
865 | 873 |
|
내보내기 Unified diff