]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Adaptation to new Model architecture
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 14 Jul 2014 06:49:40 +0000 (10:49 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 14 Jul 2014 06:49:40 +0000 (10:49 +0400)
32 files changed:
src/Model/Model_Document.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI_Result.h
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_ResultConstruction.h
src/ModelAPI/ModelAPI_ResultParameters.h [new file with mode: 0644]
src/ModelAPI/ModelAPI_ResultPart.h
src/ModuleBase/ModuleBase_Definitions.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/ModuleBase/ModuleBase_Tools.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_Tools.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_ViewerPrs.h
src/ModuleBase/ModuleBase_WidgetFeature.cpp
src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_DataTreeModel.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_PartDataModel.cpp
src/XGUI/XGUI_PartDataModel.h
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Selection.h
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_Tools.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 241ac68c4cde407f2a26ee98d97f3259ec125d8b..fb8e67a06bc85c8ad3e1900531947123a0f9b586 100644 (file)
@@ -483,7 +483,7 @@ ObjectPtr Model_Document::object(const string& theGroupID, const int theIndex)
           boost::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter)->results();
         list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
         for(; aRIter != aResults.cend(); aRIter++) {
-          if ((*aRIter)->isInHistory() && (*aRIter)->group() == theGroupID) {
+          if ((*aRIter)->isInHistory() && (*aRIter)->groupName() == theGroupID) {
             if (anIndex == theIndex)
               return *aRIter;
             anIndex++;
@@ -514,7 +514,7 @@ int Model_Document::size(const string& theGroupID)
           boost::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter)->results();
         list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
         for(; aRIter != aResults.cend(); aRIter++) {
-          if ((*aRIter)->isInHistory() && (*aRIter)->group() == theGroupID) {
+          if ((*aRIter)->isInHistory() && (*aRIter)->groupName() == theGroupID) {
             aResult++;
           }
         }
index 80ec6cd74fb12a4f5a3b4a98c4cd11f49a8e9da3..78d9901e685a9be732fa4c6cc6fafcb288a00361 100644 (file)
@@ -24,6 +24,7 @@ SET(PROJECT_HEADERS
     ModelAPI_ResultBody.h
     ModelAPI_ResultConstruction.h
     ModelAPI_ResultPart.h
+       ModelAPI_ResultParameters.h
 )
 
 SET(PROJECT_SOURCES
index b84cd0b20864be02618a32143fa4a9c0e7e011dd..01fa9dde96fedb09e6bce02e314f8950bd65280e 100644 (file)
@@ -22,7 +22,7 @@ public:
   //virtual boost::shared_ptr<ModelAPI_Feature> owner() = 0;
 
   /// Returns the group identifier of this result
-  virtual std::string group() = 0;
+  virtual std::string groupName() = 0;
 };
 
 //! Pointer on feature object
index 336e6ccd412bab754deb7838219a99af1f25a268..09ce4d6b0f6225b78242ae107ce7632b47079e5f 100644 (file)
@@ -20,7 +20,11 @@ class ModelAPI_ResultBody : public ModelAPI_Result
 {
 public:
   /// Returns the group identifier of this result
-  virtual std::string group()
+  virtual std::string groupName()
+    { return group(); }
+
+  /// Returns the group identifier of this result
+  static std::string group()
   {static std::string MY_GROUP = "Bodies"; return MY_GROUP;}
 
   /// Stores the shape (called by the execution method).
index 3c12f482c42dbd2ba5cbfba43dc9d2f690158d1f..4207ff5e3c42516d0a16dd60c96b0e9287c14cde 100644 (file)
@@ -19,9 +19,14 @@ class ModelAPI_ResultConstruction : public ModelAPI_Result
 {
 public:
   /// Returns the group identifier of this result
-  virtual std::string group()
+  virtual std::string groupName()
+    { return group(); }
+
+  /// Returns the group identifier of this result
+  static std::string group()
     {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
 
+
   /// Returns the shape-result produced by this feature
   virtual boost::shared_ptr<GeomAPI_Shape>& shape() = 0;
 
diff --git a/src/ModelAPI/ModelAPI_ResultParameters.h b/src/ModelAPI/ModelAPI_ResultParameters.h
new file mode 100644 (file)
index 0000000..ee4c143
--- /dev/null
@@ -0,0 +1,32 @@
+// File:        ModelAPI_ResultParameters.h
+// Created:     07 Jul 2014
+// Author:      Vitaly SMETANNIKOV
+
+#ifndef ModelAPI_ResultParameters_HeaderFile
+#define ModelAPI_ResultParameters_HeaderFile
+
+#include "ModelAPI_Result.h"
+
+/**\class ModelAPI_ResultParameters
+ * \ingroup DataModel
+ * \brief The construction element result of a feature.
+ *
+ * Provides a shape that may be displayed in the viewer.
+ * Intermediate, light result that in many cases produces a result on the fly.
+ */
+class ModelAPI_ResultParameters : public ModelAPI_Result
+{
+public:
+  /// Returns the group identifier of this result
+  virtual std::string groupName()
+    { return group(); }
+
+  /// Returns the group identifier of this result
+  static std::string group()
+    {static std::string MY_GROUP = "Parameters"; return MY_GROUP;}
+};
+
+//! Pointer on feature object
+typedef boost::shared_ptr<ModelAPI_ResultParameters> ResultParametersPtr;
+
+#endif
index 60328906c7c8f225093a008f879708e00ecb3990..c922b1ef429bbf9d4967a67638667a6311754de5 100644 (file)
@@ -18,7 +18,11 @@ class ModelAPI_ResultPart : public ModelAPI_Result
 {
 public:
   /// Returns the group identifier of this result
-  virtual std::string group()
+  virtual std::string groupName()
+    { return group(); }
+
+  /// Returns the group identifier of this result
+  static std::string group()
     {static std::string MY_GROUP = "Parts"; return MY_GROUP;}
 
   /// Returns the part-document of this result
index f32657a9edf6605a5141f0cabed0d5e7f996c22e..9e4bfbc025c236ac5ffe9468b8e96e983f6372da 100644 (file)
@@ -4,11 +4,13 @@
 
 #include <QList>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 
 typedef QList<int> QIntList;       //!< list of int values
 typedef QList<short> QShortList;     //!< list of short int values
 typedef QList<double> QDoubleList;    //!< list of double values
 typedef QList<FeaturePtr> QFeatureList; //!< List of features
+typedef QList<ResultPtr> QResultList; //!< List of results
 
 
 #endif
\ No newline at end of file
index 4d6e920b0a504c442fd6a5ffe99f6267c0a93794..134274398bd876d9c10fbdda9433c539c2b21004 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "ModuleBase.h"
 
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Object.h>
 
 #include <AIS_InteractiveContext.hxx>
 
@@ -30,7 +30,7 @@ public:
   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
 
   //! Returns list of currently selected data objects
-  virtual QList<FeaturePtr> selectedFeatures() const = 0; 
+  virtual QList<ObjectPtr> selectedObjects() const = 0; 
 
   //! Returns instance of loaded module
   virtual ModuleBase_IModule* module() const = 0;
diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp
new file mode 100644 (file)
index 0000000..3f0069e
--- /dev/null
@@ -0,0 +1,26 @@
+// File:        ModuleBase_Tools.cpp
+// Created:     11 July 2014
+// Author:      Vitaly Smetannikov
+
+#include "ModuleBase_Tools.h"
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultConstruction.h>
+
+namespace ModuleBase_Tools
+{
+
+//******************************************************************
+boost::shared_ptr<GeomAPI_Shape> shape(ResultPtr theResult)
+{
+  ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
+  if (aBody)
+    return aBody->shape();
+
+  ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theResult);
+  if (aConstruct)
+    return aConstruct->shape();
+
+  return boost::shared_ptr<GeomAPI_Shape>();
+}
+
+}
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h
new file mode 100644 (file)
index 0000000..f326a9e
--- /dev/null
@@ -0,0 +1,25 @@
+// File:        ModuleBase_Tools.h
+// Created:     11 July 2014
+// Author:      Vitaly Smetannikov
+
+
+#ifndef ModuleBase_Tools_H
+#define ModuleBase_Tools_H
+
+#include "ModuleBase.h"
+
+#include <ModelAPI_Result.h>
+
+class GeomAPI_Shape;
+
+namespace ModuleBase_Tools 
+{
+
+  /**
+  * Returns returns a shape if the result has a shape method. Otherwise returns NULL pointer
+  */
+  MODULEBASE_EXPORT boost::shared_ptr<GeomAPI_Shape> shape(ResultPtr theResult);
+
+};
+
+#endif
\ No newline at end of file
index b595ac156cd29cd94212d85d12bc031c5ace1db1..274ec2c2aed7e0d78fc0a785cb2b14f5620feb27 100644 (file)
@@ -11,7 +11,7 @@
 #include <TopoDS_Shape.hxx>
 #include <SelectMgr_EntityOwner.hxx>
 
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 
 /**\class ModuleBase_ViewerPrs
  * \ingroup Module base
@@ -27,21 +27,21 @@ public:
   /// \param theFeature a model feature
   /// \param theShape a viewer shape
   /// \param theOwner a selection owner
-  ModuleBase_ViewerPrs(FeaturePtr theFeature,
+  ModuleBase_ViewerPrs(ResultPtr theResult,
                  const TopoDS_Shape& theShape,
                  Handle_SelectMgr_EntityOwner theOwner)
-  : myFeature(theFeature), myShape(theShape), myOwner(theOwner) {}
+  : myResult(theResult), myShape(theShape), myOwner(theOwner) {}
   
   /// Destructor
   virtual ~ModuleBase_ViewerPrs() {}
 
   /// Sets the feature.
   /// \param theFeature a feature instance
-  void setFeature(FeaturePtr theFeature) { myFeature = theFeature; }
+  void setFeature(ResultPtr theResult) { myResult = theResult; }
 
   /// Returns the feature.
   /// \return a feature instance
-  FeaturePtr feature() const { return myFeature; }
+  ResultPtr result() const { return myResult; }
 
   /// Returns the presentation owner
   /// \param the owner
@@ -61,14 +61,14 @@ public:
 
   bool operator==(const ModuleBase_ViewerPrs& thePrs)
   {
-    bool aFeature = (myFeature.get() == thePrs.feature().get());
+    bool aResult = (myResult.get() == thePrs.result().get());
     bool aOwner = (myOwner.Access() == thePrs.owner().Access());
     bool aShape = myShape.IsEqual(thePrs.shape());
-    return aFeature && aOwner && aShape;
+    return aResult && aOwner && aShape;
   }
 
 private:
-  FeaturePtr myFeature; /// the feature
+  ResultPtr myResult; /// the feature
   Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
   TopoDS_Shape myShape; /// the shape
 };
index 7e43f4f5506b512cb5ff690b1413b9946885a61a..bfcc1956edf8d9cae610530582213c8777e21658 100644 (file)
@@ -74,7 +74,7 @@ bool ModuleBase_WidgetFeature::setFeature(const FeaturePtr& theFeature)
     return false;
 
   myFeature = theFeature;
-  myEditor->setText(theFeature ? theFeature->data()->getName().c_str() : "");
+  myEditor->setText(theFeature ? theFeature->data()->name().c_str() : "");
   emit valuesChanged();
   return true;
 }
@@ -100,7 +100,7 @@ bool ModuleBase_WidgetFeature::restoreValue(FeaturePtr theFeature)
           boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
   myFeature = aRef->feature();
-  myEditor->setText(myFeature ? myFeature->data()->getName().c_str() : "");
+  myEditor->setText(myFeature ? myFeature->data()->name().c_str() : "");
   return true;
 }
 
index 6fd65bf96e58d58f63e7795d58013913d6ee14e4..b3165fbf060f441fd3b9903f06b48371f1148c36 100644 (file)
@@ -102,7 +102,7 @@ bool ModuleBase_WidgetFeatureOrAttribute::restoreValue(FeaturePtr theFeature)
 
   std::string aText = "";
   if (aFeature)
-    aText = aFeature->data()->getName().c_str();
+    aText = aFeature->data()->name().c_str();
   else if (myAttribute)
     aText = myAttribute->attributeType().c_str();
 
index 08e9eb0201a51080d472b68c4cd629116d983090..36f6af51fff4cbbfc62fa526fe4b0eb211bf0d9e 100644 (file)
@@ -5,12 +5,14 @@
 
 #include "ModuleBase_WidgetSelector.h"
 #include "ModuleBase_IWorkshop.h"
+#include "ModuleBase_Tools.h"
 
 #include <Events_Loop.h>
 #include <Model_Events.h>
 
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
+#include <ModelAPI_Result.h>
 #include <ModelAPI_AttributeReference.h>
 #include <Config_WidgetAPI.h>
 
@@ -104,8 +106,8 @@ bool ModuleBase_WidgetSelector::storeValue(FeaturePtr theFeature) const
     boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(attributeID()));
 
   FeaturePtr aFeature = aRef->value();
-  if (!(aFeature && aFeature->isSame(mySelectedFeature))) {
-    aRef->setValue(mySelectedFeature);
+  if (!(aFeature && aFeature->isSame(mySelectedObject))) {
+    aRef->setValue(mySelectedObject);
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   }
   return true;
@@ -118,7 +120,7 @@ bool ModuleBase_WidgetSelector::restoreValue(FeaturePtr theFeature)
   boost::shared_ptr<ModelAPI_AttributeReference> aRef = aData->reference(attributeID());
 
   bool isBlocked = this->blockSignals(true);
-  mySelectedFeature = aRef->value();
+  mySelectedObject = aRef->value();
   updateSelectionName(); 
 
   this->blockSignals(isBlocked);
@@ -138,19 +140,19 @@ QList<QWidget*> ModuleBase_WidgetSelector::getControls() const
 //********************************************************************
 void ModuleBase_WidgetSelector::onSelectionChanged()
 {
-  QList<FeaturePtr> aFeatures = myWorkshop->selectedFeatures();
-  if (aFeatures.size() > 0) {
-    FeaturePtr aFeature = aFeatures.first();
-    if ((!mySelectedFeature) && (!aFeature))
+  QList<ObjectPtr> aObjects = myWorkshop->selectedObjects();
+  if (aObjects.size() > 0) {
+    ObjectPtr aObject = aObjects.first();
+    if ((!mySelectedObject) && (!aObject))
       return;
-    if (mySelectedFeature && aFeature && mySelectedFeature->isSame(aFeature))
+    if (mySelectedObject && aObject && mySelectedObject->isSame(aObject))
       return;
 
     // Check that the selection corresponds to selection type
-    if (!isAccepted(aFeature)) return;
+    if (!isAccepted(aObject)) return;
 
-    mySelectedFeature = aFeature;
-    if (mySelectedFeature) {
+    mySelectedObject = aObject;
+    if (mySelectedObject) {
       updateSelectionName();
       activateSelection(false);
       raisePanel();
@@ -162,9 +164,10 @@ void ModuleBase_WidgetSelector::onSelectionChanged()
 }
 
 //********************************************************************
-bool ModuleBase_WidgetSelector::isAccepted(const FeaturePtr theFeature) const
+bool ModuleBase_WidgetSelector::isAccepted(const ObjectPtr theResult) const
 {
-  boost::shared_ptr<GeomAPI_Shape> aShapePtr = theFeature->data()->shape();
+  ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theResult);
+  boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
   if (!aShapePtr) return false;
   TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
   if (aShape.IsNull()) return false;
@@ -188,12 +191,8 @@ bool ModuleBase_WidgetSelector::isAccepted(const FeaturePtr theFeature) const
 //********************************************************************
 void ModuleBase_WidgetSelector::updateSelectionName()
 {
-  if (mySelectedFeature) {
-    std::string aName;
-    if (mySelectedFeature->data())
-      aName = mySelectedFeature->data()->getName();
-    else 
-      aName = boost::dynamic_pointer_cast<ModelAPI_Object>(mySelectedFeature)->getName();
+  if (mySelectedObject) {
+    std::string aName = mySelectedObject->data()->name();
  
     myTextLine->setText(QString::fromStdString(aName));
   } else 
index 0d411f3b742b4f747bcb105120827446cf735cb4..61fba00492e7a1ff96af8f7fb0182296bbb57b2e 100644 (file)
@@ -8,7 +8,7 @@
 #include "ModuleBase.h"
 #include "ModuleBase_ModelWidget.h"
 
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Object.h>
 
 #include <TopAbs_ShapeEnum.hxx>
 
@@ -49,7 +49,7 @@ public:
   void setActivationOnStart(bool toActivate) { myActivateOnStart = toActivate; }
   bool activateOnStart() const { return myActivateOnStart; }
 
-  FeaturePtr selectedFeature() const { return mySelectedFeature; }
+  ObjectPtr selectedFeature() const { return mySelectedObject; }
 
 public slots:
 
@@ -66,7 +66,7 @@ private:
   void enableOthersControls(bool toEnable) const;
   void updateSelectionName();
   void raisePanel() const;
-  bool isAccepted(const FeaturePtr theFeature) const;
+  bool isAccepted(const ObjectPtr theFeature) const;
 
   static TopAbs_ShapeEnum shapeType(const QString& theType);
 
@@ -79,7 +79,7 @@ private:
 
   bool myActivateOnStart;
 
-  FeaturePtr mySelectedFeature;
+  ObjectPtr mySelectedObject;
   QStringList myShapeTypes;
 };
 
index 8ecb179b3d1b77a46503126208ead9d91469b882..ee93708255b494dff5e60eb125f0ceabf40ad29a 100644 (file)
@@ -99,7 +99,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
 {
   QMenu* aMenu = new QMenu();
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
-  QFeatureList aFeatures = aSelMgr->selection()->selectedFeatures();
+  QList<ObjectPtr> aFeatures = aSelMgr->selection()->selectedObjects();
   if (aFeatures.size() == 1) {
     PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
     FeaturePtr aFeature = aFeatures.first();
@@ -153,13 +153,14 @@ QMenu* XGUI_ContextMenuMgr::viewerMenu() const
 void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
 {
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
-  QFeatureList aFeatures = aSelMgr->selection()->selectedFeatures();
-  if (aFeatures.size() > 0) {
-    if (aFeatures.size() == 1)
+  QList<ObjectPtr> aObjects = aSelMgr->selection()->selectedObjects();
+  if (aObjects.size() > 0) {
+    if (aObjects.size() == 1)
       theMenu->addAction(action("EDIT_CMD"));
     bool isVisible = false;
-    foreach(FeaturePtr aFeature, aFeatures) {
-      if (myWorkshop->displayer()->isVisible(aFeature)) {
+    foreach(ObjectPtr aObject, aObjects) {
+      ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
+      if (aRes && myWorkshop->displayer()->isVisible(aRes)) {
         isVisible = true;
         break;
       }
index 5b9f5a8394f4c2ec8c6d8fc74cab6db593ba8252..1e187ed71941d435e15ac3706e8c6e73b2ac384a 100644 (file)
@@ -23,14 +23,14 @@ public:
 
   //! Returns Feature object by the given Model index.
   //! Returns 0 if the given index is not index of a feature
-  virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0;
+  virtual ObjectPtr feature(const QModelIndex& theIndex) const = 0;
 
   //! Returns QModelIndex which corresponds to the given feature
   //! If the feature is not found then index is not valid
-  virtual QModelIndex featureIndex(const FeaturePtr& theFeature) const = 0;
+  virtual QModelIndex featureIndex(const ObjectPtr& theFeature) const = 0;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const FeaturePtr& theFeature) const = 0;
+  virtual QModelIndex findParent(const ObjectPtr& theFeature) const = 0;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
@@ -60,7 +60,7 @@ public:
   virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
 
   //! Return a Part object
-  virtual FeaturePtr part() const = 0;
+  virtual ObjectPtr part() const = 0;
 
 protected:
   //! Id of the current part object in the document
index 83f70bf14547149dfb23246cc61dce5aef25c2f1..ac6b3af89c6029d0d1712861addda58985ca1b57 100644 (file)
@@ -6,7 +6,7 @@
 #include "XGUI_Viewer.h"
 #include "XGUI_Workshop.h"
 #include "XGUI_ViewerProxy.h"
-#include "XGUI_Tools.h"
+#include "ModuleBase_Tools.h"
 
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Data.h>
@@ -35,33 +35,31 @@ XGUI_Displayer::~XGUI_Displayer()
 {
 }
 
-bool XGUI_Displayer::isVisible(FeaturePtr theFeature)
+bool XGUI_Displayer::isVisible(ResultPtr theResult)
 {
-  FeaturePtr aFeature = XGUI_Tools::realFeature(theFeature);
-  return myFeature2AISObjectMap.find(aFeature) != myFeature2AISObjectMap.end();
+  return myResult2AISObjectMap.find(theResult) != myResult2AISObjectMap.end();
 }
 
-bool XGUI_Displayer::display(FeaturePtr theFeature, bool isUpdateViewer)
+bool XGUI_Displayer::display(ResultPtr theResult, bool isUpdateViewer)
 {
-  FeaturePtr aFeature = XGUI_Tools::realFeature(theFeature);
-  boost::shared_ptr<GeomAPI_Shape> aShapePtr = aFeature->data()->shape();
+  boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(theResult);
 
   if (aShapePtr) {
     boost::shared_ptr<GeomAPI_AISObject> anAIS(new GeomAPI_AISObject());
     anAIS->createShape(aShapePtr);
-    return display(aFeature, anAIS, isUpdateViewer);
+    return display(theResult, anAIS, isUpdateViewer);
   }
   return false;
 }
 
-bool XGUI_Displayer::display(FeaturePtr theFeature,
+bool XGUI_Displayer::display(ResultPtr theResult,
                              boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
 
   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
   if (!anAISIO.IsNull()) {
-    myFeature2AISObjectMap[theFeature] = theAIS;
+    myResult2AISObjectMap[theResult] = theAIS;
     aContext->Display(anAISIO, isUpdateViewer);
     return true;
   }
@@ -70,16 +68,14 @@ bool XGUI_Displayer::display(FeaturePtr theFeature,
 
 
 
-void XGUI_Displayer::erase(FeaturePtr theFeature,
+void XGUI_Displayer::erase(ResultPtr theResult,
                            const bool isUpdateViewer)
 {
-  FeaturePtr aFeature = XGUI_Tools::realFeature(theFeature);
-
-  if (myFeature2AISObjectMap.find(aFeature) == myFeature2AISObjectMap.end())
+  if (myResult2AISObjectMap.find(theResult) == myResult2AISObjectMap.end())
     return;
 
   Handle(AIS_InteractiveContext) aContext = AISContext();
-  boost::shared_ptr<GeomAPI_AISObject> anObject = myFeature2AISObjectMap[aFeature];
+  boost::shared_ptr<GeomAPI_AISObject> anObject = myResult2AISObjectMap[theResult];
   if (anObject)  {
     Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
     if (!anAIS.IsNull()) {
@@ -87,11 +83,11 @@ void XGUI_Displayer::erase(FeaturePtr theFeature,
       
     }
   }
-  myFeature2AISObjectMap.erase(aFeature);
+  myResult2AISObjectMap.erase(theResult);
 }
 
 
-bool XGUI_Displayer::redisplay(FeaturePtr theFeature,
+bool XGUI_Displayer::redisplay(ResultPtr theFeature,
                                boost::shared_ptr<GeomAPI_AISObject> theAIS,
                                const bool isUpdateViewer)
 {
@@ -108,12 +104,12 @@ bool XGUI_Displayer::redisplay(FeaturePtr theFeature,
     //aContext->SetPixelTolerance(MOUSE_SENSITIVITY_IN_PIXEL);
   }
   // display or redisplay presentation
-  boost::shared_ptr<GeomAPI_AISObject> anObj = myFeature2AISObjectMap[theFeature];
+  boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theFeature];
   if (isVisible(theFeature) && anObj && !anObj->empty()) {
       aContext->RecomputeSelectionOnly(anAIS);
   }
   else {
-    myFeature2AISObjectMap[theFeature] = theAIS;
+    myResult2AISObjectMap[theFeature] = theAIS;
     aContext->Display(anAIS, false);
     isCreated = true;
   }
@@ -123,15 +119,14 @@ bool XGUI_Displayer::redisplay(FeaturePtr theFeature,
   return isCreated;
 }
 
-bool XGUI_Displayer::redisplay(FeaturePtr theFeature, bool isUpdateViewer)
+bool XGUI_Displayer::redisplay(ResultPtr theResult, bool isUpdateViewer)
 {
-  FeaturePtr aFeature = XGUI_Tools::realFeature(theFeature);
-  if (!isVisible(aFeature))
+  if (!isVisible(theResult))
     return false;
 
-  boost::shared_ptr<GeomAPI_Shape> aShapePtr = aFeature->data()->shape();
+  boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(theResult);
   if (aShapePtr) {
-    boost::shared_ptr<GeomAPI_AISObject> aAISObj = getAISObject(aFeature);
+    boost::shared_ptr<GeomAPI_AISObject> aAISObj = getAISObject(theResult);
     Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj->impl<Handle(AIS_InteractiveObject)>());
     if (!aAISShape.IsNull()) {
       aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
@@ -142,7 +137,7 @@ bool XGUI_Displayer::redisplay(FeaturePtr theFeature, bool isUpdateViewer)
   return false;
 }
 
-void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature,
+void XGUI_Displayer::activateInLocalContext(ResultPtr theResult,
                                          const std::list<int>& theModes, const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
@@ -153,9 +148,9 @@ void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature,
   }
   // display or redisplay presentation
   Handle(AIS_InteractiveObject) anAIS;
-  if (isVisible(theFeature))
+  if (isVisible(theResult))
   {
-    boost::shared_ptr<GeomAPI_AISObject> anObj = myFeature2AISObjectMap[theFeature];
+    boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theResult];
     if (anObj)
       anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
   }
@@ -176,18 +171,18 @@ void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature,
     updateViewer();
 }
 
-void XGUI_Displayer::stopSelection(const QFeatureList& theFeatures, const bool isStop,
+void XGUI_Displayer::stopSelection(const QResultList& theResults, const bool isStop,
                                    const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
 
   Handle(AIS_Shape) anAIS;
-  QFeatureList::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
-  FeaturePtr aFeature;
+  QResultList::const_iterator anIt = theResults.begin(), aLast = theResults.end();
+  ResultPtr aFeature;
   for (; anIt != aLast; anIt++) {
     aFeature = *anIt;
     if (isVisible(aFeature))
-      anAIS = Handle(AIS_Shape)::DownCast(myFeature2AISObjectMap[aFeature]->impl<Handle(AIS_InteractiveObject)>());
+      anAIS = Handle(AIS_Shape)::DownCast(myResult2AISObjectMap[aFeature]->impl<Handle(AIS_InteractiveObject)>());
     if (anAIS.IsNull())
       continue;
 
@@ -206,7 +201,7 @@ void XGUI_Displayer::stopSelection(const QFeatureList& theFeatures, const bool i
     updateViewer();
 }
 
-void XGUI_Displayer::setSelected(const QFeatureList& theFeatures, const bool isUpdateViewer)
+void XGUI_Displayer::setSelected(const QResultList& theResults, const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
   // we need to unhighligth objects manually in the current local context
@@ -216,12 +211,11 @@ void XGUI_Displayer::setSelected(const QFeatureList& theFeatures, const bool isU
     aLocalContext->UnhilightLastDetected(myWorkshop->viewer()->activeView());
 
   aContext->ClearSelected();
-  foreach(FeaturePtr aFeature, theFeatures) {
-    FeaturePtr aRFeature = XGUI_Tools::realFeature(aFeature);
-    if (myFeature2AISObjectMap.find(aRFeature) == myFeature2AISObjectMap.end()) 
+  foreach(ResultPtr aResult, theResults) {
+    if (myResult2AISObjectMap.find(aResult) == myResult2AISObjectMap.end()) 
       return;
 
-    boost::shared_ptr<GeomAPI_AISObject> anObj = myFeature2AISObjectMap[aRFeature];
+    boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[aResult];
     if (anObj)
     {
       Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
@@ -249,21 +243,21 @@ void XGUI_Displayer::setSelected(const QFeatureList& theFeatures, const bool isU
     Handle(AIS_InteractiveObject) anIO = anIter.Value();
     ic->Erase(anIO, false);
   }
-  myFeature2AISObjectMap.clear();
+  myResult2AISObjectMap.clear();
   if (isUpdateViewer)
     updateViewer();
 }*/
 
-void XGUI_Displayer::eraseDeletedFeatures(const bool isUpdateViewer)
+void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
 
-  FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(),
-                                  aFLast = myFeature2AISObjectMap.end();
-  std::list<FeaturePtr> aRemoved;
+  ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(),
+                                 aFLast = myResult2AISObjectMap.end();
+  std::list<ResultPtr> aRemoved;
   for (; aFIt != aFLast; aFIt++)
   {
-    FeaturePtr aFeature = (*aFIt).first;
+    ResultPtr aFeature = (*aFIt).first;
     if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) {
       boost::shared_ptr<GeomAPI_AISObject> anObj = (*aFIt).second;
       if (!anObj) continue;
@@ -274,10 +268,10 @@ void XGUI_Displayer::eraseDeletedFeatures(const bool isUpdateViewer)
       }
     }
   }
-  std::list<FeaturePtr>::const_iterator anIt = aRemoved.begin(),
+  std::list<ResultPtr>::const_iterator anIt = aRemoved.begin(),
                                                                  aLast = aRemoved.end();
   for (; anIt != aLast; anIt++) {
-    myFeature2AISObjectMap.erase(myFeature2AISObjectMap.find(*anIt));
+    myResult2AISObjectMap.erase(myResult2AISObjectMap.find(*anIt));
   }
 
   if (isUpdateViewer)
@@ -290,19 +284,19 @@ void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
 }
 
 boost::shared_ptr<GeomAPI_AISObject> XGUI_Displayer::getAISObject(
-                                              FeaturePtr theFeature) const
+                                              ResultPtr theFeature) const
 {
   boost::shared_ptr<GeomAPI_AISObject> anIO;
-  if (myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end())
-    anIO = (myFeature2AISObjectMap.find(theFeature))->second;
+  if (myResult2AISObjectMap.find(theFeature) != myResult2AISObjectMap.end())
+    anIO = (myResult2AISObjectMap.find(theFeature))->second;
   return anIO;
 }
 
-FeaturePtr XGUI_Displayer::getFeature(Handle(AIS_InteractiveObject) theIO) const
+ResultPtr XGUI_Displayer::getResult(Handle(AIS_InteractiveObject) theIO) const
 {
-  FeaturePtr aFeature;
-  FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(),
-                                  aFLast = myFeature2AISObjectMap.end();
+  ResultPtr aFeature;
+  ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(),
+                                 aFLast = myResult2AISObjectMap.end();
   for (; aFIt != aFLast && !aFeature; aFIt++) {
     boost::shared_ptr<GeomAPI_AISObject> anObj = (*aFIt).second;
     if (!anObj) continue;
index 2c730c9e8b01ee60ef8b9a119512dd912bcc69e0..e047af515d0da44e9ec35017b378781364b47018 100644 (file)
@@ -17,7 +17,7 @@
 #include <AIS_InteractiveContext.hxx>
 #include <NCollection_List.hxx>
 
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 
 #include <ModuleBase_Definitions.h>
 #include <ModuleBase_ViewerPrs.h>
@@ -49,27 +49,27 @@ public:
 
   /// Returns the feature visibility state.
   /// \param theFeature a feature instance
-  bool isVisible(FeaturePtr theFeature);
+  bool isVisible(ResultPtr theResult);
 
   /// Display the feature. Obtain the visualized object from the feature.
   /// \param theFeature a feature instance
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
   /// Returns true if the Feature succesfully displayed
-  bool display(FeaturePtr theFeature, bool isUpdateViewer = true);
+  bool display(ResultPtr theFeature, bool isUpdateViewer = true);
 
   /// Display the feature and a shape. This shape would be associated to the given feature
   /// \param theFeature a feature instance
   /// \param theAIS AIS presentation
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
   /// Returns true if the Feature succesfully displayed
-  bool display(FeaturePtr theFeature, boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdateViewer = true);
+  bool display(ResultPtr theResult, boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdateViewer = true);
   
   /// Display the shape and activate selection of sub-shapes
   /// \param theFeature a feature instance
   /// \param theAIS an AIS object
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
   /// \returns true if the presentation is created
-  bool redisplay(FeaturePtr theFeature,
+  bool redisplay(ResultPtr theFeature,
                  boost::shared_ptr<GeomAPI_AISObject> theAIS, 
                  const bool isUpdateViewer = true);
 
@@ -77,7 +77,7 @@ public:
   * \param theFeature a feature instance
   * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
   */
-  bool redisplay(FeaturePtr theFeature, bool isUpdateViewer = true);
+  bool redisplay(ResultPtr theFeature, bool isUpdateViewer = true);
 
   /// Redisplay the shape and activate selection of sub-shapes
   /// \param theFeature a feature instance
@@ -89,14 +89,14 @@ public:
   /// \param theShape a shape
   /// \param theMode a list of local selection modes
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  void activateInLocalContext(FeaturePtr theFeature,
+  void activateInLocalContext(ResultPtr theFeature,
                               const std::list<int>& theModes, const bool isUpdateViewer = true);
 
   /// Stop the current selection and color the given features to the selection color
   /// \param theFeatures a list of features to be disabled
   /// \param theToStop the boolean state whether it it stopped or non stopped
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  void stopSelection(const QFeatureList& theFeatures, const bool isStop,
+  void stopSelection(const QResultList& theFeatures, const bool isStop,
                      const bool isUpdateViewer);
 
   /**
@@ -104,12 +104,12 @@ public:
   * \param theFeatures a list of features to be selected
   * isUpdateViewer the parameter whether the viewer should be update immediatelly
   */
-  void setSelected(const QFeatureList& theFeatures, bool isUpdateViewer = true);
+  void setSelected(const QResultList& theFeatures, bool isUpdateViewer = true);
 
   /// Erase the feature and a shape.
   /// \param theFeature a feature instance
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  void erase(FeaturePtr theFeature, const bool isUpdateViewer = true);
+  void erase(ResultPtr theResult, const bool isUpdateViewer = true);
 
   /// Erase all presentations
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
@@ -117,7 +117,7 @@ public:
 
   /// Erase AIS interactive objects, which has an empty feature in the internal map
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  void eraseDeletedFeatures(const bool isUpdateViewer = true);
+  void eraseDeletedResults(const bool isUpdateViewer = true);
 
   /// Deactivates selection of sub-shapes
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
@@ -129,12 +129,12 @@ public:
   /// Searches the interactive object by feature
   /// \param theFeature the feature or NULL if it not visualized
   /// \return theIO an interactive object
-  boost::shared_ptr<GeomAPI_AISObject> getAISObject(FeaturePtr theFeature) const;
+  boost::shared_ptr<GeomAPI_AISObject> getAISObject(ResultPtr theFeature) const;
 
   /// Searches the feature by interactive object
   /// \param theIO an interactive object
   /// \return feature the feature or NULL if it not visualized
-  FeaturePtr getFeature(Handle(AIS_InteractiveObject) theIO) const;
+  ResultPtr getResult(Handle(AIS_InteractiveObject) theIO) const;
 
 protected:
   /// Deactivate local selection
@@ -147,8 +147,8 @@ protected:
 protected:
   XGUI_Workshop* myWorkshop;
 
-  typedef std::map<FeaturePtr, boost::shared_ptr<GeomAPI_AISObject> > FeatureToAISMap;
-  FeatureToAISMap myFeature2AISObjectMap;
+  typedef std::map<ResultPtr, boost::shared_ptr<GeomAPI_AISObject> > ResultToAISMap;
+  ResultToAISMap myResult2AISObjectMap;
 };
 
 
index 9cb80fa224e46d212bd1fd4524d198df0f976934..e0a73617035736ea89f879d93330433aaa97f683 100644 (file)
@@ -28,9 +28,9 @@ Handle(AIS_InteractiveContext) XGUI_ModuleConnector::AISContext() const
 }
 
 
-QFeatureList XGUI_ModuleConnector::selectedFeatures() const
+QList<ObjectPtr> XGUI_ModuleConnector::selectedObjects() const
 {
-  return myWorkshop->selector()->selection()->selectedFeatures();
+  return myWorkshop->selector()->selection()->selectedObjects();
 }
 
 ModuleBase_IModule* XGUI_ModuleConnector::module() const
index 8ef06b3217cd9abced8e794b33bb1324701c53e3..c7119b79ee7494de674dc2fbd690048e269ce184 100644 (file)
@@ -29,7 +29,7 @@ public:
   virtual Handle(AIS_InteractiveContext) AISContext() const;
 
   //! Returns list of currently selected data objects
-  virtual QFeatureList selectedFeatures() const; 
+  virtual QList<ObjectPtr> selectedObjects() const; 
 
   //! Returns instance of loaded module
   virtual ModuleBase_IModule* module() const;
index a1e5c5ef1dd4b5bfbc04684db0424fb5cb07cbef..0924af4b59dc8d9033a8b3e55d24a001560abef3 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "XGUI.h"
 #include <ModuleBase_Definitions.h>
+#include <ModelAPI_Object.h>
 
 #include <QWidget>
 #include <QTreeView>
@@ -20,7 +21,7 @@ public:
   virtual ~XGUI_DataTree();
 
   //! Returns list of currently selected features
-  QFeatureList selectedFeatures() const { return mySelectedData; }
+  QList<ObjectPtr> selectedFeatures() const { return mySelectedData; }
 
   XGUI_DocumentDataModel* dataModel() const;
 
@@ -45,7 +46,7 @@ private slots:
 
 private:
   //! List of currently selected data
-  QFeatureList mySelectedData;
+  QList<ObjectPtr> mySelectedData;
 };
 
 
@@ -64,7 +65,7 @@ public:
   XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
 
   //! Returns list of currently selected features
-  QFeatureList selectedFeatures() const { return myFeaturesList; }
+  QList<ObjectPtr> selectedObjects() const { return myObjectsList; }
 
   void setFeaturesSelected(const QFeatureList& theFeatures);
 
@@ -111,7 +112,7 @@ private:
   QLineEdit* myActiveDocLbl;
   XGUI_DataTree* myTreeView;
 
-  QFeatureList myFeaturesList;
+  QList<ObjectPtr> myObjectsList;
 };
 
 #endif
\ No newline at end of file
index ced60958b38a5855824c27001d6c39c258c155c2..0bd28f9d7352183a8e060242540ef11b7cb2869e 100644 (file)
@@ -4,15 +4,18 @@
 #include <ModelAPI_PluginManager.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_Object.h>
+#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultConstruction.h>
 
 #include <QIcon>
 #include <QBrush>
 
 
-//FeaturePtr featureObj(const FeaturePtr& theFeature)
+//ObjectPtr featureObj(const ObjectPtr& theFeature)
 //{
 //  ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
 //  if (aObject)
@@ -42,18 +45,18 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
     case ParamObject:
       {
         DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        FeaturePtr aFeature = aRootDoc->feature(PARAMETERS_GROUP, theIndex.row());
+        ObjectPtr aFeature = aRootDoc->object(PARAMETERS_GROUP, theIndex.row());
         if (aFeature)
-          return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->getName().c_str();
+          return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->data()->name().c_str();
       } 
     case ConstructFolder:
         return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
     case ConstructObject:
       {
         DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        FeaturePtr aFeature = aRootDoc->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+        ObjectPtr aFeature = aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
         if (aFeature)
-          return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->getName().c_str();
+          return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->data()->name().c_str();
       }
     }
     break;
@@ -68,7 +71,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
     case ConstructObject:
       {
         DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        FeaturePtr aFeature = aRootDoc->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+        ObjectPtr aFeature = aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
         if (aFeature)
           return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
       }
@@ -149,12 +152,12 @@ bool XGUI_TopDataModel::hasChildren(const QModelIndex& theParent) const
   return rowCount(theParent) > 0;
 }
 
-FeaturePtr XGUI_TopDataModel::feature(const QModelIndex& theIndex) const
+ObjectPtr XGUI_TopDataModel::feature(const QModelIndex& theIndex) const
 {
   switch (theIndex.internalId()) {
   case ParamsFolder:
   case ConstructFolder:
-    return FeaturePtr();
+    return ObjectPtr();
   case ParamObject:
     {
       DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
@@ -166,11 +169,11 @@ FeaturePtr XGUI_TopDataModel::feature(const QModelIndex& theIndex) const
       return aRootDoc->feature(CONSTRUCTIONS_GROUP, theIndex.row());
     }
   }
-  return FeaturePtr();
+  return ObjectPtr();
 }
 
 
-QModelIndex XGUI_TopDataModel::findParent(const FeaturePtr& theFeature) const
+QModelIndex XGUI_TopDataModel::findParent(const ObjectPtr& theFeature) const
 {
   return findGroup(theFeature->getGroup().c_str());
 }
@@ -184,7 +187,7 @@ QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const
   return QModelIndex();
 }
 
-QModelIndex XGUI_TopDataModel::featureIndex(const FeaturePtr& theFeature) const
+QModelIndex XGUI_TopDataModel::featureIndex(const ObjectPtr& theFeature) const
 {
   QModelIndex aIndex;
   if (theFeature) {
@@ -232,7 +235,7 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
     case MyRoot:
       {
         DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        FeaturePtr aFeature = aRootDoc->feature(PARTS_GROUP, myId);
+        ObjectPtr aFeature = aRootDoc->feature(PARTS_GROUP, myId);
         if (aFeature)
           return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->getName().c_str();
       }
@@ -244,19 +247,19 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
       return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
     case ParamObject:
       {
-        FeaturePtr aFeature = featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
+        ObjectPtr aFeature = featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
         if (aFeature)
           return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->getName().c_str();
       }
     case ConstructObject:
       {
-        FeaturePtr aFeature = featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+        ObjectPtr aFeature = featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
         if (aFeature)
           return boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature)->getName().c_str();
       }
     case HistoryObject:
       {
-        FeaturePtr aFeature = featureDocument()->feature(FEATURES_GROUP, theIndex.row() - 3);
+        ObjectPtr aFeature = featureDocument()->feature(FEATURES_GROUP, theIndex.row() - 3);
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
@@ -274,13 +277,13 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
       return QIcon(":pictures/constr_folder.png");
     case ConstructObject:
       {
-        FeaturePtr aFeature = featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+        ObjectPtr aFeature = featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
         if (aFeature)
           return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
       }
     case HistoryObject:
       {
-        FeaturePtr aFeature = featureDocument()->feature(FEATURES_GROUP, theIndex.row() - 3);
+        ObjectPtr aFeature = featureDocument()->feature(FEATURES_GROUP, theIndex.row() - 3);
         if (aFeature)
           return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
       }
@@ -383,11 +386,11 @@ bool XGUI_PartDataModel::hasChildren(const QModelIndex& theParent) const
 DocumentPtr XGUI_PartDataModel::featureDocument() const
 {
   DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-  FeaturePtr aFeature = aRootDoc->feature(PARTS_GROUP, myId, true);
+  ObjectPtr aFeature = aRootDoc->feature(PARTS_GROUP, myId, true);
   return aFeature->data()->docRef("PartDocument")->value();
 }
  
-FeaturePtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const
+ObjectPtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const
 {
   switch (theIndex.internalId()) {
   case MyRoot:
@@ -398,7 +401,7 @@ FeaturePtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const
   case ParamsFolder:
   case ConstructFolder:
   case BodiesFolder:
-    return FeaturePtr();
+    return ObjectPtr();
   case ParamObject:
     return featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
   case ConstructObject:
@@ -408,7 +411,7 @@ FeaturePtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const
   case HistoryObject:
     return featureDocument()->feature(FEATURES_GROUP, theIndex.row() - 3); 
   }
-  return FeaturePtr();
+  return ObjectPtr();
 }
 
 bool XGUI_PartDataModel::hasDocument(const DocumentPtr& theDoc) const
@@ -417,7 +420,7 @@ bool XGUI_PartDataModel::hasDocument(const DocumentPtr& theDoc) const
 }
 
 
-QModelIndex XGUI_PartDataModel::findParent(const FeaturePtr& theFeature) const
+QModelIndex XGUI_PartDataModel::findParent(const ObjectPtr& theFeature) const
 {
   return findGroup(theFeature->getGroup().c_str());
 }
@@ -431,25 +434,25 @@ QModelIndex XGUI_PartDataModel::findGroup(const std::string& theGroup) const
   return QModelIndex();
 }
 
