wolfhece 2.1.119__py3-none-any.whl → 2.1.120__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.
@@ -46,6 +46,7 @@ from .PyVertex import wolfvertex,getIfromRGB,getRGBfromI, cloud_vertices
46
46
  from .PyParams import Wolf_Param, Type_Param, new_json
47
47
  from .wolf_texture import Text_Image_Texture,Text_Infos
48
48
  from .drawing_obj import Element_To_Draw
49
+ from .matplotlib_fig import Matplotlib_Figure as MplFig
49
50
 
50
51
  class Triangulation(Element_To_Draw):
51
52
  def __init__(self, fn='', pts=[], tri=[], idx: str = '', plotted: bool = True, mapviewer=None, need_for_wx: bool = False) -> None:
@@ -2626,6 +2627,83 @@ class vector:
2626
2627
 
2627
2628
  return fig,ax
2628
2629
 
2630
+ def plot_linked_wx(self, fig:MplFig, linked_arrays:dict):
2631
+ """
2632
+ Graphique Matplolib de valeurs dans les matrices liées.
2633
+
2634
+ Version pour wxPython
2635
+ """
2636
+
2637
+ colors=['red','blue','green']
2638
+
2639
+ exit=True
2640
+ for curlabel, curarray in linked_arrays.items():
2641
+ if curarray.plotted:
2642
+ exit=False
2643
+
2644
+ if exit:
2645
+ return
2646
+
2647
+ k=0
2648
+
2649
+ myls = self.asshapely_ls()
2650
+ length = myls.length
2651
+ tol=length/10.
2652
+ fig.cur_ax.set_xlim(0-tol,length+tol)
2653
+
2654
+ zmin=99999.
2655
+ zmax=-99999.
2656
+ nullvalue = -99999
2657
+
2658
+ for curlabel, curarray in linked_arrays.items():
2659
+ if curarray.plotted:
2660
+
2661
+ ds = curarray.get_dxdy_min()
2662
+
2663
+ nb = int(np.ceil(length/ds*2))
2664
+
2665
+ alls = np.linspace(0,int(length),nb)
2666
+
2667
+ pts = [myls.interpolate(curs) for curs in alls]
2668
+
2669
+ allz = np.asarray([curarray.get_value(curpt.x,curpt.y, nullvalue= nullvalue) for curpt in pts])
2670
+
2671
+ zmaxloc=np.max(allz[allz!=nullvalue])
2672
+ zminloc=np.min(allz[allz!=nullvalue])
2673
+
2674
+ zmax=max(zmax,zmaxloc)
2675
+ zmin=min(zmin,zminloc)
2676
+
2677
+ if np.max(allz)>nullvalue:
2678
+ # select parts
2679
+ if nullvalue in allz:
2680
+ # find all parts separated by nullvalue
2681
+ nulls = np.argwhere(allz==nullvalue)
2682
+ nulls = np.insert(nulls,0,-1)
2683
+ nulls = np.append(nulls,len(allz))
2684
+
2685
+ addlabel = True
2686
+ for i in range(len(nulls)-1):
2687
+ if nulls[i+1]-nulls[i]>1:
2688
+ fig.plot(alls[nulls[i]+1:nulls[i+1]],allz[nulls[i]+1:nulls[i+1]],
2689
+ color=colors[np.mod(k,3)],
2690
+ lw=2.0,
2691
+ label=curlabel if addlabel else None)
2692
+ addlabel = False
2693
+
2694
+ else:
2695
+ fig.plot(alls,allz,
2696
+ color=colors[np.mod(k,3)],
2697
+ lw=2.0,
2698
+ label=curlabel)
2699
+ k+=1
2700
+
2701
+ fig.cur_ax.set_ylim(zmin,zmax)
2702
+ fig.cur_ax.legend()
2703
+ fig.cur_ax.grid()
2704
+
2705
+ return fig
2706
+
2629
2707
  def plot_mpl(self,show=False,forceaspect=True,fig:Figure=None,ax:Axes=None,labels:dict={}):
2630
2708
  """
2631
2709
  Graphique Matplolib du vecteur
@@ -4814,6 +4892,227 @@ class zone:
4814
4892
  ax.set_yticks(np.arange(zmodmin,zmax,.25))
4815
4893
  fig.canvas.draw()
4816
4894
 
4895
+ def plot_linked_polygons_wx(self, fig:MplFig,
4896
+ linked_arrays:dict, linked_vec:dict[str,"Zones"]=None,
4897
+ linestyle:str='-', onlymedian:bool=False,
4898
+ withtopography:bool = True, ds:float = None):
4899
+ """
4900
+ Création d'un graphique sur base des polygones
4901
+
4902
+ Chaque polygone se positionnera sur base de la valeur Z de ses vertices
4903
+ - façon conventionnelle de définir une longueur
4904
+ - ceci est normalement fait lors de l'appel à 'create_polygon_from_parallel'
4905
+ - si les polygones sont créés manuellement, il faut donc prendre soin de fournir l'information adhoc ou alors utiliser l'rgument 'ds'
4906
+
4907
+ ATTENTION : Les coordonnées Z ne sont sauvegardées sur disque que si le fichier est 3D, autrement dit au format '.vecz'
4908
+
4909
+ :param fig: Figure
4910
+ :param ax: Axes
4911
+ :param linked_arrays: dictionnaire contenant les matrices à lier -- les clés sont les labels
4912
+ :param linked_vec: dictionnaire contenant les instances Zones à lier -- Besoin d'une zone et d'un vecteur 'trace/trace' pour convertir les positions en coordonnées curvilignes
4913
+ :param linestyle: style de ligne
4914
+ :param onlymedian: affiche uniquement la médiane
4915
+ :param withtopography: affiche la topographie
4916
+ :param ds: pas spatial le long de l'axe
4917
+
4918
+ """
4919
+
4920
+ colors=['red','blue','green','darkviolet','fuchsia','lime']
4921
+
4922
+ #Vérifie qu'au moins une matrice liée est fournie, sinon rien à faire
4923
+ exit=True
4924
+ for curlabel, curarray in linked_arrays.items():
4925
+ if curarray.plotted:
4926
+ exit=False
4927
+ if exit:
4928
+ return
4929
+
4930
+ k=0
4931
+
4932
+ zmin=99999.
4933
+ zmax=-99999.
4934
+
4935
+ if ds is None:
4936
+ # Récupération des positions
4937
+ srefs=np.asarray([curpol.myvertices[0].z for curpol in self.myvectors])
4938
+ else:
4939
+ # Création des positions sur base de 'ds'
4940
+ srefs=np.arange(0., float(self.nbvectors) * ds, ds)
4941
+
4942
+ for idx, (curlabel, curarray) in enumerate(linked_arrays.items()):
4943
+ if curarray.plotted:
4944
+
4945
+ logging.info(_('Plotting linked polygons for {}'.format(curlabel)))
4946
+ logging.info(_('Number of polygons : {}'.format(self.nbvectors)))
4947
+ logging.info(_('Extracting values inside polygons...'))
4948
+
4949
+ vals= [curarray.get_values_insidepoly(curpol) for curpol in self.myvectors]
4950
+
4951
+ logging.info(_('Computing stats...'))
4952
+
4953
+ values = np.asarray([cur[0] for cur in vals],dtype=object)
4954
+ valel = np.asarray([cur[1] for cur in vals],dtype=object)
4955
+
4956
+ zmaxloc=np.asarray([np.max(curval) if len(curval) >0 else -99999. for curval in values])
4957
+ zminloc=np.asarray([np.min(curval) if len(curval) >0 else -99999. for curval in values])
4958
+
4959
+ zmax=max(zmax,np.max(zmaxloc[np.where(zmaxloc>-99999.)]))
4960
+ zmin=min(zmin,np.min(zminloc[np.where(zminloc>-99999.)]))
4961
+
4962
+ if zmax>-99999:
4963
+
4964
+ zloc = np.asarray([np.median(curpoly) if len(curpoly) >0 else -99999. for curpoly in values])
4965
+
4966
+ fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
4967
+ color=colors[np.mod(k,3)],
4968
+ lw=2.0,
4969
+ linestyle=linestyle,
4970
+ label=curlabel+'_median')
4971
+
4972
+ zloc = np.asarray([np.min(curpoly) if len(curpoly) >0 else -99999. for curpoly in values])
4973
+
4974
+ if not onlymedian:
4975
+
4976
+ fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
4977
+ color=colors[np.mod(k,3)],alpha=.3,
4978
+ lw=2.0,
4979
+ linestyle=linestyle,
4980
+ label=curlabel+'_min')
4981
+
4982
+ zloc = np.asarray([np.max(curpoly) if len(curpoly) >0 else -99999. for curpoly in values])
4983
+
4984
+ fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
4985
+ color=colors[np.mod(k,3)],alpha=.3,
4986
+ lw=2.0,
4987
+ linestyle=linestyle,
4988
+ label=curlabel+'_max')
4989
+
4990
+ if withtopography and idx==0:
4991
+ if valel[0] is not None:
4992
+ zmaxloc=np.asarray([np.max(curval) if len(curval) >0 else -99999. for curval in valel])
4993
+ zminloc=np.asarray([np.min(curval) if len(curval) >0 else -99999. for curval in valel])
4994
+
4995
+ zmax=max(zmax,np.max(zmaxloc[np.where(zmaxloc>-99999.)]))
4996
+ zmin=min(zmin,np.min(zminloc[np.where(zminloc>-99999.)]))
4997
+
4998
+ if zmax>-99999:
4999
+
5000
+ zloc = np.asarray([np.median(curpoly) if len(curpoly) >0 else -99999. for curpoly in valel])
5001
+
5002
+ fig.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
5003
+ color='black',
5004
+ lw=2.0,
5005
+ linestyle=linestyle,
5006
+ label=curlabel+'_top_median')
5007
+
5008
+ # if not onlymedian:
5009
+ # zloc = np.asarray([np.min(curpoly) for curpoly in valel])
5010
+
5011
+ # ax.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
5012
+ # color='black',alpha=.3,
5013
+ # lw=2.0,
5014
+ # linestyle=linestyle,
5015
+ # label=curlabel+'_top_min')
5016
+
5017
+ # zloc = np.asarray([np.max(curpoly) for curpoly in valel])
5018
+
5019
+ # ax.plot(srefs[np.where(zloc!=-99999.)],zloc[np.where(zloc!=-99999.)],
5020
+ # color='black',alpha=.3,
5021
+ # lw=2.0,
5022
+ # linestyle=linestyle,
5023
+ # label=curlabel+'_top_max')
5024
+
5025
+ k+=1
5026
+
5027
+ for curlabel, curzones in linked_vec.items():
5028
+ curzones:Zones
5029
+ names = [curzone.myname for curzone in curzones.myzones]
5030
+ trace = None
5031
+ tracels = None
5032
+
5033
+ logging.info(_('Plotting linked zones for {}'.format(curlabel)))
5034
+
5035
+ curzone: zone
5036
+ if 'trace' in names:
5037
+ curzone = curzones.get_zone('trace')
5038
+ trace = curzone.get_vector('trace')
5039
+
5040
+ if trace is None:
5041
+ if curzone is not None:
5042
+ if curzone.nbvectors>0:
5043
+ trace = curzone.myvectors[0]
5044
+
5045
+ if trace is not None:
5046
+ tracels = trace.asshapely_ls()
5047
+ else:
5048
+ logging.warning(_('No trace found in the vectors {}'.format(curlabel)))
5049
+ break
5050
+
5051
+ if ('marks' in names) or ('repères' in names):
5052
+ if ('marks' in names):
5053
+ curzone = curzones.myzones[names.index('marks')]
5054
+ else:
5055
+ curzone = curzones.myzones[names.index('repères')]
5056
+
5057
+ logging.info(_('Plotting marks for {}'.format(curlabel)))
5058
+ logging.info(_('Number of marks : {}'.format(curzone.nbvectors)))
5059
+
5060
+ for curvect in curzone.myvectors:
5061
+ curls = curvect.asshapely_ls()
5062
+
5063
+ if curls.intersects(tracels):
5064
+ inter = curls.intersection(tracels)
5065
+ curs = float(tracels.project(inter))
5066
+
5067
+ fig.plot([curs, curs], [zmin, zmax], linestyle='--', label=curvect.myname)
5068
+ fig.text(curs, zmax, curvect.myname, fontsize=8, ha='center', va='bottom')
5069
+
5070
+ if ('banks' in names) or ('berges' in names):
5071
+
5072
+ if ('banks' in names):
5073
+ curzone = curzones.myzones[names.index('banks')]
5074
+ else:
5075
+ curzone = curzones.myzones[names.index('berges')]
5076
+
5077
+ logging.info(_('Plotting banks for {}'.format(curlabel)))
5078
+ logging.info(_('Number of banks : {}'.format(curzone.nbvectors)))
5079
+
5080
+ for curvect in curzone.myvectors:
5081
+ curvect: vector
5082
+
5083
+ curproj = curvect.projectontrace(trace)
5084
+ sz = curproj.asnparray()
5085
+ fig.plot(sz[:,0], sz[:,1], label=curvect.myname)
5086
+
5087
+ if ('bridges' in names) or ('ponts' in names):
5088
+ if ('bridges' in names):
5089
+ curzone = curzones.myzones[names.index('bridges')]
5090
+ else:
5091
+ curzone = curzones.myzones[names.index('ponts')]
5092
+
5093
+ logging.info(_('Plotting bridges for {}'.format(curlabel)))
5094
+
5095
+ for curvect in curzone.myvectors:
5096
+ curvect: vector
5097
+ curls = curvect.asshapely_ls()
5098
+
5099
+ if curls.intersects(tracels):
5100
+
5101
+ logging.info(_('Bridge {} intersects the trace'.format(curvect.myname)))
5102
+
5103
+ inter = curls.intersection(tracels)
5104
+ curs = float(tracels.project(inter))
5105
+ locz = np.asarray([vert.z for vert in curvect.myvertices])
5106
+ zmin = np.amin(locz)
5107
+ zmax = np.amax(locz)
5108
+
5109
+ fig.plot(curs, zmin, label=curvect.myname + ' min', marker='x')
5110
+ fig.plot(curs, zmax, label=curvect.myname + ' max', marker='x')
5111
+
5112
+ fig.cur_ax.set_ylim(zmin,zmax)
5113
+ zmodmin= np.floor_divide(zmin*100,25)*25/100
5114
+ fig.cur_ax.set_yticks(np.arange(zmodmin,zmax,.25))
5115
+
4817
5116
  def reset_listogl(self):
4818
5117
  """
