命名审查与垃圾代码清理(纯重命名 / 死代码删除,无行为变更)
前提:加载完成后全部采样都已驻留内存,程序此后与源文件再无联系。 据此修正了一批会让人误以为"仍在读写文件"的命名: - SampleFileAt → SampleSignalAt(取的是内存信号在给定时刻的采样值)。 - DataSet::AddPreparedFile → AddDataFile。 - PlotView::InvalidatePolylineCache → InvalidateDerivedCaches (它同时清空折线、边沿统计、中心平均值曲线、静态场景缓存与悬停引用)。 - PlotView::CursorColor(int which) → CursorColor()(两条光标同色,参数从未使用)。 - UiEllipsize(g,…) → UiEllipsize(…):纯测量不绘制,删掉被忽略的绘图上下文参数; 同时删除与 UiMeasureTextWidth 完全重复的 UiTextWidth,调用点统一到 UiMeasureTextWidth。 清理残留参数((void)xxx;): - TabConfig 的可见性/网格族(SetVisible / ToggleVisible / SetFileVisible / SetAllVisible / SoloSignal / SetMode / SyncLanes / FileHasVisible / FileAllVisible)去掉从未使用的 const DataSet& 参数(仅 SyncToDataSet 真正需要数据层,保留)。 - PlotView::OnLButtonUp(int y)、OnMouseWheel(int delta, bool shift);PainterSignalHalo 去掉未用的 ref。 - BuildDataFile 中未使用的局部 rowCount。 删除无人调用的死函数: DataSet::Clear / AddFromTable;SignalColorCount;WideToUtf8 / StartsWith; PlotView::ViewMinTime / ViewMaxTime / EdgePanelRect / EdgePanelCloseRect / EdgeCenterPanelRect / ScaleLaneRange / BeginLaneValueEdit / LaneContentHeight; SignalPanel::NeedsScrollBar / IsFilterEditing / FilterText / ContentHeight; PopupMenu::EditingItemId;TabBar::IsDragging;TextEdit::PlaceCaret。 删除只写不读的死字段:CsvTable::sourceRowCount(与 rowCount 等义)与 skippedRowCount。 以 VERY_BIG_DATA.CSV 回归验证:加载与勾选、筛选框(含"无匹配的筛选信号")、 样式区线宽文案省略、选区放大(横向与纵向)、双光标读数与 Δt、右键菜单(Y 轴数值与 实验性功能子菜单)、合并/拆分网格、标签与信号重命名省略号,行为均与改动前一致; make clean && make all 无任何警告。
This commit is contained in:
1 parent
f5028b1e18
commit
350538c634
21 files changed
+118
-456
No files matched your search
+19
-43
@@ -464,7 +464,6 @@ namespace jdi
|
||||
}
|
||||
|
||||
const std::size_t columnCount = table.headers.size();
|
||||
const std::size_t rowCount = table.rowCount;
|
||||
if (table.columns.size() < columnCount)
|
||||
{
|
||||
error = L"数据表列结构不完整。";
|
||||
@@ -599,18 +598,12 @@ namespace jdi
|
||||
}
|
||||
file.minTime = tMin;
|
||||
file.maxTime = tMax;
|
||||
(void)rowCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ============================ DataSet ============================
|
||||
|
||||
void DataSet::Clear()
|
||||
{
|
||||
m_files.clear();
|
||||
}
|
||||
|
||||
bool DataSet::AddPreparedFile(DataFile&& file, int& fileIndex)
|
||||
bool DataSet::AddDataFile(DataFile&& file, int& fileIndex)
|
||||
{
|
||||
fileIndex = -1;
|
||||
if (file.signals.empty())
|
||||
@@ -622,21 +615,6 @@ namespace jdi
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DataSet::AddFromTable(const CsvTable& table, const std::wstring& filePath, std::wstring& error,
|
||||
int& fileIndex)
|
||||
{
|
||||
fileIndex = -1;
|
||||
|
||||
// 兼容入口:复制一份表格后走与后台加载完全一致的构建流程。
|
||||
CsvTable local = table;
|
||||
DataFile file;
|
||||
if (!BuildDataFile(std::move(local), filePath, SignalCount(), file, error))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return AddPreparedFile(std::move(file), fileIndex);
|
||||
}
|
||||
|
||||
bool DataSet::InsertDerivedSignal(int fileIndex, int afterSignalIndex, SignalData&& signal,
|
||||
int& newSignalIndex)
|
||||
{
|
||||
@@ -992,7 +970,8 @@ namespace jdi
|
||||
return best;
|
||||
}
|
||||
|
||||
bool SampleFileAt(const DataFile& file, const SignalData& signal, double time, bool interpolate, double& value)
|
||||
bool SampleSignalAt(const DataFile& file, const SignalData& signal, double time, bool interpolate,
|
||||
double& value)
|
||||
{
|
||||
value = kMissing;
|
||||
|
||||
@@ -1093,7 +1072,7 @@ namespace jdi
|
||||
[](const Lane& lane) { return lane.signals.empty(); }),
|
||||
m_lanes.end());
|
||||
|
||||
SyncLanes(dataSet);
|
||||
SyncLanes();
|
||||
}
|
||||
|
||||
void TabConfig::RemapAfterFileRemoval(int fileIndex)
|
||||
@@ -1147,7 +1126,7 @@ namespace jdi
|
||||
return fileVisible[static_cast<std::size_t>(ref.signalIndex)];
|
||||
}
|
||||
|
||||
void TabConfig::SetVisible(const DataSet& dataSet, const SignalRef& ref, bool visible)
|
||||
void TabConfig::SetVisible(const SignalRef& ref, bool visible)
|
||||
{
|
||||
if (ref.fileIndex < 0 || static_cast<std::size_t>(ref.fileIndex) >= m_visible.size())
|
||||
{
|
||||
@@ -1171,15 +1150,15 @@ namespace jdi
|
||||
m_laneMode = LaneMode::CUSTOM;
|
||||
}
|
||||
|
||||
SyncLanes(dataSet);
|
||||
SyncLanes();
|
||||
}
|
||||
|
||||
void TabConfig::ToggleVisible(const DataSet& dataSet, const SignalRef& ref)
|
||||
void TabConfig::ToggleVisible(const SignalRef& ref)
|
||||
{
|
||||
SetVisible(dataSet, ref, !IsVisible(ref));
|
||||
SetVisible(ref, !IsVisible(ref));
|
||||
}
|
||||
|
||||
void TabConfig::SetFileVisible(const DataSet& dataSet, int fileIndex, bool visible)
|
||||
void TabConfig::SetFileVisible(int fileIndex, bool visible)
|
||||
{
|
||||
if (fileIndex < 0 || static_cast<std::size_t>(fileIndex) >= m_visible.size())
|
||||
{
|
||||
@@ -1187,30 +1166,29 @@ namespace jdi
|
||||
}
|
||||
std::vector<bool>& fileVisible = m_visible[static_cast<std::size_t>(fileIndex)];
|
||||
std::fill(fileVisible.begin(), fileVisible.end(), visible);
|
||||
SyncLanes(dataSet);
|
||||
SyncLanes();
|
||||
}
|
||||
|
||||
void TabConfig::SetAllVisible(const DataSet& dataSet, bool visible)
|
||||
void TabConfig::SetAllVisible(bool visible)
|
||||
{
|
||||
for (std::vector<bool>& fileVisible : m_visible)
|
||||
{
|
||||
std::fill(fileVisible.begin(), fileVisible.end(), visible);
|
||||
}
|
||||
SyncLanes(dataSet);
|
||||
SyncLanes();
|
||||
}
|
||||
|
||||
void TabConfig::SoloSignal(const DataSet& dataSet, const SignalRef& ref)
|
||||
void TabConfig::SoloSignal(const SignalRef& ref)
|
||||
{
|
||||
for (std::vector<bool>& fileVisible : m_visible)
|
||||
{
|
||||
std::fill(fileVisible.begin(), fileVisible.end(), false);
|
||||
}
|
||||
SetVisible(dataSet, ref, true);
|
||||
SetVisible(ref, true);
|
||||
}
|
||||
|
||||
bool TabConfig::FileHasVisible(const DataSet& dataSet, int fileIndex) const
|
||||
bool TabConfig::FileHasVisible(int fileIndex) const
|
||||
{
|
||||
(void)dataSet;
|
||||
if (fileIndex < 0 || static_cast<std::size_t>(fileIndex) >= m_visible.size())
|
||||
{
|
||||
return false;
|
||||
@@ -1219,9 +1197,8 @@ namespace jdi
|
||||
return std::find(fileVisible.begin(), fileVisible.end(), true) != fileVisible.end();
|
||||
}
|
||||
|
||||
bool TabConfig::FileAllVisible(const DataSet& dataSet, int fileIndex) const
|
||||
bool TabConfig::FileAllVisible(int fileIndex) const
|
||||
{
|
||||
(void)dataSet;
|
||||
if (fileIndex < 0 || static_cast<std::size_t>(fileIndex) >= m_visible.size())
|
||||
{
|
||||
return false;
|
||||
@@ -1256,15 +1233,14 @@ namespace jdi
|
||||
return count;
|
||||
}
|
||||
|
||||
void TabConfig::SetMode(const DataSet& dataSet, LaneMode mode)
|
||||
void TabConfig::SetMode(LaneMode mode)
|
||||
{
|
||||
m_laneMode = mode;
|
||||
SyncLanes(dataSet);
|
||||
SyncLanes();
|
||||
}
|
||||
|
||||
void TabConfig::SyncLanes(const DataSet& dataSet)
|
||||
void TabConfig::SyncLanes()
|
||||
{
|
||||
(void)dataSet;
|
||||
RebuildLanes(m_visible, m_lanes, m_laneMode);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user