def __init__(self, options=None, name="Survey Loader"): """ constructor """ Operator.__init__(self, options, name) self._tmp_dir = options['tmp_dir'] self.taxonomy = options['taxonomy'] # check if height/year range is requested # range is stored as dictionary {'min_values':min_values, 'max_values':max_values} # where min_value and max_value are arrays of values if options.has_key(self.HT_ATTRIBUTE_NAME): ht_ranges = options[self.HT_ATTRIBUTE_NAME] min_values_count = len(ht_ranges['min_values']) max_values_count = len(ht_ranges['max_values']) # use range only if it is correctly set if min_values_count > 0 and max_values_count > 0 and min_values_count == max_values_count: self.ht_ranges = options[self.HT_ATTRIBUTE_NAME] if options.has_key(self.YR_ATTRIBUTE_NAME): ht_ranges = options[self.YR_ATTRIBUTE_NAME] min_values_count = len(ht_ranges['min_values']) max_values_count = len(ht_ranges['max_values']) # use range only if it is correctly set if min_values_count > 0 and max_values_count > 0 and min_values_count == max_values_count: self.yr_ranges = options[self.YR_ATTRIBUTE_NAME] self._fields = { 0: QgsField(GID_FIELD_NAME, QVariant.String), 1: QgsField(LON_FIELD_NAME, QVariant.Double), 2: QgsField(LAT_FIELD_NAME, QVariant.Double), 3: QgsField(TAX_FIELD_NAME, QVariant.String, "", 255), 4: QgsField(GRP_FIELD_NAME, QVariant.String), 5: QgsField(AREA_FIELD_NAME, QVariant.String), 6: QgsField(HT_FIELD_NAME, QVariant.String), 7: QgsField(COST_FIELD_NAME, QVariant.String), }
def __init__(self, options=None, name="Survey Loader"): """ constructor """ Operator.__init__(self, options, name) self._tmp_dir = options["tmp_dir"] self.taxonomy = options["taxonomy"] # check if height/year range is requested # range is stored as dictionary {'min_values':min_values, 'max_values':max_values} # where min_value and max_value are arrays of values if options.has_key(self.HT_ATTRIBUTE_NAME): ht_ranges = options[self.HT_ATTRIBUTE_NAME] min_values_count = len(ht_ranges["min_values"]) max_values_count = len(ht_ranges["max_values"]) # use range only if it is correctly set if min_values_count > 0 and max_values_count > 0 and min_values_count == max_values_count: self.ht_ranges = options[self.HT_ATTRIBUTE_NAME] if options.has_key(self.YR_ATTRIBUTE_NAME): ht_ranges = options[self.YR_ATTRIBUTE_NAME] min_values_count = len(ht_ranges["min_values"]) max_values_count = len(ht_ranges["max_values"]) # use range only if it is correctly set if min_values_count > 0 and max_values_count > 0 and min_values_count == max_values_count: self.yr_ranges = options[self.YR_ATTRIBUTE_NAME] self._fields = { 0: QgsField(GID_FIELD_NAME, QVariant.String), 1: QgsField(LON_FIELD_NAME, QVariant.Double), 2: QgsField(LAT_FIELD_NAME, QVariant.Double), 3: QgsField(TAX_FIELD_NAME, QVariant.String, "", 255), 4: QgsField(GRP_FIELD_NAME, QVariant.String), 5: QgsField(AREA_FIELD_NAME, QVariant.String), 6: QgsField(HT_FIELD_NAME, QVariant.String), 7: QgsField(COST_FIELD_NAME, QVariant.String), }
def __init__(self, options=None, name='Mapping Scheme Loaded'): """ constructor """ Operator.__init__(self, options, name) if isinstance(options['taxonomy'], Taxonomy): self._taxonomy = options['taxonomy'] else: self._taxonomy = get_taxonomy(options['taxonomy'])