wolfhece 2.1.25__py3-none-any.whl → 2.1.27__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/libs/WolfOGL.pyx CHANGED
@@ -2,6 +2,7 @@ from libc.math cimport pow
2
2
  from cython.view cimport array as cvarray
3
3
  cimport cython
4
4
  import numpy as np
5
+ cimport numpy as np
5
6
  cdef extern from "GL\gl.h" nogil:
6
7
  enum: __gl_h_
7
8
  enum: GL_TYPEDEFS_2_0
@@ -1551,6 +1552,38 @@ cdef extern from "GL\gl.h" nogil:
1551
1552
  void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value)
1552
1553
 
1553
1554
 
1555
+ @cython.boundscheck(False) # Deactivate bounds checking
1556
+ @cython.wraparound(False) # Deactivate negative indexing.
1557
+ cpdef mapColor(float zValue, double[:] colorValues, int paletteSize, double[:,:] colorPalette, int cstcmap):
1558
+
1559
+ cdef float zColor
1560
+ cdef float lower
1561
+ cdef float upper
1562
+ cdef float[3] loccolor
1563
+
1564
+ # Mapper la valeur sur base d'intervalles
1565
+ if zValue <= colorValues[0]:
1566
+ return colorPalette[0,:]
1567
+ elif (zValue >= colorValues[paletteSize-1]):
1568
+ return colorPalette[-1,:]
1569
+ else:
1570
+ for i in range(1,paletteSize):
1571
+ if zValue <= colorValues[i]:
1572
+ lower = colorValues[i-1]
1573
+ upper = colorValues[i]
1574
+
1575
+ if cstcmap == 1:
1576
+ return colorPalette[i-1,:]
1577
+ else:
1578
+ zColor = ((zValue - lower) / (upper - lower))
1579
+
1580
+ for k in range(3):
1581
+ loccolor[k] = colorPalette[i-1,k] * (1.0 - zColor) + colorPalette[i,k] * zColor
1582
+
1583
+ return loccolor
1584
+
1585
+ return colorPalette[0,:]
1586
+
1554
1587
  @cython.boundscheck(False) # Deactivate bounds checking
1555
1588
  @cython.wraparound(False) # Deactivate negative indexing.
1556
1589
  cpdef double addme(float[:,:] array,double[:,:,:] rgb,double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha):
