1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024623: Visualization - improve selection mechanism

Redesign of selection mechanism:
- implemented 3-level BVH tree for selection;
- selection now calculates in 3D space;
- intersection tests were moved to SelectMgr_BaseFrustum descendants;
- removed .cdl files in Select3D and .cdl related to selection in MeshVS;
- SelectMgr_ViewerSelectors are now shared between local and global contexts;
- transformations of sensitive entities are now stored in SelectMgr_SelectableObject only. Sensitive entities are independent from transformations, it is applied to SelectMgr_SelectingVolumeManager instance only;
- connected and multiple connected interactive objects are now represented by their child objects only for SelectMgr_SelectionManager;
- if interactive object has child objects, they will be stored as separate objects in SelectMgr_SelectionManager now.
- test cases bugs/vis/bug24623_1, bug24623_2, bug24623_3, bug24623_4 to test performance and memory issues.
This commit is contained in:
vpa
2015-04-06 12:31:00 +03:00
committed by bugmaster
parent 7a91ad6e81
commit f751596e46
269 changed files with 12626 additions and 11723 deletions

View File

@@ -23,6 +23,7 @@
#include <Graphic3d_Structure.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <StdPrs_Curve.hxx>

View File

@@ -25,6 +25,7 @@
#include <Prs3d_Drawer.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <TopoDS.hxx>

View File

@@ -25,6 +25,7 @@
#include <Prs3d_Drawer.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <TopoDS.hxx>

View File

@@ -22,6 +22,7 @@
#include <Graphic3d_Structure.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <StdPrs_DeflectionCurve.hxx>
#include <TopoDS.hxx>

View File

@@ -19,6 +19,7 @@
#include <AIS_ConcentricRelation.ixx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <Select3D_SensitiveSegment.hxx>

View File

