개정판 27ab77fc
issue #538: end_break testing
Change-Id: I4f32cc102f44b414e4fe1ee9d233c7cc7ca807d4
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
495 | 495 |
for lineNo in lineNos: |
496 | 496 |
lineNo_froms.append(lineNo.prop('From')) |
497 | 497 |
lineNo_tos.append(lineNo.prop('To')) |
498 |
end_breaks.extend(lineNo.end_break()) |
|
498 |
#end_breaks.extend(lineNo.end_break()) |
|
499 |
|
|
500 |
for line_end in lineNo_froms + lineNo_tos: |
|
501 |
for connector in line_end.connectors: |
|
502 |
if connector.connectedItem is not None and connector.connectedItem.owner is not line_end.owner: |
|
503 |
end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath) |
|
504 |
pt = [connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]), connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])] |
|
505 |
origin = [0,0] |
|
506 |
if 2 == len(symbol.getOriginalPoint().split(',')): |
|
507 |
tokens = symbol.getOriginalPoint().split(',') |
|
508 |
origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])] |
|
509 |
end_break.buildItem(svgFileName, symbol.getType(), 5.7, pt, [end_break.boundingRect().width(), end_break.boundingRect().height()], origin, [], symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel()) |
|
510 |
|
|
511 |
end_break.set_property('Connected Item', connector.connectedItem) |
|
512 |
end_break.setToolTip('owner : ' + str(line_end)) |
|
513 |
end_break.area = 'Drawing' |
|
514 |
end_break.owner = line_end |
|
515 |
end_breaks.append(end_break) |
|
499 | 516 |
|
517 |
''' |
|
500 | 518 |
for lineNo_from in lineNo_froms + lineNo_tos: |
501 | 519 |
for connector in lineNo_from.connectors: |
502 | 520 |
for lineNo_to in lineNo_tos + lineNo_froms: |
... | ... | |
515 | 533 |
end_break.area = 'Drawing' |
516 | 534 |
end_break.owner = lineNo_from |
517 | 535 |
end_breaks.append(end_break) |
536 |
''' |
|
518 | 537 |
|
519 | 538 |
if end_breaks: |
520 | 539 |
# check dulplication |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
369 | 369 |
@brief end break check |
370 | 370 |
@author euisung |
371 | 371 |
@date 2019.05.07 |
372 |
@history 2019.05.19 euisung can cover only line to line, line to symbol and symbol to symbol will be checked in linenotracer
|
|
372 |
@history 2019.05.19 euisung can cover at both end that contact other line's middle
|
|
373 | 373 |
''' |
374 | 374 |
from EngineeringLineItem import QEngineeringLineItem |
375 | 375 |
from SymbolSvgItem import SymbolSvgItem |
... | ... | |
385 | 385 |
end_break_names = docdata.getSymbolListByType('type', 'End Break') |
386 | 386 |
if len(end_break_names) is 0: |
387 | 387 |
return end_breaks |
388 |
|
|
388 |
|
|
389 | 389 |
svgFileName = end_break_names[0].sName |
390 | 390 |
symbol = AppDocData.instance().getSymbolByQuery('name', svgFileName) |
391 | 391 |
svgFilePath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), symbol.getType(), svgFileName+'.svg') |
392 |
|
|
393 | 392 |
|
393 |
for line_end in [line_from, line_to]: |
|
394 |
for connector in line_end.connectors: |
|
395 |
if connector.connectedItem is not None and connector.connectedItem.owner is not self: |
|
396 |
end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath) |
|
397 |
pt = [connector.center()[0] - float(symbol.getOriginalPoint().split(',')[0]), connector.center()[1] - float(symbol.getOriginalPoint().split(',')[1])] |
|
398 |
origin = [0,0] |
|
399 |
if 2 == len(symbol.getOriginalPoint().split(',')): |
|
400 |
tokens = symbol.getOriginalPoint().split(',') |
|
401 |
origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])] |
|
402 |
end_break.buildItem(svgFileName, symbol.getType(), 5.7, pt, [end_break.boundingRect().width(), end_break.boundingRect().height()], origin, [], symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel()) |
|
403 |
|
|
404 |
end_break.set_property('Connected Item', connector.connectedItem) |
|
405 |
end_break.setToolTip('owner : ' + str(line_end)) |
|
406 |
end_break.area = 'Drawing' |
|
407 |
end_break.owner = line_end |
|
408 |
end_breaks.append(end_break) |
|
409 |
|
|
410 |
''' |
|
411 |
svgFileName = end_break_names[0].sName |
|
412 |
symbol = AppDocData.instance().getSymbolByQuery('name', svgFileName) |
|
413 |
svgFilePath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), symbol.getType(), svgFileName+'.svg') |
|
414 |
|
|
394 | 415 |
if type(line_from) is QEngineeringLineItem and line_from.connectors[0].connectedItem is not None and type(line_from.connectors[0].connectedItem) is QEngineeringLineItem: |
395 | 416 |
end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath) |
396 | 417 |
pt = [line_from.connectors[0].center()[0] - float(symbol.getOriginalPoint().split(',')[0]), line_from.connectors[0].center()[1] - float(symbol.getOriginalPoint().split(',')[1])] |
... | ... | |
399 | 420 |
tokens = symbol.getOriginalPoint().split(',') |
400 | 421 |
origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])] |
401 | 422 |
end_break.buildItem(svgFileName, symbol.getType(), 5.7, pt, [end_break.boundingRect().width(), end_break.boundingRect().height()], origin, [], symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel()) |
402 |
#end_break.connected_lines = [line_from.uid, line_from.connectors[0].connectedItem.uid] |
|
403 |
#attrs = end_break.getAttributes() |
|
404 |
#for attr in attrs.keys(): |
|
405 |
# if attr.Attribute == 'Connected Line': |
|
406 |
# attrs[attr] = str(line_from.connectors[0].connectedItem.uid) |
|
407 | 423 |
for prop, value in end_break.properties.items(): |
408 | 424 |
if prop.Attribute == 'Connected Item': |
409 | 425 |
end_break.properties[prop] = line_to.connectors[0].connectedItem |
... | ... | |
420 | 436 |
tokens = symbol.getOriginalPoint().split(',') |
421 | 437 |
origin = [pt[0] + float(tokens[0]), pt[1] + float(tokens[1])] |
422 | 438 |
end_break.buildItem(svgFileName, symbol.getType(), 5.7, pt, [end_break.boundingRect().width(), end_break.boundingRect().height()], origin, [], symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getHasInstrumentLabel()) |
423 |
#end_break.connected_lines = [line_to.uid, line_to.connectors[1].connectedItem.uid] |
|
424 |
#attrs = end_break.getAttributes() |
|
425 |
#for attr in attrs.keys(): |
|
426 |
# if attr.Attribute == 'Connected Line': |
|
427 |
# attrs[attr] = str(line_to.connectors[1].connectedItem.uid) |
|
428 | 439 |
for prop, value in end_break.properties.items(): |
429 | 440 |
if prop.Attribute == 'Connected Item': |
430 | 441 |
end_break.properties[prop] = line_to.connectors[1].connectedItem |
... | ... | |
432 | 443 |
end_break.area = 'Drawing' |
433 | 444 |
end_break.owner = line_to |
434 | 445 |
end_breaks.append(end_break) |
435 |
''' |
|
436 |
end_break = SymbolSvgItem.createItem('End Break', dataPath) |
|
437 |
end_break.setPosition(line_to.connectors[1].center(), origin) |
|
438 |
#end_break.parent = self |
|
439 |
end_break.connected_lines = [line_to.uid, line_to.connectors[1].connectedItem.uid] |
|
440 |
end_break.setToolTip(str(end_break.connected_lines)) |
|
441 |
end_break.area = 'Drawing' |
|
442 |
end_break.name = 'End Break' |
|
443 |
end_breaks.append(end_break) |
|
444 |
''' |
|
446 |
''' |
|
445 | 447 |
|
446 | 448 |
except Exception as ex: |
447 | 449 |
from App import App |
내보내기 Unified diff