Part: refactor ViewProviderPartExt::getDetail
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
# include <cmath>
|
||||
# include <cstdlib>
|
||||
# include <sstream>
|
||||
# include <boost/regex.hpp>
|
||||
|
||||
# include <APIHeaderSection_MakeHeader.hxx>
|
||||
# include <BinTools.hxx>
|
||||
@@ -292,6 +293,21 @@ TopoShape::TopoShape(const TopoShape& shape)
|
||||
Tag = shape.Tag;
|
||||
}
|
||||
|
||||
std::pair<std::string, unsigned long> TopoShape::getElementTypeAndIndex(const char* Name)
|
||||
{
|
||||
int index = 0;
|
||||
std::string element;
|
||||
boost::regex ex("^(Face|Edge|Vertex)([1-9][0-9]*)$");
|
||||
boost::cmatch what;
|
||||
|
||||
if (boost::regex_match(Name, what, ex)) {
|
||||
element = what[1].str();
|
||||
index = std::atoi(what[2].str().c_str());
|
||||
}
|
||||
|
||||
return std::make_pair(element, index);
|
||||
}
|
||||
|
||||
std::vector<const char*> TopoShape::getElementTypes() const
|
||||
{
|
||||
static const std::vector<const char*> temp = {"Face","Edge","Vertex"};
|
||||
|
||||
Reference in New Issue
Block a user