import { Type } from "class-transformer" ; import { observable } from "mobx" ; import { DEFAULT_BUILDING_COLOR_THEME } from "../constants/BuildingColorThemes" ; import { evostreet } from "../constants/Layouts" ; import { noColorMetric } from "../constants/ColorMetrics" ; import { custom , defaultProfile } from "../constants/Profiles" ; import { DEFAULT_COLOR_THEME } from "../constants/SceneColorThemes" ; import BuildingColorTheme from "../classes/BuildingColorTheme" ; import FileFilter from "../classes/FileFilter" ; import Layout from "../classes/Layout" ; import Metric from "../classes/Metric" ; import Profile from "../classes/Profile" ; import { SceneColorTheme } from "../classes/SceneColorTheme" ; export default class VisualizationOptionStore { public static createDefault ( ) { return new VisualizationOptionStore ( defaultProfile . clone ( ) , evostreet , noColorMetric , DEFAULT_BUILDING_COLOR_THEME , DEFAULT_COLOR_THEME , new FileFilter ( ) ) ; } @ Type ( ( ) => Profile ) @ observable public profile : Profile ; @ Type ( ( ) => Layout ) @ observable public layout : Layout ; @ Type ( ( ) => Metric ) @ observable public metricColor : Metric ; @ Type ( ( ) => BuildingColorTheme ) @ observable public buildingColorTheme : BuildingColorTheme ; @ Type ( ( ) => SceneColorTheme ) @ observable public colorTheme : SceneColorTheme ; @ Type ( ( ) => FileFilter ) public fileFilter : FileFilter ; constructor ( profile , layout , metricColor , buildingColorTheme , colorTheme , fileFilter ) { this . profile = profile ; this . layout = layout ; this . metricColor = metricColor ; this . buildingColorTheme = buildingColorTheme ; this . colorTheme = colorTheme ; this . fileFilter = fileFilter ; } setProfile ( p ) { if ( p . id === custom . id ) { this . updateCustomProfile ( ) ; this . profile = custom ; } else { this . profile = p ; } } public setCustomHeightMetric ( metric ) { this . updateCustomProfile ( ) ; custom . heightMetric = metric ; this . profile = custom ; } public setCustomFootprintMetric ( metric ) { this . updateCustomProfile ( ) ; custom . footprintMetric = metric ; this . profile = custom ; } private updateCustomProfile ( ) { custom . updateConfiguration ( this . profile . footprintMetric , this . profile . heightMetric , this . profile . scale ) ; } public equalStructure ( candidate ) { if ( candidate ) { return ( this . layout . id === candidate . layout . id && this . profile . footprintMetric === candidate . profile . footprintMetric && this . profile . heightMetric === candidate . profile . heightMetric && this . profile . scale === candidate . profile . scale ) ; } else { return false ; } } }