123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import yaml
- def get_global_config(draw_type):
- app_name = _get_app_name()
- with open(f'config/{app_name}/global-{draw_type}.yaml', 'r', encoding='utf-8') as file:
- return yaml.safe_load(file)
- def _get_app_name():
- with open('config/application.yaml', 'r', encoding='utf-8') as file:
- app_config = yaml.safe_load(file)
- app_name = app_config['app']['name']
- return app_name
- class ModelConfig:
- def __init__(self,draw_type):
- config = get_global_config(draw_type)
- self.request_url = config['request']['url']
- self.agg_route = config['agg']['route']
- self.agg_scale = config['agg']['scale']
- self.agg_shift = config['agg']['shift']['x'], config['agg']['shift']['y']
- self.div_route = config['div']['route']
- self.div_scale = config['div']['scale']
- shift_config = config['div']['shift']
- self.div_shift = [(shift_config['x'][i], shift_config['y'][i]) for i in range(len(shift_config['x']))]
- self.gate_style = config['style']['gate']
- self.window_style = config['style']['window']
- self.wind_bridge_style = config['style']['wind-bridge']
- self.fan_main_style = config['style']['fan-main']
- self.fan_local_style = config['style']['fan-local']
- self.sealed_style = config['style']['sealed']
- self.shaft_style = config['style']['shaft']
- self.air_duct_style = config['style']['air-duct']
- self.tun_2d_style = config['style']['tun-2d']
- self.tun_3d_style = config['style']['tun-3d']
- self.air_flow_style = config['style']['air-flow']
- self.tun_text_style = config['style']['tun-text']
- _global_model_configs = {
- '2d': ModelConfig('2d'),
- '3d': ModelConfig('3d')
- }
|