-FeaturePtr XGUI_PartDataModel::part() const
+ObjectPtr XGUI_PartDataModel::part() const
 {
   DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-  return aRootDoc->feature(PARTS_GROUP, myId, true);
+  return aRootDoc->object(ModelAPI_ResultPart::group(), myId);
 }
 
-QModelIndex XGUI_PartDataModel::featureIndex(const FeaturePtr& theFeature) const
+QModelIndex XGUI_PartDataModel::featureIndex(const ObjectPtr& theObject) const
 {
   QModelIndex aIndex;
-  if (theFeature) {
-    if (part() == theFeature
+  if (theObject) {
+    if (part() == theObject
       return aIndex;
 
     //std::string aGroup = theFeature->getGroup();
-    DocumentPtr aDoc = theFeature->document();
-    int aNb = aDoc->size(FEATURES_GROUP);
+    DocumentPtr aDoc = theObject->document();
+    int aNb = aDoc->size(ModelAPI_Feature::group());
     int aRow = -1;
     for (int i = 0; i < aNb; i++) {
-      if (aDoc->feature(FEATURES_GROUP, i) == theFeature) {
+      if (aDoc->object(ModelAPI_Feature::group(), i) == theObject) {
         aRow = i;
         break;
       }
index fabadeb8b076829ac42f27163cb0b9d36b373316..9ebf7669ff794593f02355dc31ef3274d9906f4f 100644 (file)
@@ -34,14 +34,14 @@ public:
 
   //! Returns Feature object by the given Model index.
   //! Returns 0 if the given index is not index of a feature
-  virtual FeaturePtr feature(const QModelIndex& theIndex) const;
+  virtual ObjectPtr feature(const QModelIndex& theIndex) const;
 
   //! Returns QModelIndex which corresponds to the given feature
   //! If the feature is not found then index is not valid
-  virtual QModelIndex featureIndex(const FeaturePtr& theFeature) const;
+  virtual QModelIndex featureIndex(const ObjectPtr& theFeature) const;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const FeaturePtr& theFeature) const;
+  virtual QModelIndex findParent(const ObjectPtr& theFeature) const;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const;
@@ -87,23 +87,23 @@ public:
 
   //! Returns Feature object by the given Model index.
   //! Returns 0 if the given index is not index of a feature
-  virtual FeaturePtr feature(const QModelIndex& theIndex) const;
+  virtual ObjectPtr feature(const QModelIndex& theIndex) const;
 
   //! Returns QModelIndex which corresponds to the given feature
   //! If the feature is not found then index is not valid
-  virtual QModelIndex featureIndex(const FeaturePtr& theFeature) const;
+  virtual QModelIndex featureIndex(const ObjectPtr& theFeature) const;
 
   //! Returns true if the given document is a sub-document of this tree
   virtual bool hasDocument(const DocumentPtr& theDoc) const;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const FeaturePtr& theFeature) const;
+  virtual QModelIndex findParent(const ObjectPtr& theFeature) const;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const;
 
   //! Return a Part object
-  virtual FeaturePtr part() const;
+  virtual ObjectPtr part() const;
 
 private: 
 
index 5900aefea0c8c4143c3163403816db009f18c9fb..05b4e0ea6d95cf5b8886669138589ef70a0b2339 100644 (file)
@@ -22,7 +22,7 @@ XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop)
 
 std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSkip) const
 {
-  std::set<FeaturePtr> aPrsFeatures;
+  std::set<ResultPtr> aPrsFeatures;
   std::list<ModuleBase_ViewerPrs> aPresentations;
 
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
@@ -33,7 +33,7 @@ std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSk
     if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
       continue;
 
-    FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
+    ResultPtr aFeature = myWorkshop->displayer()->getResult(anIO);
     if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
       continue;
     Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
@@ -45,7 +45,7 @@ std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSk
 
 std::list<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted(int theShapeTypeToSkip) const
 {
-  std::set<FeaturePtr > aPrsFeatures;
+  std::set<ResultPtr> aPrsFeatures;
   std::list<ModuleBase_ViewerPrs> aPresentations;
 
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
@@ -55,29 +55,33 @@ std::list<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted(int theShapeTypeT
     if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
       continue;
 
-    FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
-    if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
+    ResultPtr aResult = myWorkshop->displayer()->getResult(anIO);
+    if (aPrsFeatures.find(aResult) != aPrsFeatures.end())
       continue;
-    aPresentations.push_back(ModuleBase_ViewerPrs(aFeature, aShape, NULL));
-    aPrsFeatures.insert(aFeature);
+    aPresentations.push_back(ModuleBase_ViewerPrs(aResult, aShape, NULL));
+    aPrsFeatures.insert(aResult);
   }
 
   return aPresentations;
 }
 
-QFeatureList XGUI_Selection::selectedFeatures() const
+QList<ObjectPtr> XGUI_Selection::selectedObjects() const
 {
-  return myWorkshop->objectBrowser()->selectedFeatures();
-  //QFeatureList aSelectedList;
-
-  //Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
-  //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
-  //  Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
-  //  FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
-  //  if (aFeature)
-  //    aSelectedList.append(aFeature);
-  //}
-  //return aSelectedList;
+  return myWorkshop->objectBrowser()->selectedObjects();
+}
+  
+QResultList XGUI_Selection::selectedResults() const
+{
+  QResultList aSelectedList;
+
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
+    ResultPtr aResult = myWorkshop->displayer()->getResult(anIO);
+    if (aResult)
+      aSelectedList.append(aResult);
+  }
+  return aSelectedList;
 }
 
 
index c6f92f5ff6d7cca053a2c8ef7efc8684800eabab..84b73f0f769c375f3033319e947e4571483b1b67 100644 (file)
@@ -36,9 +36,14 @@ public:
   std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const;
 
   /**
-  * Returns list of features currently selected in 3d viewer
+  * Returns list of currently selected objects
   */
-  QFeatureList selectedFeatures() const;
+  QList<ObjectPtr> selectedObjects() const;
+
+  /**
+  * Returns list of currently selected results
+  */
+  QResultList selectedResults() const;
   
   //! Returns list of currently selected QModelIndexes
   QModelIndexList selectedIndexes() const;
index 93f19284c72f34fdfe66899494b2933a578c6c86..0519e29d019ef11b8f750ef3e6363b43de055e71 100644 (file)
@@ -28,18 +28,6 @@ public:
 
   XGUI_Selection* selection() const { return mySelection; }
 
-  //! Returns list of currently selected data objects
-  //QFeatureList selectedFeatures() const; 
-  
-  //! Returns list of currently selected QModelIndexes
-  //QModelIndexList selectedIndexes() const;
-
-  //! Returns list of currently selected AIS objects
-  //void selectedAISObjects(AIS_ListOfInteractive& theList) const;
-
-  //! Returns list of currently selected shapes
-  //void selectedShapes(NCollection_List<TopoDS_Shape>& theList) const;
-
   //! Connects the manager to all viewers accessible by Workshop
   void connectViewers();
 
index 5cf560636b93be6c263d9eea048d6b664f0c32b6..5672163dcf06273e50eaa790bec519328784fb9b 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <TopoDS_Shape.hxx>
 #include <ModelAPI_Object.h>
+#include <GeomAPI_Shape.h>
 
 #include <QDir>
 
@@ -71,7 +72,7 @@ std::string featureInfo(FeaturePtr theFeature)
 }
 
 //******************************************************************
-FeaturePtr realFeature(const FeaturePtr theFeature)
+/*FeaturePtr realFeature(const FeaturePtr theFeature)
 {
   if (theFeature->data()) {
     return theFeature;
@@ -79,6 +80,7 @@ FeaturePtr realFeature(const FeaturePtr theFeature)
     ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
     return aObject->featureRef();
   }
-}
+}*/
+
 
 }
index fa1c78af5652a8760b24c5639f76099e8d8a08bb..0ad21160aed3d7d068e7d48cc9a910a192158ba4 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <boost/shared_ptr.hpp>
 
-class TopoDS_Shape;
 /*!
  \brief Return directory part of the file path.
 
@@ -72,11 +71,6 @@ namespace XGUI_Tools
    \param theFeature a feature
   */
   std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
-
-  /**
-  * Returns pointer on real feature
-  */
-  FeaturePtr realFeature(const FeaturePtr theFeature);
 }
 
 #endif
