<x>0</x>
<y>0</y>
<width>817</width>
- <height>265</height>
+ <height>344</height>
</rect>
</property>
<property name="windowTitle">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
</item>
</layout>
</item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Output</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="lb_outDir">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Output dir:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="le_outDir">
+ <property name="statusTip">
+ <string>directory to store shapefiles and output mesh file if kept</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="pb_outDir">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
</widget>
</item>
<item row="0" column="1">
+ <widget class="QCheckBox" name="cb_loadMeshEdges">
+ <property name="text">
+ <string>load result</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QCheckBox" name="cb_splineMeshEdges">
+ <property name="text">
+ <string>load as spline</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>333</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
+ <widget class="QCheckBox" name="cb_loadShapeToAdjust">
+ <property name="text">
+ <string>load result</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QCheckBox" name="cb_splineShapeToAdjust">
+ <property name="text">
+ <string>load as spline</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>333</width>
<height>20</height>
</size>
</property>
import os
import sys
+import salome
+
+salome.salome_init()
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5 import uic
+from HYDROPy import *
from salome.hydrotools.shapesGroups import fitShapePointsToMesh
+from salome.hydrotools.hydroGeoMeshUtils import importPolylines
#import sysconfig
#pythonVersion = 'python' + sysconfig.get_python_version()
# Connections
self.pb_meshEdges.clicked.connect(self.on_meshEdges_browse)
self.pb_shapeToAdjust.clicked.connect(self.on_shapeToAdjust_browse)
+ self.pb_outDir.clicked.connect(self.on_outputDir_browse)
self.pb_help.clicked.connect(self.on_help)
self.pb_ok.accepted.connect(self.on_accept)
self.pb_ok.rejected.connect(self.on_reject)
if not self.shapeToAdjust:
return
self.le_shapeToAdjust.setText(self.shapeToAdjust)
+ self.le_outDir.setText(os.path.dirname(self.shapeToAdjust))
+
+ def on_outputDir_browse(self):
+ """
+ Select OutputDirectory
+ """
+ print("on_ouptutDir_browse")
+ self.outDir = QFileDialog.getExistingDirectory(self, self.tr("Output Directory"), "")
+ print(self.outDir)
+ if not self.outDir:
+ return
+ self.le_outDir.setText(self.outDir)
def on_help(self):
"""
<br>
If requested, it splits the free border shapefile and/or the shapefile adjusted in two parts, at their intersection.
<br>
- The shapefile adusted is written in the directory of the shapefile to adjust, with a suffix '_adj'.
+ The shapefile adusted is written by default in the directory of the shapefile to adjust, with a suffix '_adj'.
<br>
The split free border shapefile is written in the directory of the free border shapefile, with a suffix '_split'.
<br><br>
shapeToAdjust = self.le_shapeToAdjust.text()
isMeshEdgesSplit = self.cb_splitMeshEdges.isChecked()
isShapeToAdjustSplit = self.cb_splitShapeToAdjust.isChecked()
+ isLoadMeshEdges = self.cb_loadMeshEdges.isChecked()
+ isLoadShapeToAdjust = self.cb_loadShapeToAdjust.isChecked()
+ isSplineMeshEdges = self.cb_splineMeshEdges.isChecked()
+ isSplineShapeToAdjust = self.cb_splineShapeToAdjust.isChecked()
+ outdir = self.le_outDir.text()
self.accept()
print(meshEdges)
print(shapeToAdjust)
print(isMeshEdgesSplit)
print(isShapeToAdjustSplit)
- fitShapePointsToMesh(meshEdges, shapeToAdjust, "", isMeshEdgesSplit, isShapeToAdjustSplit)
+ fitShapePointsToMesh(meshEdges, shapeToAdjust, outdir, isMeshEdgesSplit, isShapeToAdjustSplit)
+ hydro_doc = HYDROData_Document.Document()
+ if isLoadMeshEdges:
+ a = os.path.splitext(os.path.basename(meshEdges))
+ ext = ""
+ if isMeshEdgesSplit:
+ ext = "_split"
+ meshEdgesShapefile = os.path.join(outdir, a[0] + ext + a[1])
+ shapeName = a[0] + ext
+ meshEdgesShapes = importPolylines(hydro_doc, meshEdgesShapefile, shapeName, isSplineMeshEdges, 0)
+ if isLoadShapeToAdjust:
+ a = os.path.splitext(os.path.basename(shapeToAdjust))
+ ext = "_adj"
+ adjustedShapefile = os.path.join(outdir, a[0] + ext + a[1])
+ shapeName = a[0] + ext
+ adjustedShapes = importPolylines(hydro_doc, adjustedShapefile, shapeName, isSplineShapeToAdjust, 0)
+ if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
+
def on_reject(self):
print("reject")