Beispiel #1
0
    def bedLayerPopUp(self):
        item = self.dlg.bedLayerTree.currentItem()
        zoneItem = item.parent()
        try:
            presetString = self.nextLayerpreSet
        except:
            presetString = ''
        if zoneItem:
            layerName = item.text(0)
            ZoneName = zoneItem.text(0)
            caption = ('Please set the property of zone ' + ZoneName + ': ' +
                       layerName)
            if self.dlg.rockErosionCheck.checkState() == Qt.Checked:
                useRock = True
            else:
                useRock = False

            gradClass = self.getGradClass()
            if gradClass:
                layerDialog = bedLayer(iface, gradClass,
                                       caption, rockUsed=useRock,
                                       presetString=presetString)
            else:
                onCritical(127)
            try:
                layerPhys, recString = layerDialog.run()
                item.setText(1, (layerPhys + "; " + recString))
                self.nextLayerpreSet = layerPhys + "; " + recString
            except:
                pass
        self.rockTypeCount()
Beispiel #2
0
    def setBedToZone(self):
        try:
            self.dlg.layerInZoneEdit.textChanged.disconnect()
            self.dlg.bedLayerTree.itemClicked.disconnect()
            self.dlg.zoneBedSelector.clear()
        except:
            pass
        try:
            physRef = self.physRef
        except:
            physRef = None

        if physRef:
            self.dlg.bedLayerTree.clear()
            self.dlg.bedLayerTree.setColumnCount(2)
            self.dlg.bedLayerTree.setHeaderLabels(['Layers', 'Status'])
            for i in range(0, len(physRef)):
                item = QTreeWidgetItem()
                item.setText(0, str(i+1) + ". " + physRef[i+1])
                self.dlg.bedLayerTree.addTopLevelItem(item)
                self.dlg.zoneBedSelector.addItem(str(i+1))
            self.dlg.bedLayerTree.setColumnWidth(0, 150)
            self.dlg.layerInZoneEdit.textChanged.connect(self.setBedLayerInZone)
            self.dlg.bedLayerTree.itemClicked.connect(self.bedLayerPopUp)
        else:
            onCritical(107)
 def run(self):
     result = self.dlg.exec_()
     if result == 1:
         return self.bankPairs
     else:
         onCritical(134)
         return self.bankPairs
Beispiel #4
0
 def run(self):
     result = self.dlg.exec_()
     if result == 1:
         return [
             int(self.dlg.nJumpEdit.text()),
             int(self.dlg.nLayersEdit.text())
         ]
     else:
         onCritical(303)
Beispiel #5
0
def loadParaView():
    try:
        reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
        k = _winreg.OpenKey(reg, r'SOFTWARE\WOW6432Node\Kitware, Inc.')
        pathKey = _winreg.EnumKey(k, 0)
        pathName = _winreg.QueryValue(k, pathKey)

        subprocess.call([os.path.join(pathName, 'bin', 'paraview.exe')])
    except:
        onCritical(123)
    def makeLayerItem(self):
        try:
            self.dlg.layerSelector.clear()
            totalLayers = int(self.dlg.totalLayersEdit.text())
            self.currentPair.layers = totalLayers
            self.currentPair.makeLayers(self.gradClass)

            for i in range(0, totalLayers):
                self.dlg.layerSelector.addItem(str(i + 1))

        except:
            onCritical(135)
Beispiel #7
0
    def bankModelofLineRetreat(self, string):
        string = '// Bank Erosion Module: Pairing IDs of all Bank Zones \
(Toe_ID Top_ID ...)\n'
        string += self.dlg.bankPairTable.cellWidget(0, 0).currentText()
        self.Toes.append(
            int(self.dlg.bankPairTable.cellWidget(0, 0).currentText()))
        string += ' '
        string += self.dlg.bankPairTable.cellWidget(0, 1).currentText()
        self.Tops.append(
            int(self.dlg.bankPairTable.cellWidget(0, 1).currentText()))
        string += '\n'

        bankMethod = self.dlg.erosionModTable.item(0, 2).text()
        string += '// Bank Erosion Property: Bank_Type(1=non_cohesive) \
lateral_model(1_to_3)\n'
        if not self.dlg.erosionModTable.cellWidget(0, 1).isChecked():
            string += str(1)
        else:
            string += str(2)
        try:
            bankMethod = re.split(';', bankMethod)
            string += ' '
            string += bankMethod[0]
            string += '\n'
            if bankMethod[0] == '1':
                string += '// Non-Cohesive Bank Property: L_to_V Ratio\n'
            elif bankMethod[0] == '2':
                string += '// Non-Cohesive Bank Property: Erodibility(m/s) \
Tau_cri_L(Pa) Exp\n'
            else:
                string += '// Non-Cohesive Bank Property: Tau_cri_L(Pa) \
Tau_cri_V(Pa) )\n'
            string += bankMethod[1]
            string += '\n'
        except:
            onCritical(131)
        # Remesh time interval (Not yet complete, currently fix to 1)
        string += '// Remesh Time Interval for Bank Reterat(in HOUR)\n'
        string += '1\n'

        string += '// 2DM File to define MESH Zone for Remesh? \
(empty-line=NO)\n'
        if self.dlg.remeshZoneChk.isChecked():
            string += (self.dlg.remeshLabel.text() + '\n')
        else:
            string += '\n'

        return string
