"""Modul tworzacy obiekt xml forestData
"""
from Mapa_PU.swdl.model.scheme import TreeElement
from Mapa_PU.swdl.model.tags import Tags
from Mapa_PU.swdl.model.swdl.swdl import Swdl

"""klasa pomocnicza tworząca drzewo ForestData
"""
class ForestDataConverter():
    def __init__(self,SubareaDataConverter):
        self.__sdc=SubareaDataConverter
    
    def create_forest_data(self,subarea_data_list):
        """tworzymy obiekt xml forestData
           :param subarea_data_list; lista obiektów SubareaData
        """
        try:
            forestData=TreeElement(Tags.FOREST_DATA.value)
            for subarea in subarea_data_list:
                forestData.append(self.__sdc.create_subarea_data(subarea))
            
            return forestData
        except Exception as e:
            raise e
    