wolfhece 2.2.33__py3-none-any.whl → 2.2.35__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/PyConfig.py +26 -3
- wolfhece/PyCrosssections.py +293 -16
- wolfhece/PyDraw.py +349 -7
- wolfhece/PyGui.py +43 -1
- wolfhece/PyPictures.py +420 -3
- wolfhece/PyVertexvectors.py +128 -12
- wolfhece/__init__.py +1 -0
- wolfhece/analyze_poly.py +1 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/textpillow.py +1 -1
- wolfhece/wolf_array.py +1233 -305
- wolfhece/wolf_texture.py +81 -13
- wolfhece/wolf_zi_db.py +741 -2
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/METADATA +1 -1
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/RECORD +18 -18
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/top_level.txt +0 -0
wolfhece/PyVertexvectors.py
CHANGED
@@ -705,10 +705,17 @@ class vectorproperties:
|
|
705
705
|
self.attachedimage = None
|
706
706
|
self.imagevisible = False
|
707
707
|
self.textureimage:genericImagetexture = None
|
708
|
+
self.image_scale = 1.0
|
709
|
+
self.image_relative_posx = 0.0
|
710
|
+
self.image_relative_posy = 0.0
|
711
|
+
self.image_attached_pointx = -99999.
|
712
|
+
self.image_attached_pointy = -99999.
|
708
713
|
|
709
714
|
self.plot_indices = False
|
710
715
|
|
711
|
-
|
716
|
+
self._cached_offset = None
|
717
|
+
|
718
|
+
def get_extra(self) -> list[float,float,int,float,str,bool, float, float, float, float, float]:
|
712
719
|
""" Return extra properties """
|
713
720
|
return [self.legendlength,
|
714
721
|
self.legendheight,
|
@@ -716,9 +723,15 @@ class vectorproperties:
|
|
716
723
|
self.legendorientation,
|
717
724
|
str(self.attachedimage),
|
718
725
|
self.imagevisible,
|
719
|
-
self.plot_indices
|
720
|
-
|
721
|
-
|
726
|
+
self.plot_indices,
|
727
|
+
self.image_scale,
|
728
|
+
self.image_relative_posx,
|
729
|
+
self.image_relative_posy,
|
730
|
+
self.image_attached_pointx,
|
731
|
+
self.image_attached_pointy
|
732
|
+
]
|
733
|
+
|
734
|
+
def set_extra(self, linesextra:list[float,float,int,float,str,bool, float, float, float, float, float] = None):
|
722
735
|
""" Set extra properties """
|
723
736
|
|
724
737
|
if linesextra is None:
|
@@ -728,7 +741,7 @@ class vectorproperties:
|
|
728
741
|
|
729
742
|
self.legendlength = float(linesextra[0])
|
730
743
|
self.legendheight = float(linesextra[1])
|
731
|
-
self.legendpriority =
|
744
|
+
self.legendpriority = int(linesextra[2])
|
732
745
|
self.legendorientation = float(linesextra[3])
|
733
746
|
|
734
747
|
if len(linesextra)>4:
|
@@ -738,6 +751,13 @@ class vectorproperties:
|
|
738
751
|
if len(linesextra)>6:
|
739
752
|
self.plot_indices = linesextra[6].lower() == 'true'
|
740
753
|
|
754
|
+
if len(linesextra)>7:
|
755
|
+
self.image_scale = float(linesextra[7])
|
756
|
+
self.image_relative_posx = float(linesextra[8])
|
757
|
+
self.image_relative_posy = float(linesextra[9])
|
758
|
+
self.image_attached_pointx = float(linesextra[10])
|
759
|
+
self.image_attached_pointy = float(linesextra[11])
|
760
|
+
|
741
761
|
def load_extra(self, lines:list[str]) -> int:
|
742
762
|
""" Load extra properties from lines """
|
743
763
|
|
@@ -802,6 +822,18 @@ class vectorproperties:
|
|
802
822
|
|
803
823
|
(xmin,xmax),(ymin,ymax) = self.parent.get_bounds_xx_yy()
|
804
824
|
|
825
|
+
if self.textureimage is not None:
|
826
|
+
if self.textureimage.imageFile == self.attachedimage:
|
827
|
+
self.textureimage.drawing_scale = self.image_scale
|
828
|
+
self.textureimage.offset = (self.image_relative_posx, self.image_relative_posy)
|
829
|
+
self.textureimage.xmin = xmin
|
830
|
+
self.textureimage.xmax = xmax
|
831
|
+
self.textureimage.ymin = ymin
|
832
|
+
self.textureimage.ymax = ymax
|
833
|
+
return
|
834
|
+
else:
|
835
|
+
self.textureimage.unload()
|
836
|
+
|
805
837
|
self.textureimage = genericImagetexture(which = 'attachedfile',
|
806
838
|
label=self.parent.myname,
|
807
839
|
mapviewer= self.parent.get_mapviewer(),
|
@@ -809,8 +841,9 @@ class vectorproperties:
|
|
809
841
|
xmin=xmin,
|
810
842
|
xmax=xmax,
|
811
843
|
ymin=ymin,
|
812
|
-
ymax=ymax
|
813
|
-
|
844
|
+
ymax=ymax,
|
845
|
+
drawing_scale= self.image_scale,
|
846
|
+
offset = (self.image_relative_posx, self.image_relative_posy))
|
814
847
|
else:
|
815
848
|
logging.warning('Image not found : {}'.format(self.attachedimage))
|
816
849
|
else:
|
@@ -865,6 +898,11 @@ class vectorproperties:
|
|
865
898
|
|
866
899
|
self.attachedimage = Path(props[('Image','Attached image')])
|
867
900
|
self.imagevisible = props[('Image','To show')]
|
901
|
+
self.image_scale = props[('Image','Scale')]
|
902
|
+
self.image_relative_posx = props[('Image','Relative position X')]
|
903
|
+
self.image_relative_posy = props[('Image','Relative position Y')]
|
904
|
+
self.image_attached_pointx = props[('Image','Attached point X')]
|
905
|
+
self.image_attached_pointy = props[('Image','Attached point Y')]
|
868
906
|
|
869
907
|
posx = props[('Move','Start X')]
|
870
908
|
posy = props[('Move','Start Y')]
|
@@ -1008,6 +1046,11 @@ if :\n \
|
|
1008
1046
|
|
1009
1047
|
self.myprops.addparam('Image','Attached image','',Type_Param.File, '', whichdict='Default')
|
1010
1048
|
self.myprops.addparam('Image','To show',False,Type_Param.Logical,'',whichdict='Default')
|
1049
|
+
self.myprops.addparam('Image','Scale',1.0,Type_Param.Float,'',whichdict='Default')
|
1050
|
+
self.myprops.addparam('Image','Relative position X',0.0,Type_Param.Float,'',whichdict='Default')
|
1051
|
+
self.myprops.addparam('Image','Relative position Y',0.0,Type_Param.Float,'',whichdict='Default')
|
1052
|
+
self.myprops.addparam('Image','Attached point X',-99999.,Type_Param.Float,'',whichdict='Default')
|
1053
|
+
self.myprops.addparam('Image','Attached point Y',-99999.,Type_Param.Float,'',whichdict='Default')
|
1011
1054
|
|
1012
1055
|
def destroyprop(self):
|
1013
1056
|
"""
|
@@ -1113,6 +1156,11 @@ if :\n \
|
|
1113
1156
|
|
1114
1157
|
self.myprops[('Image','Attached image')] = str(self.attachedimage)
|
1115
1158
|
self.myprops[('Image','To show')] = self.imagevisible
|
1159
|
+
self.myprops[('Image','Scale')] = self.image_scale
|
1160
|
+
self.myprops[('Image','Relative position X')] = self.image_relative_posx
|
1161
|
+
self.myprops[('Image','Relative position Y')] = self.image_relative_posy
|
1162
|
+
self.myprops[('Image','Attached point X')] = self.image_attached_pointx
|
1163
|
+
self.myprops[('Image','Attached point Y')] = self.image_attached_pointy
|
1116
1164
|
|
1117
1165
|
if self.parent._rotation_center is not None:
|
1118
1166
|
self.myprops[('Rotation','center X')] = self.parent._rotation_center[0]
|
@@ -1144,6 +1192,31 @@ if :\n \
|
|
1144
1192
|
self.myprops[('Move','Delta Y')] = 0.
|
1145
1193
|
|
1146
1194
|
self.myprops.Populate()
|
1195
|
+
|
1196
|
+
def update_image_texture(self):
|
1197
|
+
""" Update the image texture if it exists """
|
1198
|
+
if self.textureimage is not None:
|
1199
|
+
(xmin, xmax), (ymin, ymax) = self.parent.get_bounds_xx_yy()
|
1200
|
+
self.textureimage.xmin = xmin
|
1201
|
+
self.textureimage.xmax = xmax
|
1202
|
+
self.textureimage.ymin = ymin
|
1203
|
+
self.textureimage.ymax = ymax
|
1204
|
+
self.textureimage.drawing_scale = self.image_scale
|
1205
|
+
self.textureimage.offset = (self.image_relative_posx, self.image_relative_posy)
|
1206
|
+
|
1207
|
+
def _offset_image_texture(self, delta_x:float, delta_y:float):
|
1208
|
+
""" Offset the image texture by a delta in x and y direction """
|
1209
|
+
|
1210
|
+
if self._cached_offset is None:
|
1211
|
+
self._cached_offset = (self.image_relative_posx, self.image_relative_posy)
|
1212
|
+
|
1213
|
+
self.image_relative_posx = self._cached_offset[0] + delta_x
|
1214
|
+
self.image_relative_posy = self._cached_offset[1] + delta_y
|
1215
|
+
|
1216
|
+
def _reset_cached_offset(self):
|
1217
|
+
""" Reset the cached offset for the image texture """
|
1218
|
+
self._cached_offset = None
|
1219
|
+
|
1147
1220
|
class vector:
|
1148
1221
|
"""
|
1149
1222
|
Objet de gestion d'informations vectorielles
|
@@ -1419,11 +1492,13 @@ class vector:
|
|
1419
1492
|
""" Set the cache for the vertices """
|
1420
1493
|
|
1421
1494
|
self._cache_vertices = self.asnparray3d()
|
1495
|
+
self._cache_bounds = np.array([[self.xmin, self.xmax], [self.ymin, self.ymax]])
|
1422
1496
|
|
1423
1497
|
def clear_cache(self):
|
1424
1498
|
""" Clear the cache for the vertices """
|
1425
1499
|
|
1426
1500
|
self._cache_vertices = None
|
1501
|
+
self._cache_bounds = None
|
1427
1502
|
|
1428
1503
|
def move(self, deltax:float, deltay:float, use_cache:bool = True, inplace:bool = True):
|
1429
1504
|
"""
|
@@ -1445,10 +1520,26 @@ class vector:
|
|
1445
1520
|
|
1446
1521
|
if use_cache:
|
1447
1522
|
self.xy = self._cache_vertices[:,:2] + np.array([deltax, deltay])
|
1523
|
+
self.xmin = self._cache_bounds[0,0] + deltax
|
1524
|
+
self.xmax = self._cache_bounds[0,1] + deltax
|
1525
|
+
self.ymin = self._cache_bounds[1,0] + deltay
|
1526
|
+
self.ymax = self._cache_bounds[1,1] + deltay
|
1448
1527
|
else:
|
1449
1528
|
for curvert in self.myvertices:
|
1450
1529
|
curvert.x += deltax
|
1451
1530
|
curvert.y += deltay
|
1531
|
+
# update the bounds
|
1532
|
+
self.xmin += deltax
|
1533
|
+
self.xmax += deltax
|
1534
|
+
self.ymin += deltay
|
1535
|
+
self.ymax += deltay
|
1536
|
+
|
1537
|
+
# update the texture image position if it exists
|
1538
|
+
if self.myprop.textureimage is not None:
|
1539
|
+
self.myprop.textureimage.xmin = self.xmin
|
1540
|
+
self.myprop.textureimage.xmax = self.xmax
|
1541
|
+
self.myprop.textureimage.ymin = self.ymin
|
1542
|
+
self.myprop.textureimage.ymax = self.ymax
|
1452
1543
|
|
1453
1544
|
return self
|
1454
1545
|
else:
|
@@ -1482,6 +1573,14 @@ class vector:
|
|
1482
1573
|
for curvert in self.myvertices:
|
1483
1574
|
curvert.rotate(angle, center)
|
1484
1575
|
|
1576
|
+
self.find_minmax()
|
1577
|
+
|
1578
|
+
if self.myprop.textureimage is not None:
|
1579
|
+
self.myprop.textureimage.xmin = self.xmin
|
1580
|
+
self.myprop.textureimage.xmax = self.xmax
|
1581
|
+
self.myprop.textureimage.ymin = self.ymin
|
1582
|
+
self.myprop.textureimage.ymax = self.ymax
|
1583
|
+
|
1485
1584
|
return self
|
1486
1585
|
else:
|
1487
1586
|
new_vector = self.deepcopy_vector(self.myname + '_rotated')
|
@@ -2071,6 +2170,13 @@ class vector:
|
|
2071
2170
|
|
2072
2171
|
return self.myvertices[indexmp]
|
2073
2172
|
|
2173
|
+
def update_image_texture(self):
|
2174
|
+
"""
|
2175
|
+
Met à jour la texture de l'image si elle existe
|
2176
|
+
"""
|
2177
|
+
|
2178
|
+
self.myprop.update_image_texture()
|
2179
|
+
|
2074
2180
|
def find_minmax(self, only_firstlast:bool=False):
|
2075
2181
|
"""
|
2076
2182
|
Recherche l'extension spatiale du vecteur
|
@@ -2090,6 +2196,8 @@ class vector:
|
|
2090
2196
|
self.ymin=min(vert.y for vert in self.myvertices)
|
2091
2197
|
self.xmax=max(vert.x for vert in self.myvertices)
|
2092
2198
|
self.ymax=max(vert.y for vert in self.myvertices)
|
2199
|
+
|
2200
|
+
self.update_image_texture()
|
2093
2201
|
else:
|
2094
2202
|
self.xmin=-99999.
|
2095
2203
|
self.ymin=-99999.
|
@@ -2681,7 +2789,7 @@ class vector:
|
|
2681
2789
|
|
2682
2790
|
return pts
|
2683
2791
|
|
2684
|
-
def split(self,ds, new=True):
|
2792
|
+
def split(self, ds, new=True):
|
2685
2793
|
"""
|
2686
2794
|
Création d'un nouveau vecteur sur base du découpage d'un autre et d'un pas spatial à respecter
|
2687
2795
|
Le nouveau vecteur contient tous les points de l'ancien et des nouveaux sur base d'un découpage 3D
|
@@ -4135,14 +4243,14 @@ class zone:
|
|
4135
4243
|
self.has_legend |= curvect.myprop.legendvisible
|
4136
4244
|
self.has_image |= curvect.myprop.imagevisible
|
4137
4245
|
|
4138
|
-
if self.has_legend:
|
4139
|
-
for curvect in self.myvectors:
|
4140
|
-
curvect.plot_legend(sx, sy, xmin, ymin, xmax, ymax, size)
|
4141
|
-
|
4142
4246
|
if self.has_image:
|
4143
4247
|
for curvect in self.myvectors:
|
4144
4248
|
curvect.plot_image(sx, sy, xmin, ymin, xmax, ymax, size)
|
4145
4249
|
|
4250
|
+
if self.has_legend:
|
4251
|
+
for curvect in self.myvectors:
|
4252
|
+
curvect.plot_legend(sx, sy, xmin, ymin, xmax, ymax, size)
|
4253
|
+
|
4146
4254
|
def plot_matplotlib(self, ax:plt.Axes):
|
4147
4255
|
"""
|
4148
4256
|
Plot the zone using matplotlib
|
@@ -6725,6 +6833,14 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
6725
6833
|
|
6726
6834
|
return minvec
|
6727
6835
|
|
6836
|
+
def find_vector_containing_point(self, x:float, y:float) -> vector:
|
6837
|
+
""" Trouve le prmier vecteur contenant le point (x,y) """
|
6838
|
+
xy = Point(x, y)
|
6839
|
+
for curzone in self.myzones:
|
6840
|
+
for curvect in curzone.myvectors:
|
6841
|
+
if curvect.polygon.contains(xy):
|
6842
|
+
return curvect
|
6843
|
+
|
6728
6844
|
def reset_listogl(self):
|
6729
6845
|
"""
|
6730
6846
|
Reset des listes OpenGL pour toutes les zones
|
wolfhece/__init__.py
CHANGED
@@ -32,6 +32,7 @@ def ensure_ntv2grid_exists():
|
|
32
32
|
files = ['be_ign_bd72lb72_etrs89lb08.tif', 'be_ign_hBG18.tif', 'be_ign_README.txt']
|
33
33
|
|
34
34
|
pyproj_datadir = Path(pyproj.datadir.get_data_dir())
|
35
|
+
os.environ["PROJ_DATA"] = pyproj.datadir.get_data_dir() # set the PROJ_DATA environment variable to pyproj data directory
|
35
36
|
|
36
37
|
for file in files:
|
37
38
|
if not (pyproj_datadir / file).exists():
|
wolfhece/analyze_poly.py
CHANGED
@@ -231,7 +231,7 @@ class Array_analysis_onepolygon():
|
|
231
231
|
|
232
232
|
import plotly.express as px
|
233
233
|
|
234
|
-
fig = px.histogram(self.values('Values'), x=
|
234
|
+
fig = px.histogram(self.values('Values'), x=self._polygon.myname,
|
235
235
|
nbins=bins, title='Values distribution',
|
236
236
|
histnorm='probability density')
|
237
237
|
|
wolfhece/apps/version.py
CHANGED
wolfhece/textpillow.py
CHANGED