From: mpv Date: Thu, 4 Jun 2015 12:45:52 +0000 (+0300) Subject: Implementation of "allFeatures" method needed for the parameters inside of attributes... X-Git-Tag: V_1.3.0~279 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9ac4a898909782c5b6df52fcee4270247db31e45;p=modules%2Fshaper.git Implementation of "allFeatures" method needed for the parameters inside of attributes expressions update --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index ee8193036..e032dbc69 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -827,3 +827,8 @@ ResultPtr Model_Document::findByName(const std::string theName) { return myObjs->findByName(theName); } + +std::list > allFeatures() +{ + return myObjs->allFeatures(); +} diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 7969d1724..20adb3d05 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -168,6 +168,10 @@ class Model_Document : public ModelAPI_Document //! selection by name. ResultPtr findByName(const std::string theName); + ///! Returns all features of the document including the hidden features which are not in + ///! history. Not very fast method, for calling once, not in big cycles. + MODEL_EXPORT virtual std::list > allFeatures(); + protected: //! Returns (creates if needed) the general label TDF_Label generalLabel() const; diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 54033a49b..be9e80ff3 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -898,6 +898,20 @@ FeaturePtr Model_Objects::lastFeature() return FeaturePtr(); // no features at all } +std::list > Model_Objects::allFeatures() +{ + std::list > aResult; + Handle(TDataStd_ReferenceArray) aRefs; + if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) { + for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { + FeaturePtr aFeature = feature(aRefs->Value(a)); + if (aFeature.get()) + aResult.push_back(aFeature); + } + } + return aResult; +} + Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper) { return TDF_LabelMapHasher::HashCode(theLab, theUpper); diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index ef1d403b6..cd7f440e7 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -174,6 +174,11 @@ class Model_Objects /// be created before) std::string featureResultGroup(FeaturePtr theFeature); + ///! Returns all features of the document including the hidden features which are not in + ///! history. Not very fast method, for calling once, not in big cycles. + std::list > allFeatures(); + + private: TDF_Label myMain; ///< main label of the data storage diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 5f344ea08..38f02b147 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -125,6 +125,10 @@ public: virtual std::shared_ptr feature( const std::shared_ptr& theResult) = 0; + ///! Returns all features of the document including the hidden features which are not in + ///! history. Not very fast method, for calling once, not in big cycles. + virtual std::list > allFeatures() = 0; + protected: /// Only for SWIG wrapping it is here MODELAPI_EXPORT ModelAPI_Document();