def add_to_list(osmid, type, tags, ref): """Add a new area to the list of areas.""" settingsSection = Settings.get_section('area', type) if settingsSection is None: return area = Area() area.OSMID = osmid area.ref = ref area.type = type if 'name' in tags: area.name = clean_string(tags['name']) if 'leaf_type' in tags: area.leafType = tags['leaf_type'] if Settings.has_option(settingsSection, 'texture'): area.texture = Settings.get(settingsSection, 'texture') if Settings.has_option(settingsSection, 'transparency'): area.transparency = Settings.getfloat(settingsSection, 'transparency') if Settings.has_option(settingsSection, 'redComponent'): area.color[0] = Settings.getfloat(settingsSection, 'redComponent') if Settings.has_option(settingsSection, 'greenComponent'): area.color[1] = Settings.getfloat(settingsSection, 'greenComponent') if Settings.has_option(settingsSection, 'blueComponent'): area.color[2] = Settings.getfloat(settingsSection, 'blueComponent') if Settings.has_option(settingsSection, 'density'): area.density = Settings.getfloat(settingsSection, 'density') Area.list.append(area)
def add_to_list(osmid, tags, ref): """Add a new river to the list of rivers.""" if 'waterway' in tags: settingsSection = Settings.get_section('waterway', tags['waterway']) if settingsSection is None: return river = River() river.OSMID = osmid river.type = tags['waterway'] river.ref = ref if 'name' in tags: river.name = clean_string(tags['name']) if 'width' in tags: river.width = extract_float_from_string(tags['width']) elif Settings.has_option(settingsSection, 'width'): river.width = Settings.getfloat(settingsSection, 'width') if WebotsObject.enable3D: river.ref = River.add_intermediate_point_where_needed(river.ref) River.list.append(river)