Skip to content

Commit a5fd53d

Browse files
Tom O'ReillyTom O'Reilly
authored andcommitted
build displayed navigation tracks for all swath files in a datalist
1 parent f5f838f commit a5fd53d

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

src/qt-guilib/SwathData.cpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ bool SwathData::readDatafile(char *swathFile) {
164164
// Save pointer to grid struct
165165
gridData_ = &mbev_grid;
166166

167-
// Point to swath data (still valid after mbeditviz calls above)
168-
mbev_file_struct* swathData = &mbev_files[0];
169-
170167
// Load navigation track points for each imported swath file now that
171168
// projection has been applied.
172169
// getXYZ() uses
@@ -175,16 +172,33 @@ bool SwathData::readDatafile(char *swathFile) {
175172
// navlaty (northing) → VTK y — no swap needed.
176173
// sensordepth is positive meters below surface in MB-System;
177174
// negate for VTK z-up.
175+
// Point to swath data (still valid after mbeditviz calls above)
176+
mbev_file_struct* swathData = mbev_files;
177+
178178
navTrackPoints_->Reset();
179-
navTrackPoints_->SetNumberOfPoints(swathData->num_pings);
180-
for (vtkIdType i = 0; i < swathData->num_pings; i++) {
181-
navTrackPoints_->SetPoint(i,
182-
swathData->pings[i].navlonx, // easting → VTK x
183-
swathData->pings[i].navlaty, // northing → VTK y
184-
// negate: positive depth → negative VTK z
185-
-swathData->pings[i].sensordepth);
179+
int nPoints = 0;
180+
std::cerr << "mbev_num_file=" << mbev_num_files << "\n";
181+
// Compute total number of points in all swath nav tracks
182+
for (int nFile = 0; nFile < mbev_num_files; nFile++) {
183+
nPoints += swathData[nFile].num_pings;
184+
std::cerr << "nPoints=" << nPoints << "\n";
185+
}
186+
navTrackPoints_->SetNumberOfPoints(nPoints);
187+
188+
// Add nav points from all swath files
189+
vtkIdType ind = 0;
190+
for (int nFile = 0; nFile < mbev_num_files; nFile++) {
191+
// Add nav points from this swath file
192+
for (vtkIdType i = 0; i < swathData[nFile].num_pings; i++) {
193+
navTrackPoints_->SetPoint(ind++,
194+
// easting → VTK x
195+
swathData[nFile].pings[i].navlonx,
196+
// northing → VTK y
197+
swathData[nFile].pings[i].navlaty,
198+
// negate: positive depth → negative VTK z
199+
-swathData[nFile].pings[i].sensordepth);
200+
}
186201
}
187-
188202
// Set grid zmin and zmax, since the above mbeditviz functions do not
189203
int nPts = gridData_->n_rows * gridData_->n_columns;
190204
gridData_->min = std::numeric_limits<float>::max();

0 commit comments

Comments
 (0)