4819
5118
  Reset OpenGL lists.
@@ -58,6 +58,45 @@ def main():
58
58
  ret += 'Wolfhece not installed properly\n Please install the VC++ redistributable\n from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads\n\n'
59
59
  ret += 'Error : ' + str(e) + '\n\n'
60
60
 
61
+ from pathlib import Path
62
+ dirlaz = Path(__file__).parent.parent / 'lazviewer'
63
+ dirs_to_test = [dirlaz / 'libs', dirlaz / 'libs/qt_plugins', dirlaz / 'libs/qt_plugins/platforms']
64
+
65
+ for d in dirs_to_test:
66
+ if not d.exists() or not d.is_dir():
67
+ ret += str(d) + ' does not exist\n\n'
68
+
69
+ curdir = dirlaz / 'libs/qt_plugins/platforms'
70
+ files_to_test = [curdir / 'qwindows.dll']
71
+
72
+ for f in files_to_test:
73
+ if not f.exists() or not f.is_file():
74
+ ret += str(f) + ' does not exist\n\n'
75
+
76
+ curdir = dirlaz / 'libs'
77
+ files_to_test = [curdir / 'icudt53.dll', curdir / 'icuin53.dll', curdir / 'icuuc53.dll',
78
+ curdir / 'msvcp120.dll', curdir / 'msvcr120.dll', curdir / 'Qt5Core.dll',
79
+ curdir / 'Qt5Gui.dll', curdir / 'Qt5Network.dll', curdir / 'Qt5Widgets.dll',
80
+ curdir / 'tbb.dll', curdir / 'tbbmalloc.dll', curdir / 'vcomp120.dll']
81
+
82
+ for f in files_to_test:
83
+ if not f.exists() or not f.is_file():
84
+ ret += str(f) + ' does not exist\n\n'
85
+
86
+ try:
87
+ from ..lazviewer.viewer import viewer
88
+ import numpy as np
89
+
90
+ pts = np.array([[0, 0, 0], [1, 1, 1], [2, 2, 2]])
91
+ myview = viewer.viewer(pts, debug = True)
92
+
93
+ ret += 'LAZ viewer created in debug mode -- check for errors if reported\n\n'
94
+
95
+ except ImportError as e:
96
+ ret += 'Could not import/create LAZ viewer\n\n'
97
+ ret += 'Wolfhece not installed properly\n Please check if QT \n\n'
98
+ ret += 'Error : ' + str(e) + '\n\n'
99
+
61
100
  print(ret)
