프로젝트

일반

사용자정보

개정판 8f5b8e70

ID8f5b8e701aabffb6d65a0277400d512dc7ed46a7
상위 f1632ad7
하위 3778bad8, 6268f744

함의성이(가) 5년 이상 전에 추가함

issue #587: add symbol attr detection range setting

Change-Id: I92c17a9013658ee0cefaf6cb592be93f9bf03e4a

차이점 보기:

DTI_PID/DTI_PID/ConfigurationDialog.py
74 74

  
75 75
        configs = docData.getConfigs('Size', 'Delimiter')
76 76
        self.ui.lineEditSizeDelimiter.setText(configs[0].value if 1 == len(configs) else 'X')
77
        configs = docData.getConfigs('Range', 'Detection Ratio')
78
        self.ui.doubleSpinBoxDetectionRange.setValue(float(configs[0].value)) if 1 == len(configs) else self.ui.doubleSpinBoxDetectionRange.setValue(1.5)
77 79

  
78 80
        configs = docData.getConfigs('Filter', 'MinimumSize')
79
        self.ui.lineEditMinimumSize.setText(configs[0].value if 1 == len(configs) else '15')
81
        self.ui.spinBoxMinimumSize.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxMinimumSize.setValue(15)
80 82

  
81 83
        # set min,max area for small object
82 84
        configs = docData.getConfigs('Small Object Size', 'Min Area')
......
611 613
            configs.append(Config('Text Size', 'Max Text Size', self.ui.maxTextSizeSpinBox.value()))
612 614
            
613 615
            configs.append(Config('Size', 'Delimiter', self.ui.lineEditSizeDelimiter.text()))
614
            configs.append(Config('Filter', 'MinimumSize', self.ui.lineEditMinimumSize.text()))
616
            configs.append(Config('Range', 'Detection Ratio', self.ui.doubleSpinBoxDetectionRange.value()))
617
            configs.append(Config('Filter', 'MinimumSize', self.ui.spinBoxMinimumSize.value()))
615 618
            configs.append(Config('Small Object Size', 'Min Area', self.ui.spinBoxMinArea.value()))
616 619
            configs.append(Config('Small Object Size', 'Max Area', self.ui.spinBoxMaxArea.value()))
617 620
            configs.append(Config('Sliding Window', 'Width', self.ui.spinBoxWidth.value()))
DTI_PID/DTI_PID/Configuration_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file '.\UI\Configuration.ui'
3
# Form implementation generated from reading ui file './UI/Configuration.ui'
4 4
#
5 5
# Created by: PyQt5 UI code generator 5.11.3
6 6
#
......
43 43
        self.lineEditSizeDelimiter.setObjectName("lineEditSizeDelimiter")
44 44
        self.horizontalLayout_8.addWidget(self.lineEditSizeDelimiter, 0, QtCore.Qt.AlignVCenter)
45 45
        self.verticalLayout_3.addLayout(self.horizontalLayout_8)
46
        self.horizontalLayout = QtWidgets.QHBoxLayout()
47
        self.horizontalLayout.setObjectName("horizontalLayout")
48
        self.label_15 = QtWidgets.QLabel(self.groupBoxAttribute)
49
        self.label_15.setMaximumSize(QtCore.QSize(190, 16777215))
50
        self.label_15.setObjectName("label_15")
51
        self.horizontalLayout.addWidget(self.label_15)
52
        self.doubleSpinBoxDetectionRange = QtWidgets.QDoubleSpinBox(self.groupBoxAttribute)
53
        self.doubleSpinBoxDetectionRange.setSingleStep(0.1)
54
        self.doubleSpinBoxDetectionRange.setProperty("value", 1.0)
55
        self.doubleSpinBoxDetectionRange.setObjectName("doubleSpinBoxDetectionRange")
56
        self.horizontalLayout.addWidget(self.doubleSpinBoxDetectionRange)
57
        self.verticalLayout_3.addLayout(self.horizontalLayout)
46 58
        self.gridLayout_6.addLayout(self.verticalLayout_3, 0, 0, 1, 1)
47 59
        self.gridLayout_2.addWidget(self.groupBoxAttribute, 1, 1, 1, 1)
