• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paulmthompson / WhiskerToolbox / 18389801194

09 Oct 2025 09:35PM UTC coverage: 71.943% (+0.1%) from 71.826%
18389801194

push

github

paulmthompson
add correlation matrix to filtering interface

207 of 337 new or added lines in 5 files covered. (61.42%)

867 existing lines in 31 files now uncovered.

49964 of 69449 relevant lines covered (71.94%)

1103.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

19.4
/src/DataManager/utils/TableView/adapters/PointDataAdapter.cpp
1
#include "PointDataAdapter.h"
2

3
#include "Points/Point_Data.hpp"
4

5
#include <stdexcept>
6

7
PointDataAdapter::PointDataAdapter(std::shared_ptr<PointData> pointData,
17✔
8
                                   std::shared_ptr<TimeFrame> timeFrame,
9
                                   std::string name)
17✔
10
    : m_pointData(std::move(pointData)),
17✔
11
      m_timeFrame(std::move(timeFrame)),
17✔
12
      m_name(std::move(name)) {
34✔
13
    if (!m_pointData) {
17✔
14
        throw std::invalid_argument("PointData cannot be null");
×
15
    }
16
}
17✔
17

18
std::string const & PointDataAdapter::getName() const {
×
19
    return m_name;
×
20
}
21

22
std::shared_ptr<TimeFrame> PointDataAdapter::getTimeFrame() const {
×
23
    return m_timeFrame;
×
24
}
25

26
size_t PointDataAdapter::size() const {
×
27
    size_t totalPoints = 0;
×
28
    for (auto const & [time, points] : m_pointData->GetAllPointsAsRange()) {
×
29
        totalPoints += points.size();
×
UNCOV
30
    }
×
31
    return totalPoints;
×
32
}
33

34
std::vector<Point2D<float>> PointDataAdapter::getPoints() {
×
35
    std::vector<Point2D<float>> allPoints;
×
36
    allPoints.reserve(size());
×
37
    
38
    for (auto const & [time, points] : m_pointData->GetAllPointsAsRange()) {
×
39
        for (auto const & point : points) {
×
40
            allPoints.emplace_back(point.x, point.y);
×
41
        }
UNCOV
42
    }
×
43
    
44
    return allPoints;
×
45
}
×
46

47
std::vector<Point2D<float>> PointDataAdapter::getPointsInRange(TimeFrameIndex start,
×
48
                                                         TimeFrameIndex end,
49
                                                         TimeFrame const * target_timeFrame) {
50
    std::vector<Point2D<float>> rangePoints;
×
51

52
    // Get the source TimeFrame
53
    auto const * sourceTimeFrame = m_timeFrame.get();
×
54
    
55
    // Convert target range to source range if needed
56
    TimeFrameIndex sourceStart = start;
×
57
    TimeFrameIndex sourceEnd = end;
×
58
    
59
    if (target_timeFrame && sourceTimeFrame && target_timeFrame != sourceTimeFrame) {
×
60
        // Convert time range from target to source timeframe
61
        // This is a simplified conversion - in practice you might need more sophisticated mapping
62
        sourceStart = start;
×
63
        sourceEnd = end;
×
64
    }
65
    
66
    for (auto const & [time, points] : m_pointData->GetAllPointsAsRange()) {
×
67
        if (time >= sourceStart && time <= sourceEnd) {
×
68
            for (auto const & point : points) {
×
69
                rangePoints.emplace_back(point.x, point.y);
×
70
            }
71
        }
UNCOV
72
    }
×
73
    
74
    return rangePoints;
×
75
}
×
76

77
bool PointDataAdapter::hasMultiSamples() const {
17✔
78
    for (auto const & [time, points] : m_pointData->GetAllPointsAsRange()) {
70✔
79
        if (points.size() > 1) {
56✔
80
            return true;
3✔
81
        }
82
    }
56✔
83
    return false;
14✔
84
}
85

86
size_t PointDataAdapter::getEntityCountAt(TimeFrameIndex t) const {
×
87
    for (auto const & [time, points] : m_pointData->GetAllPointsAsRange()) {
×
88
        if (time == t) {
×
89
            return points.size();
×
90
        }
UNCOV
91
    }
×
92
    return 0;
×
93
}
94

95
Point2D<float> const* PointDataAdapter::getPointAt(TimeFrameIndex t, int entityIndex) const {
×
96
    for (auto const & [time, points] : m_pointData->GetAllPointsAsRange()) {
×
97
        if (time == t) {
×
98
            if (entityIndex >= 0 && static_cast<size_t>(entityIndex) < points.size()) {
×
99
                // Convert from internal point format to Point2D
100
                static thread_local Point2D<float> convertedPoint;
×
101
                convertedPoint.x = points[static_cast<size_t>(entityIndex)].x;
×
102
                convertedPoint.y = points[static_cast<size_t>(entityIndex)].y;
×
103
                return &convertedPoint;
×
104
            }
105
            break;
×
106
        }
UNCOV
107
    }
×
108
    return nullptr;
×
109
}
110

111
EntityId PointDataAdapter::getEntityIdAt(TimeFrameIndex, int entityIndex) const {
×
112
    // For now, use the entity index as the ID
113
    // In the future, this could be extended to use actual entity IDs if PointData supports them
114
    return static_cast<EntityId>(entityIndex);
×
115
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc