feat(resample): 实验性功能新增「重采样」(位于「自由标记」上方)
- Lane::ResampleItem + resample/resampleItems/resamplePanel/resampleScroll, 并在 LaneCarry / SplitLane / PruneLaneSignalItems / RemapAfterSignalInsert|Removal 同步 - 面板:可滚动分组列表(信号色条目栏 + 复选框 + 展开三角),展开后 4 行: 最大/最小数据间隔(只读,勾选时一次性缓存,绘制不扫描采样)+ 重采样间隔/频率(输入) - 输入框联动:改间隔同步频率,改频率同步间隔(输入单位分别为秒 / Hz) - 「构建为新信号」:DataSet::AppendGroupAxis 追加新时间轴 + InsertDerivedSignal, 采样值先按公式/系数/绝对值/镜像/Y偏移变换再等间隔线性插值,时间轴偏移不烘值 - 新信号名 <原信号> (重采样 <自适应单位频率>);Utf8Util::FormatFrequency 为唯一实现 - 非单调轴 / 点太少 / 间隔过大 / 点数超 2000 万 ⇒ 拒绝构建并给出自绘提示 - 顺带加入 FormulaEval(公式编译/求值,供 ApplyDrawTransform 与后续 UI 使用)
This commit is contained in:
1 parent
30e9d65c30
commit
1e1c2432ae
19 files changed
+1979
-56
No files matched your search
@@ -421,6 +421,23 @@ namespace jdi
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DataSet::AppendGroupAxis(int groupIndex, TimeAxis&& axis, std::size_t& axisIndex)
|
||||
{
|
||||
axisIndex = 0;
|
||||
if (groupIndex < 0 || groupIndex >= static_cast<int>(m_groups.size()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (axis.time.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SignalGroup& group = m_groups[static_cast<std::size_t>(groupIndex)];
|
||||
group.axes.push_back(std::move(axis));
|
||||
axisIndex = group.axes.size() - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DataSet::InsertDerivedSignal(int groupIndex, int afterSignalIndex, SignalData&& signal,
|
||||
int& newSignalIndex)
|
||||
{
|
||||
@@ -1396,6 +1413,43 @@ namespace jdi
|
||||
weakPeakItems.end());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 重采样
|
||||
|
||||
const Lane::ResampleItem* Lane::FindResampleItem(const SignalRef& ref) const
|
||||
{
|
||||
for (const ResampleItem& item : resampleItems)
|
||||
{
|
||||
if (item.ref == ref)
|
||||
{
|
||||
return &item;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Lane::ResampleItem& Lane::EnsureResampleItem(const SignalRef& ref)
|
||||
{
|
||||
for (ResampleItem& item : resampleItems)
|
||||
{
|
||||
if (item.ref == ref)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
ResampleItem item;
|
||||
item.ref = ref;
|
||||
resampleItems.push_back(item);
|
||||
return resampleItems.back();
|
||||
}
|
||||
|
||||
void Lane::RemoveResampleItem(const SignalRef& ref)
|
||||
{
|
||||
resampleItems.erase(
|
||||
std::remove_if(resampleItems.begin(), resampleItems.end(),
|
||||
[&ref](const ResampleItem& item) { return item.ref == ref; }),
|
||||
resampleItems.end());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 自由标记
|
||||
|
||||
namespace
|
||||
|
||||
Reference in new issue
Block a user