Below is an overview of Dxsect.pas, a Delphi unit from SWMM 5.2 that creates a form (TXsectionForm) for editing the cross-sectional geometry of a conduit in SWMM.
1. Purpose and Context
In SWMM, each conduit can have a cross-section shape, such as circular, trapezoidal, rectangular, street, custom, etc. Dxsect.pas implements the user interface allowing one to pick which shape is used and supply the necessary parameters (like height, bottom width, side slopes, etc.). Some shapes rely on external references (like street sections or transects), while others have special dimension lookups or standard sizes (e.g., elliptical or arch shapes).
2. The TXsectionForm Form
2.1 Key Controls and Data Fields
-
ShapeListView (
TListView
):- Displays all possible shapes (rectangular, trapezoidal, triangular, parabolic, etc.) in an icon list.
- The user clicks on an icon to select that shape.
-
NumEdit1, NumEdit2, NumEdit3, NumEdit4 (
TNumEdit
controls):- Up to four numeric parameters describing the geometry of the shape.
- For example, for a trapezoid shape, these might be:
- Bottom width
- Left slope
- Right slope
- (Sometimes blank if not needed).
-
TsectCombo (
TComboBox
) and TsectBtn (TBitBtn
):- Used for shapes that reference external definitions, like "Street" or "Irregular" (Transect-based) or "Custom" (Shape curves).
- The user picks which named external object (Street or Transect or Shape Curve) they want.
-
BarrelsEdit and BarrelsUpDown:
- Number of barrels for the conduit cross-section.
-
ForceMainNote (
TLabel
):- A special label that appears if the "Force Main" shape is selected, clarifying that one is either entering a Hazen-Williams C-factor or a Darcy-Weisbach roughness, depending on the system.
-
SidewallsCombo and SidewallsLabel:
- For rectangular open channels, the user can choose how many sidewalls are removed (0, 1, or 2) from the shape.
-
SizesCombo:
- For certain elliptical or arch shapes, the user can pick from a list of standard sizes or choose "Custom."
-
OK, Cancel, and Help Buttons:
- Confirm or discard changes, or launch help topic on cross-sections.
2.2 Data Flow
- The form is given an existing set of cross-section parameters, such as:
- shape name
- four geometry fields
- number of barrels
- name of external reference (if used by street, irregular, or custom shapes)
- The form highlights the current shape in ShapeListView, sets up the right numeric fields, and optionally displays a combo box for referencing external objects or standard sizes.
- The user modifies parameters (like top width, bottom width, side slope, etc.).
- On OK, the form checks that the data are valid (no blank references, certain numeric constraints, etc.) and returns them to the main program.
2.3 Special Cases
- Street shape:
- TsectCombo references a "Street" object name (the user picks from the list in
Project.Lists[STREET]
).
- TsectCombo references a "Street" object name (the user picks from the list in
- Irregular shape:
- TsectCombo references a "Transect" name (the user picks from
Project.Lists[TRANSECT]
).
- TsectCombo references a "Transect" name (the user picks from
- Custom shape:
- TsectCombo references a "Shape Curve" name from
Project.Lists[SHAPECURVE]
.
- TsectCombo references a "Shape Curve" name from
- Elliptical shapes (horizontal/vertical) and arch shapes:
- Provide a standard library of sizes in
SizesCombo
. If "Custom" is chosen, the user can specify dimension fields directly. - The code sets dimension fields automatically if a standard size is chosen.
- Provide a standard library of sizes in
- Rectangular open shape can remove sidewalls via
SidewallsCombo
(like an open rectangular channel). - Force main shape uses a different friction approach (Hazen-Williams or Darcy-Weisbach) indicated by
ForceMainNote
.
2.4 Validation
ValidateData checks:
- Numeric fields must be valid (non-blank if shape requires them).
- Filled circular shape's filled depth < total depth.
- If referencing a street or transect or shape curve, the user must provide a valid name (not blank).
- For elliptical/arch shapes, if "Custom" is used, certain dimension checks apply (like vertical elliptical must be taller than wide, etc.).
2.5 Key Procedures
- FormCreate: Sets up the shape list, images, label text, and dimension system (US vs. SI).
- SetData: Called externally to load the given shape & parameters into the form.
- GetData: Called to return the final shape name & parameters from the form.
- ShapeListViewSelectItem: Responds to user picking a shape icon, changes the visible numeric fields accordingly, or references an external object.
- ValidateTextEntry: Ensures each numeric entry is valid or zero if not used.
- SizesCombo for elliptical or arch shapes:
- If user picks a standard size, dimension fields are auto-filled and disabled. If "Custom," the user can specify them.
3. Summary
Dxsect.pas provides the main user interface for setting or editing a single conduit’s cross-section geometry in SWMM 5.2. By selecting a shape from a list of icons, entering up to four numeric parameters, optionally referencing external objects (Street, Transect, or Shape Curve), and specifying the number of barrels, the user configures the conduit cross-section that SWMM uses in hydraulic calculations.
No comments:
Post a Comment