//! \param theAllowFolder take into account grouping feature by folders
virtual int size(const std::string& theGroupID, const bool theAllowFolder = false) = 0;
+ //! Returns the parent object of this child. This may be result or feature, parent of a
+ //! top result. Fast method, that uses internal data structure specifics.
+ virtual std::shared_ptr<ModelAPI_Object> parent(
+ const std::shared_ptr<ModelAPI_Object> theChild) = 0;
+
//! Returns the feature that is currently edited in this document, normally
//! this is the latest created feature
//! \param theVisible use visible features only: flag is true for Object Browser functionality
virtual std::list<std::shared_ptr<ModelAPI_Object> > allObjects() = 0;
//! Creates a folder (group of the features in the object browser)
+ //! \param theAddBefore a feature, the folder is added before
+ //! (if empty, the folder is added after the last feature)
virtual std::shared_ptr<ModelAPI_Folder> addFolder(
- std::shared_ptr<ModelAPI_Feature> theAddBefore) = 0;
+ std::shared_ptr<ModelAPI_Feature> theAddBefore = std::shared_ptr<ModelAPI_Feature>()) = 0;
//! Removes the folder from the document (all features in the folder will be kept).
virtual void removeFolder(std::shared_ptr<ModelAPI_Folder> theFolder) = 0;
//! Search a folder above the list of features applicable to store them
//! \return Empty pointer if there is no applicable folder
virtual std::shared_ptr<ModelAPI_Folder> findFolderBelow(
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures) = 0;
+ //! Search a folder containing the given feature.
+ //! Addtionally calculates a zero-based index of the feature in this folder.
+ //! \param theFeature feature to search
+ //! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level.
+ //! \return the folder containing the feature or empty pointer if the feature is top-level.
+ virtual std::shared_ptr<ModelAPI_Folder> findContainingFolder(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ int& theIndexInFolder) = 0;
//! Add a list of features to the folder. The correctness of the adding is not performed
//! (such checks have been done in corresponding find.. method).
//! \return \c true if the movement is successfull