-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 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
#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
+#include <Standard_Version.hxx>
#ifdef TINSPECTOR
#include <inspector/VInspectorAPI_CallBack.hxx>
#include <set>
+#ifdef _MSC_VER
+#pragma warning(disable: 4702)
+#endif
+
/// defines the local context mouse selection sensitivity
const int MOUSE_SENSITIVITY_IN_PIXEL = 10;
//**************************************************************
XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
-: myWorkshop(theWorkshop), myNeedUpdate(false),
- myViewerBlockedRecursiveCount(0), myContextId(0)
+: myWorkshop(theWorkshop),
+ myViewerBlockedRecursiveCount(0),
+ myContextId(0),
+ myNeedUpdate(false)
{
+ BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True);
}
//**************************************************************
aScreen->setViewScale(getViewScale());
}
anAIS = aPrs->getAISObject(anAIS);
+ if (anAIS.get())
+ myWorkshop->module()->customizePresentation(theObject, anAIS);
} else {
anAIS = myWorkshop->module()->createPresentation(theObject);
isShading = true;
int aDispMode = isShading? Shading : Wireframe;
anAISIO->SetDisplayMode(aDispMode);
- aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
+ aContext->Display(anAISIO, aDispMode, 0, false, AIS_DS_Displayed);
#ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Display(anAISIO);
#endif
double aTransparency = ModelAPI_Tools::getTransparency(aResult);
if ((aTransparency >= 0) && (aTransparency != aAISObj->getTransparency()))
aAISObj->setTransparency(aTransparency);
+
+ // Set Iso-Lines
+ Handle(ModuleBase_ResultPrs) aResPrs = Handle(ModuleBase_ResultPrs)::DownCast(aAISIO);
+ if (!aResPrs.IsNull())
+ aResPrs->updateIsoLines();
}
- myWorkshop->module()->storeSelection();
+ //myWorkshop->module()->storeSelection();
-#ifdef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
- myWorkshop->selector()->deselectPresentation(aAISIO);
-#endif
+//#ifdef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
+ //myWorkshop->selector()->deselectPresentation(aAISIO);
+//#endif
if (aContext->IsDisplayed(aAISIO))
aContext->Redisplay(aAISIO, false);
#endif
//if (aNeedToRestoreSelection)
- myWorkshop->module()->restoreSelection();
+ //myWorkshop->module()->restoreSelection();
aRedisplayed = true;
#ifdef DEBUG_FEATURE_REDISPLAY
if (!theIO.IsNull()) {
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(theIO));
}
- anObject = myWorkshop->module()->findPresentedObject(anAISObj);
+ if (myWorkshop->module())
+ anObject = myWorkshop->module()->findPresentedObject(anAISObj);
}
return anObject;
}
//aContext->DefaultDrawer()->VIsoAspect()->SetNumber(0);
//aContext->DefaultDrawer()->UIsoAspect()->SetNumber(0);
- //Handle(AIS_Trihedron) aTrihedron = myWorkshop->viewer()->trihedron();
- //aTrihedron->getHighlightPointAspect()->SetScale(2.0);
- //aTrihedron->getHighlightPointAspect()->SetTypeOfMarker(Aspect_TOM_O_STAR);
-
// Commented out according to discussion in bug #2825
ModuleBase_IViewer::DefaultHighlightDrawer = aContext->HighlightStyle();
//Handle(Prs3d_Drawer) aSelStyle = aContext->SelectionStyle();
//ModuleBase_IViewer::DefaultHighlightDrawer->SetDeviationCoefficient(aDeflection);
//aSelStyle->SetDeviationCoefficient(aDeflection);
+
+ Handle(AIS_Trihedron) aTrihedron = myWorkshop->viewer()->trihedron();
+ if (!aTrihedron.IsNull())
+ ModuleBase_Tools::setPointBallHighlighting(aTrihedron.get());
}
return aContext;
}
Handle(AIS_InteractiveContext) aContext = AISContext();
Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!aContext.IsNull() && !anAISIO.IsNull()) {
- aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, true, AIS_DS_Displayed);
+ aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, AIS_DS_Displayed);
#ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Display(anAISIO);
#endif
ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator anIt = aResults.begin(), aLast = aResults.end();
for (; anIt != aLast; ++anIt) {
- AISObjectPtr aAISObj = getAISObject(*anIt);
- if (aAISObj.get() != NULL) {
- Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+ AISObjectPtr aCurAISObj = getAISObject(*anIt);
+ if (aCurAISObj.get() != NULL) {
+ Handle(AIS_InteractiveObject) anAIS = aCurAISObj->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
thePresentations.Add(anAIS);
}
0 /*wireframe*/,
-1 /* selection mode */,
Standard_True /* update viewer*/,
- Standard_False /* allow decomposition */,
AIS_DS_Displayed /* xdisplay status */);
#ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Display(aTrihedron);
/// OCCT: to write about the problem that active owners method returns one owner several times
QList<size_t> aSelectedIds; // Remember of selected address in order to avoid duplicates
for (; anOwnersIt.More(); anOwnersIt.Next()) {
- anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+ anOwner = anOwnersIt.Value();
if (aSelectedIds.contains((size_t)anOwner.get()))
continue;
aSelectedIds.append((size_t)anOwner.get());
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
if (!BROwnr.IsNull() && BROwnr->HasShape()) {
const TopoDS_Shape& aShape = BROwnr->Shape();
+
+ Handle(ModuleBase_ResultPrs) aResPrs =
+ Handle(ModuleBase_ResultPrs)::DownCast(BROwnr->Selectable());
+ TopoDS_Shape aRealShape;
+ if (!aResPrs.IsNull()) {
+ aRealShape = aResPrs->originalShape();
+ }
+
if (aShape.IsNull())
continue;
// isSame should be used here as it does not check orientation of shapes
// despite on isEqual of shapes or IsBound for shape in QMap. Orientation is
// different for Edges shapes in model shape and owner even if this is the same shape
- if (ModuleBase_Tools::isSameShape(aParameterShape, aShape)) {
+ bool isSame = ModuleBase_Tools::isSameShape(aParameterShape, aShape);
+ if (!isSame) {
+ // In case of using HideFaces panel we can have instead of an original shape
+ // a compaund of faces which represent original shape with hidden faces.
+ // So, we have to compare the parameter with original shape
+ if (!aRealShape.IsNull())
+ isSame = ModuleBase_Tools::isSameShape(aParameterShape, aRealShape);
+ }
+ if (isSame) {
Handle(AIS_InteractiveObject) anOwnerPresentation =
Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
NCollection_Map<Handle(AIS_InteractiveObject)> aPresentations =
Handle(AIS_Shape) anOwnerPresentation =
Handle(AIS_Shape)::DownCast(anOwner->Selectable());
const TopoDS_Shape& aPresentationShape = anOwnerPresentation->Shape();
- if (aParameterShape.IsSame(anOwnerPresentation->Shape()) &&
+ if (aParameterShape.IsSame(aPresentationShape) &&
!aCompsolidPresentations.Contains(anOwnerPresentation))
aCompsolidPresentations.Add(anOwnerPresentation);
}