From: mpv Date: Tue, 7 Feb 2017 12:45:17 +0000 (+0300) Subject: Added ability to debug features and results effectively: name is in the field of... X-Git-Tag: V_2.7.0~284^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=03fd07a239ae06732cc3c6b2ee18edc6f2560daf;p=modules%2Fshaper.git Added ability to debug features and results effectively: name is in the field of the Object class. --- diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index b008e76c4..2d28604bb 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -94,8 +94,12 @@ void Model_Data::setLabel(TDF_Label theLab) std::string Model_Data::name() { Handle(TDataStd_Name) aName; - if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) + if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) { +#ifdef DEBUG_NAMES + myObject->myName = TCollection_AsciiString(aName->Get()).ToCString(); +#endif return std::string(TCollection_AsciiString(aName->Get()).ToCString()); + } return ""; // not defined } @@ -118,6 +122,9 @@ void Model_Data::setName(const std::string& theName) std::dynamic_pointer_cast(myObject->document())-> changeNamingName(anOldName, theName); } +#ifdef DEBUG_NAMES + myObject->myName = theName; +#endif } AttributePtr Model_Data::addAttribute(const std::string& theID, const std::string theAttrType) diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 0d9c067d6..48eabd21e 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -16,6 +16,9 @@ class ModelAPI_Data; class ModelAPI_Document; +// sometimes it is usefull for debug to see name of each object (bad for memory and performance) +//#define DEBUG_NAMES + /**\class ModelAPI_Object * \ingroup DataModel * \brief Represents any object in the data model and in the object browser. @@ -30,6 +33,9 @@ class ModelAPI_Object: public ModelAPI_Entity std::shared_ptr myData; ///< manager of the data model of a feature std::shared_ptr myDoc; ///< document this object belongs to public: +#ifdef DEBUG_NAMES + std::string myName; // name of this object +#endif /// By default object is displayed in the object browser. MODELAPI_EXPORT virtual bool isInHistory();