36 |
36 |
from GraphicsBoundingBoxItem import QGraphicsBoundingBoxItem
|
37 |
37 |
from EngineeringTextItem import QEngineeringTextItem
|
38 |
38 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem
|
|
39 |
from EngineeringTextItem import QEngineeringTextItem
|
39 |
40 |
from EngineeringNoteItem import QEngineeringNoteItem
|
40 |
41 |
from QEngineeringSizeTextItem import QEngineeringSizeTextItem
|
41 |
42 |
from EngineeringUnknownItem import QEngineeringUnknownItem
|
... | ... | |
367 |
368 |
items = [item for item in self.graphicsView.scene.items() if issubclass(type(item), QEngineeringTextItem)]
|
368 |
369 |
self.labelTextStatus.setText("<font color='blue'>텍스트 : {}</font>".format(len(items)))
|
369 |
370 |
|
|
371 |
def dbUpdate(self):
|
|
372 |
'''
|
|
373 |
@brief db update when save or recognition
|
|
374 |
@author euisung
|
|
375 |
@date 2018.11.12
|
|
376 |
'''
|
|
377 |
from AppDocData import AppDocData
|
|
378 |
|
|
379 |
appDocData = AppDocData.instance()
|
|
380 |
|
|
381 |
appDocData.deleteDataListBeforeSave()
|
|
382 |
|
|
383 |
titleBlockProps = appDocData.getTitleBlockProperties()
|
|
384 |
items = self.graphicsView.scene.items()
|
|
385 |
titleBlockItems = []
|
|
386 |
for item in items:
|
|
387 |
if type(item) is QEngineeringLineNoTextItem:
|
|
388 |
item.saveLineData()
|
|
389 |
|
|
390 |
elif type(item) is QEngineeringTextItem:
|
|
391 |
for titleBlockProp in titleBlockProps:
|
|
392 |
if item.area == titleBlockProp[0]:
|
|
393 |
titleBlockItems.append(item)
|
|
394 |
|
|
395 |
dbItems = [item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or\
|
|
396 |
type(item) is QEngineeringNoteItem] + titleBlockItems
|
|
397 |
appDocData.saveToDatabase(dbItems)
|
|
398 |
|
370 |
399 |
'''
|
371 |
400 |
@brief action save click event
|
372 |
401 |
@author kyouho
|
... | ... | |
375 |
404 |
humkyung save saved time to database
|
376 |
405 |
2018.11.05 euisung add note data list db update
|
377 |
406 |
2018.11.05 euisung add db delete process before save
|
|
407 |
2018.11.12 euisung db part move new method to dbUpdate
|
378 |
408 |
'''
|
379 |
409 |
def actionSaveCliked(self):
|
380 |
410 |
from datetime import datetime
|
... | ... | |
384 |
414 |
if appDocData.imgName is None:
|
385 |
415 |
self.showImageSelectionMessageBox()
|
386 |
416 |
return
|
387 |
|
appDocData.deleteDataListBeforeSave()
|
388 |
417 |
|
389 |
418 |
appDocData.equipments.clear()
|
390 |
419 |
appDocData.symbols.clear()
|
391 |
420 |
appDocData.lineNos.clear()
|
392 |
421 |
appDocData.texts.clear()
|
393 |
422 |
|
394 |
|
items = self.graphicsView.scene.items()
|
395 |
|
for item in items:
|
396 |
|
if type(item) is QEngineeringLineNoTextItem:
|
397 |
|
item.saveLineData()
|
398 |
|
|
399 |
|
appDocData.saveToDatabase([item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or\
|
400 |
|
type(item) is QEngineeringNoteItem])
|
401 |
|
|
|
423 |
self.dbUpdate()
|
402 |
424 |
self.saveToXml(True)
|
403 |
425 |
|
404 |
426 |
drawings = appDocData.getDrawings()
|
... | ... | |
1174 |
1196 |
2018.11.05 euisung add save note item because of dependency
|
1175 |
1197 |
2018.11.05 euisung add db delete process before save
|
1176 |
1198 |
2018.11.12 euisung add title block properties
|
|
1199 |
2018.11.12 euisung db part move new method to dbUpdate
|
1177 |
1200 |
'''
|
1178 |
1201 |
def drawDetectedItems(self, symbolList, textInfoList, otherTextInfoList, titleBlockTextInfoList):
|
1179 |
1202 |
try:
|
... | ... | |
1186 |
1209 |
self.drawDetectedTextItem(textInfoList)
|
1187 |
1210 |
QApplication.processEvents()
|
1188 |
1211 |
self.drawDetectedOtherTextItem(otherTextInfoList)
|
1189 |
|
#QApplication.processEvents()
|
1190 |
|
#self.drawDetectedTitleBlockTextItem(titleBlockTextInfoList)
|
1191 |
|
|
1192 |
|
appDocData.deleteDataListBeforeSave()
|
1193 |
|
|
1194 |
|
items = self.graphicsView.scene.items()
|
1195 |
|
for item in items:
|
1196 |
|
if type(item) is QEngineeringLineNoTextItem:
|
1197 |
|
item.saveLineData()
|
1198 |
|
|
1199 |
|
appDocData.saveToDatabase([item for item in items if type(item) is QEngineeringInstrumentItem or type(item) is QEngineeringEquipmentItem or\
|
1200 |
|
type(item) is QEngineeringNoteItem])
|
|
1212 |
QApplication.processEvents()
|
|
1213 |
self.drawDetectedTitleBlockTextItem(titleBlockTextInfoList)
|
1201 |
1214 |
|
|
1215 |
self.dbUpdate()
|
1202 |
1216 |
self.saveToXml(False)
|
1203 |
1217 |
|
1204 |
1218 |
# update scene
|
... | ... | |
1221 |
1235 |
|
1222 |
1236 |
# parse texts
|
1223 |
1237 |
for textInfo in textInfoList:
|
1224 |
|
x = textInfo.getX()
|
1225 |
|
y = textInfo.getY()
|
1226 |
|
width = textInfo.getW()
|
1227 |
|
height = textInfo.getH()
|
1228 |
|
angle = round(math.radians(textInfo.getAngle()), 2)
|
1229 |
|
text = textInfo.getText()
|
|
1238 |
x = textInfo[1][0].getX()
|
|
1239 |
y = textInfo[1][0].getY()
|
|
1240 |
width = textInfo[1][0].getW()
|
|
1241 |
height = textInfo[1][0].getH()
|
|
1242 |
angle = round(math.radians(textInfo[1][0].getAngle()), 2)
|
|
1243 |
text = textInfo[1][0].getText()
|
1230 |
1244 |
item = TextItemFactory.instance().createTextItem(text)
|
1231 |
1245 |
|
1232 |
1246 |
if item is not None:
|
... | ... | |
1234 |
1248 |
item.size = (width, height)
|
1235 |
1249 |
item.angle = angle
|
1236 |
1250 |
item.setPlainText(text)
|
1237 |
|
item.area = 'Title Block'
|
|
1251 |
item.area = textInfo[0]
|
1238 |
1252 |
self.addTextItemToScene(item)
|
1239 |
1253 |
appDocData.texts.append(item)
|
1240 |
1254 |
except Exception as ex:
|