62
101
 
63
102
  if __name__=='__main__':
wolfhece/apps/version.py CHANGED
@@ -5,7 +5,7 @@ class WolfVersion():
5
5
 
6
6
  self.major = 2
7
7
  self.minor = 1
8
- self.patch = 119
8
+ self.patch = 120
9
9
 
10
10
  def __str__(self):
11
11
 
@@ -1,23 +1,23 @@
1
- import os
2
- import os.path
3
- import sys
4
- import platform
1
+ # import os
2
+ # import os.path
3
+ # import sys
4
+ # import platform
5
5
 
6
6
 
7
- def _add_path():
8
- _root_dir = os.path.dirname(os.path.realpath(__file__))
7
+ # def _add_path():
8
+ # _root_dir = os.path.dirname(os.path.realpath(__file__))
9
9
 
10
- # manual specify list of dll directories, with paths relative to _root_dir
11
- _dll_dirs = ['libs']
10
+ # # manual specify list of dll directories, with paths relative to _root_dir
11
+ # _dll_dirs = ['libs']
12
12
 
13
- if platform.system() == 'Windows':
14
- os.environ.setdefault('PATH', '')
15
- paths = os.environ['PATH'].split(';')
16
- for x in _dll_dirs:
17
- x = os.path.join(_root_dir, x)
18
- if os.path.isdir(x) and x not in paths:
19
- paths = [x] + paths
20
- os.environ['PATH'] = ';'.join(paths)
13
+ # if platform.system() == 'Windows':
14
+ # os.environ.setdefault('PATH', '')
15
+ # paths = os.environ['PATH'].split(';')
16
+ # for x in _dll_dirs:
17
+ # x = os.path.join(_root_dir, x)
18
+ # if os.path.isdir(x) and x not in paths:
19
+ # paths = [x] + paths
20
+ # os.environ['PATH'] = ';'.join(paths)
21
21
 