48 60
        self.groupBox = QtWidgets.QGroupBox(self.Recognition)
......
235 247
        self.horizontalLayout_16 = QtWidgets.QHBoxLayout()
236 248
        self.horizontalLayout_16.setObjectName("horizontalLayout_16")
237 249
        self.label_10 = QtWidgets.QLabel(self.groupBoxFilter)
250
        self.label_10.setMaximumSize(QtCore.QSize(155, 16777215))
238 251
        self.label_10.setObjectName("label_10")
239 252
        self.horizontalLayout_16.addWidget(self.label_10, 0, QtCore.Qt.AlignVCenter)
240
        self.lineEditMinimumSize = QtWidgets.QLineEdit(self.groupBoxFilter)
241
        self.lineEditMinimumSize.setObjectName("lineEditMinimumSize")
242
        self.horizontalLayout_16.addWidget(self.lineEditMinimumSize, 0, QtCore.Qt.AlignVCenter)
253
        self.spinBoxMinimumSize = QtWidgets.QSpinBox(self.groupBoxFilter)
254
        self.spinBoxMinimumSize.setObjectName("spinBoxMinimumSize")
255
        self.horizontalLayout_16.addWidget(self.spinBoxMinimumSize)
243 256
        self.verticalLayout_9.addLayout(self.horizontalLayout_16)
244 257
        self.gridLayout_8.addLayout(self.verticalLayout_9, 0, 0, 1, 1)
245 258
        self.gridLayout_2.addWidget(self.groupBoxFilter, 2, 1, 1, 1)
......
490 503
    def retranslateUi(self, ConfigurationDialog):
491 504
        _translate = QtCore.QCoreApplication.translate
492 505
        ConfigurationDialog.setWindowTitle(_translate("ConfigurationDialog", "Configuration"))
493
        self.groupBoxAttribute.setTitle(_translate("ConfigurationDialog", "Attribute Detection"))
506
        self.groupBoxAttribute.setTitle(_translate("ConfigurationDialog", "Attribute"))
494 507
        self.label_6.setText(_translate("ConfigurationDialog", "Size Delimiter : "))
508
        self.label_15.setText(_translate("ConfigurationDialog", "Attribute Detection Range(Ratio) : "))
495 509
        self.groupBox.setTitle(_translate("ConfigurationDialog", "Line Detection"))
496 510
        self.label_4.setText(_translate("ConfigurationDialog", "Ignore Small Object Size : "))
497 511
        self.label_16.setText(_translate("ConfigurationDialog", "Small Line Minimum Length"))
......
545 559
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabLineColor), _translate("ConfigurationDialog", "Line No Color"))
546 560

  
547 561
import MainWindow_rc
562

  
563
if __name__ == "__main__":
564
    import sys
565
    app = QtWidgets.QApplication(sys.argv)
566
    ConfigurationDialog = QtWidgets.QDialog()
567
    ui = Ui_ConfigurationDialog()
568
    ui.setupUi(ConfigurationDialog)
569
    ConfigurationDialog.show()
570
    sys.exit(app.exec_())
571

  
DTI_PID/DTI_PID/Shapes/EngineeringReducerItem.py
81 81
        try:
82 82
            configs = AppDocData.instance().getConfigs('Size', 'Delimiter')
83 83
            delimiter = configs[0].value if configs else 'X'
84
            configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio')
85
            ratio = float(configs[0].value) if 1 == len(configs) else 1.5
84 86

  
85
            dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width())
87
            dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width()) * ratio
86 88
            center = self.sceneBoundingRect().center()
87 89

  
88 90
            minDist = None
......
92 94
                    dx = attr.center().x() - center.x()
93 95
                    dy = attr.center().y() - center.y()
94 96
                    length = math.sqrt(dx*dx + dy*dy)
95
                    if (length < dist*2) and (minDist is None or length < minDist):
97
                    if (length < dist) and (minDist is None or length < minDist):
96 98
                        minDist = length
97 99
                        selected = attr
98 100
                elif type(attr) is QEngineeringInstrumentItem:
99 101
                    if not attr.is_connected:
100 102
                        dx = attr.center().x() - center.x()
