1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
10 #include <ModelAPI_Feature.h>
12 #include <ModuleBase_Definitions.h>
20 \brief Return directory part of the file path.
22 If the file path does not include directory part (the file is in the
23 current directory), null string is returned.
26 \param abs if true (default) \a path parameter is treated as absolute file path
27 \return directory part of the file path
29 namespace XGUI_Tools {
32 * Returns directory name from name of file
33 * \param path a path to a file
34 * \param isAbs is absolute or relative path
36 QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
39 \brief Return file name part of the file path.
42 \param withExt if true (default) complete file name (with all
43 extension except the last) is returned, otherwise only base name
45 \return file name part of the file path
47 QString XGUI_EXPORT file(const QString& path, bool withExt = true);
50 \brief Add a slash (platform-specific) to the end of \a path
51 if it is not already there.
52 \param path directory path
53 \return modified path (with slash added to the end)
55 QString XGUI_EXPORT addSlash(const QString& path);
57 // The model concerning tools
59 /*! Unite object names in one string using the separator between values
60 \param theObjects a list of objects
61 \param theSeparator a separator
63 QString unionOfObjectNames(const QObjectPtrList& theObjects, const QString& theSeparator);
66 Returns true if the feature is a model object
67 \param theFeature a feature
69 bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
72 Returns the string presentation of the given feature
73 \param theFeature a feature
75 std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
78 Returns true if there are no parts in the document, which are not activated or
79 all objects in the list are not PartSet document.
80 It shows the warning control if the result is false.
81 \param theParent a parent for the warning control
82 \param aList a list of object
83 \return a boolean value
85 bool XGUI_EXPORT canRemoveOrRename(QWidget* theParent, const QObjectPtrList& aList);
88 Check possibility to rename object
89 \param theObject an object to rename
92 bool canRename(const ObjectPtr& theObject, const QString& theName);
95 Returns true if there are no parts in the document, which are not activated
96 \param theNotActivatedNames out string which contains not activated names
97 \return a boolean value
99 bool XGUI_EXPORT allDocumentsActivated(QString& theNotActivatedNames);
102 Returns a container of referenced feature to the current object in the object document.
103 \param theObject an object, which will be casted to a feature type
104 \param theRefFeatures an output container
106 void XGUI_EXPORT refsToFeatureInFeatureDocument(const ObjectPtr& theObject,
107 std::set<FeaturePtr>& theRefFeatures);
110 Returns true if the object if a sub child of the feature. The feature is casted to the
111 composite one. If it is possible, the sub object check happens. The method is applyed
112 recursively to the feature subs.
113 \param theObject a candidate to be a sub object
114 \param theFeature a candidate to be a composite feature
115 \return a boolean value
117 bool XGUI_EXPORT isSubOfComposite(const ObjectPtr& theObject, const FeaturePtr& theFeature);
121 void refsDirectToFeatureInAllDocuments(const ObjectPtr& theSourceObject, const ObjectPtr& theObject,
122 const QObjectPtrList& theIgnoreList,
123 std::set<FeaturePtr>& theDirectRefFeatures,
124 std::set<FeaturePtr>& theAlreadyProcessed);
127 Returns a container of references feature to the source object. The search happens in the object
128 document and in other Part documents if the object belongs to the PartSet. The search is recursive,
129 in other words it is applyed to set of the found objects until it is possible.
130 It do not returns the referenced features to the object if this references is a composite feature
131 which has the object as a sub object.
132 \param theSourceObject an object, which references are searched
133 \param theObject an intermediate recursive object, should be set in the source object
134 \param theIgnoreList an ignore list, the found referernces which coincide with the objects are ignored
135 \param theDirectRefFeatures direct references
136 \param theIndirectRefFeatures indirect references. These are features that refers to the direct features
137 \param theAlreadyProcessed set of processed elements, used for optimization (do not reanalyse processed)
138 \return a boolean value
140 void XGUI_EXPORT refsToFeatureInAllDocuments(const ObjectPtr& theSourceObject,
141 const ObjectPtr& theObject,
142 const QObjectPtrList& theIgnoreList,
143 std::set<FeaturePtr>& theDirectRefFeatures,
144 std::set<FeaturePtr>& theIndirectRefFeatures,
145 std::set<FeaturePtr>& theAlreadyProcessed);
148 * Returns true if the result is a sub object of some composite object
149 * \param theObject a result object
150 * \returns boolean value
152 bool XGUI_EXPORT isSubOfComposite(const ObjectPtr& theObject);