#include #include #include #include #include "actors/CurtainActor.hpp" #include "geo/GeoLocalFrame.hpp" #include "model/ColorScale.hpp" #include "model/Field.hpp" using namespace geopro::core; // buildCurtain: 小 Grid(3,2) + lat/lon/y/values -> 非空 actor,mapper 输入点数=6。 TEST(Curtain, BuildsStructuredGridFromSmallGrid) { Grid g(3, 2); // nx=3 (lat/lon 列), ny=2 (深度行) g.lat = {22.50, 22.50, 22.50}; g.lon = {114.16, 114.17, 114.18}; g.y = {0.0, -10.0}; // 两层深度 double n = 0.0; for (int j = 0; j < 2; ++j) for (int i = 0; i < 3; ++i) g.valueAt(i, j) = n++; g.vmin = 0.0; g.vmax = 5.0; ColorScale cs; cs.addStop(0.0, Rgba{0, 0, 255, 255}); cs.addStop(5.0, Rgba{255, 0, 0, 255}); GeoLocalFrame frame(22.50, 114.16); auto actor = geopro::render::buildCurtain(g, cs, frame); ASSERT_NE(actor.GetPointer(), nullptr); auto* mapper = vtkDataSetMapper::SafeDownCast(actor->GetMapper()); ASSERT_NE(mapper, nullptr); auto* input = mapper->GetInput(); ASSERT_NE(input, nullptr); EXPECT_EQ(input->GetNumberOfPoints(), 6); }