]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Adaptation to new ModelAPI structure
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 15 Jul 2014 09:03:54 +0000 (13:03 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 15 Jul 2014 09:03:54 +0000 (13:03 +0400)
16 files changed:
src/ModuleBase/ModuleBase_WidgetFeature.cpp
src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp
src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp
src/ModuleBase/ModuleBase_WidgetValueFeature.cpp
src/ModuleBase/ModuleBase_WidgetValueFeature.h
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationFeatureEditMulti.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_TestOCC.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_WidgetSketchLabel.h

index 160965a1e4de25f7c7048f2e045087d89a2c8fee..5f625caeeafd045744a35b8504bd07e43e385445 100644 (file)
@@ -62,8 +62,9 @@ bool ModuleBase_WidgetFeature::setValue(ModuleBase_WidgetValue* theValue)
   if (theValue) {
     ModuleBase_WidgetValueFeature* aFeatureValue = 
                          dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
-    if (aFeatureValue)
-      isDone = setFeature(aFeatureValue->feature());
+    // TODO
+//    if (aFeatureValue)
+//      isDone = setFeature(aFeatureValue->feature());
   }
   return isDone;
 }
index c275f22386259733310c2dc681855dd6be774088..a26a70d0ac81c569af8b5c72af442f1b1fe28e47 100644 (file)
@@ -47,7 +47,8 @@ bool ModuleBase_WidgetFeatureOrAttribute::setValue(ModuleBase_WidgetValue* theVa
                          dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
     if (aFeatureValue) {
       boost::shared_ptr<GeomAPI_Pnt2d> aValuePoint = aFeatureValue->point();
-      FeaturePtr aValueFeature = aFeatureValue->feature();
+      //TODO
+/*      FeaturePtr aValueFeature = aFeatureValue->feature();
       if (aValueFeature) {
         isDone = setFeature(aValueFeature);
       }
@@ -66,7 +67,7 @@ bool ModuleBase_WidgetFeatureOrAttribute::setValue(ModuleBase_WidgetValue* theVa
         }
         if (aFPoint)
           isDone = setAttribute(aFPoint);
-      }
+      }*/
     }
   }
   return isDone;
index 303d4508e07d04c6cf45b8cf8872ac837204c9ad..e43f341e5797432d8542ee3d4f7d9eb5eb7c478e 100644 (file)
@@ -33,11 +33,12 @@ bool ModuleBase_WidgetPoint2dDistance::setValue(ModuleBase_WidgetValue* theValue
                          dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
     if (aFeatureValue) {
       boost::shared_ptr<GeomAPI_Pnt2d> aPnt = aFeatureValue->point();
-      FeaturePtr aFeature = aFeatureValue->feature();
+      // TODO
+      /*FeaturePtr aFeature = aFeatureValue->feature();
       if (aFeature && aPnt) {
         setPoint(aFeature, aPnt);
         isDone = true;
-      }
+      }*/
     }
   }
   return isDone;
index 51b39e181a98424f1023333158ab51980c40083a..da9fe5fd354f7c2f5ca58178a398f60233dfcd38 100644 (file)
@@ -14,14 +14,14 @@ ModuleBase_WidgetValueFeature::~ModuleBase_WidgetValueFeature()
 {
 }
 
-void ModuleBase_WidgetValueFeature::setFeature(const FeaturePtr& theFeature)
+void ModuleBase_WidgetValueFeature::setResult(const ResultPtr& theFeature)
 {
-  myFeature = theFeature;
+  myResult = theFeature;
 }
 
-const FeaturePtr& ModuleBase_WidgetValueFeature::feature() const
+const ResultPtr& ModuleBase_WidgetValueFeature::result() const
 {
-  return myFeature;
+  return myResult;
 }
 
 void ModuleBase_WidgetValueFeature::setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
index 9bdaeb619ac76c9fa76beb82ddecabadb4b5d42d..2de332108f08e3186498abd6d2cab38e70a46d50 100644 (file)
@@ -8,7 +8,7 @@
 #include <ModuleBase.h>
 #include <ModuleBase_WidgetValue.h>
 