index d480ef3489ddd925705ad5d8b2d5da9a2195378d..78c7cc717dc2817a2be42524e5cc910bce930f54 100644 (file)
@@ -131,7 +131,7 @@ void XGUI_Workshop::startApplication()
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_TO_REDISPLAY));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 
   activateModule();
   if (myMainWindow) {
@@ -230,21 +230,21 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
 
   // Process creation of Part
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
-    const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+    const Model_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const Model_ObjectUpdatedMessage*>(theMessage);
     onFeatureCreatedMsg(aUpdMsg);
   }
 
   // Redisplay feature
-  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_TO_REDISPLAY)) {
-    const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
+    const Model_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const Model_ObjectUpdatedMessage*>(theMessage);
     onFeatureRedisplayMsg(aUpdMsg);
   }
 
   //Update property panel on corresponding message. If there is no current operation (no
   //property panel), or received message has different feature to the current - do nothing.
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
-    const Model_FeatureUpdatedMessage* anUpdateMsg =
-        dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
+    const Model_ObjectUpdatedMessage* anUpdateMsg =
+        dynamic_cast<const Model_ObjectUpdatedMessage*>(theMessage);
     onFeatureUpdatedMsg(anUpdateMsg);
   }
 
@@ -271,7 +271,7 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
 }
 
 //******************************************************
