}
// update for everyone the concealment flag immideately: on edit feature in the midle of history
if (aWasChanged) {
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResList = anIter->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResList.begin();
- for(; aRes != aResList.end(); aRes++) {
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(anIter, aResults);
+ std::list<ResultPtr>::const_iterator aRes = aResults.begin();
+ for(; aRes != aResults.end(); aRes++) {
if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->updateConcealmentFlag();
}
-
+ // update the concealment status for disply in isConcealed of ResultBody
+ for(aRes = aResults.begin(); aRes != aResults.end(); aRes++) {
+ if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
+ (*aRes)->isConcealed();
+ }
}
}
// unblock the flush signals and up them after this
}
}
}
+ for(aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) {
+ FeaturePtr aFeature = aFeatures.Value();
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
+ // update the concealment status for disply in isConcealed of ResultBody
+ std::list<ResultPtr>::iterator aRIter = aResults.begin();
+ for(; aRIter != aResults.cend(); aRIter++) {
+ (*aRIter)->isConcealed();
+ }
+ }
}
TDF_Label Model_Objects::resultLabel(
#include <ModelAPI_AttributeIntArray.h>
#include <ModelAPI_Tools.h>
#include <Config_PropManager.h>
+#include <ModelAPI_Events.h>
// DEB
//#include <TCollection_AsciiString.hxx>
//#include <TDF_Tool.hxx>
Model_ResultBody::Model_ResultBody()
{
myBuilder = new Model_BodyBuilder(this);
+ myWasConcealed = false;
}
void Model_ResultBody::initAttributes()
bool Model_ResultBody::isConcealed()
{
- if (ModelAPI_ResultBody::isConcealed())
- return true;
- ResultPtr aThis = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
- if (aThis.get()) {
- ResultCompSolidPtr aParent = ModelAPI_Tools::compSolidOwner(aThis);
- if (aParent.get()) {
- if (aParent->isConcealed())
- return true;
+ bool aResult = false;
+ if (ModelAPI_ResultBody::isConcealed()) {
+ aResult = true;
+ } else {
+ ResultPtr aThis = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
+ if (aThis.get()) {
+ ResultCompSolidPtr aParent = ModelAPI_Tools::compSolidOwner(aThis);
+ if (aParent.get()) {
+ if (aParent->isConcealed())
+ aResult = true;
+ }
}
}
- return false;
+ if (myWasConcealed != aResult) {
+ myWasConcealed = aResult;
+ if (aResult) { // hidden unit must be redisplayed (hidden)
+ ModelAPI_EventCreator::get()->sendDeleted(document(), this->groupName());
+ // redisplay for the viewer (it must be disappeared also)
+ static Events_ID EVENT_DISP =
+ Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), EVENT_DISP);
+ } else { // was not concealed become concealed => delete event
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
+ }
+ }
+
+ return aResult;
}
/// builders that tores the naming history: one per label to allow store several shapes to one
/// label; index in vector corresponds to the label tag
//std::vector<TNaming_Builder*> myBuilders;
+
+ /// Flag that stores the previous state of "concealed": if it is changed,
+ /// The event is used to redisplay the body.
+ bool myWasConcealed;
public:
/// Request for initialization of data model of the result: adding all attributes
virtual void initAttributes();