Beispiel #8
0
    def setBankTable(self):
        if self.dlg.solverTabWidget.currentIndex() == 1:
            self.countBank()
            if len(self.banks) % 2 != 0:
                onCritical(130)
        self.dlg.bankTimeStep.setText(self.dlg.lineEditTStep.text())

        self.dlg.bankPairTable.setHorizontalHeaderLabels([u'Toe', u'Top'])
        self.dlg.bankPairTable.setColumnCount(2)
        self.dlg.bankPairTable.setColumnWidth(0, 60)
        self.dlg.bankPairTable.setColumnWidth(1, 60)

        self.dlg.erosionModTable.setColumnCount(3)
        self.dlg.erosionModTable.setColumnWidth(1, 120)
        self.dlg.erosionModTable.setColumnWidth(2, 180)

        if self.dlg.erosionModTable.rowCount() == 0:
            try:
                if len(self.banks) >= 2:
                    self.dlg.bankPairTable.setRowCount(
                        int(ceil(len(self.banks)/2.0)))
                    self.dlg.erosionModTable.setRowCount(
                        int(ceil(len(self.banks)/2.0)))
                    for i in range(0, int(ceil(len(self.banks)/2.0))):
                        comboToe = QComboBox()
                        for j in range(0, len(self.banks)):
                            comboToe.addItem(str(self.banks[j]))
                        self.dlg.bankPairTable.setCellWidget(i, 0, comboToe)
                        comboTop = QComboBox()
                        for j in range(0, len(self.banks)):
                            comboTop.addItem(str(self.banks[j]))
                        self.dlg.bankPairTable.setCellWidget(i, 1, comboTop)
                        self.dlg.erosionModTable.setItem(
                            i, 0, QTableWidgetItem('Pair ' + str(i+1)))
                        self.dlg.erosionModTable.setItem(
                            i, 2, QTableWidgetItem('Click to set property'))
                        cohChkBox = QCheckBox()
                        cohChkBox.setText('Cohesive Bank')
                        self.dlg.erosionModTable.setCellWidget(i, 1, cohChkBox)
                else:
                    self.dlg.bankPairTable.setRowCount(1)
                    comboToe = QComboBox()
                    for j in range(0, len(self.banks)):
                        comboToe.addItem(str(self.banks[j]))
                    self.dlg.bankPairTable.setCellWidget(0, 0, comboToe)
                    comboTop = QComboBox()
                    for j in range(0, len(self.banks)):
                        comboTop.addItem(str(self.banks[j]))
                    self.dlg.bankPairTable.setCellWidget(0, 1, comboTop)
                    self.dlg.erosionModTable.setItem(
                        0, 0, QTableWidgetItem('Pair 1'))
                    self.dlg.erosionModTable.setItem(
                        0, 2, QTableWidgetItem('Click to set property'))
                    cohChkBox = QCheckBox()
                    cohChkBox.setText('Cohesive Bank')
                    self.dlg.erosionModTable.setCellWidget(0, 1, cohChkBox)
            except:
                pass
        else:
            rowRequired = int(ceil(len(self.banks)/2.0))
            c_Row = self.dlg.erosionModTable.rowCount()
            if rowRequired > c_Row:
                for i in range(c_Row, rowRequired):
                    comboToe = QComboBox()
                    for j in range(0, len(self.banks)):
                        comboToe.addItem(str(self.banks[j]))
                    comboTop = QComboBox()
                    for j in range(0, len(self.banks)):
                        comboTop.addItem(str(self.banks[j]))

                    self.dlg.bankPairTable.insertRow(i)
                    self.dlg.bankPairTable.setCellWidget(i, 0, comboToe)
                    self.dlg.bankPairTable.setCellWidget(i, 1, comboTop)

                    self.dlg.erosionModTable.insertRow(i)
                    self.dlg.erosionModTable.setItem(
                        i, 0, QTableWidgetItem(u'Pair ' + str(i+1)))
                    self.dlg.erosionModTable.setItem(
                        i, 2, QTableWidgetItem('Click to set property'))
                    cohChkBox = QCheckBox()
                    cohChkBox.setText('Cohesive Bank')
                    self.dlg.erosionModTable.setCellWidget(i, 1, cohChkBox)
            elif rowRequired < c_Row:
                while c_Row > rowRequired:
                    self.dlg.bankPairTable.removeRow(c_Row-1)
                    self.dlg.erosionModTable.removeRow(c_Row-1)

                    c_Row = self.dlg.erosionModTable.rowCount()