-void XGUI_Workshop::onFeatureUpdatedMsg(const Model_FeatureUpdatedMessage* theMsg)
+void XGUI_Workshop::onFeatureUpdatedMsg(const Model_ObjectUpdatedMessage* theMsg)
 {
   std::set<FeaturePtr> aFeatures = theMsg->features();
   if (myOperationMgr->hasOperation())
@@ -289,7 +289,7 @@ void XGUI_Workshop::onFeatureUpdatedMsg(const Model_FeatureUpdatedMessage* theMs
 }
 
 //******************************************************
-void XGUI_Workshop::onFeatureRedisplayMsg(const Model_FeatureUpdatedMessage* theMsg)
+void XGUI_Workshop::onFeatureRedisplayMsg(const Model_ObjectUpdatedMessage* theMsg)
 {
   std::set<FeaturePtr> aFeatures = theMsg->features();
   std::set<FeaturePtr>::const_iterator aIt;
@@ -305,7 +305,7 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const Model_FeatureUpdatedMessage* the
 }
 
 //******************************************************
-void XGUI_Workshop::onFeatureCreatedMsg(const Model_FeatureUpdatedMessage* theMsg)
+void XGUI_Workshop::onFeatureCreatedMsg(const Model_ObjectUpdatedMessage* theMsg)
 {
   std::set<FeaturePtr> aFeatures = theMsg->features();
 
index 960c4dd89e5b5e4ab191c7c8f41c18897f510efc..870e23f19cae1f771a24c0e166a5566024902049 100644 (file)
@@ -37,7 +37,7 @@ class Config_PointerMessage;
 class QWidget;
 class QDockWidget;
 
-class Model_FeatureUpdatedMessage;
+class Model_ObjectUpdatedMessage;
 class QAction;
 
 /**\class XGUI_Workshop
@@ -152,9 +152,9 @@ protected:
   void connectWithOperation(ModuleBase_Operation* theOperation);
   void saveDocument(QString theName);
 
-  void onFeatureUpdatedMsg(const Model_FeatureUpdatedMessage* theMsg);
-  void onFeatureCreatedMsg(const Model_FeatureUpdatedMessage* theMsg);
-  void onFeatureRedisplayMsg(const Model_FeatureUpdatedMessage* theMsg);
+  void onFeatureUpdatedMsg(const Model_ObjectUpdatedMessage* theMsg);
+  void onFeatureCreatedMsg(const Model_ObjectUpdatedMessage* theMsg);
+  void onFeatureRedisplayMsg(const Model_ObjectUpdatedMessage* theMsg);
 
   QList<QAction*> getModuleCommands() const;