MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / update

Method update

src/core/virtual_path.cpp:84–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84VirtualCoordVector::size_type PathCoordVector::update(VirtualCoordVector::size_type part_start)
85{
86 auto& flags = virtual_coords.flags;
87 auto part_end = virtual_coords.size() - 1;
88 if (part_start <= part_end)
89 {
90 Q_ASSERT(virtual_coords.size() == flags.size());
91
92 if (flags[part_start].isHolePoint())
93 {
94 auto pos = virtual_coords[0];
95 qWarning("PathCoordVector at %g %g (mm) has an invalid hole at index %d.",
96 pos.x(), -pos.y(), part_start);
97 }
98
99 clear();
100 if (empty() || (part_start > 0 && flags[part_start-1].isHolePoint()))
101 {
102 emplace_back(virtual_coords[part_start], part_start, 0.0, 0.0);
103 }
104
105 for (auto index = part_start + 1; index <= part_end; ++index)
106 {
107 if (flags[index-1].isCurveStart())
108 {
109 Q_ASSERT(index+2 <= part_end);
110
111 // Add curve coordinates
112 curveToPathCoord(virtual_coords[index-1], virtual_coords[index], virtual_coords[index+1], virtual_coords[index+2], index-1, 0, 1);
113 index += 2;
114 }
115
116 // Add end point
117 const PathCoord& prev = back();
118 emplace_back(virtual_coords[index], index, 0.0, prev.clen + prev.pos.distanceTo(virtual_coords[index]));
119
120 Q_ASSERT(back().index == index);
121
122 if (index < part_end && flags[index].isHolePoint())
123 {
124 part_end = index;
125 }
126 }
127 }
128 return part_end;
129}
130
131bool PathCoordVector::isClosed() const
132{

Callers 15

calcIntersectionsTestMethod · 0.45
atypicalPathTestMethod · 0.45
commitStateChangeMethod · 0.45
drawObjectIDsMethod · 0.45
startFollowingMethod · 0.45
dragMoveMethod · 0.45
updatePreviewObjectsMethod · 0.45
updatePreviewTextMethod · 0.45
updatePreviewPathMethod · 0.45
clickPressMethod · 0.45

Calls 6

isHolePointMethod · 0.80
xMethod · 0.80
yMethod · 0.80
isCurveStartMethod · 0.80
distanceToMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected