GeomAPI_Pln.h
GeomAPI_Shape.h
GeomAPI_AISObject.h
+ GeomAPI_IPresentable.h
)
SET(PROJECT_SOURCES
--- /dev/null
+// File: GeomAPI_IPresentable.hxx
+// Created: 17 July 2014
+// Author: Vitaly SMETANNIKOV
+
+#ifndef GeomAPI_IPresentable_HeaderFile
+#define GeomAPI_IPresentable_HeaderFile
+
+#include "GeomAPI_AISObject.h"
+
+/**
+* A class which defines an interface of object which is able to create its own presentation
+*/
+class GeomAPI_IPresentable
+{
+public:
+ /** Returns the AIS preview
+ * \param thePrevious - defines a presentation if it was created previously
+ */
+ virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
+ boost::shared_ptr<GeomAPI_AISObject> thePrevious) = 0;
+};
+
+typedef boost::shared_ptr<GeomAPI_IPresentable> GeomPresentablePtr;
+
+#endif
\ No newline at end of file
/**
* Returns list of currently selected results
*/
- virtual QResultList selectedResults() const = 0;
+ virtual QList<ObjectPtr> selectedPresentations() const = 0;
//! Returns list of currently selected QModelIndexes
virtual QModelIndexList selectedIndexes() const = 0;
/// \param theFeature a model feature
/// \param theShape a viewer shape
/// \param theOwner a selection owner
- ModuleBase_ViewerPrs(ResultPtr theResult,
+ ModuleBase_ViewerPrs(ObjectPtr theResult,
const TopoDS_Shape& theShape,
Handle_SelectMgr_EntityOwner theOwner)
: myResult(theResult), myShape(theShape), myOwner(theOwner) {}
/// Sets the feature.
/// \param theFeature a feature instance
- void setFeature(ResultPtr theResult) { myResult = theResult; }
+ void setFeature(ObjectPtr theResult) { myResult = theResult; }
/// Returns the feature.
/// \return a feature instance
- ResultPtr result() const { return myResult; }
+ ObjectPtr object() const { return myResult; }
/// Returns the presentation owner
/// \param the owner
bool operator==(const ModuleBase_ViewerPrs& thePrs)
{
- bool aResult = (myResult.get() == thePrs.result().get());
+ bool aResult = (myResult.get() == thePrs.object().get());
bool aOwner = (myOwner.Access() == thePrs.owner().Access());
bool aShape = myShape.IsEqual(thePrs.shape());
return aResult && aOwner && aShape;
}
private:
- ResultPtr myResult; /// the feature
+ ObjectPtr myResult; /// the feature
Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
TopoDS_Shape myShape; /// the shape
};
{
}
-void ModuleBase_WidgetValueFeature::setResult(const ResultPtr& theFeature)
+void ModuleBase_WidgetValueFeature::setObject(const ObjectPtr& theFeature)
{
myResult = theFeature;
}
-const ResultPtr& ModuleBase_WidgetValueFeature::result() const
+const ObjectPtr& ModuleBase_WidgetValueFeature::object() const
{
return myResult;
}
/// Fill the widget values by given point
/// \param thePoint the point
- void setResult(const ResultPtr& theFeature);
+ void setObject(const ObjectPtr& theFeature);
/// Returns the widget values by given point
/// \return theFeature the current feature
- const ResultPtr& result() const;
+ const ObjectPtr& object() const;
/// Fill the widget values by given point
/// \param thePoint the point
const boost::shared_ptr<GeomAPI_Pnt2d>& point() const;
private:
- ResultPtr myResult;
+ ObjectPtr myResult;
boost::shared_ptr<GeomAPI_Pnt2d> myPoint;
};
boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
if (aSPFeature) {
- boost::shared_ptr<GeomAPI_AISObject> anAIS =
- aSPFeature->getAISObject(aDisplayer->getAISObject(aResult));
- aDisplayer->redisplay(aResult, anAIS, false);
+ //boost::shared_ptr<GeomAPI_AISObject> anAIS =
+ // aSPFeature->getAISObject(aDisplayer->getAISObject(aResult));
+ aDisplayer->display(aSPFeature, false);
+ //aDisplayer->redisplay(aResult, anAIS, false);
}
}
else
}
}
}
- ResultPtr aFeature;
+ ObjectPtr aFeature;
if (!theSelected.empty()) {
ModuleBase_ViewerPrs aPrs = theSelected.front();
- aFeature = aPrs.result();
+ aFeature = aPrs.object();
}
// TODO
//else
if ((myPreSelection.size() > 0) && myActiveWidget) {
const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
ModuleBase_WidgetValueFeature aValue;
- aValue.setResult(aPrs.result());
+ aValue.setObject(aPrs.object());
if (myActiveWidget->setValue(&aValue)) {
myPreSelection.remove(aPrs);
emit activateNextWidget(myActiveWidget);
bool PartSet_OperationFeatureCreate::setWidgetValue(FeaturePtr theFeature, double theX, double theY)
{
ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
- aValue->setResult(theFeature->firstResult());
+ aValue->setObject(theFeature);
aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
bool isApplyed = myActiveWidget->setValue(aValue);
const std::list<ModuleBase_ViewerPrs>& theSelected,
const std::list<ModuleBase_ViewerPrs>& theHighlighted)
{
- ResultPtr aFeature;
+ ObjectPtr aFeature;
if (!theHighlighted.empty())
- aFeature = theHighlighted.front().result();
+ aFeature = theHighlighted.front().object();
if (!aFeature && !theSelected.empty()) // changed for a constrain
- aFeature = theSelected.front().result();
+ aFeature = theSelected.front().object();
// TODO
/*if (!aFeature || aFeature != feature())
{
return;
if (theHighlighted.size() == 1) {
- ResultPtr aFeature = theHighlighted.front().result();
+ ObjectPtr aFeature = theHighlighted.front().object();
if (aFeature) {
std::string anOperationType = PartSet_OperationFeatureEdit::Type();
if (theSelected.size() > 1)
/// It is empty and we have to use the process mouse release to start edition operation
/// for these objects
if (theSelected.size() == 1) {
- ResultPtr aFeature = theSelected.front().result();
+ ObjectPtr aFeature = theSelected.front().object();
// TODO
//if (aFeature)
// restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
- if (!anAIS->empty())
- aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
+ //boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
+ //if (!anAIS->empty())
+ aDisplayer->display(aFeature, false);
+ //aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
std::list<int> aModes;
aModes.push_back(TopAbs_VERTEX);
boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
boost::shared_ptr<SketchPlugin_Feature> aSPFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
- if (!anAIS->empty())
- theWorkshop->displayer()->redisplay(aFeature, anAIS, true);
+ //boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
+ //if (!anAIS->empty())
+ theWorkshop->displayer()->display(aFeature, true);
+ // theWorkshop->displayer()->redisplay(aFeature, anAIS, true);
//std::list<int> aModes;
//aModes.clear();
//aModes.push_back(TopAbs_VERTEX);
ModuleBase_ViewerPrs aPrs;
for (; anIt != aLast; anIt++) {
aPrs = *anIt;
- if (!aPrs.result())
+ if (!aPrs.object())
continue;
boost::shared_ptr<SketchPlugin_Feature> aSketchFeature =
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(aPrs.result());
+ boost::dynamic_pointer_cast<SketchPlugin_Feature>(aPrs.object());
if (!aSketchFeature)
continue;
double aDelta = aSketchFeature->distanceToPoint(
#include <SketchPlugin_Feature.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Pln.h>
+#include <GeomAPI_IPresentable.h>
#include <list>
/**\class SketchPlugin_Sketch
* \ingroup DataModel
* \brief Feature for creation of the new part in PartSet.
*/
-class SketchPlugin_Sketch: public SketchPlugin_Feature
+class SketchPlugin_Sketch: public SketchPlugin_Feature, public GeomAPI_IPresentable
{
public:
/// Sketch feature kind
#include <ModelAPI_Object.h>
#include <GeomAPI_Shape.h>
+#include <GeomAPI_IPresentable.h>
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
{
}
-bool XGUI_Displayer::isVisible(ResultPtr theResult)
+bool XGUI_Displayer::isVisible(ObjectPtr theObject)
{
- return myResult2AISObjectMap.find(theResult) != myResult2AISObjectMap.end();
+ return myResult2AISObjectMap.find(theObject) != myResult2AISObjectMap.end();
}
-bool XGUI_Displayer::display(ResultPtr theResult, bool isUpdateViewer)
+void XGUI_Displayer::display(ObjectPtr theObject, bool isUpdateViewer)
{
- 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(theResult, anAIS, isUpdateViewer);
+ if (isVisible(theObject)) {
+ redisplay(theObject, isUpdateViewer);
+ } else {
+ boost::shared_ptr<GeomAPI_AISObject> anAIS;
+
+ ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult) {
+ boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
+ if (aShapePtr) {
+ anAIS = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
+ anAIS->createShape(aShapePtr);
+ }
+ } else {
+ GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+ if (aPrs) {
+ anAIS = aPrs->getAISObject(boost::shared_ptr<GeomAPI_AISObject>());
+ }
+ }
+ if (anAIS)
+ display(theObject, anAIS, isUpdateViewer);
}
- return false;
}
-bool XGUI_Displayer::display(ResultPtr theResult,
+void XGUI_Displayer::display(ObjectPtr theObject,
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()) {
- myResult2AISObjectMap[theResult] = theAIS;
+ myResult2AISObjectMap[theObject] = theAIS;
aContext->Display(anAISIO, isUpdateViewer);
- return true;
}
- return false;
}
-void XGUI_Displayer::erase(ResultPtr theResult,
- const bool isUpdateViewer)
+void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
{
- if (myResult2AISObjectMap.find(theResult) == myResult2AISObjectMap.end())
- return;
+ if (!isVisible(theObject)) return;
Handle(AIS_InteractiveContext) aContext = AISContext();
- boost::shared_ptr<GeomAPI_AISObject> anObject = myResult2AISObjectMap[theResult];
+ boost::shared_ptr<GeomAPI_AISObject> anObject = myResult2AISObjectMap[theObject];
if (anObject) {
Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull()) {
}
}
- myResult2AISObjectMap.erase(theResult);
+ myResult2AISObjectMap.erase(theObject);
}
-bool XGUI_Displayer::redisplay(ResultPtr theResult,
+/*bool XGUI_Displayer::redisplay(ObjectPtr theObject,
boost::shared_ptr<GeomAPI_AISObject> theAIS,
const bool isUpdateViewer)
{
// Open local context if there is no one
if (!aContext->HasOpenedContext()) {
aContext->ClearCurrents(false);
- aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
+ aContext->OpenLocalContext(false /use displayed objects/, true /allow shape decomposition/);
// set mouse sensitivity
//aContext->SetSensitivityMode(StdSelect_SM_WINDOW);
//aContext->SetPixelTolerance(MOUSE_SENSITIVITY_IN_PIXEL);
}
// display or redisplay presentation
- boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theResult];
- if (isVisible(theResult) && anObj && !anObj->empty()) {
- aContext->RecomputeSelectionOnly(anAIS);
+ boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+ if (isVisible(theObject) && anObj && !anObj->empty()) {
+ aContext->Redisplay(anAIS, isUpdateViewer);
+ //aContext->RecomputeSelectionOnly(anAIS);
}
else {
- myResult2AISObjectMap[theResult] = theAIS;
- aContext->Display(anAIS, false);
+ myResult2AISObjectMap[theObject] = theAIS;
+ aContext->Display(anAIS, isUpdateViewer);
isCreated = true;
}
- if (isUpdateViewer)
- updateViewer();
-
return isCreated;
-}
+}*/
-bool XGUI_Displayer::redisplay(ResultPtr theResult, bool isUpdateViewer)
+void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
{
- if (!isVisible(theResult))
- return false;
-
- boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(theResult);
- if (aShapePtr) {
- 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>());
- AISContext()->Redisplay(aAISShape);
- return true;
+ if (!isVisible(theObject))
+ return;
+
+ ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult) {
+ boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
+ if (aShapePtr) {
+ boost::shared_ptr<GeomAPI_AISObject> aAISObj = getAISObject(theObject);
+ Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj->impl<Handle(AIS_InteractiveObject)>());
+ if (!aAISShape.IsNull()) {
+ aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
+ AISContext()->Redisplay(aAISShape, isUpdateViewer);
+ }
+ }
+ } else {
+ GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+ if (aPrs) {
+ boost::shared_ptr<GeomAPI_AISObject> aAISObj = aPrs->getAISObject(getAISObject(theObject));
+ Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+ AISContext()->Redisplay(aAISIO, isUpdateViewer);
}
}
- return false;
}
void XGUI_Displayer::activateInLocalContext(ResultPtr theResult,
ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(),
aFLast = myResult2AISObjectMap.end();
- std::list<ResultPtr> aRemoved;
+ std::list<ObjectPtr> aRemoved;
for (; aFIt != aFLast; aFIt++)
{
- ResultPtr aFeature = (*aFIt).first;
+ ObjectPtr aFeature = (*aFIt).first;
if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) {
boost::shared_ptr<GeomAPI_AISObject> anObj = (*aFIt).second;
if (!anObj) continue;
}
}
}
- std::list<ResultPtr>::const_iterator anIt = aRemoved.begin(),
+ std::list<ObjectPtr>::const_iterator anIt = aRemoved.begin(),
aLast = aRemoved.end();
for (; anIt != aLast; anIt++) {
myResult2AISObjectMap.erase(myResult2AISObjectMap.find(*anIt));
closeAllContexts(true);
}
-boost::shared_ptr<GeomAPI_AISObject> XGUI_Displayer::getAISObject(
- ResultPtr theFeature) const
+boost::shared_ptr<GeomAPI_AISObject> XGUI_Displayer::getAISObject(ObjectPtr theObject) const
{
boost::shared_ptr<GeomAPI_AISObject> anIO;
- if (myResult2AISObjectMap.find(theFeature) != myResult2AISObjectMap.end())
- anIO = (myResult2AISObjectMap.find(theFeature))->second;
+ if (myResult2AISObjectMap.find(theObject) != myResult2AISObjectMap.end())
+ anIO = (myResult2AISObjectMap.find(theObject))->second;
return anIO;
}
-ResultPtr XGUI_Displayer::getResult(Handle(AIS_InteractiveObject) theIO) const
+ObjectPtr XGUI_Displayer::getObject(Handle(AIS_InteractiveObject) theIO) const
{
- ResultPtr aFeature;
+ ObjectPtr aFeature;
ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(),
aFLast = myResult2AISObjectMap.end();
for (; aFIt != aFLast && !aFeature; aFIt++) {
/// Returns the feature visibility state.
/// \param theFeature a feature instance
- bool isVisible(ResultPtr theResult);
+ bool isVisible(ObjectPtr theObject);
/// 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(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(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(ResultPtr theFeature,
- boost::shared_ptr<GeomAPI_AISObject> theAIS,
- const bool isUpdateViewer = true);
-
- /** Redisplay the shape if it was displayed
- * \param theFeature a feature instance
- * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- */
- bool redisplay(ResultPtr theFeature, bool isUpdateViewer = true);
+ void display(ObjectPtr theObject, bool isUpdateViewer = true);
/// Redisplay the shape and activate selection of sub-shapes
/// \param theFeature a feature instance
/// Erase the feature and a shape.
/// \param theFeature a feature instance
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- void erase(ResultPtr theResult, const bool isUpdateViewer = true);
+ void erase(ObjectPtr theObject, const bool isUpdateViewer = true);
/// Erase all presentations
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
/// 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(ResultPtr theFeature) const;
+ boost::shared_ptr<GeomAPI_AISObject> getAISObject(ObjectPtr theFeature) const;
/// Searches the feature by interactive object
/// \param theIO an interactive object
/// \return feature the feature or NULL if it not visualized
- ResultPtr getResult(Handle(AIS_InteractiveObject) theIO) const;
+ ObjectPtr getObject(Handle(AIS_InteractiveObject) theIO) const;
protected:
/// Deactivate local selection
/// Returns currently installed AIS_InteractiveContext
Handle(AIS_InteractiveContext) AISContext() const;
+ /// 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
+ void display(ObjectPtr theObject, 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(ObjectPtr theObject,
+ // boost::shared_ptr<GeomAPI_AISObject> theAIS,
+ // const bool isUpdateViewer = true);
+
+ /** Redisplay the shape if it was displayed
+ * \param theFeature a feature instance
+ * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+ */
+ void redisplay(ObjectPtr theObject, bool isUpdateViewer = true);
+
protected:
XGUI_Workshop* myWorkshop;
- typedef std::map<ResultPtr, boost::shared_ptr<GeomAPI_AISObject> > ResultToAISMap;
+ typedef std::map<ObjectPtr, boost::shared_ptr<GeomAPI_AISObject> > ResultToAISMap;
ResultToAISMap myResult2AISObjectMap;
};
std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSkip) const
{
- std::set<ResultPtr> aPrsFeatures;
+ std::set<ObjectPtr> aPrsFeatures;
std::list<ModuleBase_ViewerPrs> aPresentations;
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
continue;
- ResultPtr aFeature = myWorkshop->displayer()->getResult(anIO);
+ ObjectPtr aFeature = myWorkshop->displayer()->getObject(anIO);
if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
continue;
Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
std::list<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted(int theShapeTypeToSkip) const
{
- std::set<ResultPtr> aPrsFeatures;
+ std::set<ObjectPtr> aPrsFeatures;
std::list<ModuleBase_ViewerPrs> aPresentations;
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
continue;
- ResultPtr aResult = myWorkshop->displayer()->getResult(anIO);
+ ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO);
if (aPrsFeatures.find(aResult) != aPrsFeatures.end())
continue;
aPresentations.push_back(ModuleBase_ViewerPrs(aResult, aShape, NULL));
return myWorkshop->objectBrowser()->selectedObjects();
}
-QResultList XGUI_Selection::selectedResults() const
+QList<ObjectPtr> XGUI_Selection::selectedPresentations() const
{
- QResultList aSelectedList;
+ QList<ObjectPtr> 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);
+ ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO);
if (aResult)
aSelectedList.append(aResult);
}
/**
* Returns list of currently selected results
*/
- virtual QResultList selectedResults() const;
+ virtual QList<ObjectPtr> selectedPresentations() const;
//! Returns list of currently selected QModelIndexes
virtual QModelIndexList selectedIndexes() const;
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);
+ ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO);
if (aResult)
aFeatures.append(aResult);
}
{
std::set<ObjectPtr> aObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
- bool isDisplayed = false;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObj = (*aIt);
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- if (aRes) {
- if (aRes->data())
- isDisplayed = myDisplayer->redisplay(aRes, false);
- else {
- myDisplayer->erase(aRes, false);
- isDisplayed = true;
- }
+ if (aObj->data())
+ myDisplayer->display(aObj, false);
+ else {
+ myDisplayer->erase(aObj, false);
}
}
- if (isDisplayed)
- myDisplayer->updateViewer();
+ myDisplayer->updateViewer();
}
//******************************************************
void XGUI_Workshop::onFeatureCreatedMsg(const Model_ObjectUpdatedMessage* theMsg)
{
- std::set<ObjectPtr> aFeatures = theMsg->objects();
+ std::set<ObjectPtr> aObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
bool aHasPart = false;
bool isDisplayed = false;
- for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+ for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
if (aPart) {
aHasPart = true;
//break;
} else {
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(*aIt);
- if (aRes)
- isDisplayed = myDisplayer->display(aRes, false);
+ myDisplayer->display(*aIt, false);
+ isDisplayed = true;
}
}
if (isDisplayed)