void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
{
- ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
- PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
- if (aPrevOp) {
- std::list<FeaturePtr> aList = aPrevOp->subFeatures();
- XGUI_Displayer* aDisplayer = myWorkshop->displayer();
- std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
- std::list<FeaturePtr>::iterator aSFIt;
- for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
- std::list<ResultPtr> aResults = (*aSFIt)->results();
- std::list<ResultPtr>::iterator aIt;
- for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- aDisplayer->activateInLocalContext((*aIt), aModes, false);
+// bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
+// if (isDisplay) {
+ ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
+ PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
+ if (aPrevOp) {
+ std::list<FeaturePtr> aList = aPrevOp->subFeatures();
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
+ std::list<FeaturePtr>::iterator aSFIt;
+ for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
+ std::list<ResultPtr> aResults = (*aSFIt)->results();
+ std::list<ResultPtr>::iterator aIt;
+ for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+ aDisplayer->activateInLocalContext((*aIt), aModes, false);
+ }
+ }
+ FeaturePtr aFeature = aPrevOp->feature();
+ if (aFeature) {
+ std::list<ResultPtr> aResList = aFeature->results();
+ std::list<ResultPtr>::iterator aIt;
+ for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt) {
+ aDisplayer->deactivate((*aIt), false);
+ }
}
}
- }
- ModelAPI_EventCreator::get()->sendUpdated(theFeature,
- Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
-
+ ModelAPI_EventCreator::get()->sendUpdated(theFeature,
+ Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+// }
+// else
+// ->erase(theFeature->firstResult(), true);
/* bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
// TODO visualizePreview(theFeature, isDisplay, false);
if (!isDisplay) {
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature),
isUpdateViewer);
-/* FeaturePtr aFeature = aPreviewOp->feature();
- if (aFeature) {
- std::list<ResultPtr> aResList = aFeature->results();
- std::list<ResultPtr>::iterator aIt;
- for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt) {
- aDisplayer->deactivate((*aIt), false);
- }
- }*/
}
}
if (!isVisible(theObject))
return;
+ Handle(AIS_InteractiveObject) aAISIO;
boost::shared_ptr<GeomAPI_AISObject> aAISObj = getAISObject(theObject);
GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
if (aPrs) {
erase(theObject, isUpdateViewer);
return;
}
- Handle(AIS_InteractiveObject) aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
- AISContext()->Redisplay(aAISIO, isUpdateViewer);
+ aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
} else {
ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult) {
Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj->impl<Handle(AIS_InteractiveObject)>());
if (!aAISShape.IsNull()) {
aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
- AISContext()->Redisplay(aAISShape, isUpdateViewer);
+ aAISIO = aAISShape;
}
}
}
}
+ if (!aAISIO.IsNull()) {
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ aContext->Redisplay(aAISIO, isUpdateViewer);
+ //if (aContext->HasOpenedContext()) {
+ // aContext->Load(aAISIO, -1, true/*allow decomposition*/);
+ //}
+ }
}
void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult,
updateViewer();
}
-void XGUI_Displayer::deactvate(ObjectPtr theObject, bool toUpdate)
+void XGUI_Displayer::deactivate(ObjectPtr theObject, bool toUpdate)
{
if (isVisible(theObject)) {
Handle(AIS_InteractiveContext) aContext = AISContext();
std::set<ObjectPtr>::const_iterator aIt;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObj = (*aIt);
- if (aObj->data())
- myDisplayer->display(aObj, false);
- else {
+ if (!aObj->data() )
myDisplayer->erase(aObj, false);
+ else {
+ if (myDisplayer->isVisible(aObj)) // TODO VSV: Correction sketch drawing
+ myDisplayer->display(aObj, false); // In order to update presentation
}
}
myDisplayer->updateViewer();
bool aHasPart = false;
bool isDisplayed = false;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
+ ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
if (aPart) {
aHasPart = true;
- //break;
} else {
myDisplayer->display(*aIt, false);
isDisplayed = true;