]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added a selection attribute and naming basic mechanisms
authormpv <mikhail.ponikarov@opencascade.com>
Fri, 3 Oct 2014 05:21:58 +0000 (09:21 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Fri, 3 Oct 2014 05:21:58 +0000 (09:21 +0400)
15 files changed:
src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAPI/GeomAPI_Shape.h
src/Model/CMakeLists.txt
src/Model/Model_AttributeReference.h
src/Model/Model_AttributeSelection.cpp [new file with mode: 0644]
src/Model/Model_AttributeSelection.h [new file with mode: 0644]
src/Model/Model_Document.cpp
src/Model/Model_ResultBody.cpp
src/Model/Model_ResultBody.h
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_AttributeSelection.h [new file with mode: 0644]
src/ModelAPI/ModelAPI_Object.h
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_Session.cpp

index e51d30ca6bc6c75ecc79b3563163af554fb76c79..0e5bcb010afce528fa68654ab66f867f918af232 100644 (file)
@@ -13,11 +13,21 @@ GeomAPI_Shape::GeomAPI_Shape()
 {
 }
 
-bool GeomAPI_Shape::isNull()
+bool GeomAPI_Shape::isNull() const
 {
   return MY_SHAPE->IsNull() == Standard_True;
 }
 
+bool GeomAPI_Shape::isEqual(const boost::shared_ptr<GeomAPI_Shape> theShape) const
+{
+  if (isNull())
+    return theShape->isNull();
+  if (theShape->isNull())
+    return false;
+
+  return MY_SHAPE->IsEqual(theShape->impl<TopoDS_Shape>()) == Standard_True;
+}
+
 bool GeomAPI_Shape::isVertex() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
index c2e3507b4cf94dffd0cef99587443da47b136ec4..3aa0987f7e2fbaca01552535628838c75ace50f7 100644 (file)
@@ -6,6 +6,7 @@
 #define GeomAPI_Shape_H_
 
 #include <GeomAPI_Interface.h>
+#include <boost/shared_ptr.hpp>
 
 /**\class GeomAPI_Shape
  * \ingroup DataModel
@@ -17,7 +18,10 @@ class GEOMAPI_EXPORT GeomAPI_Shape : public GeomAPI_Interface
   /// Creation of empty (null) shape
   GeomAPI_Shape();
 
-  bool isNull();
+  bool isNull() const;
+
+  /// Returns whether the shapes are equal
+  virtual bool isEqual(const boost::shared_ptr<GeomAPI_Shape> theShape) const;
 
   /// Returns whether the shape is a vertex
   virtual bool isVertex() const;
@@ -28,4 +32,3 @@ class GEOMAPI_EXPORT GeomAPI_Shape : public GeomAPI_Interface
 };
 
 #endif
-
index 69a821ac3a90d8184c9cee3d21c3490ea9f4fbfe..c9715ebc2fc95683283cd4f0ff189ae166504ecb 100644 (file)
@@ -14,6 +14,7 @@ SET(PROJECT_HEADERS
     Model_AttributeBoolean.h
     Model_AttributeString.h
     Model_AttributeInteger.h
+    Model_AttributeSelection.h
     Model_Events.h
     Model_Update.h
     Model_Validator.h
@@ -36,6 +37,7 @@ SET(PROJECT_SOURCES
     Model_AttributeBoolean.cpp
     Model_AttributeString.cpp
     Model_AttributeInteger.cpp
+    Model_AttributeSelection.cpp
     Model_Events.cpp
     Model_Update.cpp
     Model_Validator.cpp
@@ -60,7 +62,7 @@ SET(PROJECT_LIBRARIES
 
 
 ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
-ADD_LIBRARY(Model MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
 TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES})
 
 INCLUDE_DIRECTORIES(
index d9993f99a6049a57a0beb97ee7a3ca7b5e84c08a..b41891bdb9ac7b451c9b30d25167a9e0ac4c4be1 100644 (file)
@@ -35,6 +35,7 @@ protected:
   MODEL_EXPORT Model_AttributeReference(TDF_Label& theLabel);
 
   friend class Model_Data;
+  friend class Model_AttributeSelection;
 };
 
 #endif
diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp
new file mode 100644 (file)
index 0000000..8c344e2
--- /dev/null
@@ -0,0 +1,60 @@
+// File:        Model_AttributeSelection.h
+// Created:     2 Oct 2014
+// Author:      Mikhail PONIKAROV
+
+#include "Model_AttributeSelection.h"
+#include "Model_Application.h"
+#include "Model_Events.h"
+#include "Model_Data.h"
+#include <ModelAPI_Feature.h>
+
+#include <TNaming_Selector.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TopoDS_Shape.hxx>
+
+using namespace std;
+
+void Model_AttributeSelection::setValue(const ResultBodyPtr& theContext,
+  const boost::shared_ptr<GeomAPI_Shape>& theSubShape)
+{
+  const boost::shared_ptr<GeomAPI_Shape>& anOldShape = value();
+  bool isOldShape = 
+    (theSubShape == anOldShape || (theSubShape && anOldShape && theSubShape->isEqual(anOldShape)));
+  if (isOldShape) return; // shape is the same, so context is also unchanged
+  // update the referenced object if needed
+  bool isOldContext = theContext == myRef.value();
+  if (!isOldContext)
+    myRef.setValue(theContext);
+  
+  // perform the selection
+  TNaming_Selector aSel(myRef.myRef->Label());
+  TopoDS_Shape aNewShape = theSubShape ? theSubShape->impl<TopoDS_Shape>() : TopoDS_Shape();
+  TopoDS_Shape aContext = theContext->shape()->impl<TopoDS_Shape>();
+  aSel.Select(aNewShape, aContext);
+  myIsInitialized = true;
+
+  owner()->data()->sendAttributeUpdated(this);
+}
+
+boost::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
+{
+  boost::shared_ptr<GeomAPI_Shape> aResult;
+  if (myIsInitialized) {
+    Handle(TNaming_NamedShape) aSelection;
+    if (myRef.myRef->Label().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
+      TopoDS_Shape aSelShape = aSelection->Get();
+      aResult->setImpl(&aSelShape);
+    }
+  }
+  return aResult;
+}
+
+Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel)
+  : myRef(theLabel)
+{
+  myIsInitialized = myRef.isInitialized();
+}
+
+ResultBodyPtr Model_AttributeSelection::context() {
+  return boost::dynamic_pointer_cast<ModelAPI_ResultBody>(myRef.value());
+}
diff --git a/src/Model/Model_AttributeSelection.h b/src/Model/Model_AttributeSelection.h
new file mode 100644 (file)
index 0000000..d8e8a54
--- /dev/null
@@ -0,0 +1,38 @@
+// File:        Model_AttributeSelection.h
+// Created:     8 May 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef Model_AttributeSelection_H_
+#define Model_AttributeSelection_H_
+
+#include "Model.h"
+#include "Model_AttributeReference.h"
+#include <ModelAPI_AttributeSelection.h>
+
+/**\class Model_AttributeSelection
+ * \ingroup DataModel
+ * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
+ */
+
+class Model_AttributeSelection : public ModelAPI_AttributeSelection
+{
+  Model_AttributeReference myRef;  ///< The reference functionality reusage
+public:
+  /// Defines the result and its selected sub-shape
+  MODEL_EXPORT virtual void setValue(
+    const ResultBodyPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
+
+  /// Returns the selected subshape
+  MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> value();
+
+  /// Returns the context of the selection (the whole shape owner)
+  MODEL_EXPORT virtual ResultBodyPtr context();
+
+protected:
+  /// Objects are created for features automatically
+  MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel);
+
+  friend class Model_Data;
+};
+
+#endif
index e583a0fb8b1698aa71045bad491113ae302ebbff..59ebd2fb0f1663417cfa9e1b17c945d973215a64 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Comment.hxx>
-#include <TDataStd_UAttribute.hxx>
 #include <TDF_ChildIDIterator.hxx>
 #include <TDataStd_ReferenceArray.hxx>
 #include <TDataStd_HLabelArray1.hxx>
@@ -49,11 +48,10 @@ Model_Document::Model_Document(const std::string theID, const std::string theKin
     : myID(theID), myKind(theKind),
       myDoc(new TDocStd_Document("BinOcaf"))  // binary OCAF format
 {
-  myDoc->SetUndoLimit(UNDO_LIMIT);
+  myDoc->SetUndoLimit(UNDO_LIMIT);  
   myTransactionsAfterSave = 0;
   myNestedNum = -1;
   myExecuteFeatures = true;
-  //myDoc->SetNestedTransactionMode();
   // to have something in the document and avoid empty doc open/save problem
   // in transaction for nesting correct working
   myDoc->NewCommand();
@@ -822,15 +820,11 @@ void Model_Document::storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData
   }
 }
 
-static const Standard_GUID ID_CONSTRUCTION("b59fa408-8ab1-42b8-980c-af5adeebe7e4");
-static const Standard_GUID ID_BODY("c1148e9a-9b17-4e9c-9160-18e918fd0013");
-static const Standard_GUID ID_PART("1b3319b9-3e0a-4298-a1dc-3fb5aaf9be59");
-
 boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
     const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
   TDF_Label aLab = resultLabel(theFeatureData, theIndex);
-  TDataStd_UAttribute::Set(aLab, ID_CONSTRUCTION);
+  TDataStd_Comment::Set(aLab, ModelAPI_ResultConstruction::group().c_str());
   ObjectPtr anOldObject = object(aLab);
   boost::shared_ptr<ModelAPI_ResultConstruction> aResult;
   if (anOldObject) {
@@ -847,7 +841,7 @@ boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
     const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
   TDF_Label aLab = resultLabel(theFeatureData, theIndex);
-  TDataStd_UAttribute::Set(aLab, ID_BODY);
+  TDataStd_Comment::Set(aLab, ModelAPI_ResultBody::group().c_str());
   ObjectPtr anOldObject = object(aLab);
   boost::shared_ptr<ModelAPI_ResultBody> aResult;
   if (anOldObject) {
@@ -864,7 +858,7 @@ boost::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
     const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
   TDF_Label aLab = resultLabel(theFeatureData, theIndex);
-  TDataStd_UAttribute::Set(aLab, ID_PART);
+  TDataStd_Comment::Set(aLab, ModelAPI_ResultPart::group().c_str());
   ObjectPtr anOldObject = object(aLab);
   boost::shared_ptr<ModelAPI_ResultPart> aResult;
   if (anOldObject) {
@@ -916,12 +910,16 @@ void Model_Document::updateResults(FeaturePtr theFeature)
     ResultPtr aNewBody;
     if (aResSize <= aResIndex) {
       TDF_Label anArgLab = aLabIter.Value();
-      if (anArgLab.IsAttribute(ID_BODY)) {
-        aNewBody = createBody(theFeature->data(), aResIndex);
-      } else if (anArgLab.IsAttribute(ID_PART)) {
-        aNewBody = createPart(theFeature->data(), aResIndex);
-      } else if (!anArgLab.IsAttribute(ID_CONSTRUCTION) && anArgLab.FindChild(1).HasAttribute()) {
-        Events_Error::send("Unknown type of result is found in the document");
+      Handle(TDataStd_Comment) aGroup;
+      if (anArgLab.FindAttribute(TDataStd_Comment::GetID(), aGroup)) {
+        if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) {
+          aNewBody = createBody(theFeature->data(), aResIndex);
+        } else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) {
+          aNewBody = createPart(theFeature->data(), aResIndex);
+        } else if (aGroup->Get() != ModelAPI_ResultConstruction::group().c_str()) {
+          Events_Error::send(std::string("Unknown type of result is found in the document:") +
+            TCollection_AsciiString(aGroup->Get()).ToCString());
+        }
       }
       if (aNewBody) {
         theFeature->setResult(aNewBody, aResIndex);
index 967265f837880942854bc7446676a9b3eac60073..0409a4cc2da521870d9940c6660e63c93ddf573c 100644 (file)
@@ -18,7 +18,10 @@ void Model_ResultBody::store(const boost::shared_ptr<GeomAPI_Shape>& theShape)
   boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
   if (aData) {
     TDF_Label& aShapeLab = aData->shapeLab();
-    // TODO: to add the naming mechanism for shape storage in the next iteration
+    // remove the previous history
+    clean();
+    aShapeLab.ForgetAllAttributes();
+    // store the new shape as primitive
     TNaming_Builder aBuilder(aShapeLab);
     if (!theShape)
       return;  // bad shape
@@ -52,3 +55,58 @@ boost::shared_ptr<ModelAPI_Feature> Model_ResultBody::owner()
 {
   return myOwner;
 }
+
+void Model_ResultBody::clean()
+{
+  std::vector<TNaming_Builder*>::iterator aBuilder = myBuilders.begin();
+  for(; aBuilder != myBuilders.end(); aBuilder++)
+    delete *aBuilder;
+}
+
+Model_ResultBody::~Model_ResultBody()
+{
+  clean();
+}
+
+TNaming_Builder* Model_ResultBody::builder(const int theTag)
+{
+  if (myBuilders.size() < (unsigned int)theTag) {
+    myBuilders.insert(myBuilders.end(), theTag - myBuilders.size() + 1, NULL);
+  }
+  if (!myBuilders[theTag]) {
+    boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
+    myBuilders[theTag] = new TNaming_Builder(aData->shapeLab().FindChild(theTag));
+  }
+  return myBuilders[theTag];
+}
+
+void Model_ResultBody::generated(
+  const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
+{
+  TopoDS_Shape aShape = theNewShape->impl<TopoDS_Shape>();
+  builder(theTag)->Generated(aShape);
+}
+
+void Model_ResultBody::generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
+{
+  TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
+  TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
+  builder(theTag)->Generated(anOldShape, aNewShape);
+}
+
+
+void Model_ResultBody::modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
+{
+  TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
+  TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
+  builder(theTag)->Modify(anOldShape, aNewShape);
+}
+
+void Model_ResultBody::deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const int theTag)
+{
+  TopoDS_Shape aShape = theOldShape->impl<TopoDS_Shape>();
+  builder(theTag)->Delete(aShape);
+}
index 08ce28ab0cd88aafb8226f1b7cccc4d0a4903671..c4ffbea314ba5af26a775103d1083496091a0e32 100644 (file)
@@ -7,6 +7,9 @@
 
 #include "Model.h"
 #include <ModelAPI_ResultBody.h>
+#include <vector>
+
+class TNaming_Builder;
 
 /**\class ModelAPI_ResultBody
  * \ingroup DataModel
 class Model_ResultBody : public ModelAPI_ResultBody
 {
   boost::shared_ptr<ModelAPI_Feature> myOwner;  ///< owner of this result
- public:
+  /// builders that tores the naming history: one per label to allow store several shapes to one 
+  /// label; index in vector corresponds to the label tag
+  std::vector<TNaming_Builder*> myBuilders;
+public:
   /// Stores the shape (called by the execution method).
   MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
   /// Returns the shape-result produced by this feature
@@ -27,10 +33,41 @@ class Model_ResultBody : public ModelAPI_ResultBody
   /// Returns the source feature of this result
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
 
- protected:
+  /// Records the subshape newShape which was generated during a topological construction.
+  /// As an example, consider the case of a face generated in construction of a box.
+  MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theNewShape, 
+    const int theTag = 1);
+
+  /// Records the shape newShape which was generated from the shape oldShape during a topological 
+  /// construction. As an example, consider the case of a face generated from an edge in 
+  /// construction of a prism.
+  MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
+
+
+  /// Records the shape newShape which is a modification of the shape oldShape.
+  /// As an example, consider the case of a face split or merged in a Boolean operation.
+  MODEL_EXPORT virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
+
+  /// Records the shape oldShape which was deleted from the current label.
+  /// As an example, consider the case of a face removed by a Boolean operation.
+  MODEL_EXPORT virtual void deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const int theTag = 1);
+
+  /// Removes the stored builders
+  MODEL_EXPORT virtual ~Model_ResultBody();
+
+protected:
   /// Makes a body on the given feature
   Model_ResultBody();
 
+  /// Removes the stored builders
+  void clean();
+
+  /// Returns (creates if necessary) the builder created on the needed tag of sub-label
+  TNaming_Builder* builder(const int theTag);
+
   friend class Model_Document;
 };
 
index 9af7ad47a800884d7d7d2a07fc99bdb01d9a12fa..b0299b5cf1ce57a8e623c938f47d8a8ecccd119b 100644 (file)
@@ -20,6 +20,7 @@ SET(PROJECT_HEADERS
     ModelAPI_AttributeRefList.h
     ModelAPI_AttributeBoolean.h
     ModelAPI_AttributeString.h
+    ModelAPI_AttributeSelection.h
     ModelAPI_Events.h
     ModelAPI_Validator.h
     ModelAPI_FeatureValidator.h
index a5bb73ebd96102e84d687941a16517edbd75e7f2..0eb00bd495b6bb40e5d44883ea780f9050d4a502 100644 (file)
@@ -16,6 +16,7 @@
   #include "ModelAPI_AttributeString.h"
   #include "ModelAPI_AttributeReference.h"
   #include "ModelAPI_AttributeRefAttr.h"
+  #include "ModelAPI_AttributeSelection.h"
   #include "ModelAPI_Validator.h"
   #include "ModelAPI_AttributeRefList.h"
   #include "ModelAPI_AttributeBoolean.h"
@@ -60,6 +61,7 @@
 %shared_ptr(ModelAPI_AttributeRefAttr)
 %shared_ptr(ModelAPI_AttributeRefList)
 %shared_ptr(ModelAPI_AttributeBoolean)
+%shared_ptr(ModelAPI_AttributeSelection)
 %shared_ptr(ModelAPI_Result)
 %shared_ptr(ModelAPI_ResultConstruction)
 %shared_ptr(ModelAPI_ResultBody)
 %include "ModelAPI_AttributeString.h"
 %include "ModelAPI_AttributeReference.h"
 %include "ModelAPI_AttributeRefAttr.h"
-%include "ModelAPI_Validator.h"
+%include "ModelAPI_AttributeBoolean.h"
+%include "ModelAPI_AttributeSelection.h"
 %include "ModelAPI_AttributeRefList.h"
+%include "ModelAPI_Validator.h"
 %include "ModelAPI_Result.h"
 %include "ModelAPI_ResultConstruction.h"
 %include "ModelAPI_ResultBody.h"
 %include "ModelAPI_ResultPart.h"
-%include "ModelAPI_AttributeBoolean.h"
 
 %template(ObjectList) std::list<boost::shared_ptr<ModelAPI_Object> >;
 %template(ResultList) std::list<boost::shared_ptr<ModelAPI_Result> >;
diff --git a/src/ModelAPI/ModelAPI_AttributeSelection.h b/src/ModelAPI/ModelAPI_AttributeSelection.h
new file mode 100644 (file)
index 0000000..9b4970c
--- /dev/null
@@ -0,0 +1,53 @@
+// File:        ModelAPI_AttributeSelection.h
+// Created:     2 Oct 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef ModelAPI_AttributeSelection_H_
+#define ModelAPI_AttributeSelection_H_
+
+#include "ModelAPI_Attribute.h"
+#include <ModelAPI_ResultBody.h>
+
+/**\class ModelAPI_AttributeSelection
+ * \ingroup DataModel
+ * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
+ */
+
+class ModelAPI_AttributeSelection : public ModelAPI_Attribute
+{
+ public:
+  /// Defines the result and its selected sub-shape
+  virtual void setValue(
+    const ResultBodyPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
+
+  /// Returns the selected subshape
+  virtual boost::shared_ptr<GeomAPI_Shape> value() = 0;
+
+  /// Returns the context of the selection (the whole shape owner)
+  virtual ResultBodyPtr context() = 0;
+
+  /// Returns the type of this class of attributes
+  static std::string type()
+  {
+    return "Selection";
+  }
+
+  /// Returns the type of this class of attributes, not static method
+  virtual std::string attributeType()
+  {
+    return type();
+  }
+
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_AttributeSelection()
+  {
+  }
+
+ protected:
+  /// Objects are created for features automatically
+  MODELAPI_EXPORT ModelAPI_AttributeSelection()
+  {
+  }
+};
+
+#endif
index 9241d9b6545310c70a13dd62e1e65d30186314d4..a00d6e3b856214479f23f42921929ba6562dcfd9 100644 (file)
@@ -54,6 +54,8 @@ class ModelAPI_Object
   /// Returns the group identifier of this object
   virtual std::string groupName() = 0;
 
+  /// To use virtuality for destructors
+  virtual ~ModelAPI_Object() {}
  protected:
   /// Sets the data manager of an object (document does)
   virtual void setData(boost::shared_ptr<ModelAPI_Data> theData)
index c2eff7efcfa22b68d049d9b235045d75860b7a4f..bcd45b354aa721d90e17cd7b32121c47f21fb2b9 100644 (file)
 #include <string>
 
 /**\class ModelAPI_ResultBody
- * \ingroup DataModel
- * \brief The body (shape) result of a feature.
- *
- * Provides a shape that may be displayed in the viewer.
- * May provide really huge results, so, working with this kind
- * of result must be optimized.
- */
+* \ingroup DataModel
+* \brief The body (shape) result of a feature.
+*
+* Provides a shape that may be displayed in the viewer.
+* May provide really huge results, so, working with this kind
+* of result must be optimized.
+*/
 class ModelAPI_ResultBody : public ModelAPI_Result
 {
- public:
+public:
   /// Returns the group identifier of this result
   virtual std::string groupName()
   {
@@ -44,7 +44,28 @@ class ModelAPI_ResultBody : public ModelAPI_Result
   {
   }
 
- protected:
+  /// Records the subshape newShape which was generated during a topological construction.
+  /// As an example, consider the case of a face generated in construction of a box.
+  virtual void generated(
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
+
+  /// Records the shape newShape which was generated from the shape oldShape during a topological 
+  /// construction. As an example, consider the case of a face generated from an edge in 
+  /// construction of a prism.
+  virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
+
+  /// Records the shape newShape which is a modification of the shape oldShape.
+  /// As an example, consider the case of a face split or merged in a Boolean operation.
+  virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
+
+  /// Records the shape oldShape which was deleted from the current label.
+  /// As an example, consider the case of a face removed by a Boolean operation.
+  virtual void deleted(
+    const boost::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
+
+protected:
   /// Use plugin manager for features creation: this method is 
   /// defined here only for SWIG-wrapping
   ModelAPI_ResultBody()
index 565dd13d379835aca3504e8951174a5a7af53058..137f8f8a54abce115a3e9970efb20d32bc507a25 100644 (file)
@@ -22,6 +22,7 @@
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Validator.h>