#include "actors/MapLineActor.hpp" #include #include #include #include #include #include #include #include namespace geopro::render { vtkSmartPointer buildSurveyLine(const geopro::core::Grid& g, const geopro::core::GeoLocalFrame& frame) { const int nx = g.nx(); const bool hasLatLon = g.lat.size() >= static_cast(nx) && g.lon.size() >= static_cast(nx); if (nx < 2 || !hasLatLon) return vtkSmartPointer::New(); vtkNew points; for (int i = 0; i < nx; ++i) { auto p = frame.toLocal(g.lat[i], g.lon[i]); points->InsertNextPoint(p.x, p.y, 0.0); // 平铺在 z=0,供俯视 } vtkNew line; line->GetPointIds()->SetNumberOfIds(nx); for (int i = 0; i < nx; ++i) line->GetPointIds()->SetId(i, i); vtkNew cells; cells->InsertNextCell(line); vtkNew poly; poly->SetPoints(points); poly->SetLines(cells); vtkNew mapper; mapper->SetInputData(poly); auto actor = vtkSmartPointer::New(); actor->SetMapper(mapper); actor->GetProperty()->SetColor(0.85, 0.15, 0.15); // 测线:红 actor->GetProperty()->SetLineWidth(3.0); return actor; } } // namespace geopro::render