:py:mod:`wolfhece.lazviewer.laz_viewer` ======================================= .. py:module:: wolfhece.lazviewer.laz_viewer Module Contents --------------- .. py:class:: Colors_Lazviewer Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.lazviewer.laz_viewer.Colors_Lazviewer :parts: 1 :private-bases: Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ORTHO_2012_2013 :value: 2013 .. py:attribute:: ORTHO_2015 :value: 2015 .. py:attribute:: ORTHO_2021 :value: 2021 .. py:attribute:: ORTHO_2023 :value: 2023 .. py:attribute:: ORTHO_2006_2007 :value: 2006 .. py:attribute:: CODE_2013 :value: 0 .. py:attribute:: CODE_2023 :value: 2 .. py:attribute:: CODE_2021_2022 :value: 3 .. py:attribute:: FROM_FILE :value: 1 .. py:class:: Classification_LAZ .. py:method:: test_wx() .. py:method:: init_2013() .. py:method:: init_2021_2022() .. py:method:: init_2023() .. py:method:: callback_colors() Update from wx GUI .. py:method:: callback_destroy() .. py:method:: interactive_update_colors() set GUI .. py:function:: choices_laz_colormap() -> list[str] .. py:class:: xyz_laz(fn: str = '', format: Literal[las, numpy] = 'las', to_read: bool = True) Classe de gestion des fichiers XYZ+Class issus d'un gros fichier laz .. py:property:: size .. py:method:: split(dir_out: str, nbparts: int) Split file into 'nb' parts along X and Y .. py:method:: get_bounds() .. py:method:: test_bounds(bounds: list[list[float, float], list[float, float]]) .. py:method:: read_bin_xyz() Lecture d'un fichier binaire de points XYZ+classification généré par la fonction sort_grid_np Le format est une succession de trame binaire de la forme : nbpoints (np.int32) X[nbpoints] (np.float32) ou (np.float64) Y[nbpoints] (np.float32) ou (np.float64) Z[nbpoints] (np.float32) Classif[nbpoints] (np.int8) Il est possible de récupérer une matrice numpy shape(nbtot,4) ou un objet laspy via l'argument 'out' (par défaut à 'las') .. py:method:: to_las() .. py:class:: xyz_laz_grid(mydir: str) Gestion d'un grid de données LAZ .. py:method:: _read_gridinfo(gridinfo: str) -> list .. py:method:: scan(bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) Find all points in bounds .. py:method:: find_files_in_bounds(bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) Find all files in bounds .. py:method:: _split_xyz(dirout: str, nbparts: int = 10) Split XYZ file into 'nb' parts along X and Y .. py:method:: _sort_grid_np(fn_in: str, fn_out: str, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]], gridsize: list[int], chunksize: int = 5000000, force_format=np.float64) Create .bin files from .laz .. py:class:: xyz_laz_grids(dir_grids: str, create: bool = False) Ensemble de grids .. py:method:: scan(bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) -> numpy.ndarray Scan all LAZ to find used data :param bounds: [[xmin,xmax], [ymin,ymax]] :type bounds: Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]] :return: np.ndarray .. py:method:: find_files_in_bounds(bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) Find all files in bounds :param bounds: [[xmin,xmax], [ymin,ymax]] .. py:method:: copy_files_in_bounds(bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]], dirout: str) Copy files in bounds to directory :param bounds: [[xmin,xmax], [ymin,ymax]] :param dirout: output directory .. py:method:: read_dir(dir_grids) Read all grids in directory and subdirectories .. py:method:: scan_around(xy: Union[shapely.geometry.LineString, list[list[float], list[float]]], length_buffer=5.0) Récupération de points LAZ autour de la section .. py:method:: plot_laz(xy: Union[shapely.geometry.LineString, list[list[float], list[float]]], length_buffer=5.0, figax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] = None, show=False) Dessin des points LAZ sur un graphique Matplotlib .. py:method:: plot_laz_wx(xy: Union[shapely.geometry.LineString, list[list[float], list[float]]], length_buffer=5.0, show=True) Dessin des points LAZ sur un graphique Matplotlib .. py:method:: create_from_laz(dir_laz: str, shape: str = None, ds: float = 50, force_format=np.float64) .. py:method:: create_bounds_shape(dir_laz: str, out_shape: str) Create shape from laz files .. py:class:: Wolf_LAZ_Data(idx: str = '', plotted: bool = False, mapviewer=None, need_for_wx: bool = False) Bases: :py:obj:`wolfhece.drawing_obj.Element_To_Draw` .. autoapi-inheritance-diagram:: wolfhece.lazviewer.laz_viewer.Wolf_LAZ_Data :parts: 1 :private-bases: Base class for LAZ data which can be imported in Pydraw.Mapviewer. .. py:property:: associated_color .. py:property:: selected .. py:property:: xyz_selected :type: numpy.ndarray Extract the selected points from the viewer. Filter the selected points by codes if _select_only_codes is not empty. .. py:property:: code_selected :type: numpy.ndarray .. py:property:: num_points Number of points .. py:property:: nb_points Number of points - alias of num_points .. py:property:: nb Number of points - alias of num_points .. py:property:: right Camera Right vector .. py:property:: mvp Model View Projection matrix See https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93projection_matrix for details .. py:property:: eye eye/camera position .. py:property:: lookat Lookat position .. py:property:: phi Azimuth angle (radians) .. py:property:: theta Elevation angle (radians) .. py:property:: r Distance from lookat .. py:property:: point_size Point size in viewer -- user units .. py:property:: xyz .. py:property:: codes .. py:property:: xmin .. py:property:: xmax .. py:property:: ymin .. py:property:: ymax .. py:property:: data Full data array (x,y,z,code) .. py:property:: bounds .. py:method:: serialize() Serialize class : data and attributes .. py:method:: deserialize(data: dict) Deserialize class : data and attributes .. py:method:: saveas(fn: str) Save class : data and attributes .. py:method:: load(fn: str) Load class : data and attributes .. py:method:: merge(other: Wolf_LAZ_Data) Merge two Wolf_LAZ_Data objects .. py:method:: filter_data(codes: list[int]) Filter data by codes .. py:method:: bg_color(value) .. py:method:: bg_color_top(value) .. py:method:: bg_color_bottom(value) .. py:method:: floor_level(value) .. py:method:: floor_color(value) .. py:method:: show_grid(value: bool) .. py:method:: show_axis(value: bool) .. py:method:: show_info(value: bool) .. py:method:: force_view(x, y, z=-1) Force lookat position .. py:method:: _eye_pos() Compute eye pos from lookat and r, phi, theta. phi is the azimuth angle (radians) theta is the elevation angle (radians) r is the distance from lookat .. py:method:: codes_unique() Only unique codes .. py:method:: create_viewer(color_code: Colors_Lazviewer = None, classification: Classification_LAZ = None) Create a viewer for las data .. py:method:: interactive_update_colors() Create a frame to interactively update colors .. py:method:: set_colors() Set colors in viewer --> using attributes method (not colormap) .. py:method:: set_classification(classification: str = None) Set classification of LAZ data TODO : Check if 2020-2022 SPW campaign is the same classification as 2013 .. py:method:: find_minmax(update=False) Find min and max of data .. py:method:: from_grid(grid: xyz_laz_grids, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) Create data from grid LAZ .. py:method:: from_file(fn: str) Create data from LAZ file .. py:method:: descimate(step: int) Descimate data. Conserve only one point every 'step' points. :param step: step of descimation .. py:method:: get_data_class(key: int) Get data with a specific code .. py:method:: add_pose_in_memory(key_time: float = 1.0) Add current pose in flight memory .. py:method:: play_flight(tlim=[-np.inf, np.inf], repeat=False, interp='cubic_natural') Play flight memory .. py:method:: set_times(times: numpy.ndarray) Set times for flight memory .. py:method:: set_times_increment(increment: float) .. py:method:: get_times() .. py:method:: record_flight(dirout: str, tlim=[-np.inf, np.inf], interp='cubic_natural', fps=24, prefix: str = 'laz_', ext: str = 'png') Record flight memory in multiple images FIXME : FREEZE the app --> to debug .. py:method:: save_flight(fn: str) Write flight memory to file JSON .. py:method:: load_flight(fn: str) Load flight memory from file JSON .. py:method:: _callback_props() .. py:method:: _callback_destroy_props() .. py:method:: _create_props() Create properties Wolf_Param for LAZ data .. py:method:: _set_new_xls() Create a new Excel grid for selected data .. py:method:: OnPlot_histogram(event: wx.MouseEvent) Plot histogram of selected data .. py:method:: OnPlot_histogram_grid(event: wx.MouseEvent) Plot histogram of selected data .. py:method:: _plot_histogram_grid() Histogram ONLY of selected data in grid. The data are extracted based on the first column of the grid untile an empty cell is found. .. py:method:: _plot_histogram() .. py:method:: _selection2vector() FIXME: must use RANSAC to compute a segment from the selected points .. py:method:: _OnEdit_Selection(event: wx.MouseEvent) Get selection from viewer and create a XLS grid .. py:method:: _edit_selection() .. py:method:: _update_viewer() Update the viewer with properties .. py:method:: _fill_props(full: bool = False) Fill properties from attributes .. py:method:: show_properties() Surcharged method (see Element_To_Draw) to show properties from MapViewer .. py:function:: find_pointsXYZ(xyz: numpy.ndarray, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) -> numpy.ndarray .. py:function:: find_points(las: laspy.LasData, xb: list[float, float], yb: list[float, float]) -> laspy.LasData Get arrays which indicate invalid X, Y, or Z values .. py:function:: read_laz(fn: str, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]] = None) -> Union[numpy.ndarray, laspy.LasData] Lecture d'un fichier LAZ, LAS ou NPZ .. py:function:: xyzlaz_scandir(mydir: str, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) Scan for XYZ files .. py:function:: laz_scandir(mydir: str, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) -> list[laspy.LasData] Scan directory and treat .laz files .. py:function:: clip_data_xyz(dir_in: str, fn_out: str, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]]) Get data and write zip numpy file .. py:function:: clip_data_laz(fn_in: str, fn_out: str, bounds: Union[tuple[tuple[float, float], tuple[float, float]], list[list[float, float], list[float, float]]], chunksize: int = 5000000) .. py:function:: get_concat_h(im1: PIL.Image.Image, im2: PIL.Image.Image) Concatenate 2 images horizontally .. py:function:: get_concat_v(im1: PIL.Image.Image, im2: PIL.Image.Image) Concatenate 2 images vertically .. py:function:: get_Orthos_Walonmap(bounds, fn, cat='IMAGERIE/ORTHO_2012_2013', size=3000) Récupération des orthos depuis Walonmap fn = filename sans extension --> .png sera ajouté automatiquement catégories possibles : - 'IMAGERIE/ORTHO_2012_2013' - 'IMAGERIE/ORTHO_2015' - 'IMAGERIE/ORTHO_2021' - 'IMAGERIE/ORTHO_2006_2007' .. py:function:: get_colors(las: laspy.LasData, which_colors: Colors_Lazviewer, imsize=2000, fname='', palette_classif: Classification_LAZ = None) .. py:function:: myviewer(las: Union[numpy.ndarray, list[laspy.LasData], laspy.LasData], which_colors: Colors_Lazviewer, fname='', palette_classif: Classification_LAZ = None) Get viewer for las data .. py:data:: grids