mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
0030737: Visualization - implementing new selection schemes in context
#apply selection scheme to container of owners (cherry picked from commit 91ed0554e0c7d8b8cca6f86b8fe1a0891e55c3ed) # Conflicts: # src/AIS/AIS_InteractiveContext_1.cxx
This commit is contained in:
@@ -161,13 +161,6 @@ myIsAutoActivateSelMode(Standard_True)
|
|||||||
aStyle->SetMethod(Aspect_TOHM_COLOR);
|
aStyle->SetMethod(Aspect_TOHM_COLOR);
|
||||||
aStyle->SetColor (Quantity_NOC_GRAY40);
|
aStyle->SetColor (Quantity_NOC_GRAY40);
|
||||||
}
|
}
|
||||||
SetSelectionScheme (AIS_SelectionType_Select, AIS_SelectionScheme_ClearAndAdd);
|
|
||||||
SetSelectionScheme (AIS_SelectionType_SelectInRect, AIS_SelectionScheme_ClearAndAdd);
|
|
||||||
SetSelectionScheme (AIS_SelectionType_SelectInPoly, AIS_SelectionScheme_ClearAndAdd);
|
|
||||||
SetSelectionScheme (AIS_SelectionType_ShiftSelect, AIS_SelectionScheme_Switch);
|
|
||||||
SetSelectionScheme (AIS_SelectionType_ShiftSelectInRect, AIS_SelectionScheme_Switch);
|
|
||||||
SetSelectionScheme (AIS_SelectionType_ShiftSelectInPoly, AIS_SelectionScheme_Switch);
|
|
||||||
|
|
||||||
InitAttributes();
|
InitAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,8 +423,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
setContextToObject (theIObj);
|
setContextToObject (theIObj);
|
||||||
if (!myObjects.IsBound (theIObj))
|
if (!myObjects.IsBound (theIObj))
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
setObjectStatus (theIObj, AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||||
myObjects.Bind (theIObj, aStatus);
|
|
||||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||||
myMainPM->Display(theIObj, theDispMode);
|
myMainPM->Display(theIObj, theDispMode);
|
||||||
if (theSelectionMode != -1)
|
if (theSelectionMode != -1)
|
||||||
@@ -508,8 +500,7 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
|
|||||||
{
|
{
|
||||||
Standard_Integer aDispMode, aHiMod, aSelModeDef;
|
Standard_Integer aDispMode, aHiMod, aSelModeDef;
|
||||||
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
|
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
|
||||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
setObjectStatus (theIObj, AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
|
||||||
myObjects.Bind (theIObj, aStatus);
|
|
||||||
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
myMainVwr->StructureManager()->RegisterObject (theIObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2062,7 +2053,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
|||||||
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
|
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
|
||||||
mgrSelector->Remove (anObj);
|
mgrSelector->Remove (anObj);
|
||||||
|
|
||||||
myObjects.UnBind (theIObj);
|
setObjectStatus (theIObj, AIS_DS_None, -1, -1);
|
||||||
myMainVwr->StructureManager()->UnregisterObject (theIObj);
|
myMainVwr->StructureManager()->UnregisterObject (theIObj);
|
||||||
|
|
||||||
for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
|
for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
|
||||||
@@ -2530,3 +2521,29 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
|
|||||||
anActiveViewIter.Value()->View()->InvalidateZLayerBoundingBox (aLayerId);
|
anActiveViewIter.Value()->View()->InvalidateZLayerBoundingBox (aLayerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : setObjectStatus
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||||
|
const AIS_DisplayStatus theStatus,
|
||||||
|
const Standard_Integer theDispMode,
|
||||||
|
const Standard_Integer theSelectionMode)
|
||||||
|
{
|
||||||
|
if (theStatus != AIS_DS_None)
|
||||||
|
{
|
||||||
|
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
|
||||||
|
myObjects.Bind (theIObj, aStatus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myObjects.UnBind (theIObj);
|
||||||
|
|
||||||
|
for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (theIObj->Children()); aPrsIter.More(); aPrsIter.Next())
|
||||||
|
{
|
||||||
|
Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()));
|
||||||
|
if (aChild.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
setObjectStatus (aChild, theStatus, theDispMode, theSelectionMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -469,13 +469,23 @@ public: //! @name Selection management
|
|||||||
return AddSelect (theObject->GlobalSelOwner());
|
return AddSelect (theObject->GlobalSelOwner());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns selection scheme used in Select
|
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
|
||||||
AIS_SelectionScheme SelectionScheme (const AIS_SelectionType theType) const
|
//! The objects detected are passed to the main viewer, which is then updated.
|
||||||
{ return mySelectionSchemes.Find (theType); }
|
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
|
||||||
|
const Standard_Integer theYPMin,
|
||||||
|
const Standard_Integer theXPMax,
|
||||||
|
const Standard_Integer theYPMax,
|
||||||
|
const Handle(V3d_View)& theView,
|
||||||
|
const AIS_SelectionScheme theSelScheme);
|
||||||
|
|
||||||
|
//! polyline selection; clears the previous picked list
|
||||||
|
Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||||
|
const Handle(V3d_View)& theView,
|
||||||
|
const AIS_SelectionScheme theSelScheme);
|
||||||
|
|
||||||
//! Returns selection scheme used in Select
|
//! Stores and hilights the previous detected; Unhilights the previous picked.
|
||||||
void SetSelectionScheme (const AIS_SelectionType theType, const AIS_SelectionScheme theScheme)
|
//! @sa MoveTo().
|
||||||
{ mySelectionSchemes.Bind (theType, theScheme); }
|
Standard_EXPORT AIS_StatusOfPick Select (const AIS_SelectionScheme theSelScheme);
|
||||||
|
|
||||||
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
|
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
|
||||||
//! The objects detected are passed to the main viewer, which is then updated.
|
//! The objects detected are passed to the main viewer, which is then updated.
|
||||||
@@ -515,6 +525,13 @@ public: //! @name Selection management
|
|||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const Standard_Boolean theToUpdateViewer);
|
const Standard_Boolean theToUpdateViewer);
|
||||||
|
|
||||||
|
//! Sets list of owner selected/deselected using selection scheme
|
||||||
|
//! It is possible that selection of other objects is changed relatively selection scheme .
|
||||||
|
//! \param theOwner owners to change selection state
|
||||||
|
//! \param theSelScheme selection scheme
|
||||||
|
Standard_EXPORT AIS_StatusOfPick Select (const AIS_NListOfEntityOwner& theOwners,
|
||||||
|
const AIS_SelectionScheme theSelScheme);
|
||||||
|
|
||||||
//! Fits the view correspondingly to the bounds of selected objects.
|
//! Fits the view correspondingly to the bounds of selected objects.
|
||||||
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
|
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
|
||||||
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
|
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
|
||||||
@@ -1380,6 +1397,14 @@ protected: //! @name internal methods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Bind/Unbind status to object and object children
|
||||||
|
//! \param theIObj object
|
||||||
|
//! \param theStatus status, if NULL, unbind object
|
||||||
|
Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||||
|
const AIS_DisplayStatus theStatus,
|
||||||
|
const Standard_Integer theDispyMode,
|
||||||
|
const Standard_Integer theSelectionMode);
|
||||||
|
|
||||||
protected: //! @name internal fields
|
protected: //! @name internal fields
|
||||||
|
|
||||||
AIS_DataMapOfIOStatus myObjects;
|
AIS_DataMapOfIOStatus myObjects;
|
||||||
@@ -1399,8 +1424,6 @@ protected: //! @name internal fields
|
|||||||
SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
|
SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
|
||||||
Standard_Boolean myAutoHilight;
|
Standard_Boolean myAutoHilight;
|
||||||
Standard_Boolean myIsAutoActivateSelMode;
|
Standard_Boolean myIsAutoActivateSelMode;
|
||||||
|
|
||||||
NCollection_DataMap<AIS_SelectionType, AIS_SelectionScheme> mySelectionSchemes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
|
DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
|
||||||
|
@@ -452,21 +452,13 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
|||||||
const Standard_Integer theXPMax,
|
const Standard_Integer theXPMax,
|
||||||
const Standard_Integer theYPMax,
|
const Standard_Integer theYPMax,
|
||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const Standard_Boolean toUpdateViewer)
|
const AIS_SelectionScheme theSelScheme)
|
||||||
{
|
{
|
||||||
if (theView->Viewer() != myMainVwr)
|
if (theView->Viewer() != myMainVwr)
|
||||||
{
|
{
|
||||||
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
|
||||||
// new objects are put...
|
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
clearDynamicHighlight();
|
|
||||||
UnhilightSelected (Standard_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPickedOwners;
|
AIS_NListOfEntityOwner aPickedOwners;
|
||||||
@@ -474,19 +466,8 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
|||||||
{
|
{
|
||||||
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
||||||
}
|
}
|
||||||
mySelection->SelectOwners (aPickedOwners, SelectionScheme (AIS_SelectionType_SelectInRect), myFilters);
|
|
||||||
|
|
||||||
if (myAutoHilight)
|
return Select (aPickedOwners, theSelScheme);
|
||||||
{
|
|
||||||
HilightSelected (toUpdateViewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer aSelNum = NbSelected();
|
|
||||||
|
|
||||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
|
||||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
|
||||||
: AIS_SOP_SeveralSelected;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -495,21 +476,13 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
|
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const Standard_Boolean toUpdateViewer)
|
const AIS_SelectionScheme theSelScheme)
|
||||||
{
|
{
|
||||||
if (theView->Viewer() != myMainVwr)
|
if (theView->Viewer() != myMainVwr)
|
||||||
{
|
{
|
||||||
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
|
||||||
// new objects are put...
|
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
clearDynamicHighlight();
|
|
||||||
UnhilightSelected (Standard_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
myMainSel->Pick (thePolyline, theView);
|
myMainSel->Pick (thePolyline, theView);
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPickedOwners;
|
AIS_NListOfEntityOwner aPickedOwners;
|
||||||
@@ -517,26 +490,15 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
|
|||||||
{
|
{
|
||||||
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
||||||
}
|
}
|
||||||
mySelection->SelectOwners (aPickedOwners, SelectionScheme (AIS_SelectionType_SelectInPoly), myFilters);
|
|
||||||
|
|
||||||
if (myAutoHilight)
|
return Select (aPickedOwners, theSelScheme);
|
||||||
{
|
|
||||||
HilightSelected (toUpdateViewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer aSelNum = NbSelected();
|
|
||||||
|
|
||||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
|
||||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
|
||||||
: AIS_SOP_SeveralSelected;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Select
|
//function : Select
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
|
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_SelectionScheme theSelScheme)
|
||||||
{
|
{
|
||||||
// special case: single selection of detected owner - is it necessary ?
|
// special case: single selection of detected owner - is it necessary ?
|
||||||
/*if (myWasLastMain && !myLastinMain.IsNull() && !myAutoHilight &&
|
/*if (myWasLastMain && !myLastinMain.IsNull() && !myAutoHilight &&
|
||||||
@@ -548,63 +510,53 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
|||||||
return getStatusOfPick (NbSelected());
|
return getStatusOfPick (NbSelected());
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
clearDynamicHighlight();
|
|
||||||
UnhilightSelected (Standard_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPickedOwners;
|
AIS_NListOfEntityOwner aPickedOwners;
|
||||||
aPickedOwners.Append (myLastinMain);
|
aPickedOwners.Append (myLastinMain);
|
||||||
mySelection->SelectOwners (aPickedOwners, SelectionScheme (AIS_SelectionType_Select), myFilters);
|
|
||||||
|
|
||||||
if (myAutoHilight)
|
return Select (aPickedOwners, theSelScheme);
|
||||||
{
|
}
|
||||||
HilightSelected (toUpdateViewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(toUpdateViewer)
|
//=======================================================================
|
||||||
{
|
//function : Select
|
||||||
UpdateCurrentViewer();
|
//purpose :
|
||||||
}
|
//=======================================================================
|
||||||
|
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMin,
|
||||||
|
const Standard_Integer theYPMin,
|
||||||
|
const Standard_Integer theXPMax,
|
||||||
|
const Standard_Integer theYPMax,
|
||||||
|
const Handle(V3d_View)& theView,
|
||||||
|
const Standard_Boolean)
|
||||||
|
{
|
||||||
|
return Select (theXPMin, theYPMin, theXPMax, theYPMax, theView, AIS_SelectionScheme_ClearAndAdd);
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Integer aSelNum = NbSelected();
|
//=======================================================================
|
||||||
|
//function : Select
|
||||||
|
//purpose : Selection by polyline
|
||||||
|
//=======================================================================
|
||||||
|
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||||
|
const Handle(V3d_View)& theView,
|
||||||
|
const Standard_Boolean)
|
||||||
|
{
|
||||||
|
return Select (thePolyline, theView, AIS_SelectionScheme_ClearAndAdd);
|
||||||
|
}
|
||||||
|
|
||||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
//=======================================================================
|
||||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
//function : Select
|
||||||
: AIS_SOP_SeveralSelected;
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean)
|
||||||
|
{
|
||||||
|
return Select (AIS_SelectionScheme_ClearAndAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ShiftSelect
|
//function : ShiftSelect
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
|
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean)
|
||||||
{
|
{
|
||||||
AIS_NListOfEntityOwner aPrevSelected = mySelection->Objects();
|
return Select (AIS_SelectionScheme_Switch);
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
clearDynamicHighlight();
|
|
||||||
UnhilightSelected (Standard_False);
|
|
||||||
}
|
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPickedOwners;
|
|
||||||
aPickedOwners.Append (myLastinMain);
|
|
||||||
mySelection->SelectOwners (aPickedOwners, SelectionScheme (AIS_SelectionType_ShiftSelect), myFilters);
|
|
||||||
|
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
HilightSelected (toUpdateViewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toUpdateViewer)
|
|
||||||
UpdateCurrentViewer();
|
|
||||||
|
|
||||||
Standard_Integer aSelNum = NbSelected();
|
|
||||||
|
|
||||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
|
||||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
|
||||||
: AIS_SOP_SeveralSelected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -616,39 +568,9 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
|||||||
const Standard_Integer theXPMax,
|
const Standard_Integer theXPMax,
|
||||||
const Standard_Integer theYPMax,
|
const Standard_Integer theYPMax,
|
||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const Standard_Boolean toUpdateViewer)
|
const Standard_Boolean)
|
||||||
{
|
{
|
||||||
if (theView->Viewer() != myMainVwr)
|
return Select (theXPMin, theYPMin, theXPMax, theYPMax, theView, AIS_SelectionScheme_Switch);
|
||||||
{
|
|
||||||
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
|
|
||||||
}
|
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPrevSelected = mySelection->Objects();
|
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
clearDynamicHighlight();
|
|
||||||
UnhilightSelected (Standard_False);
|
|
||||||
}
|
|
||||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPickedOwners;
|
|
||||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
|
||||||
{
|
|
||||||
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
|
||||||
}
|
|
||||||
mySelection->SelectOwners (aPickedOwners, SelectionScheme (AIS_SelectionType_ShiftSelectInRect), myFilters);
|
|
||||||
|
|
||||||
if (myAutoHilight)
|
|
||||||
{
|
|
||||||
HilightSelected (toUpdateViewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Integer aSelNum = NbSelected();
|
|
||||||
|
|
||||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
|
||||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
|
||||||
: AIS_SOP_SeveralSelected;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -657,31 +579,31 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
|
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
|
||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const Standard_Boolean toUpdateViewer)
|
const Standard_Boolean)
|
||||||
{
|
{
|
||||||
if (theView->Viewer() != myMainVwr)
|
return Select (thePolyline, theView, AIS_SelectionScheme_Switch);
|
||||||
{
|
}
|
||||||
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
|
|
||||||
}
|
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPrevSelected = mySelection->Objects();
|
//=======================================================================
|
||||||
|
//function : Select
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_NListOfEntityOwner& theOwners,
|
||||||
|
const AIS_SelectionScheme theSelScheme)
|
||||||
|
{
|
||||||
|
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||||
|
// new objects are put...
|
||||||
if (myAutoHilight)
|
if (myAutoHilight)
|
||||||
{
|
{
|
||||||
clearDynamicHighlight();
|
clearDynamicHighlight();
|
||||||
UnhilightSelected (Standard_False);
|
UnhilightSelected (Standard_False);
|
||||||
}
|
}
|
||||||
myMainSel->Pick (thePolyline, theView);
|
|
||||||
|
|
||||||
AIS_NListOfEntityOwner aPickedOwners;
|
mySelection->SelectOwners (theOwners, theSelScheme, myFilters);
|
||||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
|
||||||
{
|
|
||||||
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
|
||||||
}
|
|
||||||
mySelection->SelectOwners (aPickedOwners, SelectionScheme (AIS_SelectionType_ShiftSelectInPoly), myFilters);
|
|
||||||
|
|
||||||
if (myAutoHilight)
|
if (myAutoHilight)
|
||||||
{
|
{
|
||||||
HilightSelected (toUpdateViewer);
|
HilightSelected (Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer aSelNum = NbSelected();
|
Standard_Integer aSelNum = NbSelected();
|
||||||
|
@@ -20,12 +20,15 @@
|
|||||||
//! It is possible to use combination of schemes.
|
//! It is possible to use combination of schemes.
|
||||||
enum AIS_SelectionScheme
|
enum AIS_SelectionScheme
|
||||||
{
|
{
|
||||||
|
AIS_SelectionScheme_Empty = 0x0000, // do nothing
|
||||||
AIS_SelectionScheme_Clear = 0x0001, // clears current selection
|
AIS_SelectionScheme_Clear = 0x0001, // clears current selection
|
||||||
AIS_SelectionScheme_Add = 0x0002, // add detected object to current selection
|
AIS_SelectionScheme_Add = 0x0002, // add detected object to current selection
|
||||||
AIS_SelectionScheme_Switch = 0x0004, // switch selection state in values selected/deselected
|
AIS_SelectionScheme_Switch = 0x0004, // switch selection state in values selected/deselected
|
||||||
AIS_SelectionScheme_PickedIfEmpty = 0x0008, // if after switch, result selection is empty, select picked objects
|
AIS_SelectionScheme_PickedIfEmpty = 0x0008, // if after switch, result selection is empty, select picked objects
|
||||||
AIS_SelectionScheme_ClearAndSwitch = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Switch,
|
AIS_SelectionScheme_ClearAndSwitch = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Switch,
|
||||||
AIS_SelectionScheme_ClearAndAdd = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Add
|
AIS_SelectionScheme_ClearAndAdd = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Add,
|
||||||
|
AIS_SelectionScheme_ClearAndSwitchAndPicked = AIS_SelectionScheme_ClearAndSwitch | AIS_SelectionScheme_PickedIfEmpty,
|
||||||
|
AIS_SelectionScheme_Custom // reserved item for custom selection scheme
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _AIS_SelectionScheme_HeaderFile
|
#endif // _AIS_SelectionScheme_HeaderFile
|
||||||
|
Reference in New Issue
Block a user