101 103
                        dy = attr.center().y() - center.y()
102
                        if math.sqrt(dx*dx + dy*dy) < dist*2:
104
                        if math.sqrt(dx*dx + dy*dy) < dist:
103 105
                            self.add_assoc_item(attr)
104 106
                            attr.owner = self
105 107

  
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
725 725
            self._associations.clear()
726 726

  
727 727
        try:
728
            dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width())
728
            configs = AppDocData.instance().getConfigs('Range', 'Detection Ratio')
729
            ratio = float(configs[0].value) if 1 == len(configs) else 1.5
730
            dist = max(self.sceneBoundingRect().height(), self.sceneBoundingRect().width()) * ratio
729 731
            center = self.sceneBoundingRect().center()
730 732

  
731 733
            minDist = None
732 734
            selected = None
733 735
            for attr in attributes:
734
                if type(attr) is QEngineeringSizeTextItem or type(attr) is QEngineeringValveOperCodeTextItem or type(attr) is QEngineeringTextItem:
736
                if type(attr) is QEngineeringSizeTextItem or type(attr) is QEngineeringValveOperCodeTextItem:
735 737
                    dx = attr.center().x() - center.x()
736 738
                    dy = attr.center().y() - center.y()
737 739
                    length = math.sqrt(dx*dx + dy*dy)
738
                    if (length < dist*2) and (minDist is None or length < minDist):
740
                    if (length < dist) and (minDist is None or length < minDist):
739 741
                        minDist = length
740 742
                        selected = attr
741 743
                elif type(attr) is QEngineeringInstrumentItem:
742 744
                    if not attr.is_connected:
743 745
                        dx = attr.center().x() - center.x()
744 746
                        dy = attr.center().y() - center.y()
745
                        if math.sqrt(dx*dx + dy*dy) < dist*2:
747
                        if math.sqrt(dx*dx + dy*dy) < dist:
746 748
                            self.add_assoc_item(attr)
747 749
                            attr.owner = self
748 750

  
DTI_PID/DTI_PID/UI/Configuration.ui
45 45
          </size>
46 46
         </property>
47 47
         <property name="title">
48
          <string>Attribute Detection</string>
48
          <string>Attribute</string>
49 49
         </property>
50 50
         <layout class="QGridLayout" name="gridLayout_6">
51 51
          <item row="0" column="0">
......
64 64
              </item>
65 65
             </layout>
66 66
            </item>
67
            <item>
68
             <layout class="QHBoxLayout" name="horizontalLayout">
69
              <item>
70
               <widget class="QLabel" name="label_15">
71
                <property name="maximumSize">
72
                 <size>
73
                  <width>190</width>
74
                  <height>16777215</height>
75
                 </size>
76
                </property>
77
                <property name="text">
78
                 <string>Attribute Detection Range(Ratio) : </string>
79
                </property>
80
               </widget>
81
              </item>
82
              <item>
83
               <widget class="QDoubleSpinBox" name="doubleSpinBoxDetectionRange">
84
                <property name="singleStep">
85
                 <double>0.100000000000000</double>
86
                </property>
87
                <property name="value">
88
                 <double>1.000000000000000</double>
89
                </property>
90
               </widget>
91
              </item>
92
             </layout>
93
            </item>
67 94
           </layout>
68 95
          </item>
69 96
         </layout>
......
523 550
             <layout class="QHBoxLayout" name="horizontalLayout_16">
524 551
              <item alignment="Qt::AlignVCenter">
525 552
               <widget class="QLabel" name="label_10">
553
                <property name="maximumSize">
554
                 <size>
555
                  <width>155</width>
556
                  <height>16777215</height>
557
                 </size>
558
                </property>
526 559
                <property name="text">
527 560
                 <string>Minimum Detection Size : </string>
528 561
                </property>
529 562
               </widget>
530 563
              </item>
531
              <item alignment="Qt::AlignVCenter">
532
               <widget class="QLineEdit" name="lineEditMinimumSize"/>
564
              <item>
565
               <widget class="QSpinBox" name="spinBoxMinimumSize"/>
533 566
              </item>
534 567
             </layout>
535 568
            </item>

내보내기 Unified diff

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