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

Method canBeConnected

src/core/objects/object.cpp:1280–1303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1278}
1279
1280bool PathObject::canBeConnected(const PathObject* other, double connect_threshold_sq) const
1281{
1282 for (const auto& part : path_parts)
1283 {
1284 if (part.isClosed())
1285 continue;
1286
1287 for (const auto& other_part : other->path_parts)
1288 {
1289 if (other_part.isClosed())
1290 continue;
1291
1292 if (coords[part.first_index].distanceSquaredTo(other->coords[other_part.first_index]) <= connect_threshold_sq
1293 || coords[part.first_index].distanceSquaredTo(other->coords[other_part.last_index]) <= connect_threshold_sq
1294 || coords[part.last_index].distanceSquaredTo(other->coords[other_part.first_index]) <= connect_threshold_sq
1295 || coords[part.last_index].distanceSquaredTo(other->coords[other_part.last_index]) <= connect_threshold_sq)
1296 {
1297 return true;
1298 }
1299 }
1300 }
1301
1302 return false;
1303}
1304
1305bool PathObject::connectIfClose(PathObject* other, double connect_threshold_sq)
1306{

Callers 1

finishDrawingMethod · 0.80

Calls 2

distanceSquaredToMethod · 0.80
isClosedMethod · 0.45

Tested by

no test coverage detected