//=======================================================================
void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner)
{
+ AIS_NListOfEntityOwner anOwners;
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (anObj.IsNull())
{
{
if (aSelIter.Value()->IsSameSelectable (anObj))
{
- aSeq.Append (aSelIter.Value());
+ anOwners.Append (aSelIter.Value());
}
}
- anObj->HilightSelected (myMainPM, aSeq);
}
else
{
- const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
- const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
- theOwner->HilightWithColor (myMainPM, aStyle, aHiMode);
+ anOwners.Append (theOwner);
}
+ highlightOwners (anOwners);
}
//=======================================================================
//=======================================================================
void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle,
- const Standard_Integer theDispMode) const
+ const Standard_Integer theDispMode)
{
if (theObj.IsNull())
{
return;
}
+ AIS_NListOfEntityOwner anOwners;
if (!aGlobOwner->IsAutoHilight())
{
SelectMgr_SequenceOfOwner aSeq;
{
if (aSelIter.Value()->IsSameSelectable (theObj))
{
- aSeq.Append (aSelIter.Value());
+ anOwners.Append (aSelIter.Value());
}
}
- theObj->HilightSelected (myMainPM, aSeq);
}
else
{
- aGlobOwner->HilightWithColor (myMainPM, theStyle, aHiMode);
+ anOwners.Append (aGlobOwner);
}
+ highlightOwners (anOwners);
}
//=======================================================================
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
+{
+ unhighlightOwners (mySelection->Objects(), theIsToHilightSubIntensity);
+}
+
+//=======================================================================
+//function : unhighlightOwners
+//purpose :
+//=======================================================================
+void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
+ const Standard_Boolean theIsToHilightSubIntensity)
{
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- Handle(AIS_GlobalStatus) aStatus;
- if (!myObjects.Find (anInteractive, aStatus))
+ Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anInteractive);
+ if (!aStatusPtr)
{
continue;
}
anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity)
{
- if (aStatus->IsSubIntensityOn())
+ if ((*aStatusPtr)->IsSubIntensityOn())
{
- const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
+ const Standard_Integer aHiMode = getHilightMode (anInteractive, (*aStatusPtr)->HilightStyle(), (*aStatusPtr)->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode);
}
}
}
if (anOwner == anInteractive->GlobalSelOwner())
{
- myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
+ (*aStatusPtr)->SetHilightStatus (Standard_False);
}
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
//function : unhighlightGlobal
//purpose :
//=======================================================================
-void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const
+void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj)
{
if (theObj.IsNull())
{
return;
}
- if (aGlobOwner->IsAutoHilight())
- {
- aGlobOwner->Unhilight (myMainPM);
- }
- else
- {
- myMainPM->Unhighlight (theObj);
- theObj->ClearSelected();
- }
+ AIS_NListOfEntityOwner anOwners;
+ anOwners.Append (aGlobOwner);
+ unhighlightOwners (anOwners);
}
//=======================================================================
myCurDetected = 0;
myCurHighlighted = 0;
myDetectedSeq.Clear();
+ myLastActiveView = theView.get();
// preliminaires
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
ClearSelected (Standard_False);
+ myLastActiveView = theView.get();
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
ClearSelected (Standard_False);
+ myLastActiveView = theView.get();
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
{
if (!myLastPicked.IsNull())
{
+ Graphic3d_Vec2i aMousePos (-1, -1);
+ if (myMainSel->GetManager().GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point)
+ {
+ aMousePos.SetValues ((Standard_Integer )myMainSel->GetManager().GetMousePosition().X(),
+ (Standard_Integer )myMainSel->GetManager().GetMousePosition().Y());
+ }
+ if (myLastPicked->HandleMouseClick (aMousePos, Aspect_VKeyMouse_LeftButton, Aspect_VKeyFlags_NONE, false))
+ {
+ return AIS_SOP_NothingSelected;
+ }
+
if (myAutoHilight)
{
clearDynamicHighlight();
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
+ myLastActiveView = theView.get();
if (myAutoHilight)
{
UnhilightSelected (Standard_False);
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
+ myLastActiveView = theView.get();
if (myAutoHilight)
{
UnhilightSelected (Standard_False);
{
// In case of selection without using local context
clearDynamicHighlight();
+
+ highlightOwners (mySelection->Objects());
+
+ if (theToUpdateViewer)
+ UpdateCurrentViewer();
+}
+
+//=======================================================================
+//function : highlightOwners
+//purpose :
+//=======================================================================
+void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners)
+{
AIS_MapOfObjSelectedOwners anObjOwnerMap;
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ if (anObj.IsNull())
+ continue;
+
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
- Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
+ Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
+ if (!aStatusPtr)
+ {
+ continue;
+ }
if (anOwner == anObj->GlobalSelOwner())
{
- aState->SetHilightStatus (Standard_True);
- aState->SetHilightStyle (anObjSelStyle);
+ (*aStatusPtr)->SetHilightStatus (Standard_True);
+ (*aStatusPtr)->SetHilightStyle (anObjSelStyle);
}
if (!anOwner->IsAutoHilight())
{
}
else
{
- const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
+ const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, (*aStatusPtr)->DisplayMode());
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
}
}
}
anObjOwnerMap.Clear();
}
-
- if (theToUpdateViewer)
- UpdateCurrentViewer();
}
//=======================================================================
//=======================================================================
void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpdateViewer)
{
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
- const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- if (anOwner == anObj->GlobalSelOwner())
- {
- myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
- }
-
- anOwner->Unhilight (myMainPM);
- }
+ unhighlightSelected();
if (theToUpdateViewer)
UpdateCurrentViewer();
if (!myObjects.IsBound (theObject))
{
- Display (theObject, Standard_False);
+ return;
}
Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
}
if (aSelOwner == aSelectable->GlobalSelOwner())
{
- myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
+ if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (aSelectable))
+ {
+ (*aStatusPtr)->SetHilightStatus (Standard_False);
+ }
}
}
}
if (!myObjects.IsBound (anObject))
- Display (anObject, Standard_False);
+ return;
if (myAutoHilight)
{
}
}
- if (myAutoHilight && theOwner == anObject->GlobalSelOwner())
- {
- Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
- aState->SetHilightStatus (Standard_True);
- aState->SetHilightStyle (anObjSelStyle);
- }
-
if (theToUpdateViewer)
UpdateCurrentViewer();
}
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
- const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
- Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
+ Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
+ if (!aStatusPtr)
+ {
+ return;
+ }
+
if (theOwner->IsSelected())
{
highlightSelected (theOwner);
- if (isGlobal)
- {
- aStatus->SetHilightStatus (Standard_True);
- aStatus->SetHilightStyle (getSelStyle (anObj, theOwner));
- }
}
else
{
- if (theOwner->IsAutoHilight())
- {
- theOwner->Unhilight (myMainPM);
- }
- else
- {
- anObj->ClearSelected();
- }
- aStatus->SetHilightStatus (Standard_False);
- aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
+ AIS_NListOfEntityOwner anOwners;
+ anOwners.Append (theOwner);
+ unhighlightOwners (anOwners);
+
+ (*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}