Skip to content

Commit 64053af

Browse files
Tom O'ReillyTom O'Reilly
authored andcommitted
added navTrackPoints()
1 parent 5a92e62 commit 64053af

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

src/qt-guilib/TopoDataset.cpp

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include "TopoDataset.h"
2+
#include "SwathData.h"
23
#include <unistd.h>
34
#include <vtkErrorCode.h>
45
#include <vtkPointData.h>
56
#include <QDebug>
67

7-
88
using namespace mb_system;
99

1010
// ─────────────────────────────────────────────────────────────────────────────
@@ -18,6 +18,7 @@ TopoDataset::TopoDataset(QObject *parent)
1818
// ─────────────────────────────────────────────────────────────────────────────
1919
// loadFile — was TopoDataItem::loadDataPipeline()
2020
// ─────────────────────────────────────────────────────────────────────────────
21+
2122
bool TopoDataset::loadFile(const QString &path) {
2223
QByteArray ba = path.toUtf8();
2324
const char *filename = ba.constData();
@@ -51,7 +52,6 @@ bool TopoDataset::loadFile(const QString &path) {
5152
idFilter_->SetInputData(reader_->GetOutput());
5253
idFilter_->SetCellIdsArrayName(ORIGINAL_IDS);
5354
idFilter_->SetPointIdsArrayName(ORIGINAL_IDS);
54-
idFilter_->PointIdsOn();
5555
idFilter_->Update();
5656

5757
// Cache grid bounds
@@ -72,12 +72,12 @@ bool TopoDataset::loadFile(const QString &path) {
7272
// Build the quality array — one entry per point, all GOOD_DATA initially.
7373
// AddArray() is idempotent: on a reload it replaces the old array in place.
7474
vtkPolyData *pd = polyData();
75-
quality_->SetName(DATA_QUALITY_NAME);
7675
quality_->SetNumberOfTuples(pd->GetNumberOfPoints());
77-
quality_->Fill(GOOD_DATA);
76+
for (vtkIdType i = 0; i < pd->GetNumberOfPoints(); i++) {
77+
quality_->SetValue(i, GOOD_DATA);
78+
}
7879
pd->GetPointData()->AddArray(quality_);
79-
qDebug() << "quality fill: tuples=" << quality_->GetNumberOfTuples()
80-
<< "value[0]=" << quality_->GetValue(0);
80+
8181
dataLoaded_ = true;
8282
emit dataLoaded();
8383
return true;
@@ -109,6 +109,28 @@ void TopoDataset::setPointQuality(vtkIdType originalId, int quality) {
109109

110110
// ─────────────────────────────────────────────────────────────────────────────
111111

112+
vtkPoints *TopoDataset::navTrackPoints() {
113+
if (!dataLoaded_) {
114+
qDebug() << "navTrackPoints(): data not loaded";
115+
return nullptr;
116+
}
117+
if (reader_->getDataType() != TopoDataType::Swath) {
118+
qDebug() << "navTrackPoints(): not a swath file, dataType="
119+
<< reader_->getDataType();
120+
return nullptr;
121+
}
122+
TopoData *td = reader_->topoData();
123+
qDebug() << "navTrackPoints(): topoData()=" << (void*)td;
124+
SwathData *sd = dynamic_cast<SwathData *>(td);
125+
qDebug() << "navTrackPoints(): dynamic_cast<SwathData*>=" << (void*)sd;
126+
if (!sd) return nullptr;
127+
vtkPoints *pts = sd->navTrackPoints();
128+
qDebug() << "navTrackPoints(): points=" << (pts ? pts->GetNumberOfPoints() : -1);
129+
return pts;
130+
}
131+
132+
// ─────────────────────────────────────────────────────────────────────────────
133+
112134
void TopoDataset::gridBounds(double *xMin, double *xMax,
113135
double *yMin, double *yMax,
114136
double *zMin, double *zMax) const {

0 commit comments

Comments
 (0)