private void SaveClutterData(ref Dictionary<short, ClutterData> clutterDataDict) { foreach (DataGridViewRow row in (IEnumerable) this.gridClutter.Rows) { this.SaveZeroData(row); short key = Convert.ToInt16(row.Cells[this.ClutterIdCol.Name].Value); string str = row.Cells[this.ClutterClassCol.Name].Value.ToString(); float num2 = Convert.ToSingle(row.Cells[this.WeightCol.Name].Value); float num3 = Convert.ToSingle(row.Cells[this.IndoorCol.Name].Value); ClutterData data = new ClutterData { ClutterName = str, Weight = num2, IndoorUserRatio = num3 }; clutterDataDict.Add(key, data); } }
private void setEnvironmentClutter() { Dictionary<short, ClutterData> dictionary = new Dictionary<short, ClutterData>(); short[] array = new short[this.m_Model.EnvironemntMangement.InClutterData.Count]; this.m_Model.EnvironemntMangement.InClutterData.Keys.CopyTo(array, 0); for (int i = 0; i < this.ClutterDataGridView.Rows.Count; i++) { ClutterData data = new ClutterData(); data.ClutterName = this.ClutterDataGridView.Rows[i].Cells["ClutterName"].Value.ToString(); data.IndoorUserRatio = float.Parse(this.ClutterDataGridView.Rows[i].Cells["ClutterIndoor"].Value.ToString()); data.Weight = int.Parse(this.ClutterDataGridView.Rows[i].Cells["ClutterWeight"].Value.ToString()); dictionary.Add(array[i], data); } this.m_NewEnvironment.ClutterDatas = null; this.m_NewEnvironment.ClutterDatas = dictionary; }
private bool checkClutterIndoorRadio(ClutterData clutterData) { if (clutterData.IndoorUserRatio < 0f) { this.ErrorMessage = this.errorMessageHead + clutterData.ClutterName + TrafficMapResource.TRAFFICMAP_INDOORRATION + this.m_ErrorMessageDic[TrafficMapResource.TRAFFICMAP_BELOWZERO]; return false; } if (clutterData.IndoorUserRatio > 100f) { this.ErrorMessage = this.errorMessageHead + clutterData.ClutterName + TrafficMapResource.TRAFFICMAP_INDOORRATION + this.m_ErrorMessageDic[TrafficMapResource.TRAFFICMAP_LARGEHUNDRED]; return false; } return true; }
private bool checkClutterWeigh(ClutterData clutterData) { if (clutterData.Weight < 0f) { this.ErrorMessage = this.errorMessageHead + clutterData.ClutterName + TrafficMapResource.TRAFFICMAP_WEIGHTS + this.m_ErrorMessageDic[TrafficMapResource.TRAFFICMAP_BELOWZERO]; return false; } return true; }
private void SaveClutterData() { for (int i = 1; i < this.dataGridView2.Columns.Count; i += 2) { int index = (i - 1) / 2; Dictionary<short, ClutterData> dictionary = new Dictionary<short, ClutterData>(); TrafficEnvironment environment = this.m_EvnManagement.FindEnvironmentByName(this.m_EnvSelectedDis[index]); for (int j = 0; j < this.dataGridView2.Rows.Count; j++) { ClutterData data = new ClutterData(); data.ClutterName = this.dataGridView2.Rows[j].Cells[0].Value.ToString(); data.Weight = int.Parse(this.dataGridView2.Rows[j].Cells[i].Value.ToString()); data.IndoorUserRatio = float.Parse(this.dataGridView2.Rows[j].Cells[i + 1].Value.ToString()); dictionary.Add(Convert.ToInt16(this.dataGridView2.Rows[j].Tag), data); } environment.ClutterDatas = dictionary; } }