import os
import sys

current_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.normpath(os.path.join(current_path, '../')))
sys.path.append(os.path.normpath(os.path.join(current_path, '../../')))
sys.path.append(os.path.normpath(os.path.join(current_path, '../../../')))
sys.path.append(current_path)

from lib.openscenario.open_scenario_importer import OpenScenarioImporter
from lib.mgeo.class_defs.mgeo import MGeo

class OpenScenarioImporterWrapper(): 
    """ OpenScenario 파일 Import 클래스 """   
    def __init__(self, file_path):       
        self.scenario_importer = OpenScenarioImporter(file_path)
        self.scenario_data = None
        self.mgeo_folder_path = None
    
    def import_open_scenario(self):
        self.scenario_importer.import_open_scenario()

        self.scenario_data = self.scenario_importer.scenario_definition
        self.mgeo_folder_path = self.scenario_data.mgeo_folder_path
        
        self.mgeo_planner_map = MGeo.create_instance_from_json(self.mgeo_folder_path)

        self.scenario_importer.set_mgeo(self.mgeo_planner_map)

    def clear(self):
        self.scenario_importer.clear()