22
22
 
23
- _add_path()
23
+ # _add_path()
@@ -23,7 +23,7 @@ from ..PyWMS import getWalonmap
23
23
  from ..PyTranslate import _
24
24
  from ..color_constants import Colors
25
25
  from ..PyParams import Wolf_Param, Type_Param
26
- from ..matplotlib_fig import Matplotlib_Figure as MplFig
26
+ from ..matplotlib_fig import Matplotlib_Figure as MplFig, PRESET_LAYOUTS
27
27
  from ..drawing_obj import Element_To_Draw
28
28
  from ..CpGrid import CpGrid
29
29
  from ..PyVertexvectors import vector, Zones, zone, wolfvertex
@@ -375,6 +375,35 @@ class xyz_laz_grid():
375
375
 
376
376
  return retdata
377
377
 
378
+ def find_files_in_bounds(self, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]):
379
+ """ Find all files in bounds """
380
+
381
+ x1=bounds[0][0]
382
+ x2=bounds[0][1]
383
+ y1=bounds[1][0]
384
+ y2=bounds[1][1]
385
+
386
+ file1= self.genfile.split('x1')[0]
387
+ file2= self.genfile.split('y1')[-1]
388
+
389
+ files=[]
390
+
391
+ for x in range(int(self.origx), int(self.endx), int(self.dx)):
392
+ for y in range(int(self.origy), int(self.endy), int(self.dy)):
393
+
394
+ locbounds=np.float64(((x,x+self.dx),(y,y+self.dy)))
395
+
396
+ test = not(x2 < locbounds[0][0] or x1 > locbounds[0][1] or y2 < locbounds[1][0] or y1 > locbounds[1][1])
397
+
398
+ if test:
399
+ fxyz = file1+str(int(x))+'_'+str(int(y))+file2
400
+
401
+ fn = join(self.mydir,fxyz)
402
+ if exists(fn):
403
+ files.append(fn)
404
+
405
+ return files
406
+
378
407
  def _split_xyz(self, dirout:str, nbparts:int = 10):
