Salome HOME
Merge branch 'BR_2018_V8_5' into BR_PY3
[modules/hydro.git] / doc / salome / tutorial / english / english_import.rst
1 ..
2    Copyright (C) 2015-2016 EDF
3
4    This file is part of SALOME HYDRO module.
5
6    SALOME HYDRO module is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    SALOME HYDRO module is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with SALOME HYDRO module.  If not, see <http://www.gnu.org/licenses/>.
18
19 #########################################
20 Image and map background import
21 #########################################
22
23 .. |Hydro_module_button| image:: /../_static/HYDRO.png
24    :align: middle
25    :width: 16pt
26    :height: 16pt
27
28 .. |Hydro_module_launch| image:: /../_static/LaunchHYDRO.png
29    :align: middle
30
31 .. |import_image| image:: /../_static/importImage.png
32    :align: middle
33
34 .. |import_image2| image:: /../_static/importImage2.png
35    :align: middle
36
37 .. |selection_A| image:: /../_static/selectionA.png
38    :align: middle
39
40 .. |selection_B| image:: /../_static/selectionB.png
41    :align: middle
42
43 .. |selection_B2| image:: /../_static/selectionB2.png
44    :align: middle
45
46 .. |fit_all| image:: /../_static/fitall.png
47    :align: middle
48
49 .. |import_image_B| image:: /../_static/importImageB.png
50    :align: middle
51
52 .. |deux_images| image:: /../_static/deuxImages.png
53    :align: middle
54
55 .. |zoom_style| image:: /../_static/zoomStyle.png
56    :align: middle
57
58 Loading the HYDRO module
59 ========================
60
61 To activate the HYDRO module, it should be selected in the module scrolling list
62 or its icon clicked on in the ribbon: |Hydro_module_button|.
63
64   |Hydro_module_launch|
65
66
67 Importing and georeferencing a first image
68 ==========================================
69
70 Several images need to be imported in order to construct the contour of the river.
71 In this case, they are maps that can be downloaded from sites such as `Géoportail`_ or the IGN website.
72 Géoportail provides the means to find point coordinates in an image, needed for georeferencing.
73
74 .. _Géoportail: http://www.geoportail.gouv.fr/accueil
75
76 To import an image, open the pop-up menu (right click) in the SALOME HYDRO study tree *IMAGES* folder:
77
78   |import_image|
79   
80 To import an image, open the pop-up menu (right click) in the SALOME HYDRO study tree IMAGES folder::
81
82   <appli_xxx>/bin/salome/test/HYDRO/garonne_ign_01.png
83
84 The image is displayed with two points, *A*and *B*, which will be repositioned at locations
85 whose coordinates in the Lambert 93 system are known, selected far enough apart to maintain
86 a good level of precision. 
87
88   |import_image2|
89  
90 The two specific points for which the coordinates were previously located with Géoportail are shown below:
91
92   |selection_A|
93
94 One point below and to the left of the figure *92*:  coordinates (471562, 6367750).
95
96   |selection_B|
97
98 The second at the centre of the cross next to *Hautevignes*: coordinates (489400, 6377020).
99
100  * **Note**: To control the zoom on the map, use the <Ctrl> key with the left mouse button.
101    To move around on the map, the <Ctrl> key should be used with the mouse wheel [or the middle mouse button].
102
103 Select point A then point B sequentially, using the *Activate point A selection*
104 then *Activate point B selection* buttons. Once the two points have been selected,
105 the georeferencing dialog box looks like this: 
106
107   |selection_B2|
108
109 For the x,y coordinates of each point, the first column gives the coordinates of the image pixel and the second
110 column gives the geographical references.
111
112 The georeferencing is validated by clicking on the *Apply and Close* button.
113 You must ensure that the "eye" icon to the left of the image name in the tree is active
114 and re-centre the image using the *fit all* button: |fit_all|. 
115
116  The image obtained is slightly tilted to the right. 
117
118  * Note: in this view, the zoom may be performed with the mouse wheel.
119    The zoom may be centred on the mouse position or at the centre of the image.
120    This option is accessible in the *File/preferences* menu under the *SALOME* section,
121    *3D viewer* tab, *zooming style*: 
122
123   |zoom_style|
124
125 When you move the mouse over the map, the cursor coordinates are displayed in the status bar at the bottom left
126 of the application.
127
128  * **Note**: you must get used to **saving the current study regularly** (menu *File/Save* or *File/Save as*).
129    It is also advised to save the different steps of the study in different files:
130    *there have been previous instances where, under specific circumstances that are difficult to reproduce,
131    the study was saved in an incomplete state*. This problem has only arisen in cases where studies
132    incorporating data from several modules were being reloaded without the HYDRO module being activated
133    before the save operation.
134    To guard against the risk of an incomplete save, check that the HYDRO module is activated before saving the study. 
135
136 Importing a second image, georeferenced from the first 
137 ======================================================
138
139 The second image is stored in the same place as the first ::
140
141   <appli_xxx>/bin/salome/test/HYDRO/garonne_ign_02.png
142
143 This image is georeferenced using choose points on the reference image option in the diolog box.
144 Once the first image has been selected as reference, the two images are seen one above the other.
145 First, a point A is selected at the same location on both images, then a point B.
146 These two points should be as far apart as possible and the zoom sufficiently close to be precise.
147 The dialog box should now look like the one below:
148
149   |import_image_B|
150
151 After having confirmed the dialog instructions and then displayed both images and re-centred the view,
152 the following is obtained:
153
154   |deux_images|
155
156 Definition of a local coordinate system
157 =======================================
158
159 Using a local reference point as origin reduces the size of the numbers being handled.
160 Changing the origin significantly improves the precision of the geometry, mesh and calculation steps.
161 On the contrary, keeping the large number values of the initial coordinates makes it impossible
162 to obtain a good quality mesh.
163
164 The coordinates of the new origin are entered via the *HYDRO/Change Local CS* menu.
165
166 In this example, the point (430 000, 6 350 000), located to the south west of our study domain, is entered.
167  
168 After confirming the change of origin, one sees that the cursor coordinates, which are displayed in the status bar
169 at the bottom left of the application, are provided in both coordinate systems (local and global).
170  
171  * **Note**: this change of origin can be made several times, at different points in the study,
172    as everything that was previously imported is transposed by the application.
173    However it is preferable to do this quite early to minimise the risks of error or inconsistency and,
174    in any event, before exporting the HYDRO module elements, particularly the model geometry.
175    It is recommended to set the local coordinate system early in the study,
176    as soon as the extent of the computational domain is known. 
177
178  * After a change of origin, some entries in the study tree are marked in italic blue: they must be updated.
179    Use the context menu *update*, then reset the view with *Fit All* command.
180
181 Python dump
182 ===========
183
184 All actions/operations completed through the graphic interface have their equivalent in Python script.
185 A script dump of the study can be made using the *File/Dump Study* menu.
186 The resulting Python script can be used to reconstruct the study data in a new SALOME study.
187 This script is of course editable.
188  
189 The dump can be made after definition of the local coordinate system and the obtained file compared with ::
190
191   <appli_xxx>/bin/salome/test/HYDRO/h003_changeLCS.py
192
193 The correct execution of the dump can be checked by starting again with a new study
194 (restart SALOME, new document or just new document),
195 then menu *File/Load Script* and activation of the HYDRO module. 
196
197 .. only:: html
198
199    :ref:`ref_exempleInondation`