public ModelVM(ElementSet elementSet) { _materials = new ObservableCollection <MaterialSetVM> { new MaterialSetVM("None", new CarbonMaterials.GWPMaterialSet("None"), this), new MaterialSetVM("Concrete", CarbonMaterials.GWPMaterialSet.GetDefaultGWPConcreteSetSeparateSteel(), this), new MaterialSetVM("Concrete", CarbonMaterials.GWPMaterialSet.GetDefaultGWPConcreteSet(), this) }; _elementSet = elementSet; Elements = new ObservableCollection <ElementVM>(); foreach (var elem in elementSet.Elements) { elem.Material = _materials[0].GWPMaterial; Elements.Add(new ElementVM(elem, this)); } Filters = new List <FilterSetVM>(); for (int i = 0; i < elementSet.FilterNames.Count(); i++) { var filter = elementSet.FilterNames[i]; var newFilterSet = new FilterSetVM(filter); var filterValues = elementSet.Elements.Select(a => a.Filters[i]) .Distinct() .ToList(); foreach (var item in filterValues) { newFilterSet.FilterItems.Add(new FilterItemVM(item)); } Filters.Add(newFilterSet); } SelectionSets = new ObservableCollection <SelectionSetVM>(); updateCarbonVsCategoryChartValues(); }
public FilterItemVM(string name, FilterSetVM parent) { Name = name; _parent = parent; }