AddSegment() public method

Adds the a segment to the facility.
public AddSegment ( SlopedFacilitySegment segment ) : void
segment SlopedFacilitySegment The segment to add.
return void
Ejemplo n.º 1
0
        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);
              }
        }