XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
connect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), this,
SLOT(onStorePoint2D(ObjectPtr, const std::string&)), Qt::UniqueConnection);
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ aDisplayer->openLocalContext();
+ aDisplayer->deactivateObjectsOutOfContext();
}
}
if (!isDisplay)
aDisplayer->erase((*aSFIt), false);
}
+ aDisplayer->deactivateObjectsOutOfContext();
}
if (isDisplay)
ModelAPI_EventCreator::get()->sendUpdated(
if (aSketchOp) {
Handle(StdSelect_FaceFilter) aFilter = new StdSelect_FaceFilter(StdSelect_Plane);
aDisplayer->activateObjectsOutOfContext(aModes, aFilter);
+ } else {
+ aDisplayer->deactivateObjectsOutOfContext();
}
}
}
boost::shared_ptr<GeomAPI_AISObject> anAIS;
GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+ bool isShading = false;
if (aPrs) {
anAIS = aPrs->getAISObject(boost::shared_ptr<GeomAPI_AISObject>());
} else {
if (aShapePtr) {
anAIS = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
anAIS->createShape(aShapePtr);
+ isShading = true;
}
}
}
if (anAIS)
- display(theObject, anAIS, isUpdateViewer);
+ display(theObject, anAIS, isShading, isUpdateViewer);
}
}
-void XGUI_Displayer::display(ObjectPtr theObject, boost::shared_ptr<GeomAPI_AISObject> theAIS,
- bool isUpdateViewer)
+void XGUI_Displayer::display(ObjectPtr theObject, boost::shared_ptr<GeomAPI_AISObject> theAIS,
+ bool isShading, bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
if (aContext.IsNull())
Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAISIO.IsNull()) {
myResult2AISObjectMap[theObject] = theAIS;
- aContext->Display(anAISIO, isUpdateViewer);
+ aContext->Display(anAISIO, false);
+ aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, isUpdateViewer);
}
}
myResult2AISObjectMap.erase(theObject);
}
-/*bool XGUI_Displayer::redisplay(ObjectPtr theObject,
- boost::shared_ptr<GeomAPI_AISObject> theAIS,
- const bool isUpdateViewer)
- {
- bool isCreated = false;
- Handle(AIS_InteractiveObject) anAIS =
- theAIS ? theAIS->impl<Handle(AIS_InteractiveObject)>() : Handle(AIS_InteractiveObject)();
- Handle(AIS_InteractiveContext) aContext = AISContext();
- // Open local context if there is no one
- if (!aContext->HasOpenedContext()) {
- aContext->ClearCurrents(false);
- 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[theObject];
- if (isVisible(theObject) && anObj && !anObj->empty()) {
- aContext->Redisplay(anAIS, isUpdateViewer);
- //aContext->RecomputeSelectionOnly(anAIS);
- }
- else {
- myResult2AISObjectMap[theObject] = theAIS;
- aContext->Display(anAIS, isUpdateViewer);
- isCreated = true;
- }
- return isCreated;
- }*/
-
void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
{
if (!isVisible(theObject))
updateViewer();
}
+void XGUI_Displayer::openLocalContext()
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (aContext.IsNull())
+ return;
+ // 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();
+ aContext->NotUseDisplayedObjects();
+ }
+}
+
void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
{
AISContext()->ClearSelected(false);
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
void eraseDeletedResults(const bool isUpdateViewer = true);
+ void openLocalContext();
+
/// Deactivates selection of sub-shapes
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
void closeLocalContexts(const bool isUpdateViewer = true);
/// \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,
+ void display(ObjectPtr theObject, boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isShading,
bool isUpdateViewer = true);
/// Display the shape and activate selection of sub-shapes