feat(core): 补全数据模型(Anomaly + Grid/ScatterField 元字段)
This commit is contained in:
parent
a7d624cdcc
commit
a35ababdd4
|
|
@ -0,0 +1,20 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
namespace geopro::core {
|
||||||
|
|
||||||
|
enum class AnomalyMarkType { Point = 1, Polyline = 2, Polygon = 3 };
|
||||||
|
|
||||||
|
struct Vec2 { double x, y; };
|
||||||
|
|
||||||
|
struct Anomaly {
|
||||||
|
std::string name;
|
||||||
|
std::string typeName; // exceptionTypeName
|
||||||
|
AnomalyMarkType markType = AnomalyMarkType::Polyline;
|
||||||
|
std::vector<Vec2> localPts; // location.coordinate(局部坐标)
|
||||||
|
std::string lineColor = "#000000"; // legend.polylineColor
|
||||||
|
double lineWidth = 1.0; // legend.polylineWidth
|
||||||
|
bool dashed = true; // legend.polylineShape == "dash"
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace geopro::core
|
||||||
|
|
@ -33,6 +33,10 @@ public:
|
||||||
const std::vector<double>& values() const { return values_; }
|
const std::vector<double>& values() const { return values_; }
|
||||||
std::vector<double>& values() { return values_; }
|
std::vector<double>& values() { return values_; }
|
||||||
std::vector<double> x, y; // 轴坐标(规则)
|
std::vector<double> x, y; // 轴坐标(规则)
|
||||||
|
std::vector<double> z; // [nx*ny] 褶皱面抬升(可空=平面)
|
||||||
|
std::vector<double> elevation; // [nx] 电极/地表高程
|
||||||
|
std::vector<double> lat, lon; // [nx] 经纬度
|
||||||
|
double vmin = 0.0, vmax = 0.0;
|
||||||
private:
|
private:
|
||||||
int nx_, ny_;
|
int nx_, ny_;
|
||||||
std::vector<double> values_;
|
std::vector<double> values_;
|
||||||
|
|
@ -41,6 +45,7 @@ private:
|
||||||
// 散点场(剖面原数据):局部坐标 + 值。
|
// 散点场(剖面原数据):局部坐标 + 值。
|
||||||
struct ScatterField {
|
struct ScatterField {
|
||||||
std::vector<double> x, y, z, v; // 对应样本 xlist/ylist/(hlist)/vlist
|
std::vector<double> x, y, z, v; // 对应样本 xlist/ylist/(hlist)/vlist
|
||||||
|
std::vector<double> projX, projY; // GIS 平面坐标
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace geopro::core
|
} // namespace geopro::core
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ target_sources(geopro_tests PRIVATE core/test_model.cpp)
|
||||||
target_sources(geopro_tests PRIVATE core/test_color_scale.cpp)
|
target_sources(geopro_tests PRIVATE core/test_color_scale.cpp)
|
||||||
target_sources(geopro_tests PRIVATE core/test_idw.cpp)
|
target_sources(geopro_tests PRIVATE core/test_idw.cpp)
|
||||||
target_sources(geopro_tests PRIVATE core/test_crs_transform.cpp)
|
target_sources(geopro_tests PRIVATE core/test_crs_transform.cpp)
|
||||||
|
target_sources(geopro_tests PRIVATE core/test_model_data.cpp)
|
||||||
target_link_libraries(geopro_tests PRIVATE geopro_core)
|
target_link_libraries(geopro_tests PRIVATE geopro_core)
|
||||||
|
|
||||||
add_subdirectory(spike) # spike S3: banded contour 渲染验证
|
add_subdirectory(spike) # spike S3: banded contour 渲染验证
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "model/Field.hpp"
|
||||||
|
#include "model/Anomaly.hpp"
|
||||||
|
using namespace geopro::core;
|
||||||
|
|
||||||
|
TEST(DataModel, GridHasMetaFields) {
|
||||||
|
Grid g(2, 3);
|
||||||
|
g.z.assign(6, 0.0); g.elevation = {1,2}; g.lat = {22.5,22.5}; g.lon = {114.1,114.1};
|
||||||
|
g.vmin = -10; g.vmax = 800;
|
||||||
|
EXPECT_EQ(g.z.size(), 6u);
|
||||||
|
EXPECT_DOUBLE_EQ(g.vmax, 800);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(DataModel, ScatterHasGis) {
|
||||||
|
ScatterField s; s.projX = {516000.0}; s.projY = {2494000.0};
|
||||||
|
EXPECT_EQ(s.projX.size(), 1u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(DataModel, AnomalyHolds) {
|
||||||
|
Anomaly a;
|
||||||
|
a.name = "ERT1-54"; a.markType = AnomalyMarkType::Polyline;
|
||||||
|
a.localPts = {{1.0, 2.0}, {3.0, 4.0}};
|
||||||
|
EXPECT_EQ(a.markType, AnomalyMarkType::Polyline);
|
||||||
|
EXPECT_EQ(a.localPts.size(), 2u);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue