} else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_ERROR_CHANGED)) {
std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
- std::set<ObjectPtr> aObjects = aUpdMsg->objects();
+ std::set<ObjectPtr> anObjects = aUpdMsg->objects();
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(workshop()->operationMgr()->currentOperation());
FeaturePtr aFeature = aFOperation->feature();
if (aFeature.get()) {
std::set<ObjectPtr>::const_iterator aIt;
- for (aIt = aObjects.begin(); aIt != aObjects.end() && !aFeatureChanged; ++aIt) {
+ for (aIt = anObjects.begin(); aIt != anObjects.end() && !aFeatureChanged; ++aIt) {
aFeatureChanged = ModelAPI_Feature::feature(*aIt) == aFeature;
}
}
const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
#ifdef DEBUG_FEATURE_UPDATED
- std::set<ObjectPtr> aObjects = theMsg->objects();
+ std::set<ObjectPtr> anObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
QStringList anInfo;
- for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+ for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureUpdatedMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureUpdatedMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
std::set<ObjectPtr> aFeatures = theMsg->objects();
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
//******************************************************
void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
- std::set<ObjectPtr> aObjects = theMsg->objects();
+ std::set<ObjectPtr> anObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
#ifdef DEBUG_FEATURE_REDISPLAY
QStringList anInfo;
- for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+ for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureRedisplayMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureRedisplayMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
XGUI_Workshop* aWorkshop = workshop();
bool aFirstVisualizedBody = false;
bool aRedisplayed = false;
- for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+ //std::list<ObjectPtr> aHiddenObjects;
+ for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
ObjectPtr aObj = (*aIt);
// Hide the object if it is invalid or concealed one
if (!aHide) { // check that this is not hidden result
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
aHide = aRes && aRes->isConcealed();
+
+ // Hide the presentation with an empty shape. But isDisplayed state of the object should not
+ // be changed to the object becomes visible when the shape becomes not empty
+ if (!aHide && aRes.get())
+ aHide = !aRes->shape().get() || aRes->shape()->isNull();
}
+
#ifdef DEBUG_RESULT_COMPSOLID
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
if (aRes.get()) {
}
#endif
if (aHide) {
+ //we should provide objects which are hidden in the viewer, e.g. sketch always should visualizes
+ // all sub-features, if some features are to be hidden, sould be proposed may be to removed #1223
+ //aHiddenObjects.push_back(aObj);
aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed;
#ifdef DEBUG_FEATURE_REDISPLAY
// Redisplay the visible object or the object of the current operation
}
}
}
- if (aRedisplayed) {
- customizeCurrentObject();
+ // this processing should be moved in another place in order to do not cause problems in
+ // flush messages chain
+ //if (aHiddenObjects.size() > 0)
+ // myWorkshop->module()->processHiddenObject(aHiddenObjects);
+
+ bool isCustomized = customizeCurrentObject(anObjects, aRedisplayed);
+ if (aRedisplayed || isCustomized) {
//VSV FitAll updated viewer by it self
if (aFirstVisualizedBody)
myWorkshop->viewer()->fitAll();
//******************************************************
void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
- std::set<ObjectPtr> aObjects = theMsg->objects();
+ std::set<ObjectPtr> anObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
#ifdef DEBUG_FEATURE_CREATED
QStringList anInfo;
- for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+ for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureCreatedMsg: %1, %2").arg(aObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureCreatedMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
bool aFirstVisualizedBody = false;
//bool aHasPart = false;
bool aDisplayed = false;
- for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+ for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
ObjectPtr anObject = *aIt;
#ifdef DEBUG_RESULT_COMPSOLID
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
bool isConcealed = aRes && aRes->isConcealed();
aHide = aRes && aRes->isConcealed();
+ // Hide the presentation with an empty shape. But isDisplayed state of the object should not
+ // be changed to the object becomes visible when the shape becomes not empty
+ if (!aHide && aRes.get())
+ aHide = !aRes->shape().get() || aRes->shape()->isNull();
}
if (!aHide) {
// setDisplayed has to be called in order to synchronize internal state of the object
}
}
+ bool isCustomized = customizeCurrentObject(anObjects, aDisplayed);
+
//if (myObjectBrowser)
// myObjectBrowser->processEvent(theMsg);
if (aDisplayed) {
- customizeCurrentObject();
//VSV FitAll updated viewer by it self
if (aFirstVisualizedBody)
myWorkshop->viewer()->fitAll();
aDisplayed = aDisplayer->display(theObj, false);
if (aNb == 0)
theFirstVisualizedBody = true;
- } else
+ } else {
aDisplayed = aDisplayer->display(theObj, false);
-
+ if (aDisplayed) {
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObj);
+ if (aResult.get() != NULL) {
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
+ theFirstVisualizedBody = aShapePtr.get() != NULL;
+ }
+ }
+ }
return aDisplayed;
}
-bool XGUI_WorkshopListener::customizeCurrentObject()
+bool XGUI_WorkshopListener::customizeCurrentObject(const std::set<ObjectPtr>& theObjects,
+ bool theForceRedisplay)
{
- bool aCustomized = false;
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
+ FeaturePtr aCurrentFeature;
if (anOperationMgr->hasOperation()) {
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(anOperationMgr->currentOperation());
if (aFOperation) {
- FeaturePtr aCurrentFeature = aFOperation->feature();
- if (aCurrentFeature.get())
- aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
- ModuleBase_IModule::CustomizeAllObjects, false);
+ aCurrentFeature = aFOperation->feature();
+ }
+ }
+
+ bool aCustomized = false;
+ if (aCurrentFeature.get()) {
+ // the customize presentation should be redisplayed if force redislayed is true or
+ // if a list of message objects contains the operation feature for case when
+ // the feature is hidden, but arguments of the feature are modified
+ // e.g. extrusion is hidden(h=0) but sketch is chosen
+ if (theForceRedisplay || theObjects.find(aCurrentFeature) != theObjects.end()) {
+ aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
+ ModuleBase_IModule::CustomizeArguments, false);
+ aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
+ ModuleBase_IModule::CustomizeResults, false);
+ aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
+ ModuleBase_IModule::CustomizeHighlightedObjects, false);
}
}
return aCustomized;