@@ -18,6 +18,7 @@
#include <AIS_ConnectedInteractive.ixx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <Geom_Transformation.hxx>
@@ -287,31 +288,30 @@ void AIS_ConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selectio
if (!myReference->HasSelection (theMode))
{
myReference->UpdateSelection (theMode);
myReference->RecomputePrimitives (theMode);
}
const Handle(SelectMgr_Selection)& TheRefSel = myReference->Selection (theMode);
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Select3D_SensitiveEntity) aSensitive, aNewSensitive;
TopLoc_Location aLocation (Transformation());
anOwner->SetLocation (aLocation);
if (TheRefSel->IsEmpty())
{
myReference->UpdateSelection (theMode);
myReference->RecomputePrimitives (theMode);
}
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
{
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive());
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast (TheRefSel->Sensitive()->BaseSensitive());
if (!aSensitive.IsNull())
{
TopLoc_Location aLocation (Transformation());
// Get the copy of SE3D
aNewSensitive = aSensitive->GetConnected (aLocation);
aNewSensitive = aSensitive->GetConnected();
aNewSensitive->Set(anOwner);
// In case if SE3D caches some location-dependent data
// that must be updated after setting OWN
aNewSensitive->SetLocation (aLocation);
theSelection->Add (aNewSensitive);
}
@@ -330,13 +330,13 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
Shapes2EntitiesMap;
if (!myReference->HasSelection (theMode))
myReference->UpdateSelection (theMode);
myReference->RecomputePrimitives (theMode);
const Handle(SelectMgr_Selection)& aRefSel = myReference->Selection (theMode);
if (aRefSel->IsEmpty() || aRefSel->UpdateStatus() == SelectMgr_TOU_Full)
{
myReference->UpdateSelection (theMode);
myReference->RecomputePrimitives (theMode);
}
Handle(StdSelect_BRepOwner) anOwner;
@@ -352,7 +352,7 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
// sensitive entities associated with aMode
for (aRefSel->Init(); aRefSel->More(); aRefSel->Next())
{
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive());
aSE = Handle(Select3D_SensitiveEntity)::DownCast (aRefSel->Sensitive()->BaseSensitive());
if(!aSE.IsNull())
{
anOwner = Handle(StdSelect_BRepOwner)::DownCast (aSE->OwnerId());
@@ -376,17 +376,14 @@ void AIS_ConnectedInteractive::computeSubShapeSelection (const Handle(SelectMgr_
this,
aSEList.First()->OwnerId()->Priority(),
Standard_True);
anOwner->SetLocation (Transformation());
for (SensitiveList::Iterator aListIt (aSEList); aListIt.More(); aListIt.Next())
{
{
aSE = aListIt.Value();
TopLoc_Location aLocation (Transformation());
aNewSE = aSE->GetConnected (aDummyLoc);
aNewSE = aSE->GetConnected();
aNewSE->Set (anOwner);
// In case if aSE caches some location-dependent data
// that must be updated after setting anOwner
aNewSE->SetLocation (aLocation);
theSelection->Add (aNewSE);
}

View File

@@ -50,8 +50,6 @@
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
#include <Select3D_ListIteratorOfListOfSensitive.hxx>
#include <Select3D_ListOfSensitive.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <Select3D_SensitiveGroup.hxx>
#include <Select3D_SensitiveCurve.hxx>

View File

@@ -32,7 +32,6 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Select3D_ListOfSensitive.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard.hxx>
#include <TCollection_ExtendedString.hxx>

View File

@@ -26,6 +26,7 @@
#include <Geom_Circle.hxx>
#include <ElCLib.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Precision.hxx>

View File

@@ -23,6 +23,7 @@
#include <TopAbs_ShapeEnum.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <BRep_Tool.hxx>

View File

@@ -40,6 +40,7 @@
#include <Select3D_SensitiveCurve.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>

View File

@@ -427,43 +427,16 @@ is
---Purpose:
-- Removes selection mode from Interactive Objects.
-- aMode provides the selection mode index of the entity aniobj.
SetSensitivityMode(me : mutable;
aMode : SensitivityMode from StdSelect) is static;
---Level: Public
---Purpose: Sets the selection sensitivity mode. SM_WINDOW mode
-- uses the specified pixel tolerance to compute the sensitivity
-- value, SM_VIEW mode allows to define the sensitivity manually.
SensitivityMode(me) returns SensitivityMode from StdSelect;
---Level: Public
---Purpose: Returns the selection sensitivity mode.
SetSensitivity(me:mutable;
aPrecision: Real from Standard);
---Level: Public
---Purpose: Sets the sensitivity aPrecision
-- according to the view size for the current context or local
-- context if any is activated.
-- Sets the sensitivity aPrecision in pixels for the current context
-- or local context if any is activated. By default, this
-- sensitivity is equal to 4 pixels.
-- When a local context is open, the defined sensitivity applies to
-- this local context instead of the main context.
Sensitivity (me) returns Real from Standard;
---Level: Public
---Purpose: Returns the selection sensitivity value.
SetPixelTolerance(me:mutable;
aPrecision: Integer from Standard = 4);
aPrecision: Real from Standard = 4.0);
---Level: Public
---Purpose: Define the current selection pixel sensitivity
-- for this context or local context if any one is activated.
-- Warning: When a local context is open the sensitivity is apply on it
-- instead on the main context.
PixelTolerance(me) returns Integer from Standard;
PixelTolerance(me) returns Real from Standard;
---Level: Public
---Purpose: Returns the pixel tolerance.
@@ -1668,9 +1641,10 @@ is
ZDetection(me) returns Boolean;
---Purpose: Retrieves the Z detection state.
Activate(me : mutable;
anIobj : InteractiveObject from AIS;
aMode : Integer from Standard = 0);
Activate(me : mutable;
anIobj : InteractiveObject from AIS;
aMode : Integer from Standard = 0;
theIsForce : Boolean from Standard = Standard_False);
---Purpose: Activates the selection mode aMode whose index is
-- given, for the given interactive entity anIobj.
@@ -1947,10 +1921,10 @@ is
---C++: inline
---C++: return const &
MainSelector(me) returns any ViewerSelector3d from StdSelect;
MainSelector(me) returns ViewerSelector3d from StdSelect;
---C++: inline
---C++: return const &
LocalSelector(me) returns any ViewerSelector3d from StdSelect;
LocalSelector(me) returns ViewerSelector3d from StdSelect;
PurgeDisplay(me:mutable)
returns Integer from Standard;
@@ -1962,12 +1936,6 @@ is
HighestIndex(me) returns Integer from Standard;
DisplayActiveAreas(me:mutable;aView:View from V3d) ;
ClearActiveAreas (me :mutable;
aView: View from V3d) is static;
---Level: Internal
DisplayActiveSensitive(me:mutable;aView : View from V3d) is static;
@@ -1978,9 +1946,6 @@ is
DisplayActiveSensitive(me:mutable;
anObject: InteractiveObject from AIS;
aView : View from V3d) is static;
DisplayActiveAreas(me:mutable;
anObject: InteractiveObject from AIS;
aView : View from V3d) is static;
GetDefModes(me;
anIobj : InteractiveObject from AIS;
@@ -2010,6 +1975,8 @@ is
---Purpose: returns if possible,
-- the first local context where the object is seen
RebuildSelectionStructs (me : mutable);
---Purpose: Rebuilds 1st level of BVH selection forcibly
SetViewAffinity (me : mutable;
theIObj : InteractiveObject from AIS;
theView : View from V3d;
@@ -2017,6 +1984,12 @@ is
---Purpose: setup object visibility in specified view,
-- has no effect if object is not disaplyed in this context.
Disconnect (me : mutable;
theAssembly : InteractiveObject from AIS;
theObjToDisconnect : InteractiveObject from AIS = NULL)
is static;
---Purpose: Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
ObjectsForView (me;
theListOfIO : in out ListOfInteractive from AIS;
theView : View from V3d;

View File

@@ -43,6 +43,7 @@
#include <Prs3d_PlaneAspect.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <Standard_Atomic.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <UnitsAPI.hxx>
#include <AIS_Trihedron.hxx>
@@ -2364,6 +2365,9 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
if (theIObj.IsNull()
|| !myObjects.IsBound (theIObj))
{
// for cases when reference shape of connected interactives was not displayed
// but its selection primitives were calculated
mgrSelector->Remove (theIObj);
return;
}
@@ -2584,65 +2588,11 @@ void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObj
//
}
//=======================================================================
//function : SetSensitivityMode
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetSensitivityMode (const StdSelect_SensitivityMode theMode)
{
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetSensitivityMode (theMode);
}
else
{
myMainSel->SetSensitivityMode (theMode);
}
}
//=======================================================================
//function : SensitivityMode
//purpose :
//=======================================================================
StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const
{
return HasOpenedContext()
? myLocalContexts (myCurLocalIndex)->SensitivityMode()
: myMainSel->SensitivityMode();
}
//=======================================================================
//function : SetSensitivity
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetSensitivity (const Standard_Real thePrecision)
{
if (HasOpenedContext())
{
myLocalContexts(myCurLocalIndex)->SetSensitivity (thePrecision);
}
else
{
myMainSel->SetSensitivity (thePrecision);
}
}
//=======================================================================
//function : Sensitivity
//purpose :
//=======================================================================
Standard_Real AIS_InteractiveContext::Sensitivity() const
{
return HasOpenedContext()
? myLocalContexts(myCurLocalIndex)->Sensitivity()
: myMainSel->Sensitivity();
}
//=======================================================================
//function : SetPixelTolerance
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Real thePrecision)
{
if (HasOpenedContext())
{
@@ -2658,7 +2608,7 @@ void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecis
//function : PixelTolerance
//purpose :
//=======================================================================
Standard_Integer AIS_InteractiveContext::PixelTolerance() const
Standard_Real AIS_InteractiveContext::PixelTolerance() const
{
return HasOpenedContext()
? myLocalContexts (myCurLocalIndex)->PixelTolerance()
@@ -2836,3 +2786,37 @@ Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_Interactive
? theIObj->ZLayer()
: Graphic3d_ZLayerId_UNKNOWN;
}
//=======================================================================
//function : RebuildSelectionStructs
//purpose : Rebuilds 1st level of BVH selection forcibly
//=======================================================================
void AIS_InteractiveContext::RebuildSelectionStructs()
{
myMainSel->RebuildObjectsTree (Standard_True);
}
//=======================================================================
//function : Disconnect
//purpose : Disconnects selectable object from an assembly and updates selection structures
//=======================================================================
void AIS_InteractiveContext::Disconnect (const Handle(AIS_InteractiveObject)& theAssembly,
const Handle(AIS_InteractiveObject)& theObjToDisconnect)
{
if (theAssembly->IsInstance ("AIS_MultipleConnectedInteractive"))
{
const Handle(AIS_MultipleConnectedInteractive)& theObj =
Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly);
theObj->Disconnect (theObjToDisconnect);
mgrSelector->Remove (theObjToDisconnect);
}
else if (theAssembly->IsInstance ("AIS_ConnectedInteractive") && theObjToDisconnect == NULL)
{
const Handle(AIS_ConnectedInteractive)& theObj =
Handle(AIS_ConnectedInteractive)::DownCast (theAssembly);
theObj->Disconnect();
mgrSelector->Remove (theObj);
}
else
return;
}

View File

@@ -16,6 +16,7 @@
#include <AIS_InteractiveContext.jxx>
#include <SelectMgr_EntityOwner.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <AIS_Selection.hxx>
#include <AIS_StatusOfDetection.hxx>
#include <AIS_StatusOfPick.hxx>
@@ -1098,11 +1099,11 @@ void AIS_InteractiveContext::EntityOwners(SelectMgr_IndexedMapOfOwner& theOwners
if ( !theIObj->HasSelection( aMode ) )
continue;
Handle(SelectMgr_Selection) aSel = theIObj->Selection( aMode );
Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
for ( aSel->Init(); aSel->More(); aSel->Next() )
{
Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive();
Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
if ( aEntity.IsNull() )
continue;

View File

@@ -29,6 +29,8 @@
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <AIS_Selection.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
//=======================================================================
//function : OpenLocalContext
//purpose :
@@ -59,10 +61,6 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
myLastPicked.Nullify();
myWasLastMain = Standard_True;
Standard_Integer untilnow = myCurLocalIndex;
myCurLocalIndex = HighestIndex() + 1;
Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
@@ -72,12 +70,6 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
// the AIS_LocalContext bind itself to myLocalContexts
// because procedures performed in AIS_LocalContext constructor
// already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
//myLocalContexts.Bind (myCurLocalIndex, NewLocal);
NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 1)
? myLocalContexts (untilnow)->MainSelector()->Projector()
: myMainSel->Projector());
NewLocal->MainSelector()->UpdateConversion();
#ifdef OCCT_DEBUG
cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
@@ -123,17 +115,11 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
// the only open local context is closed...
if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
myLocalContexts.UnBind(myCurLocalIndex);
myCurLocalIndex = 0;
ResetOriginalState(Standard_False);
if(updateproj)
myMainSel->UpdateConversion();
else{
myMainSel->UpdateSort();
}
if(debugmode)
cout<<"No More Opened Local Context "<<endl;
}
@@ -146,11 +132,6 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
// the current is closed...
if(GoodIndex==myCurLocalIndex){
myCurLocalIndex = HighestIndex();
const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
if (!LocCtx->HasSameProjector (VS->Projector()))
{
LocCtx->MainSelector()->UpdateConversion();
}
}
else if(debugmode)
cout<<"a No Current Local Context WasClosed"<<endl;
@@ -177,7 +158,6 @@ void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewe
ResetOriginalState(Standard_False);
myMainSel->UpdateSort();
if(updateviewer) myMainVwr->Update();
}
@@ -226,12 +206,13 @@ Standard_Integer AIS_InteractiveContext::HighestIndex() const
void AIS_InteractiveContext::
Activate(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Integer aMode)
const Standard_Integer aMode,
const Standard_Boolean theIsForce)
{
if(!HasOpenedContext()){
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
if(STAT->GraphicStatus()==AIS_DS_Displayed)
if(STAT->GraphicStatus()==AIS_DS_Displayed || theIsForce)
mgrSelector->Activate(anIObj,aMode,myMainSel);
STAT ->AddSelectionMode(aMode);
}
@@ -570,31 +551,6 @@ const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
return myFilters->StoredFilters();
}
//=======================================================================
//function : DisplayActiveAreas
//purpose :
//=======================================================================
void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
else
myMainSel->DisplayAreas(aviou);
}
//=======================================================================
//function : ClearActiveAreas
//purpose :
//=======================================================================
void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
else
myMainSel->ClearAreas(aviou);
}
//=======================================================================
//function : DisplayActiveSensitive
//purpose :
@@ -631,41 +587,11 @@ void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_Interactive
for(;It.More();It.Next()){
const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
VS->DisplaySensitive(Sel,aviou,Standard_False);
VS->DisplaySensitive(Sel,anIObj->Transformation(), aviou,Standard_False);
}
}
//=======================================================================
//function : DisplayActiveAreas
//purpose :
//=======================================================================
void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
const Handle(V3d_View)& aviou)
{
TColStd_ListIteratorOfListOfInteger It;
Handle(StdSelect_ViewerSelector3d) VS;
if(HasOpenedContext()){
const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
if(!LC->IsIn(anIObj)) return;
It.Initialize(LC->SelectionModes(anIObj));
VS = LC->MainSelector();
}
else{
if(!myObjects.IsBound(anIObj)) return;
It.Initialize(myObjects(anIObj)->SelectionModes());
VS = myMainSel;
}
for(;It.More();It.Next()){
const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
VS->DisplayAreas(Sel,aviou,Standard_False);
}
}
//=======================================================================
//function : ClearActiveSensitive
//purpose :
@@ -848,6 +774,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
{
Standard_Boolean upd_main(Standard_False);
TColStd_ListIteratorOfListOfInteger itl;
myMainSel->ResetSelectionActivationStatus();
for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
const Handle(AIS_InteractiveObject)& iobj = it.Key();

View File

@@ -581,6 +581,12 @@ is
---Purpose: Retrieves current polygon offsets settings from <myDrawer>.
---Category: Inquire methods
BoundingBox (me : mutable;
theBndBox : out Box from Bnd)
is redefined;
---Level: Public
---Purpose: Returns bounding box of object correspondingly to its current display mode.
fields
myCTXPtr : PToContext from AIS;

View File

@@ -33,6 +33,8 @@
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_BndBox4f.hxx>
#include <Graphic3d_CStructure.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Structure.hxx>
@@ -586,3 +588,62 @@ void AIS_InteractiveObject::PolygonOffsets(Standard_Integer& aMode,
if( HasPolygonOffsets() )
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode, aFactor, aUnits );
}
//=======================================================================
//function : BoundingBox
//purpose : Returns bounding box of object correspondingly to its
// current display mode
//=======================================================================
void AIS_InteractiveObject::BoundingBox (Bnd_Box& theBndBox)
{
if (myDisplayMode == -1)
{
if (!myPresentations.IsEmpty())
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations.First().Presentation();
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
const Graphic3d_BndBox4f& aBndBox = aStruct->CStructure()->BoundingBox();
theBndBox.Update (static_cast<Standard_Real> (aBndBox.CornerMin().x()),
static_cast<Standard_Real> (aBndBox.CornerMin().y()),
static_cast<Standard_Real> (aBndBox.CornerMin().z()),
static_cast<Standard_Real> (aBndBox.CornerMax().x()),
static_cast<Standard_Real> (aBndBox.CornerMax().y()),
static_cast<Standard_Real> (aBndBox.CornerMax().z()));
return;
}
else
{
for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (Children()); aPrsIter.More(); aPrsIter.Next())
{
const Handle(AIS_InteractiveObject)& aChild = Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value());
if (aChild.IsNull())
{
continue;
}
Bnd_Box aBox;
aChild->BoundingBox (aBox);
theBndBox.Add (aBox);
}
return;
}
}
else
{
for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
{
if (myPresentations (aPrsIter).Mode() == myDisplayMode)
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
const Graphic3d_BndBox4f& aBndBox = aStruct->CStructure()->BoundingBox();
theBndBox.Update (static_cast<Standard_Real> (aBndBox.CornerMin().x()),
static_cast<Standard_Real> (aBndBox.CornerMin().y()),
static_cast<Standard_Real> (aBndBox.CornerMin().z()),
static_cast<Standard_Real> (aBndBox.CornerMax().x()),
static_cast<Standard_Real> (aBndBox.CornerMax().y()),
static_cast<Standard_Real> (aBndBox.CornerMax().z()));
return;
}
}
}
}