379
408
  """ Split XYZ file into 'nb' parts along X and Y """
380
409
  for entry in scandir(self.mydir):
@@ -494,7 +523,7 @@ class xyz_laz_grids():
494
523
  """ Ensemble de grids """
495
524
 
496
525
  def __init__(self, dir_grids:str, create:bool=False) -> None:
497
- self.grids = []
526
+ self.grids:list[xyz_laz_grid] = []
498
527
  self.colors = Classification_LAZ()
499
528
  self.colors.init_2023()
500
529
 
@@ -527,6 +556,36 @@ class xyz_laz_grids():
527
556
  logging.info(_('Data found -- {} points'.format(ret.shape[0])))
528
557
  return ret
529
558
 
559
+ def find_files_in_bounds(self, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]):
560
+
561
+ ret = [(cur.mydir, cur.find_files_in_bounds(bounds)) for cur in self.grids]
562
+ ret = [cur for cur in ret if len(cur[1])>0]
563
+
564
+ if len(ret)==0:
565
+ logging.info(_('No data found'))
566
+ return []
567
+ else:
568
+ logging.info(_('Data found -- {} files'.format(len(ret))))
569
+ return ret
570
+
571
+ def copy_files_in_bounds(self, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]], dirout:str):
572
+
573
+ import shutil
574
+
575
+ out = Path(dirout)
576
+ out.mkdir(exist_ok=True)
577
+
578
+ files = self.find_files_in_bounds(bounds)
579
+
580
+ for curdir, curfiles in files:
581
+ locdir = dirout / Path(curdir).parent.name
582
+ locdir.mkdir(exist_ok=True)
583
+ for curfile in curfiles:
584
+ shutil.copy(curfile, locdir / Path(curfile).name)
585
+
586
+ # copy gridinfo.txt
587
+ shutil.copy(join(curdir,'gridinfo.txt'), locdir / 'gridinfo.txt')
588
+
530
589
  def read_dir(self, dir_grids):
531
590
  dirs = listdir(dir_grids)
532
591
 
@@ -637,14 +696,11 @@ class xyz_laz_grids():
637
696
 
638
697
  (up_s, up_z, up_color), (down_s, down_z, down_color) = self.scan_around(xy, length_buffer)
639
698
 
640
- figmpl = MplFig()
641
- figmpl.presets()
642
- fig = figmpl.fig
643
- ax = figmpl.cur_ax
699
+ figmpl = MplFig(PRESET_LAYOUTS.DEFAULT)
644
700
 
645
701
  logging.info(_('Plotting'))
646
- ax.scatter(up_s, up_z, c=up_color ,marker='.')
647
- ax.scatter(down_s, down_z,c=down_color,marker='+')
702
+ figmpl.plot(up_s, up_z, c=up_color ,marker='.')
703
+ figmpl.plot(down_s, down_z,c=down_color,marker='+')
648
704
 
