Below is a high-level summary of Fovmap.pas, the Delphi unit that defines SWMM’s Overview Map form (TOVMapForm). This form provides an outline view of the entire study area map, with a rectangular highlight showing the map region currently visible on the main MapForm.
1. Purpose
Fovmap.pas implements TOVMapForm, a small, always-available form in EPA SWMM that displays:
- A miniature (bird’s-eye) view of the entire project map.
- A focus rectangle representing the bounds of the visible area on the main map (on TMapForm).
- Dragging this rectangle re-centers the main map’s view.
2. TOVMapForm: Key Functionalities
-
OVmap (TMap):
- A dedicated TMap object storing a scaled-down rendering of the main map’s geometry and any backdrop image.
-
FocusRect (TRect):
- A rectangle drawn on the overview map indicating which portion is currently seen on TMapForm.
-
Form Life Cycle:
- FormCreate: Instantiates OVmap, sets up defaults, and prepares for drawing the map outline.
- FormDestroy: Frees the OVmap object.
- FormClose: Hides (rather than frees) the overview map form.
- FormResize & Rescale: Rescales and redraws the overview map to fit the form’s new dimensions.
-
Drawing & Refreshing:
- Redraw: Renders an outline (or backdrop) of the entire project on an internal bitmap.
- PaintFocusRect: Draws a bold red rectangle to highlight the main map’s current view.
- ShowMapExtent: Computes and updates the focus rectangle coordinates based on the main map’s zoom and pan settings.
-
Dragging:
- The user can click inside the focus rectangle and drag it around to shift the main map’s viewport.
- FormMouseDown: Begins dragging if the mouse is within FocusRect.
- FormMouseMove: Dynamically redraws a dashed rectangle as the user drags.
- FormMouseUp: Repositions the focus rectangle, then re-centers the main map accordingly.
-
Miscellaneous:
- NeedsUpdating: A boolean that indicates if changes are pending (e.g., waiting until the form becomes active before redrawing).
- WMGetMinMaxInfo: Restricts how small the user can resize the overview form.
3. Usage in SWMM
- Creation: Instantiated when SWMM starts. Stays hidden or visible based on a View menu toggle.
- Coordination with Main Map:
- The main MapForm updates OVMapForm whenever project data or zoom changes, calling
OVMapForm.Redraw
orOVMapForm.ShowMapExtent
. - If the user drags the focus rectangle in OVMapForm, it calls back to re-pan the main map’s window.
- The main MapForm updates OVMapForm whenever project data or zoom changes, calling
- Benefits:
- Quickly locates and navigates large study areas.
- Makes panning easier: user sees entire layout, and drags focus box to move main map’s window around.
4. Summary
In Fovmap.pas, TOVMapForm provides a scaled-down “overview map” of the entire study area, with a highlighted rectangle to indicate the currently visible portion in the main map form. The user can drag this rectangle to reposition the main view. Internally, OVmap is a TMap object that draws an outline or backdrop image of the complete area, while FocusRect denotes the current zoom/pan region from TMapForm. This overview greatly aids navigation and spatial context in SWMM’s user interface.
No comments:
Post a Comment