View File

@@ -23,6 +23,7 @@
#include <Graphic3d_Structure.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <StdPrs_Curve.hxx>
#include <Geom_Line.hxx>

View File

@@ -51,7 +51,6 @@ uses
Shape from TopoDS,
View from V3d,
PresentationManager3d from PrsMgr,
Projector from Select3D,
IndexedMapOfOwner from SelectMgr,
EntityOwner from SelectMgr,
OrFilter from SelectMgr,
@@ -105,14 +104,6 @@ is
Terminate(me: mutable; updateviewer : Boolean from Standard = Standard_True);
HasSameProjector(me;aPrj:Projector from Select3D)
returns Boolean from Standard;
---Purpose: compares the current projector of the localContext
-- with <aPrj>
-- returns True if the projectors are identical.
-- (no need to update projection of selection primitives
-- when closing the local context)....
Reactivate(me:mutable);
---Purpose: to be called when a upper local context was closed...
-- useful to put pack the right projector...
@@ -445,35 +436,14 @@ is
WithColor : out Boolean from Standard;
HiCol : out NameOfColor from Quantity)
returns Boolean from Standard;
SetSensitivityMode(me : mutable;
aMode : SensitivityMode from StdSelect) is static;
---Level: Public
---Purpose: Sets the selection sensitivity mode. SM_WINDOW mode
-- uses the specified pixel tolerance to compute the sensitivity
-- value, SM_VIEW mode allows to define the sensitivity manually.
SensitivityMode(me) returns SensitivityMode from StdSelect;
---Level: Public
---Purpose: Returns the selection sensitivity mode.
SetSensitivity(me:mutable;
aPrecision: Real from Standard);
---Level: Public
---Purpose: Define the current selection sensitivity for
-- this local context according to the view size.
Sensitivity (me) returns Real from Standard;
---Level: Public
---Purpose: Returns the selection sensitivity value.
SetPixelTolerance(me:mutable;
aPrecision: Integer from Standard = 2);
aPrecision: Real from Standard = 2);
---Level: Public
---Purpose: Define the current selection sensitivity for
-- this local context according to the view size.
PixelTolerance(me) returns Integer from Standard;
PixelTolerance(me) returns Real from Standard;
---Level: Public
---Purpose: Returns the pixel tolerance.
@@ -505,11 +475,6 @@ is
---Category: INTERNAL METHODS;
UpdateConversion(me:mutable);
UpdateSort(me:mutable);
Status(me) returns AsciiString from TCollection is private;
@@ -524,15 +489,12 @@ is
UnloadContextObjects(me:mutable);
Process(me : mutable;
anObject : SelectableObject from SelectMgr;
WithProj: Boolean from Standard = Standard_True) is static private;
anObject : SelectableObject from SelectMgr) is static private;
Process(me:mutable;
WithProj: Boolean from Standard = Standard_True) is static private;
Process(me:mutable) is static private;
ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr;
WithProj: Boolean from Standard = Standard_True) is static private;
ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr) is static private;
manageDetected (me : mutable;
thePickOwner : EntityOwner from SelectMgr;
@@ -566,13 +528,6 @@ is
ComesFromDecomposition(me; aPickedIndex : Integer from Standard)
returns Boolean from Standard is static private;
DisplayAreas(me:mutable;aviou:View from V3d);
ClearAreas (me:mutable;
aView: View from V3d) is static;
---Level: Internal
HasFilters(me;aType:ShapeEnum from TopAbs)
returns Boolean from Standard is private;
@@ -580,7 +535,7 @@ is
ClearSensitive(me:mutable;aView:View from V3d) is static;
MainSelector(me) returns any ViewerSelector3d from StdSelect;
MainSelector(me) returns ViewerSelector3d from StdSelect;
---C++: inline
---C++: return const&

View File

@@ -33,6 +33,7 @@
#include <Prs3d_Presentation.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <StdSelect_ShapeTypeFilter.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <AIS_Selection.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
@@ -70,7 +71,7 @@ myLoadDisplayed(LoadDisplayed),
myAcceptStdMode(AcceptStandardModes),
myAcceptErase(AcceptEraseOfTemp),
mySM(aCtx->SelectionManager()),
myMainVS(new StdSelect_ViewerSelector3d(aCtx->MainSelector()->Projector())),
myMainVS(aCtx->MainSelector()),
myFilters(new SelectMgr_OrFilter()),
myAutoHilight(Standard_True),
mylastindex(0),
@@ -84,13 +85,14 @@ myAISCurDetected(0)
// created and mapped.
aCtx->myLocalContexts.Bind (Index, this);
myMainVS->ResetSelectionActivationStatus();
myMainPM = aCtx->MainPrsMgr();
mySelName = AIS_Local_SelName(this, Index);
AIS_Selection::CreateSelection(mySelName.ToCString());
mySM->Add(myMainVS);
if(myLoadDisplayed) LoadContextObjects();
Process(Standard_False);
Process();
}
@@ -195,7 +197,24 @@ Load(const Handle(AIS_InteractiveObject)& anInteractive,
const Standard_Boolean AllowShapeDecomposition,
const Standard_Integer ActivationMode)
{
if(myActiveObjects.IsBound(anInteractive)) return Standard_False;
if (myActiveObjects.IsBound (anInteractive))
{
if (anInteractive->HasSelection (ActivationMode))
{
const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode);
if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
{
if (!myMainVS->Contains (anInteractive))
{
mySM->Load (anInteractive, myMainVS);
}
mySM->Activate (anInteractive, ActivationMode, myMainVS);
return Standard_True;
}
}
return Standard_False;
}
Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
if(anInteractive->AcceptShapeDecomposition() && AllowShapeDecomposition)
@@ -296,8 +315,6 @@ Erase(const Handle(AIS_InteractiveObject)& anInteractive)
}
}
UpdateSort();
ClearOutdatedSelection (anInteractive, Standard_True);
return status;
@@ -353,7 +370,6 @@ void AIS_LocalContext::Clear(const AIS_ClearMode aType)
case AIS_CM_TemporaryShapePrs:
ClearDetected();
}
UpdateSort();
}
//=======================================================================
//function : ActivateMode
@@ -370,7 +386,6 @@ void AIS_LocalContext::ActivateMode(const Handle(AIS_InteractiveObject)& aSelect
myActiveObjects(aSelectable)->AddSelectionMode(aMode);
mySM->Activate(aSelectable,aMode,myMainVS);
}
UpdateSort();
}
//=======================================================================
//function : ActivateMode
@@ -386,8 +401,6 @@ void AIS_LocalContext::DeactivateMode(const Handle(AIS_InteractiveObject)& aSele
myActiveObjects(aSelectable)->RemoveSelectionMode(aMode);
mySM->Deactivate(aSelectable,aMode,myMainVS);
UpdateSort();
}
//=======================================================================
//function : ActivateMode
@@ -398,9 +411,8 @@ void AIS_LocalContext::Deactivate(const Handle(AIS_InteractiveObject)& aSelectab
{
if(!myActiveObjects.IsBound(aSelectable)) return;
mySM->Deactivate(aSelectable,myMainVS);
mySM->Deactivate(aSelectable, -1, myMainVS);
myActiveObjects(aSelectable)->ClearSelectionModes();
UpdateSort();
}
//=======================================================================
@@ -465,7 +477,6 @@ Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& a
{
mySM->Remove (aSelectable);
}
UpdateSort();
ClearOutdatedSelection (aSelectable, Standard_True);
// This should be done at the very end because most methods use
@@ -538,10 +549,8 @@ void AIS_LocalContext::DeactivateStandardMode(const TopAbs_ShapeEnum aType)
myListOfStandardMode.Remove(It);
if(myFilters->IsIn(myStdFilters[IMode]))
myFilters->Remove(myStdFilters[IMode]);
UpdateSort();
return;
}
UpdateSort();
}
//=======================================================================
@@ -588,31 +597,6 @@ void AIS_LocalContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
}
}
Standard_Boolean AIS_LocalContext::HasSameProjector(const Handle(Select3D_Projector)& thePrj) const
{
const Handle(Select3D_Projector)& aCurPrj = myMainVS->Projector();
if (aCurPrj->Perspective() != thePrj->Perspective())
return Standard_False;
if (aCurPrj->Perspective() && aCurPrj->Focus() != thePrj->Focus())
return Standard_False;
const gp_GTrsf& aCurTrsf = aCurPrj->Transformation();
const gp_GTrsf& aPrjTrsf = thePrj->Transformation();
for (Standard_Integer i = 1; i <= 3; ++i)
{
for (Standard_Integer j = 1; j <= 3 ; ++j)
{
if (aCurTrsf.Value (i, j) != aPrjTrsf.Value (i, j))
return Standard_False;
}
}
return Standard_True;
}
//=======================================================================
//function : Terminate
//purpose :
@@ -627,7 +611,6 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
mylastindex=0;
// clear the selector...
myMainVS->Clear();
myCTX->SelectionManager()->Remove(myMainVS);
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
@@ -650,7 +633,6 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
}
Handle(V3d_View) aDummyView;
myMainVS->ClearAreas (aDummyView);
myMainVS->ClearSensitive (aDummyView);
if (theToUpdate)
@@ -893,12 +875,17 @@ void AIS_LocalContext::LoadContextObjects()
myCTX->DisplayedObjects(LL,Standard_True);
Handle(AIS_LocalStatus) Att;
for (It.Initialize(LL);It.More();It.Next()){
const Handle(AIS_InteractiveObject)& anObj = It.Value();
Att= new AIS_LocalStatus();
Att->SetDecomposition((It.Value()->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
Att->SetTemporary(Standard_False);
Att->SetHilightMode(It.Value()->HasHilightMode()? It.Value()->HilightMode(): 0);
myActiveObjects.Bind(It.Value(),Att);
Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
for (anObj->Init(); anObj->More(); anObj->Next())
{
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
}
myActiveObjects.Bind(anObj,Att);
}
}
}
@@ -922,17 +909,16 @@ void AIS_LocalContext::UnloadContextObjects()
//purpose :
//=======================================================================
void AIS_LocalContext::Process(const Handle(SelectMgr_SelectableObject)& anObject,
const Standard_Boolean WithProj)
void AIS_LocalContext::Process(const Handle(SelectMgr_SelectableObject)& anObject)
{
if(!myActiveObjects.IsBound(anObject)) return;
if(myActiveObjects(anObject)->Decomposed())
ActivateStandardModes(anObject,WithProj);
ActivateStandardModes(anObject);
else
{
TColStd_ListIteratorOfListOfInteger It(myActiveObjects(anObject)->SelectionModes());
for(;It.More();It.Next())
myCTX->SelectionManager()->Activate(anObject,It.Value(),myMainVS,WithProj);
myCTX->SelectionManager()->Activate(anObject,It.Value(),myMainVS);
}
}
@@ -941,7 +927,7 @@ void AIS_LocalContext::Process(const Handle(SelectMgr_SelectableObject)& anObjec
//purpose :
//=======================================================================
void AIS_LocalContext::Process(const Standard_Boolean WithProj)
void AIS_LocalContext::Process()
{
myMainVS->Clear();
@@ -951,11 +937,11 @@ void AIS_LocalContext::Process(const Standard_Boolean WithProj)
for(;It.More();It.Next()){
myCTX->SelectionManager()->Load(It.Key(),myMainVS);
if(It.Value()->Decomposed())
ActivateStandardModes(It.Key(),WithProj);
ActivateStandardModes(It.Key());
else if( myCTX->GetAutoActivateSelection() )
{
It.Value()->AddSelectionMode(0);
myCTX->SelectionManager()->Activate(It.Key(),0,myMainVS,WithProj);
myCTX->SelectionManager()->Activate(It.Key(),0,myMainVS);
}
}
@@ -966,8 +952,7 @@ void AIS_LocalContext::Process(const Standard_Boolean WithProj)
//purpose :
//=======================================================================
void AIS_LocalContext::ActivateStandardModes(const Handle(SelectMgr_SelectableObject)& anObject,
const Standard_Boolean WithProj)
void AIS_LocalContext::ActivateStandardModes(const Handle(SelectMgr_SelectableObject)& anObject)
{
if(!myActiveObjects.IsBound(anObject)) return;
@@ -976,7 +961,7 @@ void AIS_LocalContext::ActivateStandardModes(const Handle(SelectMgr_SelectableOb
const Handle(AIS_LocalStatus)& LS = myActiveObjects(anObject);
if(LS->Decomposed()){
for(;itl.More();itl.Next()){
myCTX->SelectionManager()->Activate(anObject,itl.Value(),myMainVS,WithProj);
myCTX->SelectionManager()->Activate(anObject,itl.Value(),myMainVS);
LS->AddSelectionMode(itl.Value());
}
}
@@ -1023,13 +1008,13 @@ void AIS_LocalContext::ClearObjects()
myMainPM->Erase(SO,CurAtt->DisplayMode());
}
TColStd_ListIteratorOfListOfInteger ITL(CurAtt->SelectionModes());
for(;ITL.More();ITL.Next())
mySM->Deactivate(SO,ITL.Value(),myMainVS);
if(CurAtt->IsTemporary())
mySM->Remove(SO,myMainVS);
TColStd_ListIteratorOfListOfInteger aSelModeIter (CurAtt->SelectionModes());
for ( ; aSelModeIter.More(); aSelModeIter.Next())
{
Standard_Integer aSelMode = aSelModeIter.Value();
mySM->Deactivate (SO, aSelMode, myMainVS);
}
}
ClearSelected( Standard_False );
myActiveObjects.Clear();
@@ -1082,16 +1067,6 @@ void AIS_LocalContext::ClearDetected()
}
}
void AIS_LocalContext::UpdateConversion()
{
myMainVS->UpdateConversion();
}
void AIS_LocalContext::UpdateSort()
{
myMainVS->UpdateSort();
}
//=======================================================================
//function : BeginImmediateDraw
//purpose :
@@ -1155,32 +1130,12 @@ Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const
return myMainPM->IsImmediateModeOn();
}
void AIS_LocalContext::SetSensitivityMode(const StdSelect_SensitivityMode aMode) {
myMainVS->SetSensitivityMode(aMode);
}
StdSelect_SensitivityMode AIS_LocalContext::SensitivityMode() const {
return myMainVS->SensitivityMode();
}
void AIS_LocalContext::SetSensitivity(const Standard_Real aPrecision) {
myMainVS->SetSensitivity(aPrecision);
}
Standard_Real AIS_LocalContext::Sensitivity() const {
return myMainVS->Sensitivity();
}
void AIS_LocalContext::SetPixelTolerance(const Standard_Integer aPrecision) {
void AIS_LocalContext::SetPixelTolerance(const Standard_Real aPrecision) {
myMainVS->SetPixelTolerance(aPrecision);
}
Standard_Integer AIS_LocalContext::PixelTolerance() const {
Standard_Real AIS_LocalContext::PixelTolerance() const {
return myMainVS->PixelTolerance();
}

View File

@@ -31,12 +31,12 @@
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Group.hxx>
#include <Select3D_SensitiveTriangulation.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Map.hxx>
#include <Visual3d_View.hxx>
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
#include <OSD_Environment.hxx>
@@ -855,7 +855,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
continue;
}
if (toClearDeactivated && !mySM->IsActivated (theIO, myMainVS, aMode))
if (toClearDeactivated && !mySM->IsActivated(theIO, aMode, myMainVS))
{
continue;
}
@@ -863,7 +863,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
Handle(SelectMgr_Selection) aSelection = theIO->Selection(aMode);
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive();
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
if (anEntity.IsNull())
{
continue;
@@ -1012,7 +1012,7 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
const Handle(SelectMgr_Selection)& SIOBJ = anIObj->Selection(0);
SIOBJ->Init();
if(SIOBJ->More()){
Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->OwnerId();
Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId();
EO = *((Handle(SelectMgr_EntityOwner)*)&BO);
}
}
@@ -1049,10 +1049,9 @@ void AIS_LocalContext::AddOrRemoveSelected(const Handle(AIS_InteractiveObject)&
{
const Handle(SelectMgr_Selection)& SIOBJ = anIObj->Selection(0);
SIOBJ->Init();
if(SIOBJ->More())
{
Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->OwnerId();
EO = *((Handle(SelectMgr_EntityOwner)*)&BO);
if(SIOBJ->More()){
Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId();
EO = *((Handle(SelectMgr_EntityOwner)*)&BO);
}
}
if(EO.IsNull())
@@ -1272,27 +1271,6 @@ Standard_Boolean AIS_LocalContext::ComesFromDecomposition(const Standard_Integer
return Standard_False;
}
//=======================================================================
//function : DisplayAreas
//purpose :
//=======================================================================
void AIS_LocalContext::DisplayAreas(const Handle(V3d_View)& aviou)
{
myMainVS->DisplayAreas(aviou);
}
//=======================================================================
//function : ClearAreas
//purpose :
//=======================================================================
void AIS_LocalContext::ClearAreas(const Handle(V3d_View)& aviou)
{
myMainVS->ClearAreas(aviou);
}
//=======================================================================
//function : DisplaySensitive
//purpose :
@@ -1475,9 +1453,9 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const
Standard_Boolean found(Standard_False);
if (!found) {
SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive aSensitiveIt (myMainVS->Primitives());
for (; aSensitiveIt.More(); aSensitiveIt.Next()) {
EO = Handle(SelectMgr_EntityOwner)::DownCast (aSensitiveIt.Value()->OwnerId());
NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (myMainVS->ActiveOwners());
for (; anOwnersIt.More(); anOwnersIt.Next()) {
EO = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
if (!BROwnr.IsNull() && BROwnr->HasShape() && BROwnr->Shape() == sh) {
found = Standard_True;

View File

@@ -30,6 +30,7 @@
#include <Select3D_SensitiveCurve.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <ElCLib.hxx>
#include <ElSLib.hxx>

View File

@@ -38,6 +38,7 @@
#include <Geom_TrimmedCurve.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveCurve.hxx>

View File

@@ -31,6 +31,7 @@
#include <Select3D_SensitiveCurve.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <ElCLib.hxx>
#include <ElSLib.hxx>

View File

@@ -159,6 +159,7 @@ AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive()
: AIS_InteractiveObject (PrsMgr_TOP_AllView)
{
myHasOwnPresentations = Standard_False;
myAssemblyOwner = NULL;
SetHilightMode (0);
}
@@ -189,12 +190,16 @@ Handle(AIS_InteractiveObject) AIS_MultipleConnectedInteractive::Connect (const H
const Graphic3d_TransModeFlags& theTrsfPersFlag,
const gp_Pnt& theTrsfPersPoint)
{
if (myAssemblyOwner.IsNull())
myAssemblyOwner = new SelectMgr_EntityOwner (this);
Handle(AIS_InteractiveObject) anObjectToAdd;
Handle(AIS_MultipleConnectedInteractive) aMultiConnected = Handle(AIS_MultipleConnectedInteractive)::DownCast (theAnotherObj);
if (!aMultiConnected.IsNull())
{
Handle(AIS_MultipleConnectedInteractive) aNewMultiConnected = new AIS_MultipleConnectedInteractive();
aNewMultiConnected->myAssemblyOwner = myAssemblyOwner;
aNewMultiConnected->SetLocalTransformation (aMultiConnected->LocalTransformation());
// Perform deep copy of instance tree
@@ -357,7 +362,7 @@ Standard_Boolean AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() co
//function : ComputeSelection
//purpose :
//=======================================================================
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
const Standard_Integer theMode)
{
if (theMode != 0)
@@ -370,67 +375,13 @@ void AIS_MultipleConnectedInteractive::ComputeSelection (const Handle(SelectMgr_
continue;
}
if (!aChild->HasSelection(theMode))
if (!aChild->HasSelection (theMode))
{
aChild->UpdateSelection(theMode);
aChild->RecomputePrimitives (theMode);
}
aChild->ComputeSelection (theSelection, theMode);
}
return;
}
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
{
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
if (aChild.IsNull())
{
continue;
}
if (!aChild->HasSelection (theMode))
{
aChild->UpdateSelection (theMode);
}
const Handle(SelectMgr_Selection)& TheRefSel = aChild->Selection (theMode);
// To redirect selection we must replace owners in sensitives, but we don't want new owner for each SE.
// Only for each existing owner.
NCollection_DataMap <Handle(SelectMgr_EntityOwner), Handle(SelectMgr_EntityOwner)> anOwnerMap;
Handle(Select3D_SensitiveEntity) aSensitive, aNewSensitive;
if (TheRefSel->IsEmpty())
{
aChild->UpdateSelection(theMode);
}
for (TheRefSel->Init(); TheRefSel->More(); TheRefSel->Next())
{
aSensitive = Handle(Select3D_SensitiveEntity)::DownCast(TheRefSel->Sensitive());
if (!aSensitive.IsNull())
{
TopLoc_Location aLocation (Transformation());
// Get the copy of aSensitive
aNewSensitive = aSensitive->GetConnected (aLocation);
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aNewSensitive->OwnerId());
if (!anOwnerMap.IsBound (anOwner))
{
Handle(SelectMgr_EntityOwner) aNewOwner = new SelectMgr_AssemblyEntityOwner (anOwner, this);
anOwnerMap.Bind (anOwner, aNewOwner);
}
aNewSensitive->Set (anOwnerMap.Find (anOwner));
// In case if aSensitive caches some location-dependent data
// that must be updated after setting OWN
aNewSensitive->SetLocation (aLocation);
theSelection->Add (aNewSensitive);
}
Handle(SelectMgr_Selection) aSelection = new SelectMgr_Selection (theMode);
aChild->ComputeSelection (aSelection, theMode);
}
}
}

View File

@@ -35,6 +35,7 @@
#include <Select3D_SensitiveBox.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <StdPrs_WFDeflectionShape.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TCollection_ExtendedString.hxx>

View File

@@ -33,6 +33,7 @@
#include <AIS.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveBox.hxx>

View File

@@ -41,6 +41,7 @@
#include <Select3D_SensitiveSegment.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>

View File

@@ -50,7 +50,7 @@ inline Select3D_TypeOfSensitivity AIS_Plane::TypeOfSensitivity() const
return myTypeOfSensitivity;
}
inline void AIS_Plane::SetTypeOfSensitivity (const Select3D_TypeOfSensitivity theTypeOfSensitivity)
inline void AIS_Plane::SetTypeOfSensitivity (const Select3D_TypeOfSensitivity& theTypeOfSensitivity)
{
myTypeOfSensitivity = theTypeOfSensitivity;
}

View File

@@ -26,6 +26,7 @@
#include <DsgPrs_DatumPrs.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitivePoint.hxx>
#include <Geom_Axis1Placement.hxx>

View File

@@ -21,6 +21,7 @@
#include <gce_MakeLin.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Precision.hxx>

View File

@@ -21,6 +21,7 @@
#include <Select3D_SensitiveSegment.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>