@@ -1603,3 +1636,327 @@ cpdef double addmeall(float[:,:] array,double[:,:,:] rgb,double ox, double oy, d
1603
1636
  glNormal3f(0.e0,0.e0,1.e0)
1604
1637
  glEnd()
1605
1638
 
1639
+ @cython.boundscheck(False) # Deactivate bounds checking
1640
+ @cython.wraparound(False) # Deactivate negative indexing.
1641
+ cpdef double addme_uint8(float[:,:] array, np.uint8_t[:,:,:] rgb,double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,np.uint8_t alpha):
1642
+
1643
+ cdef int i,j
1644
+ cdef double x,y
1645
+ cdef double dxaff,dyaff
1646
+
1647
+ dxaff=dx*float(cursize)
1648
+ dyaff=dy*float(cursize)
1649
+
1650
+ for j in range(jstart,jend,cursize):
1651
+ for i in range(istart,iend,cursize):
1652
+ if array[i,j]!=nullvalue :
1653
+ x=ox+float(i)*dx
1654
+ y=oy+float(j)*dy
1655
+
1656
+ glBegin(GL_QUADS)
1657
+ glColor4ub(rgb[i,j,0],rgb[i,j,1],rgb[i,j,2],255)
1658
+ glVertex2d(x,y)
1659
+ glVertex2d(x+dxaff,y)
1660
+ glVertex2d(x+dxaff,y+dyaff)
1661
+ glVertex2d(x,y+dyaff)
1662
+ glNormal3f(0.e0,0.e0,1.e0)
1663
+ glEnd()
1664
+
1665
+
1666
+ @cython.boundscheck(False) # Deactivate bounds checking
1667
+ @cython.wraparound(False) # Deactivate negative indexing.
1668
+ cpdef double addmeall_uint8(float[:,:] array, np.uint8_t[:,:,:] rgb,double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,np.uint8_t alpha):
1669
+
1670
+ cdef int i,j
1671
+ cdef double x,y
1672
+ cdef double dxaff,dyaff
1673
+
1674
+ dxaff=dx*float(cursize)
1675
+ dyaff=dy*float(cursize)
1676
+
1677
+ for j in range(jstart,jend,cursize):
1678
+ for i in range(istart,iend,cursize):
1679
+ x=ox+float(i)*dx
1680
+ y=oy+float(j)*dy
1681
+
1682
+ glBegin(GL_QUADS)
1683
+ glColor4ub(rgb[i,j,0],rgb[i,j,1],rgb[i,j,2],255)
1684
+ glVertex2d(x,y)
1685
+ glVertex2d(x+dxaff,y)
1686
+ glVertex2d(x+dxaff,y+dyaff)
1687
+ glVertex2d(x,y+dyaff)
1688
+ glNormal3f(0.e0,0.e0,1.e0)
1689
+ glEnd()
1690
+
1691
+ @cython.boundscheck(False) # Deactivate bounds checking
1692
+ @cython.wraparound(False) # Deactivate negative indexing.
1693
+ cpdef double addme_pal(float[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1694
+
1695
+ cdef int i,j
1696
+ cdef double x,y
1697
+ cdef double dxaff,dyaff
1698
+
1699
+ dxaff=dx*float(cursize)
1700
+ dyaff=dy*float(cursize)
1701
+
1702
+ for j in range(jstart,jend,cursize):
1703
+ for i in range(istart,iend,cursize):
1704
+ if array[i,j]!=nullvalue :
1705
+ x=ox+float(i)*dx
1706
+ y=oy+float(j)*dy
1707
+
1708
+ color = mapColor(array[i,j],values,len(values),rgb, cst_cmap)
1709
+ glBegin(GL_QUADS)
1710
+ glColor4f(color[0],color[1],color[2],float(alpha))
1711
+ glVertex2d(x,y)
1712
+ glVertex2d(x+dxaff,y)
1713
+ glVertex2d(x+dxaff,y+dyaff)
1714
+ glVertex2d(x,y+dyaff)
1715
+ glNormal3f(0.e0,0.e0,1.e0)
1716
+ glEnd()
1717
+
1718
+
1719
+ @cython.boundscheck(False) # Deactivate bounds checking
1720
+ @cython.wraparound(False) # Deactivate negative indexing.
1721
+ cpdef double addmeall_pal(float[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1722
+
1723
+ cdef int i,j
1724
+ cdef double x,y
1725
+ cdef double dxaff,dyaff
1726
+
1727
+ dxaff=dx*float(cursize)
1728
+ dyaff=dy*float(cursize)
1729
+
1730
+ for j in range(jstart,jend,cursize):
1731
+ for i in range(istart,iend,cursize):
1732
+ x=ox+float(i)*dx
1733
+ y=oy+float(j)*dy
1734
+
1735
+ color = mapColor(array[i,j],values,len(values),rgb, cst_cmap)
1736
+ glBegin(GL_QUADS)
1737
+ glColor4f(color[0],color[1],color[2],float(alpha))
1738
+ glVertex2d(x,y)
1739
+ glVertex2d(x+dxaff,y)
1740
+ glVertex2d(x+dxaff,y+dyaff)
1741
+ glVertex2d(x,y+dyaff)
1742
+ glNormal3f(0.e0,0.e0,1.e0)
1743
+ glEnd()
1744
+
1745
+
1746
+ @cython.boundscheck(False) # Deactivate bounds checking
1747
+ @cython.wraparound(False) # Deactivate negative indexing.
1748
+ cpdef double addme_int8_pal(np.int8_t[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1749
+
1750
+ cdef int i,j
1751
+ cdef double x,y
1752
+ cdef double dxaff,dyaff
1753
+
1754
+ dxaff=dx*float(cursize)
1755
+ dyaff=dy*float(cursize)
1756
+
1757
+ for j in range(jstart,jend,cursize):
1758
+ for i in range(istart,iend,cursize):
1759
+ if array[i,j]!=nullvalue :
1760
+ x=ox+float(i)*dx
1761
+ y=oy+float(j)*dy
1762
+
1763
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1764
+ glBegin(GL_QUADS)
1765
+ glColor4f(color[0],color[1],color[2],float(alpha))
1766
+ glVertex2d(x,y)
1767
+ glVertex2d(x+dxaff,y)
1768
+ glVertex2d(x+dxaff,y+dyaff)
1769
+ glVertex2d(x,y+dyaff)
1770
+ glNormal3f(0.e0,0.e0,1.e0)
1771
+ glEnd()
1772
+
1773
+
1774
+ @cython.boundscheck(False) # Deactivate bounds checking
1775
+ @cython.wraparound(False) # Deactivate negative indexing.
1776
+ cpdef double addmeall_int8_pal(np.int8_t[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1777
+
1778
+ cdef int i,j
1779
+ cdef double x,y
1780
+ cdef double dxaff,dyaff
1781
+
1782
+ dxaff=dx*float(cursize)
1783
+ dyaff=dy*float(cursize)
1784
+
1785
+ for j in range(jstart,jend,cursize):
1786
+ for i in range(istart,iend,cursize):
1787
+ x=ox+float(i)*dx
1788
+ y=oy+float(j)*dy
1789
+
1790
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1791
+ glBegin(GL_QUADS)
1792
+ glColor4f(color[0],color[1],color[2],float(alpha))
1793
+ glVertex2d(x,y)
1794
+ glVertex2d(x+dxaff,y)
1795
+ glVertex2d(x+dxaff,y+dyaff)
1796
+ glVertex2d(x,y+dyaff)
1797
+ glNormal3f(0.e0,0.e0,1.e0)
1798
+ glEnd()
1799
+
1800
+ @cython.boundscheck(False) # Deactivate bounds checking
1801
+ @cython.wraparound(False) # Deactivate negative indexing.
1802
+ cpdef double addme_int_pal(int[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1803
+
1804
+ cdef int i,j
1805
+ cdef double x,y
1806
+ cdef double dxaff,dyaff
1807
+
1808
+ dxaff=dx*float(cursize)
1809
+ dyaff=dy*float(cursize)
1810
+
1811
+ for j in range(jstart,jend,cursize):
1812
+ for i in range(istart,iend,cursize):
1813
+ if array[i,j]!=nullvalue :
1814
+ x=ox+float(i)*dx
1815
+ y=oy+float(j)*dy
1816
+
1817
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1818
+ glBegin(GL_QUADS)
1819
+ glColor4f(color[0],color[1],color[2],float(alpha))
1820
+ glVertex2d(x,y)
1821
+ glVertex2d(x+dxaff,y)
1822
+ glVertex2d(x+dxaff,y+dyaff)
1823
+ glVertex2d(x,y+dyaff)
1824
+ glNormal3f(0.e0,0.e0,1.e0)
1825
+ glEnd()
1826
+
1827
+
1828
+ @cython.boundscheck(False) # Deactivate bounds checking
1829
+ @cython.wraparound(False) # Deactivate negative indexing.
1830
+ cpdef double addmeall_int_pal(int[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1831
+
1832
+ cdef int i,j
1833
+ cdef double x,y
1834
+ cdef double dxaff,dyaff
1835
+
1836
+ dxaff=dx*float(cursize)
1837
+ dyaff=dy*float(cursize)
1838
+
1839
+ for j in range(jstart,jend,cursize):
1840
+ for i in range(istart,iend,cursize):
1841
+ x=ox+float(i)*dx
1842
+ y=oy+float(j)*dy
1843
+
1844
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1845
+ glBegin(GL_QUADS)
1846
+ glColor4f(color[0],color[1],color[2],float(alpha))
1847
+ glVertex2d(x,y)
1848
+ glVertex2d(x+dxaff,y)
1849
+ glVertex2d(x+dxaff,y+dyaff)
1850
+ glVertex2d(x,y+dyaff)
1851
+ glNormal3f(0.e0,0.e0,1.e0)
1852
+ glEnd()
1853
+
1854
+ @cython.boundscheck(False) # Deactivate bounds checking
1855
+ @cython.wraparound(False) # Deactivate negative indexing.
1856
+ cpdef double addme_int16_pal(np.int16_t[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1857
+
1858
+ cdef int i,j
1859
+ cdef double x,y
1860
+ cdef double dxaff,dyaff
1861
+
1862
+ dxaff=dx*float(cursize)
1863
+ dyaff=dy*float(cursize)
1864
+
1865
+ for j in range(jstart,jend,cursize):
1866
+ for i in range(istart,iend,cursize):
1867
+ if array[i,j]!=nullvalue :
1868
+ x=ox+float(i)*dx
1869
+ y=oy+float(j)*dy
1870
+
1871
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1872
+ glBegin(GL_QUADS)
1873
+ glColor4f(color[0],color[1],color[2],float(alpha))
1874
+ glVertex2d(x,y)
1875
+ glVertex2d(x+dxaff,y)
1876
+ glVertex2d(x+dxaff,y+dyaff)
1877
+ glVertex2d(x,y+dyaff)
1878
+ glNormal3f(0.e0,0.e0,1.e0)
1879
+ glEnd()
1880
+
1881
+
1882
+ @cython.boundscheck(False) # Deactivate bounds checking
1883
+ @cython.wraparound(False) # Deactivate negative indexing.
1884
+ cpdef double addmeall_int16_pal(np.int16_t[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1885
+
1886
+ cdef int i,j
1887
+ cdef double x,y
1888
+ cdef double dxaff,dyaff
1889
+
1890
+ dxaff=dx*float(cursize)
1891
+ dyaff=dy*float(cursize)
1892
+
1893
+ for j in range(jstart,jend,cursize):
1894
+ for i in range(istart,iend,cursize):
1895
+ x=ox+float(i)*dx
1896
+ y=oy+float(j)*dy
1897
+
1898
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1899
+ glBegin(GL_QUADS)
1900
+ glColor4f(color[0],color[1],color[2],float(alpha))
1901
+ glVertex2d(x,y)
1902
+ glVertex2d(x+dxaff,y)
1903
+ glVertex2d(x+dxaff,y+dyaff)
1904
+ glVertex2d(x,y+dyaff)
1905
+ glNormal3f(0.e0,0.e0,1.e0)
1906
+ glEnd()
1907
+
1908
+
1909
+ @cython.boundscheck(False) # Deactivate bounds checking
1910
+ @cython.wraparound(False) # Deactivate negative indexing.
1911
+ cpdef double addme_double_pal(double[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1912
+
1913
+ cdef int i,j
1914
+ cdef double x,y
1915
+ cdef double dxaff,dyaff
1916
+
1917
+ dxaff=dx*float(cursize)
1918
+ dyaff=dy*float(cursize)
1919
+
1920
+ for j in range(jstart,jend,cursize):
1921
+ for i in range(istart,iend,cursize):
1922
+ if array[i,j]!=nullvalue :
1923
+ x=ox+float(i)*dx
1924
+ y=oy+float(j)*dy
1925
+
1926
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1927
+ glBegin(GL_QUADS)
1928
+ glColor4f(color[0],color[1],color[2],float(alpha))
1929
+ glVertex2d(x,y)
1930
+ glVertex2d(x+dxaff,y)
1931
+ glVertex2d(x+dxaff,y+dyaff)
1932
+ glVertex2d(x,y+dyaff)
1933
+ glNormal3f(0.e0,0.e0,1.e0)
1934
+ glEnd()
1935
+
1936
+
1937
+ @cython.boundscheck(False) # Deactivate bounds checking
1938
+ @cython.wraparound(False) # Deactivate negative indexing.
1939
+ cpdef double addmeall_double_pal(double[:,:] array, double[:,:] rgb, double[:] values, double ox, double oy, double dx, double dy,int jstart,int jend,int istart,int iend, int cursize, double nullvalue,double alpha, int cst_cmap):
1940
+
1941
+ cdef int i,j
1942
+ cdef double x,y
1943
+ cdef double dxaff,dyaff
1944
+
1945
+ dxaff=dx*float(cursize)
1946
+ dyaff=dy*float(cursize)
1947
+
1948
+ for j in range(jstart,jend,cursize):
1949
+ for i in range(istart,iend,cursize):
1950
+ x=ox+float(i)*dx
1951
+ y=oy+float(j)*dy
1952
+
1953
+ color = mapColor(float(array[i,j]),values,len(values),rgb, cst_cmap)
1954
+ glBegin(GL_QUADS)
1955
+ glColor4f(color[0],color[1],color[2],float(alpha))
1956
+ glVertex2d(x,y)
1957
+ glVertex2d(x+dxaff,y)
1958
+ glVertex2d(x+dxaff,y+dyaff)
1959
+ glVertex2d(x,y+dyaff)
1960
+ glNormal3f(0.e0,0.e0,1.e0)
1961
+ glEnd()
1962
+
Binary file
wolfhece/pyviews.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
 
3
3
  from .drawing_obj import Element_To_Draw
4
- from .wolf_array import WolfArray,WolfArrayMB
4
+ from .wolf_array import WolfArray,WolfArrayMB, VERSION_RGB
5
5
  from .PyParams import Wolf_Param, key_Param, Type_Param
6
6
 
7
7
  class WolfViews(Element_To_Draw):
@@ -178,10 +178,10 @@ class WolfViews(Element_To_Draw):
178
178
  if isinstance(cur,WolfArray):
179
179
  if cur.rgb is None:
180
180
  if pal is not None:
181
- cur.rgb = pal.get_rgba(cur.array)
181
+ if VERSION_RGB ==1: cur.rgb = pal.get_rgba(cur.array)
182
182
  else:
183
183
  cur.mypal.defaultgray_minmax(cur.array)
184
- cur.rgb = cur.mypal.get_rgba(cur.array)
184
+ if VERSION_RGB ==1: cur.rgb = cur.mypal.get_rgba(cur.array)
185
185
 
186
186
  cur.plot(sx,sy,xmin,ymin,xmax,ymax)
187
187
  cur.plotted = oldplotted