프로젝트

일반

사용자정보

개정판 22fdbd0b

ID22fdbd0be4dd4f11ad4982fbbb39b48bde0f2577
상위 6d46bd8c
하위 592167a8

백흠경이(가) 6년 이상 전에 추가함

Add HMB table script

차이점 보기:

DTI_PID/DTI_PID.sln
1 1

2 2
Microsoft Visual Studio Solution File, Format Version 12.00
3 3
# Visual Studio 15
4
VisualStudioVersion = 15.0.26430.14
4
VisualStudioVersion = 15.0.27130.2027
5 5
MinimumVisualStudioVersion = 10.0.40219.1
6 6
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "DTI_PID", "DTI_PID\DTI_PID.pyproj", "{7C2E55A3-2B16-4B4F-867F-F16E2EF6F2F0}"
7 7
EndProject
8 8
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SPPIDConverter", "SPPIDConverter\SPPIDConverter.vbproj", "{60285A68-977E-4CBE-BD3E-5224BFA9D799}"
9 9
EndProject
10
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDF_TO_IMAGE", "PDF_TO_IMAGE\PDF_TO_IMAGE.csproj", "{B7B8B0AE-9F03-4543-BC05-813A25E9D584}"
11
EndProject
10 12
Global
11 13
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 14
		Debug|Any CPU = Debug|Any CPU
15
		Debug|x64 = Debug|x64
13 16
		Release|Any CPU = Release|Any CPU
17
		Release|x64 = Release|x64
14 18
	EndGlobalSection
