committed by
WandererFan
parent
516595fbce
commit
4d9e4efc87
@@ -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;
|
||||
|
||||
@@ -91,7 +91,9 @@ class TechDrawExport DrawUtil
|
||||
{
|
||||
public:
|
||||
static int getIndexFromName(const std::string& geomName);
|
||||
static std::vector<int> getIndexFromName(const std::vector<std::string>& geomNames);
|
||||
static std::string getGeomTypeFromName(const std::string& geomName);
|
||||
static bool isGeomTypeConsistent(const std::vector<std::string>& geomNames);
|
||||
static std::string makeGeomName(const std::string& geomType, int index);
|
||||
static bool isSamePoint(TopoDS_Vertex v1, TopoDS_Vertex v2, double tolerance = VERTEXTOLERANCE);
|
||||
static bool isZeroEdge(TopoDS_Edge e, double tolerance = VERTEXTOLERANCE);
|
||||
|
||||
Reference in New Issue
Block a user