if (isNewTransaction)
aMgr->startOperation("Activation");
aMgr->setActiveDocument(aMgr->moduleDocument());
- if (isNewTransaction) aMgr->finishOperation();
+ if (isNewTransaction)
+ aMgr->finishOperation();
myModule->workshop()->updateCommandStatus();
}
// If the object is a field result then delete extra sub-objects
if (aFieldRes.get()) {
+ // Call shape in order to update content of Field.
+ // It is necessary to do for cases when field was created by script when module is inactive.
+ aFieldRes->shape();
while (myChildren.size() > aNb) {
ModuleBase_ITreeNode* aNode = myChildren.last();
myChildren.removeAll(aNode);
}
else if (aFieldRes.get()) {
FieldStepPtr aStep = aFieldRes->step(i);
- if (i < myChildren.size()) {
- PartSet_StepNode* aStepNode = static_cast<PartSet_StepNode*>(myChildren.at(i));
- if (aStepNode->object() != aStep) {
- aStepNode->setObject(aStep);
+ if (aStep.get()) {
+ if (i < myChildren.size()) {
+ PartSet_StepNode* aStepNode = static_cast<PartSet_StepNode*>(myChildren.at(i));
+ if (aStepNode->object() != aStep) {
+ aStepNode->setObject(aStep);
+ }
+ }
+ else {
+ aNode = new PartSet_StepNode(aStep, this);
+ myChildren.append(aNode);
}
- }
- else {
- aNode = new PartSet_StepNode(aStep, this);
- myChildren.append(aNode);
}
}
}
ResultFieldPtr aFieldRes = std::dynamic_pointer_cast<ModelAPI_ResultField>(myObject);
ObjectPtr aBody;
int i;
+ // Call shape in order to update content of Field.
+ // It is necessary to do for cases when field was created by script when module is inactive.
+ if (aFieldRes.get())
+ aFieldRes->shape();
for (i = 0; i < aNb; i++) {
aBody = subObject(i);
if (aBody.get()) {
}
else {
FieldStepPtr aStep = aFieldRes->step(i);
- if (i < myChildren.size()) {
- PartSet_StepNode* aStepNode = static_cast<PartSet_StepNode*>(myChildren.at(i));
- if (aStepNode->object() != aStep) {
- aStepNode->setObject(aStep);
+ if (aStep.get()) {
+ if (i < myChildren.size()) {
+ PartSet_StepNode* aStepNode = static_cast<PartSet_StepNode*>(myChildren.at(i));
+ if (aStepNode->object() != aStep) {
+ aStepNode->setObject(aStep);
+ }
+ }
+ else {
+ aNode = new PartSet_StepNode(aStep, this);
+ myChildren.append(aNode);
}
- }
- else {
- aNode = new PartSet_StepNode(aStep, this);
- myChildren.append(aNode);
}
}
}
SUIT_DataBrowser* aBrowser = getApp()->objectBrowser();
if (aBrowser)
delete aBrowser;
+ myWorkshop->displayer()->updateViewer();
}
//******************************************************
aDocs.append(aMgr->moduleDocument());
foreach(DocumentPtr aDoc, aDocs) {
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultConstruction::group(), false);
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultBody::group(), false);
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultPart::group(), false);
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultGroup::group(), false);
+ synchronizeGroupInViewer(aDoc, false);
}
}
//******************************************************
void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
- const std::string& theGroup,
bool theUpdateViewer)
{
- ObjectPtr aObj;
- int aSize = theDoc->size(theGroup);
+ FeaturePtr aFeature;
+ ResultPtr aRes;
+ int aSize = theDoc->numInternalFeatures();
for (int i = 0; i < aSize; i++) {
- aObj = theDoc->object(theGroup, i);
- if (aObj->isDisplayed()) {
- // 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
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull()))
- continue;
- ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObj);
- if (aResBody.get())
- synchronizeResultTree(aResBody, false);
- else
- myDisplayer->display(aObj, false);
+ aFeature = theDoc->internalFeature(i);
+ const std::list<ResultPtr>& aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ aFeature->setDisplayed(false);
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+ aRes = (*aIt);
+ if (aRes->isDisplayed() && !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 (!aRes->shape().get() || aRes->shape()->isNull())
+ continue;
+ ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+ if (aResBody.get())
+ synchronizeResultTree(aResBody, false);
+ else {
+ if (aRes->isInHistory()) {
+ if (aRes->isDisplayed())
+ myDisplayer->display(aRes, false);
+ else
+ myDisplayer->erase(aRes, false);
+ }
+ else
+ aRes->setDisplayed(false);
+ }
+ }
}
}
if (theUpdateViewer)
/// Has to be called in order to display objects from a specifed group
/// with visibility status = true
/// \param theDoc the document for objects synchronisation
- /// \param theGroup the group name
/// \param theUpdateViewer update viewer flag
void synchronizeGroupInViewer(const DocumentPtr& theDoc,
- const std::string& theGroup,
bool theUpdateViewer);
void synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer);