draw_bathy
Description
draw_bathy.c is a Motif GUI source file responsible for drawing and updating the bathymetry display within the “Submetrix 2000 unraveller” application. It visualizes the processed bathymetry data, including depths, across-track positions, and quality indicators. The drawing is performed on an XmDrawingArea widget and is continuously updated to reflect changes in processing parameters or data navigation. It also presents current processing parameter values on the display for user feedback.
How It Works
init_bathy()function:- Initializes the
DA10structure (a global context for the drawing area). - Retrieves the geometry of the
DrawingAreawidget (DA10.widget). - Creates an
X Pixmap(DA10.pixmap) as an off-screen buffer for drawing, which prevents flickering. - Fills the pixmap with a white background.
- Initializes the
draw_bathy()function: This is the main drawing routine, called to refresh the bathymetry display.- Clear Drawing Area: Clears the pixmap with a white or black background, depending on the
current_side(port/starboard) andshow_rawflag. - Axis/Grid Drawing: Draws X and Y axes (gray lines) if the
current_sideis assigned. - Port Side Display (if
current_side == SUBX_PORT):- Processed Bathymetry (if
!show_raw): Iterates through 2D bins (dep_across_bins) to draw a heatmap of depths. It also draws lines representing detected peaks (peak_bin) for bottom tracking. - Raw Data (if
show_raw == 1): Plots individual depth points (depths,across) based on raw processed data. Points are colored white if they meet amplitude and quality thresholds, otherwise blue. - Gate Visualization: Draws red points representing shallow and deep gates (
gate_shal,gate_deep,track_gate_shal,track_gate_deep) that define valid areas for bottom detection. - Parameter Display: Displays current values of key processing parameters (e.g.,
# sam,ph av,pr Hz,tx cy,ct rg) as text on the drawing area.
- Processed Bathymetry (if
- Starboard Side Display (if
current_side == SUBX_STBD):- The drawing logic is very similar to the port side, but adapted for the starboard data.
- Displays
max_variance,min_binned,qua_thresh,amp_perc_thresh,water_depth_multiplier, andmax_across_coverage.
- Copy to Screen: After all drawing operations are completed on the
DA10.pixmap, theXCopyAreafunction copies the entire pixmap to the visible window (DA10.window), ensuring a smooth, flicker-free update.
- Clear Drawing Area: Clears the pixmap with a white or black background, depending on the
expose_bathy()function:- This function is registered as an expose callback and is responsible for redrawing the contents of the window whenever an
Exposeevent occurs (e.g., when the window is uncovered or resized). It simply copies the pre-renderedDA10.pixmapto the screen.
- This function is registered as an expose callback and is responsible for redrawing the contents of the window whenever an
This file heavily relies on global variables (DA10, txInfo, current_side, show_raw, dep_across_bins, peak_count, peak_bin, depths, across, anal1, angdiffs, port_thresh, stbd_thresh, qua_thresh, perc_watercol, amp_thresh, pr_depth, pr_across, pr_var, no_prs, min_binned, max_variance, gate_shal, gate_deep, track_gate_shal, track_gate_deep, port_pc, stbd_pc, water_depth_multiplier, max_across_coverage, phase_filter_length, DT) to access and display the application’s state and data.