Obtain the layer mode selected by user.
        :returns: selected layer mode.
        :rtype: string, None
500098
def selected_layermode(self):
        
        item = self.lstLayerModes.currentItem()
        try:
            return definition(item.data(QtCore.Qt.UserRole))
        except (AttributeError, NameError):
            return None
582884
def selected_purpose(self):
        
        item = self.lstCategories.currentItem()
        try:
            return definition(item.data(QtCore.Qt.UserRole))
        except (AttributeError, NameError):
            return None
138938
def selection(self):
        
        if self._cached_selection is _NO_CACHED_SELECTION:
            self._cached_selection = self._selection()

        return self._cached_selection
1172983
def modes(self):
        
        (self._modes, value) = self.get_cached_attr_set(self._modes, 'modes')
        return value
82221
function() {
    var self = this;
    return _.compact(this.map.layers.map(function(layer) {
      return self.mapView.getLayerByCid(layer.cid);
    }));
  }
249490
def get_view_selection(self):
        """"""
        if not self.MODEL_STORAGE_ID:
            return None, None

        # avoid selection requests on empty tree views -> case warnings in gtk3
        if len(self.store) == 0:
            paths = []
        else:
            model, paths = self._tree_selection.get_selected_rows()

        # get all related models for selection from respective tree store field
        selected_model_list = []
        for path in paths:
            model = self.store[path][self.MODEL_STORAGE_ID]
            selected_model_list.append(model)
        return self._tree_selection, selected_model_list
1010514
private static Integer getLayer(Featurable featurable)
    {
        if (featurable.hasFeature(Layerable.class))
        {
            final Layerable layerable = featurable.getFeature(Layerable.class);
            return layerable.getLayerDisplay();
        }
        return LAYER_DEFAULT;
    }
587205
def toString(self):
        
        output = ""
        for layer in reverse(self.layers):
            output += layer.toString()
        return output
673736
def selected_canvas_explayer(self):
        
        if self.lstCanvasExpLayers.selectedItems():
            item = self.lstCanvasExpLayers.currentItem()
        else:
            return None
        try:
            layer_id = item.data(Qt.UserRole)
        except (AttributeError, NameError):
            layer_id = None

        # noinspection PyArgumentList
        layer = QgsProject.instance().mapLayer(layer_id)
        return layer
508069
def channel_choice_control(self):
        
        self.current.task_data['control'], self.current.task_data['msg'] \
            = self.selection_error_control(self.input['form'])
        if self.current.task_data['control']:
            self.current.task_data['option'] = self.input['cmd']
            self.current.task_data['split_operation'] = False
            keys, names = self.return_selected_form_items(self.input['form']['ChannelList'])
            self.current.task_data['chosen_channels'] = keys
            self.current.task_data['chosen_channels_names'] = names
1302138
def selected_band(self):
        
        item = self.lstBands.currentItem()
        return item.data(QtCore.Qt.UserRole)
495374
def _get_version_mode(self, mode=None):
        
        version_mode = self._version_modes.get(mode)
        if not version_mode:
            version_mode = self._version_modes[mode] = VersionMode(name=mode)
        return version_mode
65912
def selected_subcategory(self):
        
        item = self.lstSubcategories.currentItem()
        try:
            return definition(item.data(QtCore.Qt.UserRole))
        except (AttributeError, NameError):
            return None
754006
def selected_canvas_agglayer(self):
        
        if self.lstCanvasAggLayers.selectedItems():
            item = self.lstCanvasAggLayers.currentItem()
        else:
            return None
        try:
            layer_id = item.data(QtCore.Qt.UserRole)
        except (AttributeError, NameError):
            layer_id = None

        layer = QgsProject.instance().mapLayer(layer_id)
        return layer
586292
def layer(self, layer_name):
        
        uri = self.layer_uri(layer_name)
        layer = QgsVectorLayer(uri, layer_name, 'ogr')
        if not layer.isValid():
            layer = QgsRasterLayer(uri, layer_name)
            if not layer.isValid():
                return False

        monkey_patch_keywords(layer)

        return layer
912091
def get_registered_layer(name):
    
    ret = _LAYER_REGISTRY.get(name, None)
    if ret == _NameConflict:
        raise KeyError("Layer named '{}' is registered with `@layer_register` more than once!".format(name))
    return ret
1110274
def layer_from_combo(combo):
    
    index = combo.currentIndex()
    if index < 0:
        return None

    layer_id = combo.itemData(index, Qt.UserRole)
    layer = QgsProject.instance().mapLayer(layer_id)
    return layer