wolfhece 2.1.19__py3-none-any.whl → 2.1.21__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/PyDraw.py +10 -0
- wolfhece/PyVertexvectors.py +72 -30
- wolfhece/apps/version.py +1 -1
- wolfhece/math_parser/__init__.py +855 -0
- wolfhece/math_parser/calculator.py +179 -0
- wolfhece/wolf_array.py +45 -50
- {wolfhece-2.1.19.dist-info → wolfhece-2.1.21.dist-info}/METADATA +2 -1
- {wolfhece-2.1.19.dist-info → wolfhece-2.1.21.dist-info}/RECORD +11 -9
- {wolfhece-2.1.19.dist-info → wolfhece-2.1.21.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.19.dist-info → wolfhece-2.1.21.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.19.dist-info → wolfhece-2.1.21.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -62,6 +62,7 @@ from .lazviewer.laz_viewer import myviewer, read_laz, clip_data_xyz, xyz_laz_gri
|
|
62
62
|
from . import Lidar2002
|
63
63
|
from .picc import Picc_data, Cadaster_data
|
64
64
|
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier
|
65
|
+
from .math_parser.calculator import Calculator
|
65
66
|
|
66
67
|
# try:
|
67
68
|
# from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
|
@@ -445,6 +446,8 @@ class WolfMapViewer(wx.Frame):
|
|
445
446
|
self.tools_menu = wx.Menu()
|
446
447
|
|
447
448
|
self.menu_contour_from_arrays = self.tools_menu.Append(wx.ID_ANY, _("Create contour from checked arrays..."), _("Create contour"))
|
449
|
+
self.menu_calculator = self.tools_menu.Append(wx.ID_ANY, _("Calculator..."), _("Calculator"))
|
450
|
+
self.calculator = None
|
448
451
|
|
449
452
|
# Cross sections
|
450
453
|
# ----------------
|
@@ -4645,6 +4648,13 @@ class WolfMapViewer(wx.Frame):
|
|
4645
4648
|
newzones = self.create_Zones_from_arrays(self.get_list_objects(draw_type.ARRAYS, checked_state=True))
|
4646
4649
|
self.add_object('vector', newobj=newzones, ToCheck=True, id='Contours from arrays')
|
4647
4650
|
|
4651
|
+
elif itemlabel == _("Calculator..."):
|
4652
|
+
|
4653
|
+
if self.calculator is None:
|
4654
|
+
self.calculator = Calculator(mapviewer = self)
|
4655
|
+
else:
|
4656
|
+
self.calculator.Show()
|
4657
|
+
|
4648
4658
|
elif itemlabel == _("Create bridge and export gltf..."):
|
4649
4659
|
|
4650
4660
|
if self.active_cs is None:
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -6,7 +6,8 @@ from wx.dataview import *
|
|
6
6
|
from wx.core import BoxSizer, FlexGridSizer, TreeItemId
|
7
7
|
from OpenGL.GL import *
|
8
8
|
from shapely.geometry import LineString, MultiLineString,Point,MultiPoint,Polygon,JOIN_STYLE, MultiPolygon
|
9
|
-
from shapely.ops import nearest_points,substring, split
|
9
|
+
from shapely.ops import nearest_points,substring, split, polygonize
|
10
|
+
from shapely import delaunay_triangles
|
10
11
|
import pygltflib
|
11
12
|
from scipy.interpolate import interp1d
|
12
13
|
import matplotlib.pyplot as plt
|
@@ -1508,25 +1509,32 @@ class vector:
|
|
1508
1509
|
If the vector has no interior, the list contains the whole vector as a polygon
|
1509
1510
|
"""
|
1510
1511
|
|
1511
|
-
if self.
|
1512
|
-
|
1512
|
+
if self.myprop.filled:
|
1513
|
+
return [self.myvertices]
|
1513
1514
|
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
if curvert in not_in_use:
|
1518
|
-
alls.append(new_poly)
|
1519
|
-
new_poly = []
|
1520
|
-
new_poly.append(curvert)
|
1521
|
-
else:
|
1522
|
-
new_poly.append(curvert)
|
1515
|
+
else:
|
1516
|
+
if self.has_interior:
|
1517
|
+
# not_in_use = [curvert for curvert in self.myvertices if not curvert.in_use]
|
1523
1518
|
|
1524
|
-
|
1525
|
-
alls[0].append(self.myvertices[0])
|
1519
|
+
alls = []
|
1526
1520
|
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1521
|
+
new_poly = []
|
1522
|
+
alls.append(new_poly)
|
1523
|
+
|
1524
|
+
for curvert in self.myvertices:
|
1525
|
+
if curvert.in_use:
|
1526
|
+
new_poly.append(curvert)
|
1527
|
+
else:
|
1528
|
+
new_poly = []
|
1529
|
+
alls.append(new_poly)
|
1530
|
+
new_poly.append(curvert)
|
1531
|
+
|
1532
|
+
if self.myprop.closed and (self.myvertices[0].x != self.myvertices[-1].x or self.myvertices[0].y != self.myvertices[-1].y):
|
1533
|
+
alls[0].append(self.myvertices[0])
|
1534
|
+
|
1535
|
+
return alls
|
1536
|
+
else:
|
1537
|
+
return [self.myvertices]
|
1530
1538
|
|
1531
1539
|
def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
1532
1540
|
"""
|
@@ -1556,26 +1564,54 @@ class vector:
|
|
1556
1564
|
else:
|
1557
1565
|
glColor3ub(int(rgb[0]),int(rgb[1]),int(rgb[2]))
|
1558
1566
|
|
1559
|
-
|
1567
|
+
if self.myprop.filled:
|
1560
1568
|
|
1561
|
-
|
1569
|
+
import triangle
|
1570
|
+
|
1571
|
+
ls = self.asshapely_pol()
|
1572
|
+
|
1573
|
+
if False:
|
1574
|
+
|
1575
|
+
#FIXME : Shapely have not constrained Delaunay triangulation -- using Delaunay from Wolf Fortran instead
|
1576
|
+
ls = ls.segmentize(.1)
|
1577
|
+
delaunay = delaunay_triangles(ls)
|
1578
|
+
|
1579
|
+
for curpol in delaunay.geoms:
|
1580
|
+
if ls.contains(curpol.centroid):
|
1581
|
+
glBegin(GL_POLYGON)
|
1582
|
+
for curvert in curpol.exterior.coords:
|
1583
|
+
glVertex2d(curvert[0],curvert[1])
|
1584
|
+
glEnd()
|
1585
|
+
else:
|
1586
|
+
logging.debug(_('Polygon not in Polygon'))
|
1562
1587
|
|
1563
|
-
if self.myprop.filled:
|
1564
|
-
glBegin(GL_POLYGON)
|
1565
1588
|
else:
|
1589
|
+
#En attendant de lier WOLF-Fortran, on utilise la triangulation contrainte de la librairie Triangle -- https://rufat.be/triangle/
|
1590
|
+
xx, yy = ls.exterior.xy
|
1591
|
+
geom = {'vertices' : np.array([xx,yy]).T, 'segments' : np.array([[i,i+1] for i in range(len(xx)-1)]+[[len(xx)-1,0]])}
|
1592
|
+
delaunay = triangle.triangulate(geom,'p')
|
1593
|
+
|
1594
|
+
for curtri in delaunay['triangles']:
|
1595
|
+
glBegin(GL_POLYGON)
|
1596
|
+
for i in range(3):
|
1597
|
+
glVertex2d(delaunay['vertices'][curtri[i]][0],delaunay['vertices'][curtri[i]][1])
|
1598
|
+
glEnd()
|
1599
|
+
|
1600
|
+
else:
|
1601
|
+
all_polys = self.get_subpolygons()
|
1602
|
+
|
1603
|
+
for curpoly in all_polys:
|
1604
|
+
|
1566
1605
|
glBegin(GL_LINE_STRIP)
|
1567
1606
|
|
1568
|
-
|
1569
|
-
|
1607
|
+
for curvertex in curpoly:
|
1608
|
+
glVertex2d(curvertex.x, curvertex.y)
|
1570
1609
|
|
1571
|
-
|
1610
|
+
glEnd()
|
1572
1611
|
|
1573
1612
|
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE)
|
1574
1613
|
glDisable(GL_BLEND)
|
1575
1614
|
|
1576
|
-
# if self.myprop.legendvisible:
|
1577
|
-
# self.textimage.paint()
|
1578
|
-
|
1579
1615
|
def plot_legend(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
|
1580
1616
|
"""
|
1581
1617
|
Plot OpenGL
|
@@ -1661,7 +1697,7 @@ class vector:
|
|
1661
1697
|
|
1662
1698
|
self.parentzone.reset_listogl()
|
1663
1699
|
|
1664
|
-
def fillgrid(self,gridto:CpGrid):
|
1700
|
+
def fillgrid(self, gridto:CpGrid):
|
1665
1701
|
"""
|
1666
1702
|
Remplissage d'un CpGrid
|
1667
1703
|
"""
|
@@ -1672,6 +1708,7 @@ class vector:
|
|
1672
1708
|
gridto.SetColLabelValue(2,'Z')
|
1673
1709
|
gridto.SetColLabelValue(3,'value')
|
1674
1710
|
gridto.SetColLabelValue(4,'s curvi')
|
1711
|
+
gridto.SetColLabelValue(5,'in use')
|
1675
1712
|
|
1676
1713
|
nb=gridto.GetNumberRows()
|
1677
1714
|
if len(self.myvertices)-nb>0:
|
@@ -1681,6 +1718,7 @@ class vector:
|
|
1681
1718
|
gridto.SetCellValue(k,0,str(curv.x))
|
1682
1719
|
gridto.SetCellValue(k,1,str(curv.y))
|
1683
1720
|
gridto.SetCellValue(k,2,str(curv.z))
|
1721
|
+
gridto.SetCellValue(k,5,'1' if curv.in_use else '0')
|
1684
1722
|
k+=1
|
1685
1723
|
|
1686
1724
|
def updatefromgrid(self,gridfrom:CpGrid):
|
@@ -1695,6 +1733,7 @@ class vector:
|
|
1695
1733
|
x=gridfrom.GetCellValue(k,0)
|
1696
1734
|
y=gridfrom.GetCellValue(k,1)
|
1697
1735
|
z=gridfrom.GetCellValue(k,2)
|
1736
|
+
inuse = gridfrom.GetCellValue(k,5)
|
1698
1737
|
if z=='':
|
1699
1738
|
z=0.
|
1700
1739
|
if x!='':
|
@@ -1702,6 +1741,7 @@ class vector:
|
|
1702
1741
|
self.myvertices[k].x=float(x)
|
1703
1742
|
self.myvertices[k].y=float(y)
|
1704
1743
|
self.myvertices[k].z=float(z)
|
1744
|
+
self.myvertices[k].in_use = inuse=='1'
|
1705
1745
|
else:
|
1706
1746
|
newvert=wolfvertex(float(x),float(y),float(z))
|
1707
1747
|
self.add_vertex(newvert)
|
@@ -1715,6 +1755,8 @@ class vector:
|
|
1715
1755
|
if self.linestring is not None:
|
1716
1756
|
self.prepare_shapely()
|
1717
1757
|
|
1758
|
+
self.parentzone.reset_listogl()
|
1759
|
+
|
1718
1760
|
def get_s2d(self):
|
1719
1761
|
"""
|
1720
1762
|
calcul et retour des positions curvilignes 2D
|
@@ -3842,7 +3884,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
3842
3884
|
self.set_mapviewer()
|
3843
3885
|
|
3844
3886
|
try:
|
3845
|
-
super(Zones, self).__init__(None, size=(
|
3887
|
+
super(Zones, self).__init__(None, size=(400, 400))
|
3846
3888
|
self.Bind(wx.EVT_CLOSE,self.OnClose) # on lie la procédure de fermeture de façon à juste masquer le Frame et non le détruire
|
3847
3889
|
except:
|
3848
3890
|
raise Warning(_('Bad wx context -- see Zones.__init__'))
|
@@ -4405,7 +4447,7 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4405
4447
|
boxupdownz = BoxSizer(orient=wx.VERTICAL)
|
4406
4448
|
|
4407
4449
|
self.xls=CpGrid(self,-1,wx.WANTS_CHARS)
|
4408
|
-
self.xls.CreateGrid(10,
|
4450
|
+
self.xls.CreateGrid(10,6)
|
4409
4451
|
|
4410
4452
|
self.addrows = wx.Button(self,label=_('Add rows'))
|
4411
4453
|
self.addrows.SetToolTip(_("Add rows to the grid --> Useful for manually adding some points to a vector"))
|