Exemplo n.º 1
0
    def _add_new_fqpr_from_proj(self, parent: QtGui.QStandardItem, line_data):
        """
        Read from the kluster_main FqprProject (provided here is the line_data from that project) and add the lines
        that are not currently in project tree.  self.tree_data contains the record of the data in the tree.

        Parameters
        ----------
        parent: PySide2.QtGui.QStandardItem, the item that represents the 'Converted' entry in the tree.  All fqpr
                projects go underneath.
        line_data: dict, a dictionary of project paths: multibeam lines.
                   ex: {'C:\\collab\\dasktest\\data_dir\\hassler_acceptance\\refsurf\\converted':
                                {'0015_20200304_070725_S250.all': [1583305645.423, 1583305889.905]}

        """
        current_fq_proj = self.tree_data['Converted'][1:]
        for fq_proj in line_data:
            if fq_proj not in current_fq_proj:
                proj_child = QtGui.QStandardItem(fq_proj)
                parent.appendRow(proj_child)
                for fq_line in line_data[fq_proj]:
                    line_child = QtGui.QStandardItem(fq_line)
                    proj_child.appendRow([line_child])
                self.tree_data['Converted'].append(fq_proj)
            else:  # see if there are new lines to display
                idx = self.tree_data['Converted'][1:].index(fq_proj)
                proj_child = parent.child(idx)
                tst = proj_child.rowCount()
                tsttwo = len(line_data[fq_proj])
                if proj_child.rowCount() != len(line_data[fq_proj]):  # new lines
                    tree_lines = [proj_child.child(rw).text() for rw in range(proj_child.rowCount())]
                    for fq_line in line_data[fq_proj]:
                        if fq_line not in tree_lines:
                            line_child = QtGui.QStandardItem(fq_line)
                            proj_child.appendRow([line_child])
        parent.sortChildren(0, order=QtCore.Qt.AscendingOrder)
Exemplo n.º 2
0
    def _add_new_surf_from_proj(self, parent: QtGui.QStandardItem, surf_data):
        """
        Read from the kluster_main FqprProject (provided here is the line_data from that project) and add the surfaces
        that are not currently in project tree.  self.tree_data contains the record of the data in the tree.

        Parameters
        ----------
        parent: PySide2.QtGui.QStandardItem, the item that represents the 'Surfaces' entry in the tree.  All fqpr
                projects go underneath.
        surf_data: dict, a dictionary of surface paths: surface objects.
                   ex: {'C:/collab/dasktest/data_dir/hassler_acceptance/refsurf/refsurf.npz':
                            <HSTB.kluster.fqpr_surface.BaseSurface object at 0x0000019CFFF1A520>}

        """
        current_surfs = self.tree_data['Surfaces'][1:]
        for surf in surf_data:
            if surf not in current_surfs:
                surf_child = QtGui.QStandardItem(surf)
                parent.appendRow(surf_child)
                for lyr in surf_data[surf].return_layer_names():
                    lyr_child = QtGui.QStandardItem(lyr)
                    lyr_child.setCheckable(True)
                    surf_child.appendRow([lyr_child])
                    if lyr == 'depth':  # add optional hillshade layer
                        lyr_child = QtGui.QStandardItem('hillshade')
                        lyr_child.setCheckable(True)
                        surf_child.appendRow([lyr_child])
                try:  # add the ability to draw the grid outline, new in bathygrid 1.1.2
                    surf_data[surf].get_tile_boundaries
                    lyr_child = QtGui.QStandardItem('tiles')
                    lyr_child.setCheckable(True)
                    surf_child.appendRow([lyr_child])
                except AttributeError:  # bathygrid does not support this method
                    pass
                self.tree_data['Surfaces'].append(surf)
        parent.sortChildren(0, order=QtCore.Qt.AscendingOrder)