SelectMgr_ViewerSelector::TraverseSensitives() now takes into account object's view affinity.
AIS_InteractiveContext::moveTo() - dropped code SelectMgr_AndOrFilter::SetDisabledObjects()
as filtering is now done by selector itself.
ViewAffinity property has been moved to PrsMgr_PresentableObject for simplicity.
Removed redundant map Graphic3d_CView::HiddenObjects().
continue;
}
- Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->ObjectAffinity (anObjIter.Key());
+ Handle(Graphic3d_ViewAffinity) anAffinity = anObjIter.Key()->ViewAffinity();
const Standard_Boolean isVisible = anAffinity->IsVisible (aViewId);
if (isVisible == theIsVisibleInView)
{
return;
}
- Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->ObjectAffinity (theIObj);
+ Handle(Graphic3d_ViewAffinity) anAffinity = theIObj->ViewAffinity();
Handle(Graphic3d_CView) aViewImpl = theView->View();
anAffinity->SetVisible (aViewImpl->Identification(), theIsVisible == Standard_True);
- if (theIsVisible)
- {
- theView->View()->ChangeHiddenObjects()->Remove (theIObj.get());
- }
- else
- {
- theView->View()->ChangeHiddenObjects()->Add (theIObj.get());
- }
}
//=======================================================================
if (!myObjects.IsBound (theIObj))
{
setObjectStatus (theIObj, PrsMgr_DisplayStatus_Displayed, theDispMode, theSelectionMode);
- myMainVwr->StructureManager()->RegisterObject (theIObj);
+ theIObj->ViewAffinity()->SetVisible (true); // reset view affinity mask
+ myMainVwr->StructureManager()->RegisterObject (theIObj, theIObj->ViewAffinity());
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
setObjectStatus (theIObj, PrsMgr_DisplayStatus_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
- myMainVwr->StructureManager()->RegisterObject (theIObj);
+ theIObj->ViewAffinity()->SetVisible (true); // reset view affinity mask
+ myMainVwr->StructureManager()->RegisterObject (theIObj, theIObj->ViewAffinity());
}
// Register theIObj in the selection manager to prepare further activation of selection
mgrSelector->Remove (anObj);
setObjectStatus (theIObj, PrsMgr_DisplayStatus_None, -1, -1);
+ theIObj->ViewAffinity()->SetVisible (true); // reset view affinity mask
myMainVwr->StructureManager()->UnregisterObject (theIObj);
- for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
- {
- aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
- }
-
if (!myLastPicked.IsNull())
{
if (myLastPicked->IsSameSelectable (theIObj))
continue;
}
- Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->ObjectAffinity (anObj);
+ Handle(Graphic3d_ViewAffinity) anAffinity = anObj->ViewAffinity();
const Standard_Boolean isVisible = aViewId == -1 || anAffinity->IsVisible (aViewId);
if (!isVisible)
{
myDetectedSeq.Clear();
myLastActiveView = theView.get();
- // preliminaires
+ // preliminaries
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
Standard_Boolean toUpdateViewer = Standard_False;
- myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
-
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
// (the objects must be AIS_Shapes)
const Standard_Integer aDetectedNb = MainSelector()->NbPicked();
return;
}
- aPresentation->CStructure()->ViewAffinity = thePM->StructureManager()->ObjectAffinity (Handle(Standard_Transient) (this));
+ aPresentation->CStructure()->ViewAffinity = myViewAffinity;
if (anOwner->Mode() == AIS_MM_TranslationPlane)
{
Handle(Prs3d_Presentation) aHiPrs = GetHilightPresentation (thePrsMgr);
aHiPrs->Clear();
- aHiPrs->CStructure()->ViewAffinity = thePrsMgr->StructureManager()->ObjectAffinity (Handle(Standard_Transient)(this));
+ aHiPrs->CStructure()->ViewAffinity = myViewAffinity;
aHiPrs->SetTransformPersistence (TransformPersistence());
aHiPrs->SetZLayer (aLayer);
//
myStructureManager (theMgr),
myCamera (new Graphic3d_Camera()),
- myHiddenObjects (new Graphic3d_NMapOfTransient()),
myIsInComputedMode (Standard_False),
myIsActive (Standard_False),
myIsRemoved (Standard_False),
//! Returns number of displayed structures in the view.
virtual Standard_Integer NumberOfDisplayedStructures() const { return myStructsDisplayed.Extent(); }
- //! Returns map of objects hidden within this specific view (not viewer-wise).
- const Handle(Graphic3d_NMapOfTransient)& HiddenObjects() const { return myHiddenObjects; }
-
- //! Returns map of objects hidden within this specific view (not viewer-wise).
- Handle(Graphic3d_NMapOfTransient)& ChangeHiddenObjects() { return myHiddenObjects; }
-
//! Returns Standard_True in case if the structure with the given <theStructId> is
//! in list of structures to be computed and stores computed struct to <theComputedStruct>.
Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
Graphic3d_SequenceOfStructure myStructsToCompute;
Graphic3d_SequenceOfStructure myStructsComputed;
Graphic3d_MapOfStructure myStructsDisplayed;
- Handle(Graphic3d_NMapOfTransient) myHiddenObjects;
Standard_Boolean myIsInComputedMode;
Standard_Boolean myIsActive;
Standard_Boolean myIsRemoved;
}
}
-Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::RegisterObject (const Handle(Standard_Transient)& theObject)
+// ========================================================================
+// function : RegisterObject
+// purpose :
+// ========================================================================
+void Graphic3d_StructureManager::RegisterObject (const Handle(Standard_Transient)& theObject,
+ const Handle(Graphic3d_ViewAffinity)& theAffinity)
{
Handle(Graphic3d_ViewAffinity) aResult;
- if (myRegisteredObjects.Find (theObject.operator->(), aResult))
+ if (myRegisteredObjects.Find (theObject.operator->(), aResult)
+ && aResult == theAffinity)
{
- return aResult;
+ return;
}
- aResult = new Graphic3d_ViewAffinity();
- myRegisteredObjects.Bind (theObject.operator->(), aResult);
- return aResult;
+ myRegisteredObjects.Bind (theObject.operator->(), theAffinity);
}
+// ========================================================================
+// function : UnregisterObject
+// purpose :
+// ========================================================================
void Graphic3d_StructureManager::UnregisterObject (const Handle(Standard_Transient)& theObject)
{
myRegisteredObjects.UnBind (theObject.operator->());
}
-Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::ObjectAffinity (const Handle(Standard_Transient)& theObject) const
+// ========================================================================
+// function : ObjectAffinity
+// purpose :
+// ========================================================================
+const Handle(Graphic3d_ViewAffinity)& Graphic3d_StructureManager::ObjectAffinity (const Handle(Standard_Transient)& theObject) const
{
- Handle(Graphic3d_ViewAffinity) aResult;
- myRegisteredObjects.Find (theObject.operator->(), aResult);
- return aResult;
+ const Handle(Graphic3d_ViewAffinity)* aResult = myRegisteredObjects.Seek (theObject.operator->());
+ if (aResult == nullptr)
+ {
+ static const Handle(Graphic3d_ViewAffinity) aDummy;
+ return aDummy;
+ }
+ return *aResult;
}
// ========================================================================
//! Recomputes all structures from theStructures.
Standard_EXPORT void RecomputeStructures (const NCollection_Map<Graphic3d_Structure*>& theStructures);
- Standard_EXPORT Handle(Graphic3d_ViewAffinity) RegisterObject (const Handle(Standard_Transient)& theObject);
+ Standard_EXPORT void RegisterObject (const Handle(Standard_Transient)& theObject,
+ const Handle(Graphic3d_ViewAffinity)& theAffinity);
Standard_EXPORT void UnregisterObject (const Handle(Standard_Transient)& theObject);
- Standard_EXPORT Handle(Graphic3d_ViewAffinity) ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
+ Standard_EXPORT const Handle(Graphic3d_ViewAffinity)& ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
//! Returns TRUE if Device Lost flag has been set and presentation data should be reuploaded onto graphics driver.
Standard_Boolean IsDeviceLost() const { return myDeviceLostFlag; }
mySelectingVolumeMgr.BuildSelectingVolume();
- TraverseSensitives();
+ TraverseSensitives (-1);
}
//============================================================================
mySelectingVolumeMgr.BuildSelectingVolume();
- TraverseSensitives();
+ TraverseSensitives (-1);
}
//============================================================================
mySelectingVolumeMgr.BuildSelectingVolume();
- TraverseSensitives();
+ TraverseSensitives (-1);
}
//============================================================================
//=======================================================================
PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
: myParent (NULL),
+ myViewAffinity (new Graphic3d_ViewAffinity()),
myDrawer (new Prs3d_Drawer()),
myTypeOfPresentation3d (theType),
myDisplayStatus (PrsMgr_DisplayStatus_None),
//! This method should be called before object displaying to take effect.
Standard_EXPORT virtual void SetMutable (const Standard_Boolean theIsMutable);
+ //! Return view affinity mask.
+ const Handle(Graphic3d_ViewAffinity)& ViewAffinity() const { return myViewAffinity; }
+
//! Returns true if the Interactive Object has display mode setting overriding global setting (within Interactive Context).
Standard_Boolean HasDisplayMode() const { return myDrawer->DisplayMode() != -1; }
PrsMgr_PresentableObject* myParent; //!< pointer to the parent object
PrsMgr_Presentations myPresentations; //!< list of presentations
+ Handle(Graphic3d_ViewAffinity) myViewAffinity; //!< view affinity mask
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; //!< sequence of object-specific clipping planes
Handle(Prs3d_Drawer) myDrawer; //!< main presentation attributes
Handle(Prs3d_Drawer) myHilightDrawer; //!< (optional) custom presentation attributes for highlighting selected object
Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj, theMode);
aPrs->SetZLayer (thePrsObj->ZLayer());
- aPrs->CStructure()->ViewAffinity = myStructureManager->ObjectAffinity (!theSelObj.IsNull() ? theSelObj : thePrsObj);
+ aPrs->CStructure()->ViewAffinity = !theSelObj.IsNull() ? theSelObj->ViewAffinity() : thePrsObj->ViewAffinity();
thePrsObj->Presentations().Append (aPrs);
thePrsObj->Fill (this, aPrs, theMode);
// purpose : Traverses BVH containing all added selectable objects and
// finds candidates for further search of overlap
//=======================================================================
-void SelectMgr_ViewerSelector::TraverseSensitives()
+void SelectMgr_ViewerSelector::TraverseSensitives (const Standard_Integer theViewId)
{
SelectMgr_BVHThreadPool::Sentry aSentry (myBVHThreadPool);
}
else
{
- Standard_Integer aStartIdx = aBVHTree->BegPrimitive (aNode);
- Standard_Integer anEndIdx = aBVHTree->EndPrimitive (aNode);
+ const Standard_Integer aStartIdx = aBVHTree->BegPrimitive (aNode);
+ const Standard_Integer anEndIdx = aBVHTree->EndPrimitive (aNode);
for (Standard_Integer anIdx = aStartIdx; anIdx <= anEndIdx; ++anIdx)
{
- const Handle(SelectMgr_SelectableObject)& aSelectableObject =
- mySelectableObjects.GetObjectById (aBVHSubset, anIdx);
-
- traverseObject (aSelectableObject, aMgr, aCamera, aProjectionMat, aWorldViewMat, aWinSize);
+ const Handle(SelectMgr_SelectableObject)& aSelObj = mySelectableObjects.GetObjectById (aBVHSubset, anIdx);
+ const Handle(Graphic3d_ViewAffinity)& aViewAffinity = aSelObj->ViewAffinity();
+ if (theViewId == -1 || aViewAffinity->IsVisible (theViewId))
+ {
+ traverseObject (aSelObj, aMgr, aCamera, aProjectionMat, aWorldViewMat, aWinSize);
+ }
}
if (aHead < 0)
{
mySelectingVolumeMgr.BuildSelectingVolume();
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
- TraverseSensitives();
+ TraverseSensitives (theView->View()->Identification());
}
//=======================================================================
mySelectingVolumeMgr.BuildSelectingVolume();
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
- TraverseSensitives();
+ TraverseSensitives (theView->View()->Identification());
}
//=======================================================================
mySelectingVolumeMgr.BuildSelectingVolume();
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
- TraverseSensitives();
+ TraverseSensitives (theView->View()->Identification());
}
//=======================================================================
mySelectingVolumeMgr.BuildSelectingVolume();
mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes(), Handle(Graphic3d_SequenceOfHClipPlane)(), NULL);
- TraverseSensitives();
+ TraverseSensitives (theView->View()->Identification());
}
//=======================================================================
//! Traverses BVH containing all added selectable objects and
//! finds candidates for further search of overlap
- Standard_EXPORT void TraverseSensitives();
+ Standard_EXPORT void TraverseSensitives (const Standard_Integer theViewId = -1);
//! Internal function that checks if there is possible overlap between some entity of selectable object theObject and
//! current selecting volume.
--- /dev/null
+puts "============"
+puts "0031965: Visualization - AIS_InteractiveContext::HilightWithColor() ignores passed highlight style"
+puts "============"
+puts ""
+
+pload MODELING VISUALIZATION
+vinit V1/RootView -width 1024 -height 512 -composer 0
+vbackground GRAY20
+
+vinit V2/ViewLeft -parent V1/RootView -width 0.5 -height 1.0
+vbackground GRAY30
+
+box b 100 200 300
+vdisplay -dispMode 1 b
+vaspects b -faceBoundaryDraw 1
+vfit
+vviewcube vc
+
+vinit V2/ViewRight -parent V1/RootView -width 0.5 -height 1.0 -left 0.5
+vbackground GRAY40
+psphere s 300
+vdisplay -dispMode 1 s
+vaspects s -material SILVER
+vfit
+vzbufftrihedron
+
+vactivate V2/ViewLeft
+verase s -view
+vcamera -rotationMode pick
+vmoveto 100 100
+if { [string match "*Select3D_SensitiveSphere*" [vstate -entities]] } { puts "Error: sphere should NOT be detected" }
+
+vseldump $::imagedir/${::casename}_sel.png -type entity
+vdump $::imagedir/${::casename}_vis.png