X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FModel%2FModel_Objects.h;h=0991cf21077dba0fe2b3bcc38a0caafd91f4ebbf;hb=4e677bdcfd9ebe4b467a1cc4cc274bcfbe5fb8ca;hp=19572e143001cce978f159a0c629c30f5d6bfb88;hpb=8578511c4164ad4fd45ad1c6a92cc8aaacba5972;p=modules%2Fshaper.git diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index 19572e143..0991cf210 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -109,6 +109,10 @@ class Model_Objects //! \param theAllowFolder take into account grouping feature by folders int size(const std::string& theGroupID, const bool theAllowFolder = false); + //! 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. + std::shared_ptr parent(const std::shared_ptr theChild); + //! Returns all (and disabled) results of the given type. //! Not fast method (iterates all features). void allResults(const std::string& theGroupID, std::list& theResults); @@ -162,6 +166,14 @@ class Model_Objects std::shared_ptr findFolder( const std::list >& theFeatures, const bool theBelow); + //! 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. + std::shared_ptr findContainingFolder( + const std::shared_ptr& theFeature, + int& theIndexInFolder); //! 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 @@ -284,7 +296,7 @@ class Model_Objects std::string& theParentName) const; /// Return object representing a folder or empty pointer - ObjectPtr folder(TDF_Label theLabel) const; + const ObjectPtr& folder(TDF_Label theLabel) const; private: TDF_Label myMain; ///< main label of the data storage