/// To use virtuality for destructors
MODELAPI_EXPORT virtual ~ModelAPI_Object();
+ /// Returns true if object must be displayed in the viewer: flag is stored in the
+ /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps
+ /// the original state i nthe current transaction.
+ MODELAPI_EXPORT virtual bool isDisplayed();
+
+ /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay"
+ /// signal.
+ MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
+
protected:
/// Sets the data manager of an object (document does)
MODELAPI_EXPORT virtual void setData(std::shared_ptr<ModelAPI_Data> theData);
/// removes all fields from this feature
MODELAPI_EXPORT virtual void erase();
- /// Returns true if object must be displayed in the viewer: flag is stored in the
- /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps
- /// the original state i nthe current transaction.
- MODELAPI_EXPORT virtual bool isDisplayed();
-
- /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay"
- /// signal.
- MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
-
friend class Model_Objects;
};
ObjectPtr aObj = (*aIt);
// Hide the object if it is invalid or concealed one
- bool aHide = !aObj->data() || !aObj->data()->isValid() || aObj->isDisabled();
+ bool aHide = !aObj->data() || !aObj->data()->isValid() ||
+ aObj->isDisabled() || (!aObj->isDisplayed());
if (!aHide) { // check that this is not hidden result
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
aHide = aRes && aRes->isConcealed();
myDisplayer->deactivate(aObj);
}
} else { // display object if the current operation has it
- ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
- if (aOperation && aOperation->hasObject(aObj)) {
+ if (displayObject(aObj)) {
ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
- #ifdef DEBUG_FEATURE_REDISPLAY
- QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
- qDebug(QString(" display object = %1").arg(anObjInfo).toStdString().c_str());
- #endif
- if (displayObject(aObj)) {
+ if (aOperation && aOperation->hasObject(aObj)) {
+ ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
+ #ifdef DEBUG_FEATURE_REDISPLAY
+ QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
+ qDebug(QString(" display object = %1").arg(anObjInfo).toStdString().c_str());
+ #endif
// Deactivate object of current operation from selection
if (myDisplayer->isActive(aObj))
myDisplayer->deactivate(aObj);
//**************************************************************
void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
{
- foreach (ObjectPtr aObj, theList)
- {
+ foreach (ObjectPtr aObj, theList) {
if (isVisible) {
- displayObject(aObj);
+ aObj->setDisplayed(true);
+ //displayObject(aObj);
} else {
- myDisplayer->erase(aObj, false);
+ aObj->setDisplayed(false);
+ //myDisplayer->erase(aObj, false);
}
}
- myDisplayer->updateViewer();
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ //myDisplayer->updateViewer();
}
//**************************************************************
//**************************************************************
void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup)
{
- for (int i = 0; i < theDoc->size(theGroup); i++)
- displayObject(theDoc->object(theGroup, i));
+ for (int i = 0; i < theDoc->size(theGroup); i++)
+ theDoc->object(theGroup, i)->setDisplayed(true);
+ //displayObject(theDoc->object(theGroup, i));
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
//**************************************************************