// Display all sketcher sub-Objects
myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theOperation->feature());
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
- XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
// Hide sketcher result
std::list<ResultPtr> aResults = myCurrentSketch->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- aDisplayer->erase((*aIt), false);
+ (*aIt)->setDisplayed(false);
}
- aDisplayer->erase(myCurrentSketch, false);
+ myCurrentSketch->setDisplayed(false);
// Display sketcher objects
for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
std::list<ResultPtr> aResults = aFeature->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- aDisplayer->display((*aIt), false);
+ (*aIt)->setDisplayed(true);
}
- aDisplayer->display(aFeature, false);
+ aFeature->setDisplayed(true);
}
if (myPlaneFilter.IsNull())
std::shared_ptr<GeomAPI_Pln> aPln = PartSet_Tools::sketchPlane(myCurrentSketch);
myPlaneFilter->setPlane(aPln->impl<gp_Pln>());
}
- aDisplayer->updateViewer();
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
// all sketch objects should be activated in the sketch selection modes by edit operation start
if (theOperation->isEditOperation())
activateObjectsInSketchMode(true);
activateObjectsInSketchMode(false);
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
- XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
DataPtr aData = myCurrentSketch->data();
if ((!aData) || (!aData->isValid())) {
+ XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
// The sketch was aborted
myCurrentSketch = CompositeFeaturePtr();
myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
foreach (ObjectPtr aObj, aObjects) {
DataPtr aObjData = aObj->data();
if ((!aObjData) || (!aObjData->isValid()))
- aDisplayer->erase(aObj);
+ aObj->setDisplayed(false);
}
return;
}
std::list<ResultPtr> aResults = aFeature->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- aDisplayer->erase((*aIt), false);
+ (*aIt)->setDisplayed(false);
}
- aDisplayer->erase(aFeature, false);
+ aFeature->setDisplayed(false);
}
// Display sketcher result
std::list<ResultPtr> aResults = myCurrentSketch->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- aDisplayer->display((*aIt), false);
+ (*aIt)->setDisplayed(true);
}
- aDisplayer->display(myCurrentSketch);
+ myCurrentSketch->setDisplayed(true);
myCurrentSketch = CompositeFeaturePtr();
myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
- aDisplayer->updateViewer();
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
// it is hidden by a sketch operation start and shown by a sketch stop, just the sketch
// nested features can be visualized
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (aFeature.get() != NULL && aFeature == activeSketch())
+ if (aFeature.get() != NULL && aFeature == activeSketch()) {
aCanDisplay = false;
+ }
}
else { // there are no an active sketch
// 2. sketch sub-features should not be visualized if the sketch operation is not active
if (aFeature.get() != NULL) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSketchFeature.get())
+ if (aSketchFeature.get()) {
aCanDisplay = false;
+ }
}
}
}
}
}
- if (!isObjectFound)
+ if (!isObjectFound) {
+ theObject->setDisplayed(aCanDisplay); // If it be set into True - set to False
return aCanDisplay;
+ }
// 4. For created nested feature operation do not display the created feature if
// the mouse curstor leaves the OCC window.
}
}
#endif
+ theObject->setDisplayed(aCanDisplay); // If it be set into True - set to False
return aCanDisplay;
}
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
- XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
// 1. change visibility of the object itself, here the presentable object is processed,
// e.g. constraints features
FeaturePtr aFeature = theOperation->feature();
std::list<ResultPtr> aResults = aFeature->results();
if (isToDisplay)
- aDisplayer->display(aFeature, false);
+ aFeature->setDisplayed(true);
else
- aDisplayer->erase(aFeature, false);
+ aFeature->setDisplayed(false);
// change visibility of the object results, e.g. non-constraint features
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
if (isToDisplay) {
- aDisplayer->display(*aIt, false);
+ (*aIt)->setDisplayed(true);
}
else {
- aDisplayer->erase(*aIt, false);
+ (*aIt)->setDisplayed(false);
}
}
- aDisplayer->updateViewer();
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
void PartSet_SketcherMgr::activateObjectsInSketchMode(const bool isActive)
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
- XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
const QStringList& aConstrIds = constraintsIdList();
for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
FeaturePtr aSubFeature = myCurrentSketch->subFeature(i);
if (aConstrIds.contains(QString(aSubFeature->getKind().c_str()))) {
if (myIsConstraintsShown)
- aDisplayer->display(aSubFeature, false);
+ aSubFeature->setDisplayed(true);
else
- aDisplayer->erase(aSubFeature, false);
+ aSubFeature->setDisplayed(false);
}
}
- aDisplayer->updateViewer();
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
aLoop->registerListener(this, Events_LongOp::eventID());
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
- aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW));
- aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED));
} else {
QApplication::restoreOverrideCursor();
}
- } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
- std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
- std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
- const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
- QObjectPtrList aList;
- std::set<ObjectPtr>::const_iterator aIt;
- for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
- aList.append(*aIt);
- showObjects(aList, true);
- } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) {
- std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
- std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
- const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
- QObjectPtrList aList;
- std::set<ObjectPtr>::const_iterator aIt;
- for (aIt = aObjList.cbegin(); aIt != aObjList.cend(); ++aIt)
- aList.append(*aIt);
- showObjects(aList, false);
}
//An operation passed by message. Start it, process and commit.
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
setDisplayMode(aObjects, XGUI_Displayer::Shading);
else if (theId == "WIREFRAME_CMD")
setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
- else if (theId == "HIDEALL_CMD")
- myDisplayer->eraseAll();
+ else if (theId == "HIDEALL_CMD") {
+ QObjectPtrList aList = myDisplayer->displayedObjects();
+ foreach (ObjectPtr aObj, aList)
+ aObj->setDisplayed(false);
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ }
}
//**************************************************************
//**************************************************************
void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList)
{
- myDisplayer->showOnly(theList);
+ QObjectPtrList aList = myDisplayer->displayedObjects();
+ foreach (ObjectPtr aObj, aList)
+ aObj->setDisplayed(false);
+ foreach (ObjectPtr aObj, theList)
+ aObj->setDisplayed(true);
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+
}