private void SelectionChangedCommandExcute() { if (StationType.Equals("110kV_A2-7")) { //设置标高列表的值(先清空) MockLevels.Clear(); MockLevel L1 = new MockLevel() { Name = "-3.300米层", Elevation = -3300 / 304.8, IsStructural = true }; MockLevel L2 = new MockLevel() { Name = "-3.200米层", Elevation = -3200 / 304.8, IsStructural = false }; MockLevel L4 = new MockLevel() { Name = "-1.050米层", Elevation = -1050 / 304.8, IsStructural = false }; MockLevel L5 = new MockLevel() { Name = "-0.050米层", Elevation = -50 / 304.8, IsStructural = true }; MockLevel L6 = new MockLevel() { Name = "0.000米层", Elevation = 0, IsStructural = false }; MockLevel L7 = new MockLevel() { Name = "4.750米层", Elevation = 4750 / 304.8, IsStructural = true }; MockLevel L8 = new MockLevel() { Name = "4.800米层", Elevation = 4800 / 304.8, IsStructural = false }; MockLevel L9 = new MockLevel() { Name = "9.600米层", Elevation = 9600 / 304.8, IsStructural = true }; MockLevel L10 = new MockLevel() { Name = "10.600米层", Elevation = 10600 / 304.8, IsStructural = true }; MockLevels.Add(L1); MockLevels.Add(L2); MockLevels.Add(L4); MockLevels.Add(L5); MockLevels.Add(L6); MockLevels.Add(L7); MockLevels.Add(L8); MockLevels.Add(L9); MockLevels.Add(L10); } }
/// <summary> /// 根据doc中的实际标高,自动获得对应的mocklevel /// </summary> /// <returns></returns> private ObservableCollection <MockLevel> GetMockLevels() { ObservableCollection <MockLevel> mockLevels = new ObservableCollection <MockLevel>(); foreach (var level in acturalLevels) { MockLevel mockLevel = new MockLevel() { Name = level.Name, Elevation = level.Elevation }; if (level.Name.Contains("结构")) { mockLevel.IsStructural = true; } mockLevels.Add(mockLevel); } return(mockLevels); }
private void AddLevelCommandExcute() { MockLevel addedLevel; string name; if (MockLevels.Count == 0) { addedLevel = new MockLevel(); addedLevel.Elevation = 3000 / 304.8; name = (addedLevel.Elevation * 304.8 / 1000).ToString("#0.000"); addedLevel.Name = name + "米层"; MockLevels.Add(addedLevel); } else if (MockLevels.Count > 0) { MockLevel lastLevel = MockLevels.Last(); addedLevel = new MockLevel(); addedLevel.Elevation = lastLevel.Elevation + 3000 / 304.8; name = (addedLevel.Elevation * 304.8 / 1000).ToString("#0.000"); addedLevel.Name = name + "米层"; MockLevels.Add(addedLevel); } }