[TechDraw] Add ability to align points by rotating view

Fixes #7061
This commit is contained in:
Benjamin Bræstrup Sayoc
2024-09-14 00:20:53 +02:00
committed by WandererFan
parent 516595fbce
commit 4d9e4efc87
12 changed files with 340 additions and 0 deletions

View File

@@ -101,6 +101,16 @@ using namespace TechDraw;
}
}
/*static*/ std::vector<int> DrawUtil::getIndexFromName(const std::vector<std::string>& geomNames)
{
std::vector<int> result;
result.reserve(200);
for (const std::string& geomName : geomNames) {
result.push_back(getIndexFromName(geomName));
}
return result;
}
std::string DrawUtil::getGeomTypeFromName(const std::string& geomName)
{
if (geomName.empty()) {
@@ -126,6 +136,20 @@ std::string DrawUtil::getGeomTypeFromName(const std::string& geomName)
}
}
//! Check if all geomNames are of same geomType
//! Edge1, Edge2, Edge3 -> true
//! Edge1, Edge2, Vertex7 -> false
bool DrawUtil::isGeomTypeConsistent(const std::vector<std::string>& geomNames)
{
std::string reference = getGeomTypeFromName(geomNames.at(0));
for (std::string geomName : geomNames) {
if (reference != getGeomTypeFromName(geomName)) {
return false;
}
}
return true;
}
std::string DrawUtil::makeGeomName(const std::string& geomType, int index)
{
std::stringstream newName;