-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "XGUI_FacesPanel.h"
+#include "XGUI_ObjectsBrowser.h"
+#include "XGUI_SelectionMgr.h"
+#include "XGUI_Tools.h"
+#include "XGUI_Workshop.h"
+
+#include <ModuleBase_IModule.h>
+#include <ModuleBase_ISelection.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_IViewer.h>
+#include <ModuleBase_ListView.h>
+#include <ModuleBase_ResultPrs.h>
+#include <ModuleBase_Tools.h>
+#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_SelectionFilterType.h>
#include <Config_PropManager.h>
#include <Events_Loop.h>
#include <ModelAPI_Events.h>
-#include <ModuleBase_IModule.h>
-#include <ModuleBase_ISelection.h>
-#include "ModuleBase_IWorkshop.h"
-#include "ModuleBase_ListView.h"
-#include "ModuleBase_ResultPrs.h"
-#include "ModuleBase_Tools.h"
-#include "ModuleBase_ViewerPrs.h"
-
-#include "XGUI_ObjectsBrowser.h"
-#include "XGUI_SelectionMgr.h"
-#include "XGUI_SelectionFilterType.h"
-#include "XGUI_Tools.h"
-#include "XGUI_Workshop.h"
-
#include <QAction>
#include <QCheckBox>
#include <QFocusEvent>
aPrs->interactive());
if (aResultPrs.IsNull())
continue;
+ QString aItemName = XGUI_Tools::generateName(aPrs);
+ if (myListView->hasItem(aItemName))
+ return;
myItems.insert(myLastItemIndex, aPrs);
- myListView->addItem(generateName(aPrs), myLastItemIndex);
+ myListView->addItem(aItemName, myLastItemIndex);
myLastItemIndex++;
isModified = true;
continue;
Handle(ModuleBase_ResultPrs) aResultPrs = anObjectToPrs.at(anObject);
- if (aResultPrs->hasSubShapeVisible(anIt->second) || useTransparency()) // redisplay
- ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
- else { // erase object because it is entirely hidden
+ if (!aResultPrs->hasSubShapeVisible(anIt->second)) { // redisplay
+ // erase object because it is entirely hidden
anObject->setDisplayed(false);
myHiddenObjects.insert(anObject);
- ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
}
+ ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
}
if (isModified) {
updateProcessedObjects(myItems, myItemObjects);
flushRedisplay();
}
+ onTransparencyChanged();
}
//********************************************************************
bool isRedisplayed = redisplayObjects(aRestoredObjects);
isRedisplayed = displayHiddenObjects(aRestoredObjects, myHiddenObjects)
|| isRedisplayed;
- if (isRedisplayed)
+ if (isRedisplayed) {
flushRedisplay();
+ myWorkshop->viewer()->update();
+ }
// should be after flush of redisplay to have items object to be updated
updateProcessedObjects(myItems, myItemObjects);
+
}
myListView->removeSelectedItems();
emit closed();
}
-//********************************************************************
-QString XGUI_FacesPanel::generateName(const ModuleBase_ViewerPrsPtr& thePrs)
-{
- if (!thePrs.get() || !thePrs->object().get())
- return "Undefined";
-
- GeomShapePtr aContext;
- ObjectPtr anObject = thePrs->object();
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
- if (aResult.get())
- aContext = aResult->shape();
- else {
- // TODO if there is this case
- }
-
- QString aName = anObject->data()->name().c_str();
- if (aContext.get()) {
- GeomShapePtr aSubShape(new GeomAPI_Shape());
- aSubShape->setImpl(new TopoDS_Shape(ModuleBase_Tools::getSelectedShape(thePrs)));
- if (!aSubShape->isEqual(aContext))
- aName += QString("_%1").arg(GeomAlgoAPI_CompoundBuilder::id(aContext, aSubShape));
- }
- return aName;
-}
-
//********************************************************************
bool XGUI_FacesPanel::customizeObject(const ObjectPtr& theObject,
const AISObjectPtr& thePresentation)