/// <summary> /// Removes a segment from the facility. /// </summary> /// <param name="segment">The segment to delete.</param> public void DeleteSegment(SlopedFacilitySegment segment) { if (_segments.Contains(segment)) { _segments.Remove(segment); } }
private void btnTest_Click(object sender, EventArgs e) { try { //Create a new segment SlopedFacilitySegment segment = new SlopedFacilitySegment(); //Assign values to segment. All segments have these fields: segment.SegmentLengthFt = 10; segment.CheckDamLengthFt = 2; segment.SlopeRatio = 0.02; segment.SideSlopeRightRatio = 4; segment.SideSlopeLeftRatio = 4; segment.DownstreamDepthIn = 9; segment.LandscapeWidthFt = 2; segment.RockStorageWidthFt = 4; //Only facility types with rock galleries use this field; see parameter matrix for details //Create a catchment, no change for sloped facilities Catchment catchment = new Catchment("Test Catchment"); //Create a SlopedFacility object, constructed the same way as a standard facility SlopedFacility facility = new SlopedFacility(FacilityType.Swale, FacilityConfiguration.A, catchment); //Segments can be added or deleted from the sloped facility. facility.AddSegment(segment); facility.DeleteSegment(segment); PerformCalculations(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } }
/// <summary> /// Removes a segment from the facility. /// </summary> /// <param name="segment">The segment to delete.</param> public void DeleteSegment(SlopedFacilitySegment segment) { if (_segments.Contains(segment)) _segments.Remove(segment); }
/// <summary> /// Adds the a segment to the facility. /// </summary> /// <param name="segment">The segment to add.</param> public void AddSegment(SlopedFacilitySegment segment) { _segments.Add(segment); }