}
myModule->workshop()->displayer()->updateViewer();
}
- if (aType == EVENT_OBJECT_DELETED)
- {
+ if (aType == EVENT_OBJECT_DELETED) {
const ModelAPI_ObjectDeletedMessage* aDelMsg =
dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
boost::shared_ptr<ModelAPI_Document> aDoc = aDelMsg->document();
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);
+ }
+ }
+ }
ModelAPI_EventCreator::get()->sendUpdated(theFeature,
- Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
/* bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
// TODO visualizePreview(theFeature, isDisplay, false);
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 (!aSPFeature)
continue;
//visualizePreview((*anIt), true, false);
- aDisplayer->activateInLocalContext((*anIt)->firstResult(), aModes, false);
+ aDisplayer->activateInLocalContext((*anIt), aModes, false);
}
aDisplayer->updateViewer();
}
//myFeaturePrs->init(aNewFeature);
//myFeaturePrs->setFeature(myInitFeature, SM_FirstPoint);
- emit featureConstructed(aNewFeature, FM_Activation);
+//TODO emit featureConstructed(aNewFeature, FM_Activation);
if (theFlushMessage)
flushCreated();
return aNewFeature;
std::list<FeaturePtr> PartSet_OperationSketch::subFeatures() const
{
- boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
+ std::list<FeaturePtr> aFeaList;
+ FeaturePtr aFeature = feature();
+ if (!aFeature)
+ return aFeaList;
+
+ boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
if (!aData->isValid())
return std::list<FeaturePtr>();
boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
std::list<ObjectPtr> aList = aRefList->list();
std::list<ObjectPtr>::iterator aIt;
- std::list<FeaturePtr> aFeaList;
for (aIt = aList.begin(); aIt != aList.end(); ++aIt) {
FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aIt);
if (aFeature)
aContext->ClearCurrents(false);
aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
}
-/* std::list<int>::const_iterator anIt;
- for (anIt = theModes.begin(); anIt != theModes.end(); anIt++)
- aContext->ActivateStandardMode((TopAbs_ShapeEnum)(*anIt));
- */
// display or redisplay presentation
Handle(AIS_InteractiveObject) anAIS;
- if (isVisible(theResult))
- {
+ if (isVisible(theResult)) {
boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theResult];
if (anObj)
anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
// Activate selection of objects from prs
if (!anAIS.IsNull()) {
+ aContext->ClearSelected(false); // ToCheck
aContext->Load(anAIS, -1, true/*allow decomposition*/);
aContext->Deactivate(anAIS);
std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
- for (; anIt != aLast; anIt++)
- {
+ for (; anIt != aLast; anIt++) {
aContext->Activate(anAIS, (*anIt));
}
}
updateViewer();
}
+void XGUI_Displayer::deactvate(ObjectPtr theObject, bool toUpdate)
+{
+ if (isVisible(theObject)) {
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+
+ boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+ Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+ aContext->Deactivate(anAIS);
+ }
+}
+
void XGUI_Displayer::stopSelection(const QList<ObjectPtr>& theResults, const bool isStop,
const bool isUpdateViewer)
{
/// \return feature the feature or NULL if it not visualized
ObjectPtr getObject(Handle(AIS_InteractiveObject) theIO) const;
+ void deactvate(ObjectPtr theFeature, bool toUpdate);
+
protected:
/// Deactivate local selection
/// \param isUpdateViewer the state wether the viewer should be updated immediatelly