-#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 
 #include <boost/shared_ptr.hpp>
 
@@ -28,11 +28,11 @@ public:
 
   /// Fill the widget values by given point
   /// \param thePoint the point
-  void setFeature(const FeaturePtr& theFeature);
+  void setResult(const ResultPtr& theFeature);
 
   /// Returns the widget values by given point
   /// \return theFeature the current feature
-  const FeaturePtr& feature() const;
+  const ResultPtr& result() const;
 
   /// Fill the widget values by given point
   /// \param thePoint the point
@@ -43,7 +43,7 @@ public:
   const boost::shared_ptr<GeomAPI_Pnt2d>& point() const;
 
 private:
-  FeaturePtr myFeature;
+  ResultPtr myResult;
   boost::shared_ptr<GeomAPI_Pnt2d> myPoint;
 };
 
index 1b597c4dccfe5d409aa689dad0acf7933f7d2069..efbc1a706fc661971401aaef2e6a6abc997f6991 100644 (file)
@@ -46,13 +46,13 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
     std::set<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
     for (; anIt != aLast; anIt++) {
       ObjectPtr aObject = *anIt;
-      ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
-      if (aResult) {
-        if (myModule->workshop()->displayer()->isVisible(aResult) ||
+      FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+      if (aFeature) {
+        if (myModule->workshop()->displayer()->isVisible(aFeature->firstResult()) ||
             aType == EVENT_OBJECT_CREATED) {
-          myModule->visualizePreview(aResult, true, false);
+          myModule->visualizePreview(aFeature->firstResult(), true, false);
           //if (aType == EVENT_OBJECT_CREATED)
-          myModule->activateFeature(aResult, true);
+          myModule->activateFeature(aFeature, true);
         }
       }
     }
@@ -69,7 +69,7 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
     for (; anIt != aLast; anIt++) {
       std::string aGroup = *anIt;
       if (aGroup.compare(SKETCH_KIND) == 0) { // Update only Sketch group
-        myModule->workshop()->displayer()->eraseDeletedFeatures();
+        myModule->workshop()->displayer()->eraseDeletedResults();
         myModule->updateCurrentPreview(aGroup);
       }
     }
index 02d41a0fc57c26ec3ebd29d35b867f530e0273b0..b52edee63b7be64f4a160c94421bf1e053c3daa0 100644 (file)
@@ -186,9 +186,11 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
 
 void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
 {
-  QFeatureList aFeatures = myWorkshop->selector()->selection()->selectedFeatures();
+  QList<ObjectPtr> aFeatures = myWorkshop->selector()->selection()->selectedObjects();
   if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
-    editFeature(aFeatures.first());
+    FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aFeatures.first());
+    if (aFeature)
+      editFeature(aFeature);
   }
 }
 
@@ -301,7 +303,16 @@ void PartSet_Module::onStopSelection(const QFeatureList& theFeatures, const bool
       activateFeature((*anIt), false);
     }
   }
-  aDisplayer->stopSelection(theFeatures, isStop, false);
+  QResultList aResults;
+  foreach(FeaturePtr aFeature, theFeatures) {
+    if (aFeature->results().size() > 0) {
+      std::list<ResultPtr>& aResList = aFeature->results();
+      std::list<ResultPtr>::iterator aIt;
+      for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt)
+        aResults.append(*aIt);
+    }
+  }
+  aDisplayer->stopSelection(aResults, isStop, false);
 
   XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
   aViewer->enableSelection(!isStop);
@@ -309,7 +320,7 @@ void PartSet_Module::onStopSelection(const QFeatureList& theFeatures, const bool
   aDisplayer->updateViewer();
 }
 
