wolfhece 2.1.85__py3-none-any.whl → 2.1.87__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyVertexvectors.py +387 -34
- wolfhece/apps/check_version.py +49 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/irm_qdf.py +314 -65
- wolfhece/pypolygons_scen.py +130 -46
- wolfhece/scenario/check_scenario.py +10 -1
- wolfhece/scenario/config_manager.py +42 -7
- wolfhece/wolfresults_2D.py +1 -1
- {wolfhece-2.1.85.dist-info → wolfhece-2.1.87.dist-info}/METADATA +1 -1
- {wolfhece-2.1.85.dist-info → wolfhece-2.1.87.dist-info}/RECORD +13 -12
- {wolfhece-2.1.85.dist-info → wolfhece-2.1.87.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.85.dist-info → wolfhece-2.1.87.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.85.dist-info → wolfhece-2.1.87.dist-info}/top_level.txt +0 -0
wolfhece/PyVertexvectors.py
CHANGED
@@ -1749,7 +1749,7 @@ class vector:
|
|
1749
1749
|
if self.mytree is not None:
|
1750
1750
|
self.mytree.UncheckItem(self.myitem)
|
1751
1751
|
|
1752
|
-
self.
|
1752
|
+
self._reset_listogl()
|
1753
1753
|
|
1754
1754
|
def use(self):
|
1755
1755
|
"""
|
@@ -1760,7 +1760,7 @@ class vector:
|
|
1760
1760
|
self.mytree.CheckItem(self.myitem)
|
1761
1761
|
|
1762
1762
|
|
1763
|
-
self.
|
1763
|
+
self._reset_listogl()
|
1764
1764
|
|
1765
1765
|
def fillgrid(self, gridto:CpGrid):
|
1766
1766
|
"""
|
@@ -1820,7 +1820,7 @@ class vector:
|
|
1820
1820
|
if self.linestring is not None:
|
1821
1821
|
self.prepare_shapely()
|
1822
1822
|
|
1823
|
-
self.
|
1823
|
+
self._reset_listogl()
|
1824
1824
|
|
1825
1825
|
def get_s2d(self):
|
1826
1826
|
"""
|
@@ -1842,11 +1842,14 @@ class vector:
|
|
1842
1842
|
|
1843
1843
|
return s3d
|
1844
1844
|
|
1845
|
-
def get_sz(self,cumul=True):
|
1845
|
+
def get_sz(self, cumul=True):
|
1846
1846
|
"""
|
1847
|
-
Calcule et retourne la distance horizontale cumulée ou non
|
1847
|
+
Calcule et retourne la distance horizontale cumulée ou non
|
1848
|
+
de chaque point vis-à-vis du premier point
|
1848
1849
|
|
1849
1850
|
Utile pour le tracé de sections en travers ou des vérifications de position
|
1851
|
+
|
1852
|
+
:param cumul: si True, retourne la distance cumulée 2D. si False, retourne la distance 2D entre chaque point et le premier.
|
1850
1853
|
"""
|
1851
1854
|
z = np.asarray([self.myvertices[i].z for i in range(self.nbvertices)])
|
1852
1855
|
|
@@ -1977,6 +1980,9 @@ class vector:
|
|
1977
1980
|
"""
|
1978
1981
|
Création d'un nouveau vecteur sur base du découpage d'un autre et d'un pas spatial à respecter
|
1979
1982
|
Le nouveau vecteur contient tous les points de l'ancien et des nouveaux sur base d'un découpage 3D
|
1983
|
+
|
1984
|
+
:param ds: pas spatial
|
1985
|
+
:param new: si True, le vecteur est ajouté à la zone parente
|
1980
1986
|
"""
|
1981
1987
|
newvec = vector(name=self.myname+'_split',parentzone=self.parentzone)
|
1982
1988
|
|
@@ -1995,10 +2001,7 @@ class vector:
|
|
1995
2001
|
curzone=self.parentzone
|
1996
2002
|
if curzone is not None:
|
1997
2003
|
curzone.add_vector(newvec)
|
1998
|
-
|
1999
|
-
curzone.parent.fill_structure()
|
2000
|
-
except:
|
2001
|
-
pass
|
2004
|
+
curzone._fill_structure()
|
2002
2005
|
else:
|
2003
2006
|
self.myvertices = newvec.myvertices
|
2004
2007
|
self.update_lengths()
|
@@ -2303,7 +2306,7 @@ class vector:
|
|
2303
2306
|
|
2304
2307
|
return fig,ax
|
2305
2308
|
|
2306
|
-
def deepcopy_vector(self, name: str = None, parentzone
|
2309
|
+
def deepcopy_vector(self, name: str = None, parentzone = None) -> 'vector':
|
2307
2310
|
"""
|
2308
2311
|
Return a deep copy of the vector.
|
2309
2312
|
"""
|
@@ -2311,7 +2314,7 @@ class vector:
|
|
2311
2314
|
if name is None:
|
2312
2315
|
name = self.myname + "_copy"
|
2313
2316
|
|
2314
|
-
if parentzone:
|
2317
|
+
if parentzone is not None:
|
2315
2318
|
copied_vector = vector(name=name,parentzone=parentzone)
|
2316
2319
|
else:
|
2317
2320
|
copied_vector = vector(name=name)
|
@@ -2320,6 +2323,13 @@ class vector:
|
|
2320
2323
|
|
2321
2324
|
return copied_vector
|
2322
2325
|
|
2326
|
+
def deepcopy(self, name: str = None, parentzone = None) -> 'vector':
|
2327
|
+
"""
|
2328
|
+
Return a deep copy of the vector.
|
2329
|
+
"""
|
2330
|
+
|
2331
|
+
return self.deepcopy_vector(name, parentzone)
|
2332
|
+
|
2323
2333
|
def set_legend_to_centroid(self, text:str='', visible:bool=True):
|
2324
2334
|
"""
|
2325
2335
|
Positionne la légende au centre du vecteur
|
@@ -2333,6 +2343,312 @@ class vector:
|
|
2333
2343
|
self.myprop.legendy = centroid.y
|
2334
2344
|
self.myprop.legendtext = text if text else self.myname
|
2335
2345
|
|
2346
|
+
def set_z(self, new_z:np.ndarray):
|
2347
|
+
""" Set the z values of the vertices """
|
2348
|
+
self.z = new_z
|
2349
|
+
|
2350
|
+
@property
|
2351
|
+
def z(self):
|
2352
|
+
z = np.asarray([curvert.z for curvert in self.myvertices])
|
2353
|
+
if self.add_zdatum:
|
2354
|
+
z+=self.zdatum
|
2355
|
+
return z
|
2356
|
+
|
2357
|
+
@property
|
2358
|
+
def x(self):
|
2359
|
+
return np.asarray([curvert.x for curvert in self.myvertices])
|
2360
|
+
|
2361
|
+
@property
|
2362
|
+
def y(self):
|
2363
|
+
return np.asarray([curvert.y for curvert in self.myvertices])
|
2364
|
+
|
2365
|
+
@property
|
2366
|
+
def xy(self):
|
2367
|
+
return np.asarray([[curvert.x, curvert.y] for curvert in self.myvertices])
|
2368
|
+
|
2369
|
+
@property
|
2370
|
+
def xz(self):
|
2371
|
+
return np.asarray([[curvert.x, curvert.z] for curvert in self.myvertices])
|
2372
|
+
|
2373
|
+
@property
|
2374
|
+
def xyz(self):
|
2375
|
+
return self.asnparray3d()
|
2376
|
+
|
2377
|
+
@property
|
2378
|
+
def i(self):
|
2379
|
+
return np.asarray([curvert.in_use for curvert in self.myvertices])
|
2380
|
+
|
2381
|
+
@property
|
2382
|
+
def xyzi(self):
|
2383
|
+
x = self.x
|
2384
|
+
y = self.y
|
2385
|
+
z = self.z
|
2386
|
+
i = self.i
|
2387
|
+
return np.column_stack((x,y,z,i))
|
2388
|
+
|
2389
|
+
@property
|
2390
|
+
def xyi(self):
|
2391
|
+
return np.asarray([[curvert.x, curvert.y, curvert.in_use] for curvert in self.myvertices])
|
2392
|
+
|
2393
|
+
@property
|
2394
|
+
def sz(self):
|
2395
|
+
return self.get_sz()
|
2396
|
+
|
2397
|
+
@property
|
2398
|
+
def s(self):
|
2399
|
+
sz = self.get_sz()
|
2400
|
+
return sz[0]
|
2401
|
+
|
2402
|
+
@x.setter
|
2403
|
+
def x(self, new_x:np.ndarray | list):
|
2404
|
+
""" Set the x values of the vertices """
|
2405
|
+
|
2406
|
+
if isinstance(new_x, list):
|
2407
|
+
new_x = np.array(new_x)
|
2408
|
+
|
2409
|
+
if len(new_x) != self.nbvertices:
|
2410
|
+
logging.warning(_('New x values have not the same length as the number of vertices'))
|
2411
|
+
return
|
2412
|
+
|
2413
|
+
for curvert, newx in zip(self.myvertices, new_x):
|
2414
|
+
curvert.x = newx
|
2415
|
+
|
2416
|
+
self._reset_listogl()
|
2417
|
+
|
2418
|
+
@y.setter
|
2419
|
+
def y(self, new_y:np.ndarray | list):
|
2420
|
+
""" Set the y values of the vertices """
|
2421
|
+
|
2422
|
+
if isinstance(new_y, list):
|
2423
|
+
new_y = np.array(new_y)
|
2424
|
+
|
2425
|
+
if len(new_y) != self.nbvertices:
|
2426
|
+
logging.warning(_('New y values have not the same length as the number of vertices'))
|
2427
|
+
return
|
2428
|
+
|
2429
|
+
for curvert, newy in zip(self.myvertices, new_y):
|
2430
|
+
curvert.y = newy
|
2431
|
+
|
2432
|
+
self._reset_listogl()
|
2433
|
+
|
2434
|
+
@z.setter
|
2435
|
+
def z(self, new_z:np.ndarray | float | list):
|
2436
|
+
""" Set the z values of the vertices """
|
2437
|
+
|
2438
|
+
if isinstance(new_z, (int, float)):
|
2439
|
+
new_z = np.full(self.nbvertices, new_z, dtype=float)
|
2440
|
+
|
2441
|
+
if isinstance(new_z, list):
|
2442
|
+
new_z = np.array(new_z)
|
2443
|
+
|
2444
|
+
if len(new_z) != self.nbvertices:
|
2445
|
+
logging.warning(_('New z values have not the same length as the number of vertices'))
|
2446
|
+
return
|
2447
|
+
|
2448
|
+
if self.add_zdatum:
|
2449
|
+
for curvert, newz in zip(self.myvertices, new_z):
|
2450
|
+
curvert.z = newz - self.zdatum
|
2451
|
+
else:
|
2452
|
+
for curvert, newz in zip(self.myvertices, new_z):
|
2453
|
+
curvert.z = newz
|
2454
|
+
|
2455
|
+
self._reset_listogl()
|
2456
|
+
|
2457
|
+
@xyz.setter
|
2458
|
+
def xyz(self, new_xyz:np.ndarray | list):
|
2459
|
+
""" Set the x, y, z values of the vertices """
|
2460
|
+
|
2461
|
+
if isinstance(new_xyz, list):
|
2462
|
+
new_xyz = np.array(new_xyz)
|
2463
|
+
|
2464
|
+
if len(new_xyz) != self.nbvertices:
|
2465
|
+
logging.warning(_('New xyz values have not the same length as the number of vertices'))
|
2466
|
+
return
|
2467
|
+
|
2468
|
+
if self.add_zdatum:
|
2469
|
+
for curvert, newxyz in zip(self.myvertices, new_xyz):
|
2470
|
+
curvert.x = newxyz[0]
|
2471
|
+
curvert.y = newxyz[1]
|
2472
|
+
curvert.z = newxyz[2] - self.zdatum
|
2473
|
+
else:
|
2474
|
+
for curvert, newxyz in zip(self.myvertices, new_xyz):
|
2475
|
+
curvert.x = newxyz[0]
|
2476
|
+
curvert.y = newxyz[1]
|
2477
|
+
curvert.z = newxyz[2]
|
2478
|
+
|
2479
|
+
self._reset_listogl()
|
2480
|
+
|
2481
|
+
@xy.setter
|
2482
|
+
def xy(self, new_xy:np.ndarray | list):
|
2483
|
+
""" Set the x, y values of the vertices """
|
2484
|
+
|
2485
|
+
if isinstance(new_xy, list):
|
2486
|
+
new_xy = np.array(new_xy)
|
2487
|
+
|
2488
|
+
if len(new_xy) != self.nbvertices:
|
2489
|
+
logging.warning(_('New xy values have not the same length as the number of vertices'))
|
2490
|
+
return
|
2491
|
+
|
2492
|
+
for curvert, newxy in zip(self.myvertices, new_xy):
|
2493
|
+
curvert.x = newxy[0]
|
2494
|
+
curvert.y = newxy[1]
|
2495
|
+
|
2496
|
+
self._reset_listogl()
|
2497
|
+
|
2498
|
+
@xz.setter
|
2499
|
+
def xz(self, new_xz:np.ndarray | list):
|
2500
|
+
""" Set the x, z values of the vertices """
|
2501
|
+
|
2502
|
+
if isinstance(new_xz, list):
|
2503
|
+
new_xz = np.array(new_xz)
|
2504
|
+
|
2505
|
+
if len(new_xz) != self.nbvertices:
|
2506
|
+
logging.warning(_('New xz values have not the same length as the number of vertices'))
|
2507
|
+
return
|
2508
|
+
|
2509
|
+
if self.add_zdatum:
|
2510
|
+
for curvert, newxz in zip(self.myvertices, new_xz):
|
2511
|
+
curvert.x = newxz[0]
|
2512
|
+
curvert.z = newxz[1] - self.zdatum
|
2513
|
+
else:
|
2514
|
+
for curvert, newxz in zip(self.myvertices, new_xz):
|
2515
|
+
curvert.x = newxz[0]
|
2516
|
+
curvert.z = newxz[1]
|
2517
|
+
|
2518
|
+
self._reset_listogl()
|
2519
|
+
|
2520
|
+
@xyzi.setter
|
2521
|
+
def xyzi(self, new_xyzi:np.ndarray | list):
|
2522
|
+
""" Set the x, y, z, in_use values of the vertices """
|
2523
|
+
|
2524
|
+
if isinstance(new_xyzi, list):
|
2525
|
+
new_xyzi = np.array(new_xyzi)
|
2526
|
+
|
2527
|
+
if len(new_xyzi) != self.nbvertices:
|
2528
|
+
logging.warning(_('New xyzi values have not the same length as the number of vertices'))
|
2529
|
+
return
|
2530
|
+
|
2531
|
+
for curvert, newxyzi in zip(self.myvertices, new_xyzi):
|
2532
|
+
curvert.x = newxyzi[0]
|
2533
|
+
curvert.y = newxyzi[1]
|
2534
|
+
curvert.z = newxyzi[2] - self.zdatum if self.add_zdatum else newxyzi[2]
|
2535
|
+
curvert.in_use = newxyzi[3]
|
2536
|
+
|
2537
|
+
self._reset_listogl()
|
2538
|
+
|
2539
|
+
@xyi.setter
|
2540
|
+
def xyi(self, new_xyi:np.ndarray | list):
|
2541
|
+
""" Set the x, y, in_use values of the vertices """
|
2542
|
+
|
2543
|
+
if isinstance(new_xyi, list):
|
2544
|
+
new_xyi = np.array(new_xyi)
|
2545
|
+
|
2546
|
+
if len(new_xyi) != self.nbvertices:
|
2547
|
+
logging.warning(_('New xyi values have not the same length as the number of vertices'))
|
2548
|
+
return
|
2549
|
+
|
2550
|
+
for curvert, newxyi in zip(self.myvertices, new_xyi):
|
2551
|
+
curvert.x = newxyi[0]
|
2552
|
+
curvert.y = newxyi[1]
|
2553
|
+
curvert.in_use = newxyi[2]
|
2554
|
+
|
2555
|
+
self._reset_listogl()
|
2556
|
+
|
2557
|
+
@i.setter
|
2558
|
+
def i(self, new_i:np.ndarray | list):
|
2559
|
+
""" Set the in_use values of the vertices """
|
2560
|
+
|
2561
|
+
if isinstance(new_i, list):
|
2562
|
+
new_i = np.array(new_i)
|
2563
|
+
|
2564
|
+
if len(new_i) != self.nbvertices:
|
2565
|
+
logging.warning(_('New i values have not the same length as the number of vertices'))
|
2566
|
+
return
|
2567
|
+
|
2568
|
+
for curvert, newi in zip(self.myvertices, new_i):
|
2569
|
+
curvert.in_use = newi
|
2570
|
+
|
2571
|
+
self._reset_listogl()
|
2572
|
+
|
2573
|
+
def __str__(self):
|
2574
|
+
return self.myname
|
2575
|
+
|
2576
|
+
def __len__(self):
|
2577
|
+
return self.nbvertices
|
2578
|
+
|
2579
|
+
def __iter__(self) -> wolfvertex:
|
2580
|
+
return iter(self.myvertices)
|
2581
|
+
|
2582
|
+
def __getitem__(self, ndx:int) -> wolfvertex:
|
2583
|
+
""" Permet de retrouver un vertex sur base de son index """
|
2584
|
+
if ndx>=0 and ndx < self.nbvertices:
|
2585
|
+
return self.myvertices[ndx]
|
2586
|
+
else:
|
2587
|
+
logging.warning(_('Index out of range'))
|
2588
|
+
|
2589
|
+
def __setitem__(self, ndx:int, value:wolfvertex):
|
2590
|
+
""" Permet de modifier un vertex sur base de son index """
|
2591
|
+
if ndx>=0 and ndx < self.nbvertices:
|
2592
|
+
self.myvertices[ndx] = value
|
2593
|
+
self._reset_listogl()
|
2594
|
+
else:
|
2595
|
+
logging.warning(_('Index out of range'))
|
2596
|
+
|
2597
|
+
def __delitem__(self, ndx:int):
|
2598
|
+
""" Permet de supprimer un vertex sur base de son index """
|
2599
|
+
if ndx>=0 and ndx < self.nbvertices:
|
2600
|
+
self.myvertices.pop(ndx)
|
2601
|
+
self._reset_listogl()
|
2602
|
+
else:
|
2603
|
+
logging.warning(_('Index out of range'))
|
2604
|
+
|
2605
|
+
def append(self, other:"vector", merge_type:Literal['link', 'copy']='link'):
|
2606
|
+
"""
|
2607
|
+
Append a vector to the current one
|
2608
|
+
"""
|
2609
|
+
|
2610
|
+
if merge_type == 'link':
|
2611
|
+
self.myvertices.extend(other.myvertices)
|
2612
|
+
elif merge_type == 'copy':
|
2613
|
+
self.myvertices.extend(other.myvertices.copy())
|
2614
|
+
else:
|
2615
|
+
logging.warning(_('Merge type not supported'))
|
2616
|
+
|
2617
|
+
self.update_lengths()
|
2618
|
+
self._reset_listogl()
|
2619
|
+
|
2620
|
+
def cut(self, s:float, is3D:bool=True, adim:bool=True, frombegin:bool=True):
|
2621
|
+
"""
|
2622
|
+
cut a vector at a given curvilinear abscissa
|
2623
|
+
"""
|
2624
|
+
|
2625
|
+
newvec = vector(name=self.myname+'_cut', parentzone=self.parentzone)
|
2626
|
+
self.parentzone.add_vector(newvec, update_struct=True)
|
2627
|
+
|
2628
|
+
k,cums,lengthparts=self.get_segment(s,is3D,adim,frombegin)
|
2629
|
+
|
2630
|
+
if frombegin:
|
2631
|
+
newvec.myvertices = self.myvertices[:k+1]
|
2632
|
+
self.myvertices = self.myvertices[k:]
|
2633
|
+
else:
|
2634
|
+
newvec.myvertices = self.myvertices[k:]
|
2635
|
+
self.myvertices = self.myvertices[:k+1]
|
2636
|
+
|
2637
|
+
self.update_lengths()
|
2638
|
+
newvec.update_lengths()
|
2639
|
+
|
2640
|
+
self._reset_listogl()
|
2641
|
+
|
2642
|
+
return newvec
|
2643
|
+
|
2644
|
+
def _reset_listogl(self):
|
2645
|
+
"""
|
2646
|
+
Reset the list of OpenGL display
|
2647
|
+
"""
|
2648
|
+
if self.parentzone is not None:
|
2649
|
+
self.parentzone.reset_listogl()
|
2650
|
+
|
2651
|
+
|
2336
2652
|
class zone:
|
2337
2653
|
"""
|
2338
2654
|
Objet de gestion d'informations vectorielles
|
@@ -2547,7 +2863,7 @@ class zone:
|
|
2547
2863
|
|
2548
2864
|
return i
|
2549
2865
|
|
2550
|
-
def add_vector(self, addedvect:vector, index=-99999, forceparent=False):
|
2866
|
+
def add_vector(self, addedvect:vector, index=-99999, forceparent=False, update_struct=False):
|
2551
2867
|
"""
|
2552
2868
|
Ajout d'une instance 'vector'
|
2553
2869
|
|
@@ -2574,6 +2890,9 @@ class zone:
|
|
2574
2890
|
# NOTHING because the active vector is normally choosen by the UI or during special operations
|
2575
2891
|
# Here, we select the first added vector
|
2576
2892
|
|
2893
|
+
if update_struct:
|
2894
|
+
self._fill_structure()
|
2895
|
+
|
2577
2896
|
def count(self):
|
2578
2897
|
"""
|
2579
2898
|
Compte le nombre de vecteurs
|
@@ -2936,7 +3255,7 @@ class zone:
|
|
2936
3255
|
|
2937
3256
|
def createmultibin_proj(self, nb=None, nb2=0) -> Triangulation:
|
2938
3257
|
"""
|
2939
|
-
Création d'une triangulation sur base des vecteurs par projection au plus proche du
|
3258
|
+
Création d'une triangulation sur base des vecteurs par projection au plus proche du vecteur central
|
2940
3259
|
Tient compte de l'ordre
|
2941
3260
|
|
2942
3261
|
:param nb : nombre de points de découpe des vecteurs
|
@@ -3220,7 +3539,14 @@ class zone:
|
|
3220
3539
|
zonepolyleft.find_minmax(True)
|
3221
3540
|
zonepolyright.find_minmax(True)
|
3222
3541
|
|
3223
|
-
self.
|
3542
|
+
self._fill_structure()
|
3543
|
+
|
3544
|
+
def _fill_structure(self):
|
3545
|
+
"""
|
3546
|
+
Mise à jour des structures
|
3547
|
+
"""
|
3548
|
+
if self.parent is not None:
|
3549
|
+
self.parent.fill_structure()
|
3224
3550
|
|
3225
3551
|
def create_sliding_polygon_from_parallel(self,
|
3226
3552
|
poly_length:float,
|
@@ -3503,7 +3829,7 @@ class zone:
|
|
3503
3829
|
zonepolyleft.find_minmax(True)
|
3504
3830
|
zonepolyright.find_minmax(True)
|
3505
3831
|
|
3506
|
-
self.
|
3832
|
+
self._fill_structure()
|
3507
3833
|
|
3508
3834
|
return myparallels
|
3509
3835
|
|
@@ -3844,22 +4170,28 @@ class zone:
|
|
3844
4170
|
glDeleteLists(self.idgllist,1)
|
3845
4171
|
self.idgllist=-99999
|
3846
4172
|
|
3847
|
-
def deepcopy_zone(self, name: str =None, parent: str= None):
|
4173
|
+
def deepcopy_zone(self, name: str =None, parent: str= None) -> "zone":
|
3848
4174
|
""" Return a deep copy of the zone"""
|
3849
4175
|
|
3850
4176
|
if name is None:
|
3851
4177
|
name = self.myname + '_copy'
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
copied_zone
|
3857
|
-
|
3858
|
-
|
3859
|
-
|
3860
|
-
|
3861
|
-
|
3862
|
-
|
4178
|
+
|
4179
|
+
if parent is not None:
|
4180
|
+
copied_zone = zone(name=name, parent=parent)
|
4181
|
+
else:
|
4182
|
+
copied_zone = zone(name=name)
|
4183
|
+
|
4184
|
+
copied_zone.myvectors = []
|
4185
|
+
for vec in self.myvectors:
|
4186
|
+
copied_vec = vec.deepcopy_vector(parentzone = copied_zone)
|
4187
|
+
copied_zone.add_vector(copied_vec, forceparent=True)
|
4188
|
+
|
4189
|
+
return copied_zone
|
4190
|
+
|
4191
|
+
def deepcopy(self, name: str =None, parent: str= None) -> "zone":
|
4192
|
+
""" Return a deep copy of the zone"""
|
4193
|
+
|
4194
|
+
return self.deepcopy_zone(name, parent)
|
3863
4195
|
|
3864
4196
|
def show_properties(self):
|
3865
4197
|
""" Show properties of the zone --> will be applied to all vectors int he zone """
|
@@ -4507,6 +4839,16 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4507
4839
|
"""
|
4508
4840
|
self.plotted = False
|
4509
4841
|
|
4842
|
+
def save(self):
|
4843
|
+
"""
|
4844
|
+
Sauvegarde sur disque, sans remise en cause du nom de fichier
|
4845
|
+
"""
|
4846
|
+
if self.filename =='':
|
4847
|
+
logging.warning(_('No filename defined'))
|
4848
|
+
return
|
4849
|
+
|
4850
|
+
self.saveas()
|
4851
|
+
|
4510
4852
|
def saveas(self, filename:str=''):
|
4511
4853
|
"""
|
4512
4854
|
Sauvegarde sur disque
|
@@ -4742,12 +5084,12 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4742
5084
|
self.binfrom3.SetToolTip(_("Create a bin/rectangular channel based on 3 vectors in the currently active zone \n Some parameters will be prompted to the user (lateral height, ...) and if a triangular mesh must be created --> Blender"))
|
4743
5085
|
self.binfrom3.Bind(wx.EVT_BUTTON,self.Oncreatebin)
|
4744
5086
|
|
4745
|
-
self.trifromall = wx.Button(self,label=_('Create
|
4746
|
-
self.trifromall.SetToolTip(_("Create a triangular mesh based on all vectors
|
5087
|
+
self.trifromall = wx.Button(self,label=_('Create triangulation'))
|
5088
|
+
self.trifromall.SetToolTip(_("Create a triangular mesh based on all vectors within the currently active zone.\nUse the vertices as they are after subdividing the vectors into a specified number of points.\nAdd the resulting mesh to the GUI.\nThis can be useful in certain interpolation methods."))
|
4747
5089
|
self.trifromall.Bind(wx.EVT_BUTTON,self.Oncreatemultibin)
|
4748
5090
|
|
4749
|
-
self.trifromall_proj = wx.Button(self,label=_('Create
|
4750
|
-
self.trifromall_proj.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone
|
5091
|
+
self.trifromall_proj = wx.Button(self,label=_('Create triangulation (projection)'))
|
5092
|
+
self.trifromall_proj.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone.\nGenerate vertices by projecting the central polyline, or the nearest one if there is an even number of polylines, onto the other polylines.\nAdd the resulting mesh to the GUI.\nThis can be useful in certain interpolation methods."))
|
4751
5093
|
self.trifromall_proj.Bind(wx.EVT_BUTTON,self.Oncreatemultibin_project)
|
4752
5094
|
|
4753
5095
|
self.polyfrompar = wx.Button(self,label=_('Create polygons from parallels'))
|
@@ -5217,7 +5559,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
5217
5559
|
self.mapviewer.start_action('capture vertices', _('Capture vertices'))
|
5218
5560
|
firstvert=wolfvertex(0.,0.)
|
5219
5561
|
self.active_vector.add_vertex(firstvert)
|
5220
|
-
self.active_vector.
|
5562
|
+
self.active_vector._reset_listogl()
|
5221
5563
|
self.mapviewer.mimicme()
|
5222
5564
|
|
5223
5565
|
def OnReverse(self, event:wx.MouseEvent):
|
@@ -5233,6 +5575,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
5233
5575
|
|
5234
5576
|
self.active_vector.reverse()
|
5235
5577
|
self.fill_structure()
|
5578
|
+
self.active_vector._reset_listogl()
|
5236
5579
|
|
5237
5580
|
def OnAddPar(self, event:wx.MouseEvent):
|
5238
5581
|
"""
|
@@ -5257,6 +5600,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
5257
5600
|
self.fill_structure()
|
5258
5601
|
self.find_minmax(True)
|
5259
5602
|
self.expand_tree(self.active_zone)
|
5603
|
+
self.active_zone.reset_listogl()
|
5260
5604
|
|
5261
5605
|
def OncaptureandDynapar(self, event:wx.MouseEvent):
|
5262
5606
|
"""
|
@@ -6024,6 +6368,8 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
6024
6368
|
msg+=_('\n')
|
6025
6369
|
msg+=_('Retry !\n')
|
6026
6370
|
wx.MessageBox(msg)
|
6371
|
+
else:
|
6372
|
+
logging.warning(_('Active vector is None - Retry !'))
|
6027
6373
|
return True
|
6028
6374
|
return False
|
6029
6375
|
|
@@ -6340,18 +6686,25 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
6340
6686
|
dlg.Destroy()
|
6341
6687
|
return
|
6342
6688
|
|
6343
|
-
def deepcopy_zones(self, name:str = None):
|
6689
|
+
def deepcopy_zones(self, name:str = None) -> "Zones":
|
6344
6690
|
"""
|
6345
6691
|
Return the deep copy of the current
|
6346
6692
|
Zones (a new object).
|
6347
6693
|
"""
|
6348
|
-
copied_Zones = Zones()
|
6694
|
+
copied_Zones = Zones(idx=name)
|
6349
6695
|
for zne in self.myzones:
|
6350
6696
|
new_zne = zne.deepcopy_zone(parent= copied_Zones)
|
6351
6697
|
copied_Zones.add_zone(new_zne,forceparent=True)
|
6352
6698
|
copied_Zones.find_minmax(True)
|
6353
6699
|
return copied_Zones
|
6354
6700
|
|
6701
|
+
def deepcopy(self, name:str = None) -> "Zones":
|
6702
|
+
"""
|
6703
|
+
Return the deep copy of the current
|
6704
|
+
Zones (a new object).
|
6705
|
+
"""
|
6706
|
+
return self.deepcopy_zones(name=name)
|
6707
|
+
|
6355
6708
|
class Grid(Zones):
|
6356
6709
|
"""
|
6357
6710
|
Grid to draw on the mapviewer.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import pkg_resources
|
2
|
+
|
3
|
+
from .version import WolfVersion
|
4
|
+
|
5
|
+
def validate_version(expected_version:str):
|
6
|
+
|
7
|
+
# Test de la version afin de s'assurer que les dernières fonctionnalités sont présentes
|
8
|
+
major, minor, patch = str(WolfVersion()).split('.')
|
9
|
+
major = int(major)
|
10
|
+
minor = int(minor)
|
11
|
+
patch = int(patch)
|
12
|
+
|
13
|
+
major_expected, minor_expected, patch_expected = expected_version.split('.')
|
14
|
+
major_expected = int(major_expected)
|
15
|
+
minor_expected = int(minor_expected)
|
16
|
+
patch_expected = int(patch_expected)
|
17
|
+
|
18
|
+
test = major == major_expected and minor == minor_expected and patch >= patch_expected
|
19
|
+
|
20
|
+
if test:
|
21
|
+
return 'Version correcte'
|
22
|
+
else:
|
23
|
+
return 'Version incorrecte'
|
24
|
+
|
25
|
+
def validate_package_version(expected_version:str):
|
26
|
+
# Test de la version afin de s'assurer que les dernières fonctionnalités sont présentes
|
27
|
+
# Obtenir la version du paquet 'wolfhece' dans l'espace de
|
28
|
+
# stockage des paquets de l'environnement Python actif.
|
29
|
+
# Potentiellement différente de la version accessible via le PATH
|
30
|
+
# en fonction de la amchine utilisée.
|
31
|
+
pkg_wolfhece = pkg_resources.get_distribution('wolfhece')
|
32
|
+
locversion_pkg = pkg_wolfhece.version
|
33
|
+
major, minor, patch = str(locversion_pkg).split('.')
|
34
|
+
major = int(major)
|
35
|
+
minor = int(minor)
|
36
|
+
patch = int(patch)
|
37
|
+
|
38
|
+
major_expected, minor_expected, patch_expected = expected_version.split('.')
|
39
|
+
major_expected = int(major_expected)
|
40
|
+
minor_expected = int(minor_expected)
|
41
|
+
patch_expected = int(patch_expected)
|
42
|
+
|
43
|
+
test = major == major_expected and minor == minor_expected and patch >= patch_expected
|
44
|
+
|
45
|
+
if test:
|
46
|
+
return 'Version correcte'
|
47
|
+
else:
|
48
|
+
return 'Version incorrecte'
|
49
|
+
|