return shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
}
+shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
+{
+ // TODO: optimize this method
+ shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theGroupID);
+ for(int a = 0; a != theIndex; anIter->next()) a++;
+ return anIter->current();
+}
+
Model_Document::Model_Document(const std::string theID)
: myID(theID), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
{
MODEL_EXPORT virtual const std::string& id() const {return myID;}
+ //! Returns the feature in the group by the index (started from zero)
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
+ feature(const std::string& theGroupID, const int theIndex);
+
protected:
//! Returns (creates if needed) the group label
MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Iterator> featuresIterator(
const std::string theGroup) = 0;
+ ///! Returns the id of hte document
MODELAPI_EXPORT virtual const std::string& id() const = 0;
+ //! Returns the feature in the group by the index (started from zero)
+ MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
+ feature(const std::string& theGroupID, const int theIndex) = 0;
+
protected:
/// Only for SWIG wrapping it is here
MODELAPI_EXPORT ModelAPI_Document()