-void PartSet_Module::onSetSelection(const QFeatureList& theFeatures)
+void PartSet_Module::onSetSelection(const QResultList& theFeatures)
 {
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   aDisplayer->setSelected(theFeatures, false);
@@ -325,7 +336,7 @@ void PartSet_Module::onCloseLocalContext()
 void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
 {
   bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
-  visualizePreview(theFeature, isDisplay, false);
+  // TODO visualizePreview(theFeature, isDisplay, false);
   if (!isDisplay) {
     ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
     FeaturePtr aSketch;
@@ -338,7 +349,7 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
       std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
                                             aLast = aList.end();
       for (; anIt != aLast; anIt++)
-        visualizePreview(*anIt, false, false);
+        visualizePreview((*anIt)->firstResult(), false, false);
       aDisplayer->updateViewer();
     }
   }
@@ -433,7 +444,7 @@ void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
   Events_Loop::loop()->send(aMessage);
 }
 
-void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
+void PartSet_Module::visualizePreview(ResultPtr theFeature, bool isDisplay,
                                       const bool isUpdateViewer)
 {
   ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
@@ -468,7 +479,7 @@ void PartSet_Module::activateFeature(FeaturePtr theFeature, const bool isUpdateV
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
     XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature),
+    aDisplayer->activateInLocalContext(theFeature->firstResult(), aPreviewOp->getSelectionModes(theFeature),
                                        isUpdateViewer);
   }
 }
@@ -498,8 +509,8 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
       boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
     if (!aSPFeature)
       continue;
-    visualizePreview(*anIt, true, false);
-    aDisplayer->activateInLocalContext(*anIt, aModes, false);
+    visualizePreview((*anIt)->firstResult(), true, false);
+    aDisplayer->activateInLocalContext((*anIt)->firstResult(), aModes, false);
   }
   aDisplayer->updateViewer();
 }
@@ -510,16 +521,16 @@ void PartSet_Module::editFeature(FeaturePtr theFeature)
     return;
 
 //  if (theFeature->getKind() == SKETCH_KIND) {
-    FeaturePtr aFeature = theFeature;
-    if (XGUI_Tools::isModelObject(aFeature)) {
-      ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
-      aFeature = aObject->featureRef();
-    }
-
-    if (aFeature) {
-      onLaunchOperation(aFeature->getKind(), aFeature);
-      updateCurrentPreview(aFeature->getKind());
-    }
+    //FeaturePtr aFeature = theFeature;
+    //if (XGUI_Tools::isModelObject(aFeature)) {
+    //  ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
+    //  aFeature = aObject->featureRef();
+    //}
+
+    //if (aFeature) {
+      onLaunchOperation(theFeature->getKind(), theFeature);
+      updateCurrentPreview(theFeature->getKind());
+    //}
 //  }
 }
 
index 627d088b15bf30c63627d5b317449d3a1191d41b..eaec86601bf7f913335699a9f04cdee09c0e8b06 100644 (file)
@@ -55,7 +55,7 @@ public:
   /// \param theFeature the feature instance to be displayed
   /// \param isDisplay the state whether the presentation should be displayed or erased
   /// \param isUpdateViewer the flag whether the viewer should be updated
-  void visualizePreview(FeaturePtr theFeature, bool isDisplay,
+  void visualizePreview(ResultPtr theResult, bool isDisplay,
                         const bool isUpdateViewer = true);
 
   /// Activates the feature in the displayer
@@ -125,7 +125,7 @@ public slots:
 
   /// SLOT, to set selection
   /// \param theFeatures a list of features to be selected
-  void onSetSelection(const QFeatureList& theFeatures);
+  void onSetSelection(const QResultList& theFeatures);
 
   /// SLOT, to close the viewer local context
   void onCloseLocalContext();
index dc9e868f3ffcec01e43ab51e0792a6cb04b11e3a..8326bfcbd490833c7b4d9c08da62994c912daac0 100644 (file)
@@ -145,19 +145,21 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
       }
     }
   }
-  FeaturePtr aFeature;
+  ResultPtr aFeature;
   if (!theSelected.empty()) {
     ModuleBase_ViewerPrs aPrs = theSelected.front();
     aFeature = aPrs.result();
   }
