private void RadioButton_Checked(object sender, RoutedEventArgs e) { if (!IsRunning) { return; } var button = sender as RadioButton; EnergySavingType energyType = (EnergySavingType)Enum.Parse(typeof(EnergySavingType), button.Name); switch (energyType) { case EnergySavingType.SavingRatioType: double value = 0; Double.TryParse(SavingRatioTextBox.Text, out value); Standard = new EnergySavingRatio(energyType, value); if (string.IsNullOrEmpty(SavingRatioTextBox.Text)) { SavingRatioTextBox.Text = "0"; } break; case EnergySavingType.LeedStandardType: Standard = new EnergySavingRatio(energyType, LEEDComboBox.SelectedIndex); break; case EnergySavingType.ChineseGreenBuildingStandardType: Standard = new EnergySavingRatio(energyType, ChineseGreenBuildingStandar_ComboBox.SelectedIndex); break; default: throw new Exception("Unknown EnergyType!"); } }
public ComputationUnit(IFeature f) { Feature = f; //this.UnitType = f["unitType"] == "Parcel" ? ComputationUnitType.Parcel : ComputationUnitType.Building; this.LayerName = f["layerName"]; if (this.LayerName.Contains("YD-")) // 用地图层 { this.UnitType = ComputationUnitType.Parcel; } else if (this.LayerName.Contains("JZ-")) // 建筑图层 { this.UnitType = ComputationUnitType.Building; } else // 其他图层 { this.UnitType = ComputationUnitType.Other; } f["unitType"] = this.UnitType.ToString(); this.FAR = f["far"].TryParseToDouble(); this.Levels = f["levels"].TryParseToInt32(); this.Type = string.IsNullOrEmpty(f["buildType"]) ? GetDefaultType(this.LayerName, this.FAR, this.Levels) : f["buildType"].ParseToEnum <BuildingType>(); this.Structure = string.IsNullOrEmpty(f["struct"]) ? StructuralType.Concrete : f["struct"].ParseToEnum <StructuralType>(); this.MixOfficePercent = f["mixOffic"].TryParseToDouble(); this.MixIndustryPercent = f["mixIndu"].TryParseToDouble(); this.MixEducationPercent = f["mixEdu"].TryParseToDouble(); this.MixHotelPercent = f["mixHotel"].TryParseToDouble(); this.MixGreenFieldPercent = f["mixGreen"].TryParseToDouble(); this.MixOtherPercent = f["mixOther"].TryParseToDouble(); this.MixRetailPercent = f["mixRetai"].TryParseToDouble(); this.MixResidencialPercent = f["mixResi"].TryParseToDouble(); this.Area = string.IsNullOrEmpty(f["area"]) ? f.Area() : f["area"].TryParseToDouble(); this.PerCapitaResidencial = CheckPerCapitaResidencial(f["perResi"].TryParseToDouble()); this.PerCapitaOffice = CheckPerCapitaOffice(f["perOffic"].TryParseToDouble()); this.PerCapitaIndustry = CheckPerCapitaIndustry(f["perIndu"].TryParseToDouble()); this.Populations = IsEmptyPopulation(f["pop"]) ? UpdatePopulation() : f["pop"].TryParseToDouble(); EnergySavingType tmpType = (EnergySavingType)Enum.Parse(typeof(EnergySavingType), f["escType"]); double tmpValue = f["escValue"].TryParseToDouble(); this.EnergySavingCoefficient = new EnergySavingRatio(tmpType, tmpValue); this.GreenField = string.IsNullOrEmpty(f["green"]) ? GetDefaultGreenType(this.Type) : f["green"].ParseToEnum <GreenFieldType>(); this.Position = new PointString(f.GeoData).Centroid(); UpdateResult(); }
public EnergySavingRatio(EnergySavingType energyType, double tmpValue) { EnergyType = energyType; TempValue = tmpValue; }