444 |
444 |
if docData.imgName is None:
|
445 |
445 |
self.showImageSelectionMessageBox()
|
446 |
446 |
return
|
447 |
|
result = xg.writeXmlOnScene(docData.imgName, docData.imgWidth, docData.imgHeight, self.graphicsView.scene)
|
|
447 |
result = xg.writeXmlOnScene(docData.imgName, docData.imgWidth, docData.imgHeight)
|
448 |
448 |
|
449 |
449 |
if len(self.removedItems['LINE']):
|
450 |
450 |
docData.deleteLineDataList_LineNo(self.removedItems['LINE'])
|
... | ... | |
1253 |
1253 |
2018.11.05 euisung add db delete process before save
|
1254 |
1254 |
2018.11.12 euisung add title block properties
|
1255 |
1255 |
2018.11.12 euisung db part move new method to dbUpdate
|
|
1256 |
2018.11.26 euisung isolate scene adding part -> drawDetectedItemsToSecene()
|
1256 |
1257 |
'''
|
1257 |
1258 |
def drawDetectedItems(self, symbolList, textInfoList, otherTextInfoList, titleBlockTextInfoList):
|
1258 |
1259 |
try:
|
... | ... | |
1268 |
1269 |
QApplication.processEvents()
|
1269 |
1270 |
self.drawDetectedTitleBlockTextItem(titleBlockTextInfoList)
|
1270 |
1271 |
|
1271 |
|
self.drawDetectedItemsToSecene()
|
1272 |
|
|
1273 |
1272 |
self.dbUpdate()
|
1274 |
1273 |
self.saveToXml(False)
|
1275 |
1274 |
|
... | ... | |
1296 |
1295 |
for text in appDocData.texts:
|
1297 |
1296 |
self.addTextItemToScene(text)
|
1298 |
1297 |
|
|
1298 |
for line in appDocData.lines:
|
|
1299 |
self.graphicsView.scene.addItem(line)
|
|
1300 |
|
|
1301 |
for unknown in appDocData.unknowns:
|
|
1302 |
self.addUnknownItemToScene(unknown)
|
|
1303 |
|
|
1304 |
|
1299 |
1305 |
def postDetectLineProcess(self):
|
1300 |
1306 |
'''
|
1301 |
1307 |
@brief check allowables among undetected items
|
... | ... | |
1343 |
1349 |
@brief draw title block
|
1344 |
1350 |
@author euisung
|
1345 |
1351 |
@date 2018.11.12
|
|
1352 |
@history 2018.11.26 euisung remove scene dependency
|
1346 |
1353 |
'''
|
1347 |
1354 |
from TextItemFactory import TextItemFactory
|
1348 |
1355 |
import math
|
... | ... | |
1375 |
1382 |
@brief
|
1376 |
1383 |
@author humkyung
|
1377 |
1384 |
@date 2018.08.23
|
|
1385 |
@history 2018.11.26 euisung remove scene dependency
|
|
1386 |
2018.11.26 euisung isolate scene adding part -> drawDetectedItemsToSecene()
|
1378 |
1387 |
'''
|
1379 |
1388 |
def drawDetectedLines(self, lineList, worker):
|
1380 |
|
area = AppDocData.instance().getArea('Drawing')
|
|
1389 |
appDocData = AppDocData.instance()
|
|
1390 |
area = appDocData.getArea('Drawing')
|
1381 |
1391 |
|
1382 |
|
lines = []
|
1383 |
1392 |
for pts in lineList:
|
1384 |
1393 |
processLine = QEngineeringLineItem(vertices=[(area.x + param[0], area.y + param[1]) for param in pts])
|
1385 |
1394 |
processLine.area = 'Drawing'
|
1386 |
|
self.graphicsView.scene.addItem(processLine)
|
1387 |
|
lines.append(processLine)
|
|
1395 |
#self.graphicsView.scene.addItem(processLine)
|
|
1396 |
appDocData.lines.append(processLine)
|
1388 |
1397 |
|
1389 |
1398 |
if processLine.length() > 100: # TODO: check critical length
|
1390 |
1399 |
processLine.addFlowArrow()
|
... | ... | |
1395 |
1404 |
|
1396 |
1405 |
'''
|
1397 |
1406 |
history 2018.06.09 humkyung check length of original and connection point is 2 while parsing
|
|
1407 |
2018.11.26 euisung remove scene dependency
|
1398 |
1408 |
'''
|
1399 |
1409 |
def drawDetectedSymbolItem(self, symbolList):
|
1400 |
1410 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
... | ... | |
1454 |
1464 |
|
1455 |
1465 |
'''
|
1456 |
1466 |
@history 2018.06.08 Jeongwoo Add parameter on round method
|
1457 |
|
@history 2018.11.02 euisung Add save note text item
|
1458 |
|
@history 2018.11.05 euisung delete save note text item and move to drawDetectedItems()
|
|
1467 |
@history 2018.11.02 euisung Add save note text item
|
|
1468 |
@history 2018.11.05 euisung delete save note text item and move to drawDetectedItems()
|
|
1469 |
2018.11.26 euisung remove scene dependency
|
1459 |
1470 |
'''
|
1460 |
1471 |
def drawDetectedTextItem(self, textInfoList):
|
1461 |
1472 |
from TextItemFactory import TextItemFactory
|
... | ... | |
1529 |
1540 |
@history 2018.06.14 Jeongwoo Change method to add unknown item
|
1530 |
1541 |
2018.06.18 Jeongwoo Add connect on unknown item
|
1531 |
1542 |
Add [transfer] for using pyqtSignal
|
|
1543 |
2018.11.26 euisung remove scene dependency
|
|
1544 |
2018.11.26 euisung isolate scene adding part -> drawDetectedItemsToSecene()
|
1532 |
1545 |
'''
|
1533 |
1546 |
def drawUnknownItems(self):
|
1534 |
1547 |
from QEngineeringFlowArrowItem import QEngineeringFlowArrowItem
|
... | ... | |
1546 |
1559 |
imgDiff = cv2.threshold(cv2.cvtColor(cv2.imread(diffFilePath, 1), cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY)[1]
|
1547 |
1560 |
|
1548 |
1561 |
## remove line
|
1549 |
|
lines = [item for item in self.graphicsView.scene.items() if (type(item) is QEngineeringLineItem)]
|
|
1562 |
lines = docData.lines
|
1550 |
1563 |
for line in lines:
|
1551 |
1564 |
line.drawToImage(imgDiff, 255, thickness)
|
1552 |
1565 |
cv2.imwrite(diffFilePath, imgDiff)
|
... | ... | |
1586 |
1599 |
|
1587 |
1600 |
for item in diffItems:
|
1588 |
1601 |
item.transfer.onRemoved.connect(self.itemRemoved)
|
1589 |
|
self.addUnknownItemToScene(item)
|
|
1602 |
#self.addUnknownItemToScene(item)
|
|
1603 |
docData.unknowns.append(item)
|
1590 |
1604 |
|
1591 |
1605 |
notFilePath = os.path.join(project.getTempPath(), "NOT_" + os.path.basename(self.path))
|
1592 |
1606 |
cv2.imwrite(notFilePath, imgNot)
|