-  else
-    aFeature = feature(); // for the widget distance only
+  // TODO
+  //else
+  //  aFeature = feature(); // for the widget distance only
 
-  bool isApplyed = setWidgetValue(aFeature, aX, anY);
+  // TODO
+  /*bool isApplyed = setWidgetValue(aFeature, aX, anY);
   if (isApplyed) {
     flushUpdated();
     emit activateNextWidget(myActiveWidget);
-  }
+  }*/
 }
 
 void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
@@ -192,7 +194,7 @@ void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* t
   if ((myPreSelection.size() > 0) && myActiveWidget) {
     const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
     ModuleBase_WidgetValueFeature aValue;
-    aValue.setFeature(aPrs.result());
+    aValue.setResult(aPrs.result());
     if (myActiveWidget->setValue(&aValue)) {
       myPreSelection.remove(aPrs);
       emit activateNextWidget(myActiveWidget);
@@ -281,7 +283,7 @@ FeaturePtr PartSet_OperationFeatureCreate::createFeature(const bool theFlushMess
 bool PartSet_OperationFeatureCreate::setWidgetValue(FeaturePtr theFeature, double theX, double theY)
 {
   ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
-  aValue->setFeature(theFeature);
+  aValue->setResult(theFeature->firstResult());
   aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
   bool isApplyed = myActiveWidget->setValue(aValue);
 
index 6705c0e6cb1e4acc084bb74181a433988416a377..e767208aacda5b6c8b2fad5ae62b6f54ed5b2e8a 100644 (file)
@@ -78,23 +78,25 @@ void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3
     aFeature = theHighlighted.front().result();
   if (!aFeature && !theSelected.empty()) // changed for a constrain
     aFeature = theSelected.front().result();
-
-  if (!aFeature || aFeature != feature())
+  // TODO
+  /*if (!aFeature || aFeature != feature())
   {
     commit();
     emit featureConstructed(feature(), FM_Deactivation);
 
     bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
     if(aHasShift && !theHighlighted.empty()) {
-      QFeatureList aSelected;
+      QResultList aSelected;
+      // TODO
       aSelected.push_back(feature());
       aSelected.push_back(theHighlighted.front().result());
       emit setSelection(aSelected);
     }
+    // TODO
     else if (aFeature) {
       restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
     }
-  }
+  }*/
 }
 
 void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
index 960cab6b481cb917bfc602f28930b86af507b23b..d66acf804a2ba1cbe435c259ec1bce70da234afe 100644 (file)
@@ -58,9 +58,10 @@ void PartSet_OperationFeatureEditMulti::initSelection(const std::list<ModuleBase
     // deselected in the viewer by blockSelection signal in the startOperation method.
     bool isSelected = false;
     std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
-    for (; anIt != aLast && !isSelected; anIt++) {
+    // TODO
+    /*for (; anIt != aLast && !isSelected; anIt++) {
       isSelected = (*anIt).feature() == feature();
-    }
+    }*/
     if (!isSelected)
       myFeatures = theHighlighted;
     else
@@ -109,13 +110,14 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
     aSketchFeature->move(aDeltaX, aDeltaY);
 
     std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
-    for (; anIt != aLast; anIt++) {
+    // TODO
+    /*for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = (*anIt).feature();
       if (!aFeature || aFeature == feature())
         continue;
       aSketchFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
       aSketchFeature->move(aDeltaX, aDeltaY);
-    }
+    }*/
   }
   sendFeatures();
 
@@ -129,12 +131,13 @@ void PartSet_OperationFeatureEditMulti::mouseReleased(QMouseEvent* theEvent, Han
   std::list<ModuleBase_ViewerPrs> aFeatures = myFeatures;
   commit();
   std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
-  for (; anIt != aLast; anIt++) {
+  // TODO
+  /*for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = (*anIt).feature();
     if (aFeature) {
       emit featureConstructed(aFeature, FM_Deactivation);
        }
-  }
+  }*/
 }
 
 void PartSet_OperationFeatureEditMulti::startOperation()
@@ -165,8 +168,8 @@ void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked, const boo
   QFeatureList aFeatureList;
   std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
                                             aLast = myFeatures.end();
-  for(; anIt != aLast; anIt++)
-    aFeatureList.append((*anIt).feature());
+  /*for(; anIt != aLast; anIt++)
+    aFeatureList.append((*anIt).feature());*/
   if (isBlocked) {
     emit setSelection(QFeatureList());
     emit stopSelection(aFeatureList, true);
@@ -185,13 +188,14 @@ void PartSet_OperationFeatureEditMulti::sendFeatures()
 
   std::list<FeaturePtr > aFeatures;
   std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
-  for (; anIt != aLast; anIt++) {
+  // TODO
+  /*for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = (*anIt).feature();
     if (!aFeature)
       continue;
 
     ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
-  }
+  }*/
   Events_Loop::loop()->flush(anEvent);
   flushUpdated();
 }
index 563caf21ca286697d7714ca8ac94f12cfcc2e13e..2cccb18a2fbecd5fa61d3b1ead427b7962009951 100644 (file)
@@ -91,12 +91,12 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie
       return;
 
     if (theHighlighted.size() == 1) {
-      FeaturePtr aFeature = theHighlighted.front().feature();
+      ResultPtr aFeature = theHighlighted.front().result();
       if (aFeature) {
         std::string anOperationType = PartSet_OperationFeatureEdit::Type();
         if (theSelected.size() > 1)
           anOperationType = PartSet_OperationFeatureEditMulti::Type();
-        restartOperation(anOperationType, aFeature);
+        // TODO restartOperation(anOperationType, aFeature);
       }
     }
     else
@@ -117,9 +117,10 @@ void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_Vi
     /// It is empty and we have to use the process mouse release to start edition operation
     /// for these objects
     if (theSelected.size() == 1) {
-      FeaturePtr aFeature = theSelected.front().feature();
-      if (aFeature)
-        restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
+      ResultPtr aFeature = theSelected.front().result();
+      // TODO
+      //if (aFeature)
+      //  restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
     }
   }
 }
@@ -145,7 +146,15 @@ std::list<FeaturePtr> PartSet_OperationSketch::subFeatures() const
   boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
         boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
 
-  return aRefList->list();
+  std::list<ObjectPtr> aList = aRefList->list();
+  std::list<ObjectPtr>::iterator aIt;
+  std::list<FeaturePtr> aFeaList;
+  for (aIt = aList.begin(); aIt != aList.end(); ++aIt) {
+    FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aIt);
+    if (aFeature)
+      aFeaList.push_back(aFeature);
+  }
+  return aFeaList;
 }
 
 void PartSet_OperationSketch::stopOperation()
index bef1dfde5cde9d2d426d81de989e99b2c5cb228c..7c6864f7cc7d4ffc9c6941bbd44056cc5e9f1b53 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <PartSet_OperationSketchBase.h>
 #include <PartSet_Tools.h>
+#include <ModelAPI_ResultBody.h>
 
 #include <SketchPlugin_Feature.h>
 #include <V3d_View.hxx>
@@ -35,9 +36,13 @@ boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
 {
   boost::shared_ptr<SketchPlugin_Feature> aFeature = 
                               boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
-  if (!aFeature)
-    return boost::shared_ptr<GeomAPI_Shape>();
-  return aFeature->preview();
+  if (aFeature) {
+    ResultPtr aRes = aFeature->firstResult();
+    ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+    if (aBody)
+      return aBody->shape();
+  }
+  return boost::shared_ptr<GeomAPI_Shape>();
 }
 
 std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
index 4cc60a5c4e7b059260c2302f69d251bbf622bde8..c8b1e0186e08845add527191753c8a94badbf421 100644 (file)
@@ -152,12 +152,12 @@ void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop)
       boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
     boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
     if (!anAIS->empty())
-      aDisplayer->redisplay(aFeature, anAIS, false);
+      aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
 
     std::list<int> aModes;
     aModes.push_back(TopAbs_VERTEX);
     aModes.push_back(TopAbs_EDGE);
-    aDisplayer->activateInLocalContext(aFeature, aModes, true);
+    aDisplayer->activateInLocalContext(aFeature->firstResult(), aModes, true);
 
     // change the line
     /*double aDelta = -200;
@@ -182,9 +182,9 @@ void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop)
     //aModes.push_back(TopAbs_VERTEX);
     //aModes.push_back(TopAbs_EDGE);
     //aDisplayer->activateInLocalContext(aFeature, aModes, true);
-    myTestObject = aFeature;
+    myTestObject = aFeature->firstResult();
 
-    QFeatureList aFeatureList;
+    QResultList aFeatureList;
     aFeatureList.append(myTestObject);
     aDisplayer->setSelected(aFeatureList, true);
   }
@@ -195,13 +195,14 @@ void PartSet_TestOCC::changeTestLine(XGUI_Workshop* theWorkshop)
   // change the line
   if (!myTestObject)
     return;
-  FeaturePtr aFeature = myTestObject;
+  ResultPtr aFeature = myTestObject;
 
   myTestDelta = myTestDelta - 50;
   double aDelta = myTestDelta;
-  PartSet_Tools::setFeaturePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
-  PartSet_Tools::setFeaturePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
-  boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+  // TODO
+  //PartSet_Tools::setFeaturePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
+  //PartSet_Tools::setFeaturePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
+  //boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
 
   boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
   boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
index 24a726a90df03bf938282248b2ab5637556dc8c4..e2c6d3cccf9ef89e77d1ecd7b09789733f5489b2 100644 (file)
@@ -162,7 +162,7 @@ FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theVie
                                boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
     if (aMinDelta < 0 || aMinDelta > aDelta) {
       aMinDelta = aDelta;
-      aDeltaFeature = aPrs.result();
+      // TODO aDeltaFeature = aPrs.result();
     }
   }
   return aDeltaFeature;
@@ -225,7 +225,7 @@ FeaturePtr PartSet_Tools::feature(FeaturePtr theFeature, const std::string& theA
   boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
           boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(theAttribute));
   if (anAttr) {
-    aFeature = anAttr->feature();
+    aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->object());
     if (!theKind.empty() && aFeature && aFeature->getKind() != theKind) {
       aFeature = FeaturePtr();
     }
@@ -277,14 +277,14 @@ void PartSet_Tools::setConstraints(FeaturePtr theSketch, FeaturePtr theFeature,
   boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
         boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
 
-  std::list<FeaturePtr > aFeatures = aRefList->list();
-  std::list<FeaturePtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+  std::list<ObjectPtr > aFeatures = aRefList->list();
+  std::list<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
   std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes;
   boost::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = boost::shared_ptr<GeomAPI_Pnt2d>
                                                      (new GeomAPI_Pnt2d(theClickedX, theClickedY));
   for (; anIt != aLast; anIt++)
   {
-    FeaturePtr aFeature = *anIt;
+    FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
     // find the given point in the feature attributes
     anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::type());
     std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
index 30cdaace39917bcbd8e9d58be4c8b06352435198..839b3ec57826adee4982677712e40741b255bab3 100644 (file)
@@ -23,9 +23,9 @@ public:
 
   /// Saves the internal parameters to the given feature
   /// \param theFeature a model feature to be changed
-  virtual bool storeValue(FeaturePtr theFeature) const { return true;}
+  virtual bool storeValue(ObjectPtr theFeature) const { return true;}
 
-  virtual bool restoreValue(FeaturePtr theFeature) { return true;}
+  virtual bool restoreValue(ObjectPtr theFeature) { return true;}
 
   /// Returns list of widget controls
   /// \return a control list