649
705
  if show:
650
706
  figmpl.Show()
@@ -883,9 +939,12 @@ class Wolf_LAZ_Data(Element_To_Draw):
883
939
 
884
940
  nb1 = self.data.shape[0]
885
941
  if self.viewer is not None:
886
- nb2 = self.viewer.get('num_points')[0]
887
- assert nb1 == nb2, _('Incoherent number of points')
888
-
942
+ try:
943
+ nb2 = self.viewer.get('num_points')[0]
944
+ assert nb1 == nb2, _('Incoherent number of points')
945
+ except:
946
+ # viewer is not initialized or Destroyed
947
+ self.viewer = None
889
948
  return nb1
890
949
 
891
950
  @property
@@ -1138,7 +1197,7 @@ class Wolf_LAZ_Data(Element_To_Draw):
1138
1197
  def bounds(self, value):
1139
1198
  self._bounds = value
1140
1199
 
1141
- def from_grid(self, grid:xyz_laz_grid, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]):
1200
+ def from_grid(self, grid:xyz_laz_grids, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]):
1142
1201
  """ Create data from grid LAZ """
1143
1202
  self.bounds = bounds
1144
1203
  self.data = grid.scan(bounds)
@@ -1482,7 +1541,7 @@ class Wolf_LAZ_Data(Element_To_Draw):
1482
1541
  props = self._myprops
1483
1542
 
1484
1543
  self.lookat = (props[('Look at', 'X')], props[('Look at', 'Y')], props[('Look at', 'Z')])
1485
- self.eye = (props[('Camera', 'X')], props[('Camera', 'Y')], props[('Camera', 'Z')])
1544
+ # self.eye = (props[('Camera', 'X')], props[('Camera', 'Y')], props[('Camera', 'Z')])
1486
1545
 
1487
1546
  color = np.asarray(props[('Background', 'Color')])
1488
1547
  self.bg_color(color / 255.)
@@ -0,0 +1,2 @@
1
+ [Paths]
2
+ Plugins=../libs/qt_plugins
@@ -12,8 +12,12 @@ _viewer_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
12
12
  if not os.path.isabs(_viewer_dir):
13
13
  _viewer_dir = os.path.abspath(_viewer_dir)
14
14
 
15
- __all__ = ['viewer']
15
+ _viewer_libs_dir = os.path.join(_viewer_dir, '../libs')
16
+
17
+ if not os.path.isabs(_viewer_libs_dir):
18
+ _viewer_libs_dir = os.path.abspath(_viewer_libs_dir)
16
19
 
20
+ __all__ = ['viewer']
17
21
 
18
22
  class viewer:
19
23
  def __init__(self, *args, **kwargs):
@@ -22,7 +26,7 @@ class viewer:
22
26
  Examples:
23
27
  Create 100 random points
24
28
 
25
- >>> xyz = pptk.rand(100, 3)
29
+ >>> xyz = pptk.rand(100, 3)python
26
30
 
27
31
  Visualize the points
28
32
 
@@ -49,10 +53,16 @@ class viewer:
49
53
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
50
54
  s.bind(('localhost', 0))
51
55
  s.listen(0)
52
- self._process = subprocess.Popen(
53
- [os.path.join(_viewer_dir, 'viewer'), str(s.getsockname()[1])],
54
- stdout=subprocess.PIPE,
55
- stderr=(None if debug else subprocess.PIPE))
56
+
57
+ env = os.environ.copy()
58
+ env["PATH"] = _viewer_dir + os.pathsep + _viewer_libs_dir + os.pathsep + env["PATH"]
59
+ # print(env["PATH"])
60
+
61
+ self._process = subprocess.Popen([os.path.join(_viewer_dir, 'viewer'),
62
+ str(s.getsockname()[1])],
63
+ stdout=subprocess.PIPE,
64
+ stderr=(None if debug else subprocess.PIPE),
65
+ env = env)
56
66
  if debug:
57
67
  print ('Started viewer process: %s' \
58
68
  % os.path.join(_viewer_dir, 'viewer'))