from PyQt5 import uic
import pyproj
-from pyproj import CRS
from salome.hydrotools.changeCoords import changeCoords
self.medFileIn = None
self.medFileOut = None
EPSG_list = (2154, 27561, 27562, 27563, 27564, 27571, 27572, 27573, 27574 )
+ has_CRS = pyproj.__version__ >= "2.0.0"
+ try:
+ import pyproj.CRS
+ has_CRS = True
+ except ImportError:
+ has_CRS = False
+
+ if has_CRS:
+ for epsg in EPSG_list:
+ crs_code = CRS.from_epsg(epsg)
+ EPSG_name[epsg] = crs_code.name
+ EPSG_name = {}
+ else:
+ EPSG_name = {\
+ 2154 :"RGF93 / Lambert-93",
+ 27561:"NTF (Paris) / Lambert Nord France",
+ 27562:"NTF (Paris) / Lambert Centre France",
+ 27563:"NTF (Paris) / Lambert Sud France",
+ 27564:"NTF (Paris) / Lambert Corse",
+ 27571:"NTF (Paris) / Lambert zone I",
+ 27572:"NTF (Paris) / Lambert zone II",
+ 27573:"NTF (Paris) / Lambert zone III",
+ 27574:"NTF (Paris) / Lambert zone IV",
+ }
+
for epsg in EPSG_list:
- crs_code = CRS.from_epsg(epsg)
- codeName = str(epsg) + ' ' + crs_code.name
+ codeName = str(epsg) + ' ' + EPSG_name[epsg]
self.cmb_systemIn.addItem(codeName)
self.cmb_systemOut.addItem(codeName)
self.cb_changeCoordSystem.setChecked(True)
self.cb_changeCoordSystem.setChecked(False)
-
+
def on_med_file_in_browse(self):
"""
Select input MED file
a = os.path.splitext(self.medFileIn)
self.medFileOut = a[0] + '_coo' + a[1]
self.le_medFileOut.setText(self.medFileOut)
-
+
def on_med_file_out_browse(self):
"""
Select output MED file
if not self.medFileOut:
return
self.le_medFileOut.setText(self.medFileOut)
-
+
def on_help(self):
"""
display a help message
This dialog is used to change the nodes coordinates in a mesh. It is used either for a simple translation, a change of coordinates system
(for instance from Lambert II to Lambert-93), or a combination.
- <br><br>
+ <br><br>
The modified mesh is saved in a new file.
- <br>
+ <br>
If there is a change of coordinates system, the input mesh is first translated, when it uses a local origin.
After the change of coordinates system, the output mesh can be translated (new local origin).
- <br>
+ <br>
When there is only a simple translation, the operation is: Xout = Xin + offsetXin -offsetXout, Yout = Yin + offsetYin -offsetYout.
- <br><br>
+ <br><br>
Below is the description of the dialog controls.
<h3>Change coordinates system</h3>
<h3>Input MED file</h3>
This field allows the selection of a med file (via the standard file open dialog).
The filling of this field is mandatory.
-
+
<h3>Input offsetX, offsetY</h3>
- These fields are used to set the Origin of the local coordinates system of the input mesh, if any.
+ These fields are used to set the Origin of the local coordinates system of the input mesh, if any.
<h3>Input Coord System</h3>
- This combo box is use to select the coordinate system of the input mesh.
+ This combo box is use to select the coordinate system of the input mesh.
<h3>Output MED file</h3>
This field allows the definition of a med file (via the standard file save dialog).
The filling of this field is mandatory.
-
+
<h3>Output offsetX, offsetY</h3>
- These fields are used to set the Origin of the local coordinates system of the output mesh, if any.
+ These fields are used to set the Origin of the local coordinates system of the output mesh, if any.
<h3>Output Coord System</h3>
- This combo box is use to select the coordinate system of the output mesh.
+ This combo box is use to select the coordinate system of the output mesh.
"""
QMessageBox.about(self, self.tr("About change coordinates dialog"), msg);
-
-
+
+
def on_accept(self):
print("accept")
#TODO check medfile in and out not empty
def on_reject(self):
print("reject")
self.reject()
-
+
def execDialog(context):
print("execDialog")
study = context.study
sg = context.sg
dlg = changeCoordsDialog()
- dlg.exec_()
+ dlg.exec_()