15 19
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 20
		{7C2E55A3-2B16-4B4F-867F-F16E2EF6F2F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21
		{7C2E55A3-2B16-4B4F-867F-F16E2EF6F2F0}.Debug|x64.ActiveCfg = Debug|Any CPU
17 22
		{7C2E55A3-2B16-4B4F-867F-F16E2EF6F2F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
23
		{7C2E55A3-2B16-4B4F-867F-F16E2EF6F2F0}.Release|x64.ActiveCfg = Release|Any CPU
18 24
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 25
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Debug|Any CPU.Build.0 = Debug|Any CPU
26
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Debug|x64.ActiveCfg = Debug|Any CPU
27
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Debug|x64.Build.0 = Debug|Any CPU
20 28
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 29
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Release|Any CPU.Build.0 = Release|Any CPU
30
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Release|x64.ActiveCfg = Release|Any CPU
31
		{60285A68-977E-4CBE-BD3E-5224BFA9D799}.Release|x64.Build.0 = Release|Any CPU
32
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Debug|Any CPU.Build.0 = Debug|Any CPU
34
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Debug|x64.ActiveCfg = Debug|x64
35
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Debug|x64.Build.0 = Debug|x64
36
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Release|Any CPU.ActiveCfg = Release|Any CPU
37
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Release|Any CPU.Build.0 = Release|Any CPU
38
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Release|x64.ActiveCfg = Release|x64
39
		{B7B8B0AE-9F03-4543-BC05-813A25E9D584}.Release|x64.Build.0 = Release|x64
22 40
	EndGlobalSection
23 41
	GlobalSection(SolutionProperties) = preSolution
24 42
		HideSolutionNode = FALSE
DTI_PID/DTI_PID/AppDocData.py
550 550
        @author     Jeongwoo
551 551
        @date       18.05.08
552 552
        @history    humkyung 2018.06.19 make 'Tile' directory
553
                    humkyung 2018.07.09 make drawing folder if not exists
553 554
    '''
554 555
    def makeChildDir(self):
555 556
        project = AppDocData.instance().getCurrentProject()
......
568 569
        tempDir = project.getTempPath()
569 570
        if not os.path.exists(tempDir):
570 571
            os.makedirs(tempDir)
572
        drawingPath = project.getDrawingFilePath()
573
        if not os.path.exists(drawingPath):
574
            os.makedirs(drawingPath)
571 575
        
572 576
        path = os.path.join(tempDir, 'Tile')
573 577
        if not os.path.exists(path):
DTI_PID/DTI_PID/DTI_PID.py
419 419
                searchedItemSp = (roiItemSp[0]+pt[0] + round(offsetDrawingArea[0]), roiItemSp[1]+pt[1] + round(offsetDrawingArea[1]))
420 420

  
421 421
                for i in range(len(searchedSymbolList)):
422
                    '''
422 423
                    _pt = searchedSymbolList[i].getSp()
423 424
                    rect = QRectF(_pt[0], _pt[1], searchedSymbolList[i].getWidth(), searchedSymbolList[i].getHeight())
424 425
                    _rect = QRectF(searchedItemSp[0], searchedItemSp[1], sw, sh)
425 426
                    if rect.intersects(_rect):
426 427
                        intersect = rect.intersected(_rect)
427 428
                        overlapArea = intersect.width()*intersect.height()
428
                        if overlapArea > ACCEPT_OVERLAY_AREA:
429
                        if overlapArea > sw*sh*0.1:
429 430
                            symbolIndex = i
430 431
                            break
431

  
432 432
                    '''
433 433
                    overlapArea = contains(searchedSymbolList[i], searchedItemSp, sw, sh)
434 434
                    if overlapArea > ACCEPT_OVERLAY_AREA:
435 435
                        symbolIndex = i
436 436
                        break
437
                    '''
438 437
                        
439 438
                hitRate = tmRes[pt[1], pt[0]]
440 439
                ## DEBUG
DTI_PID/DTI_PID/DTI_PID_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file '.\UI\DTI__PID.ui'
3
# Form implementation generated from reading ui file '.\ui\DTI__PID.ui'
4 4
#
5 5
# Created by: PyQt5 UI code generator 5.10.1
6 6
#
......
35 35
        self.menu_2.setObjectName("menu_2")
36 36
        self.menu_3 = QtWidgets.QMenu(self.menubar)
37 37
        self.menu_3.setObjectName("menu_3")
38
        self.menu_4 = QtWidgets.QMenu(self.menubar)
39
        self.menu_4.setObjectName("menu_4")
38 40
        MainWindow.setMenuBar(self.menubar)
39 41
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
40 42
        self.statusbar.setObjectName("statusbar")
......
255 257
        font.setFamily("맑은 고딕")
256 258
        self.actionFluid_Code.setFont(font)
257 259
        self.actionFluid_Code.setObjectName("actionFluid_Code")
260
        self.actionpdf_to_image = QtWidgets.QAction(MainWindow)
261
        font = QtGui.QFont()
262
        font.setFamily("맑은 고딕")
263
        self.actionpdf_to_image.setFont(font)
264
        self.actionpdf_to_image.setObjectName("actionpdf_to_image")
258 265
        self.menu.addAction(self.actionOpen)
259 266
        self.menu.addAction(self.actionArea)
260 267
        self.menu.addAction(self.actionConfiguration)
......
272 279
        self.menu_3.addAction(self.actionViewLine)
273 280
        self.menu_3.addSeparator()
274 281
        self.menu_3.addAction(self.actionViewUnknown)
282
        self.menu_4.addAction(self.actionpdf_to_image)
275 283
        self.menubar.addAction(self.menu.menuAction())
276 284
        self.menubar.addAction(self.menu_2.menuAction())
277 285
        self.menubar.addAction(self.menu_3.menuAction())
286
        self.menubar.addAction(self.menu_4.menuAction())
278 287
        self.toolBar.addAction(self.actionOpen)
279 288
        self.toolBar.addAction(self.actionRecognition)
280 289
        self.toolBar.addAction(self.actionLineRecognition)
......
301 310
        self.menu.setTitle(_translate("MainWindow", "파일"))
302 311
        self.menu_2.setTitle(_translate("MainWindow", "데이타"))
303 312
        self.menu_3.setTitle(_translate("MainWindow", "보기"))
313
        self.menu_4.setTitle(_translate("MainWindow", "툴"))
304 314
        self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
305 315
        self.dockWidget.setWindowTitle(_translate("MainWindow", "심볼 탐색기"))
306 316
        self.pushButtonCreateSymbol.setText(_translate("MainWindow", "생성"))
......
339 349
        self.actionViewUnknown.setText(_translate("MainWindow", "미인식"))
340 350
        self.actionNominalPipeSize.setText(_translate("MainWindow", "Nominal Pipe Size"))
341 351
        self.actionFluid_Code.setText(_translate("MainWindow", "Fluid Code"))
352
        self.actionpdf_to_image.setText(_translate("MainWindow", "PDF 변환"))
342 353

  
343 354

  
344 355
if __name__ == "__main__":
DTI_PID/DTI_PID/MainWindow.py
151 151
        self.actionViewUnknown.triggered.connect(self.onViewUnknown)
152 152
        self.actionZoom.triggered.connect(self.areaZoom)
153 153
        self.actionFitWindow.triggered.connect(self.fitWindow)
154
        self.actionpdf_to_image.triggered.connect(self.onConvertPDFToImage)
154 155
        self.graphicsView.scene.changed.connect(lambda: self.resultTreeWidget.sceneChanged(self.graphicsView.scene.items()))
155 156
        self.graphicsView.scene.selectionChanged.connect(self.onSelectionChanged)
156 157
        self.actionInitialize.triggered.connect(self.initializeScene)
......
175 176
        self.graphicsView.zoomImageInit()
176 177

  
177 178
    '''
179
        @brief      convert to selected pdf to image
180
        @author     humkyung 
181
        @date       2018.07.09
182
    '''
183
    def onConvertPDFToImage(self):
184
        from pdf2image import convert_from_path
185

  
186
        try:
187
            options = QFileDialog.Options()
188
            options |= QFileDialog.DontUseNativeDialog
189
            if QT_VERSION_STR[0] == '4':
190
                fileName = QFileDialog.getOpenFileName(self, "Open PDF file", os.getcwd(), "PDF files(*.pdf)", options=options)
191
            elif QT_VERSION_STR[0] == '5':
192
                fileName, dummy = QFileDialog.getOpenFileName(self, "Open PDF file", os.getcwd(), "PDF files(*.pdf)", options=options)
193

  
194
            if len(fileName) and os.path.isfile(fileName):
195
                pages = convert_from_path(fileName, 500)
196
                for page in pages:
197
                    page.save('d:\\Projects\\DTIPID\\LPG\\drawings\\out.png', 'PNG')
198
        except Exception as ex:
199
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
200

  
201
    '''
178 202
        @brief      selection changed
179 203
        @author     humkyung
180 204
        @date       2018.06.27
DTI_PID/DTI_PID/Project.py
29 29
        return self.path
30 30

  
31 31
    '''
32
        @brief  return drawing file path
33
        @author humkyung
34
        @date   2018.07.09
35
    '''
36
    def getDrawingFilePath(self):
37
        return os.path.join(self.getPath(), 'drawings')
38

  
39
    '''
32 40
        @brief  return output path
33 41
        @author humkyung
34 42
        @date   2018.04.10
35 43
    '''
36 44
    def getOutputPath(self):
37
        return self.getPath() + '/output'
45
        return os.path.join(self.getPath(), 'output')
38 46

  
39 47
    '''
40 48
        @brief  return image file path
......
42 50
        @date   2018.04.10
43 51
    '''
44 52
    def getImageFilePath(self):
45
        return self.getPath() + '/image'
53
        return os.path.join(self.getPath(), 'image')
46 54

  
47 55
    '''
48 56
        @brief  return db file path
DTI_PID/DTI_PID/Scripts/HMB.sql
1
CREATE TABLE IF NOT EXISTS HMB (
2
	UID TEXT NOT NULL,
3
	STREAM_NO TEXT NOT NULL,
4
	PHASE TEXT NOT NULL,
5
	PROP TEXT NOT NULL,
6
	VALUE TEXT,
7
	UNIT TEXT,
8
	CONSTRAINT HMB_PK PRIMARY KEY (UID)
9
);
10
CREATE INDEX IF NOT EXISTS HMB_STREAM_NO_IDX ON HMB (STREAM_NO,PROP,UNIT);
DTI_PID/DTI_PID/Shapes/QEngineeringLineNoTextItem.py
20 20
from QEngineeringTextItem import QEngineeringTextItem
21 21

  
22 22
class QEngineeringLineNoTextItem(QEngineeringTextItem):
23
    #removed = pyqtSignal(QGraphicsItem)
24 23

  
25 24
    '''
26 25
        @history    18.05.14    Jeongwoo    Add variable self.runs
26
                    humkyung 2018.07.09 add stream no
27 27
    '''
28 28
    def __init__(self, parent=None):
29 29
        import uuid
......
31 31
        QEngineeringTextItem.__init__(self, parent)
32 32
        
33 33
        self._runs = []
34
        self._streamNo = None
34 35

  
35 36
    '''
36 37
        @brief  getter of runs
......
49 50
    @runs.setter
50 51
    def runs(self, value):
51 52
        self._runs = value
53
    
54
    '''
55
        @brief  getter of stream no
56
        @author humkyung
57
        @date   2018.07.09
58
    '''
59
    @property
60
    def streamNo(self):
61
        return self._streamNo
62

  
63
    '''
64
        @brief  setter of stream no
65
        @author humkyung
66
        @date   2018.07.09
67
    '''
68
    @streamNo.setter
69
    def streamNo(self, value):
70
        self._streamNo = value
52 71

  
53 72
    def getLongestTwoPoints(self, pts):
54 73
        import math
......
68 87
        return res
69 88
            
70 89
    '''
90
        @brief      get line no attributes
91
        @author     humkyung
92
        @date       2018.04.24
93
        @history    humkyung 2018.05.09 evaluate string for Tag Seq No
94
                    kyouho 2018.07.06 add using TextItemFactory.isLineNo method
95
    '''
96
    def getLineNoAttributes(self):
97
        res = []
98

  
99
        try:
100
            docData = AppDocData.instance()
101
            configs = docData.getConfigs('Line No', 'Delimiter')
102
            delimiter = configs[0].value if 1 == len(configs) else '-'
103
            lineNoconfigs = docData.getConfigs('Line No', 'Configuration')
104
            sizeDataList = docData.getNomialPipeSizeData(True)
105
            fluidCodeList = docData.getFluidCodeData(True)
106
            configs = docData.getConfigs('Line No Tag Rule', 'Tag Seq No')
107
            tagSeqNoPattern = configs[0].value if 1 == len(configs) else None
108

  
109
            from TextItemFactory import TextItemFactory
110
            item = TextItemFactory.instance().isLineNo(self.text(), delimiter, lineNoconfigs, sizeDataList, fluidCodeList, tagSeqNoPattern)
111

  
112
            if item[0]:
113
                result = item[1]
114
                configs = lineNoconfigs[0].value.split(self.delimiter)
115
                for i in range(len(configs)):
116
                    if configs[i] == delimiter:
117
                        continue
118
                    res.append((configs[i], result[i]))
119

  
120
            res.append('Stream No', self.streamNo)
121
        except Exception as ex:
122
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
123
        
124
        return res
125

  
126
    '''
71 127
        @brief      generate xml code
72 128
        @author     humkyung
73 129
        @date       2018.04.23
DTI_PID/DTI_PID/Shapes/QEngineeringTextItem.py
251 251
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
252 252

  
253 253
        return visited
254

  
255
    '''
256
        @brief      get line no attributes
257
        @author     humkyung
258
        @date       2018.04.24
259
        @history    humkyung 2018.05.09 evaluate string for Tag Seq No
260
                    kyouho 2018.07.06 add using TextItemFactory.isLineNo method
261
    '''
262
    def getLineNoAttributes(self):
263
        res = []
264

  
265
        try:
266
            docData = AppDocData.instance()
267
            configs = docData.getConfigs('Line No', 'Delimiter')
268
            delimiter = configs[0].value if 1 == len(configs) else '-'
269
            lineNoconfigs = docData.getConfigs('Line No', 'Configuration')
270
            sizeDataList = docData.getNomialPipeSizeData(True)
271
            fluidCodeList = docData.getFluidCodeData(True)
272
            configs = docData.getConfigs('Line No Tag Rule', 'Tag Seq No')
273
            tagSeqNoPattern = configs[0].value if 1 == len(configs) else None
274

  
275
            from TextItemFactory import TextItemFactory
276
            item = TextItemFactory.instance().isLineNo(self.text(), delimiter, lineNoconfigs, sizeDataList, fluidCodeList, tagSeqNoPattern)
277

  
278
            if item[0]:
279
                result = item[1]
280
                configs = lineNoconfigs[0].value.split(self.delimiter)
281
                for i in range(len(configs)):
282
                    if configs[i] == delimiter:
283
                        continue
284
                    res.append((configs[i], result[i]))
285

  
286
        except Exception as ex:
287
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
288
        
289
        return res
290

  
254
    
291 255
    '''
292 256
        @brief      generate xml code
293 257
        @author     humkyung
DTI_PID/DTI_PID/UI/DTI__PID.ui
72 72
    <addaction name="separator"/>
73 73
    <addaction name="actionViewUnknown"/>
74 74
   </widget>
75
   <widget class="QMenu" name="menu_4">
76
    <property name="title">
77
     <string>툴</string>
78
    </property>
79
    <addaction name="actionpdf_to_image"/>
80
   </widget>
75 81
   <addaction name="menu"/>
76 82
   <addaction name="menu_2"/>
77 83
   <addaction name="menu_3"/>
84
   <addaction name="menu_4"/>
78 85
  </widget>
79 86
  <widget class="QStatusBar" name="statusbar"/>
80 87
  <widget class="QToolBar" name="toolBar">
......
531 538
    </font>
532 539
   </property>
533 540
  </action>
541
  <action name="actionpdf_to_image">
542
   <property name="text">
543
    <string>PDF 변환</string>
544
   </property>
545
   <property name="font">
546
    <font>
547
     <family>맑은 고딕</family>
548
    </font>
549
   </property>
550
  </action>
534 551
 </widget>
535 552
 <resources/>
536 553
 <connections/>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)