1 #include "XGUI_Tools.h"
3 #include <TopoDS_Shape.hxx>
4 #include <ModelAPI_Object.h>
5 #include <GeomAPI_Shape.h>
12 namespace XGUI_Tools {
13 //******************************************************************
14 QString dir(const QString& path, bool isAbs)
16 QDir aDir = QFileInfo(path).dir();
17 QString dirPath = isAbs ? aDir.absolutePath() : aDir.path();
18 if (dirPath == QString("."))
23 //******************************************************************
24 QString file(const QString& path, bool withExt)
27 while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' || fPath[fPath.length() - 1] == '/'))
28 fPath.remove(fPath.length() - 1, 1);
31 return QFileInfo(fPath).fileName();
33 return QFileInfo(fPath).completeBaseName();
36 //******************************************************************
37 QString addSlash(const QString& path)
40 if (!res.isEmpty() && res.at(res.length() - 1) != QChar('/')
41 && res.at(res.length() - 1) != QChar('\\'))
42 res += QDir::separator();
46 //******************************************************************
47 bool isModelObject(FeaturePtr theFeature)
49 return theFeature && !theFeature->data();
52 //******************************************************************
53 std::string featureInfo(FeaturePtr theFeature)
55 std::ostringstream aStream;
57 aStream << theFeature.get() << " " << theFeature->getKind();
58 return QString(aStream.str().c_str()).toStdString();
61 //******************************************************************
62 /*FeaturePtr realFeature(const FeaturePtr theFeature)
64 if (theFeature->data()) {
67 ObjectPtr aObject = std::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
68 return aObject->featureRef();