//purpose :
//=======================================================================
-void Select3D_SensitiveGroup::Project(const Select3D_Projector& aProjector)
+void Select3D_SensitiveGroup::Project(const Handle(Select3D_Projector)& aProjector)
{
Select3D_SensitiveEntity::Project(aProjector); // to set the field last proj...
-
+
for(Select3D_ListIteratorOfListOfSensitive It(myList);It.More();It.Next()){
It.Value()->Project(aProjector);
}
myLastTol = aTol;
for(Select3D_ListIteratorOfListOfSensitive It(myList);It.More();It.Next()){
myLastRank++;
- if(It.Value()->Matches(X,Y,aTol,DMin)){
- myX = X;myY = Y;myLastTol = aTol;
- SetLastDepth( Precision::Infinite() );
-
- Select3D_SensitiveEntity::Matches(X,Y,aTol,DMin);
- return Standard_True;
+ if (It.Value()->Matches (X, Y, aTol, DMin))
+ {
+ myX = X; myY = Y; myLastTol = aTol;
+ // compute and validate the depth (will call ::ComputeDepth())
+ return Select3D_SensitiveEntity::Matches (X, Y, aTol, DMin);
}
}
- myLastRank =0;
- SetLastDepth(0.0);
+ // no match
+ myLastRank = 0;
+ SetLastDepth (ShortRealLast());
return Standard_False;
}
//=======================================================================
Standard_Real Select3D_SensitiveGroup::ComputeDepth(const gp_Lin& EyeLine) const
{
- Standard_Integer currank(0);
- Standard_Real DMin,thedepth(Precision::Infinite());
- for(Select3D_ListIteratorOfListOfSensitive It(myList);It.More();It.Next()){
+ Standard_Integer currank = 0;
+ Standard_Real DMin, thedepth (Precision::Infinite());
+ for (Select3D_ListIteratorOfListOfSensitive It(myList);It.More();It.Next())
+ {
currank++;
- if(currank>=myLastRank){
- if(It.Value()->Matches(myX,myY,myLastTol,DMin)){
- It.Value()->ComputeDepth(EyeLine);
- thedepth = Min(Depth(),
- It.Value()->Depth());
+ if (currank >= myLastRank)
+ {
+ // this recomputes and validates the depth for the entity
+ if (It.Value()->Matches (myX, myY, myLastTol, DMin))
+ {
+ It.Value()->ComputeDepth (EyeLine);
+ if (It.Value()->Depth() < thedepth)
+ {
+ // search for topmost entity
+ thedepth = It.Value()->Depth();
+ //myLastRank = currank; // can not do this here...
+ }
}
}
-
}
return thedepth;
}
return nbboxes;
}
-void Select3D_SensitiveGroup::SetLastPrj(const Select3D_Projector& Prj)
+void Select3D_SensitiveGroup::SetLastPrj(const Handle(Select3D_Projector)& Prj)
{
Select3D_SensitiveEntity::SetLastPrj(Prj);
for(Select3D_ListIteratorOfListOfSensitive It(myList);It.More();It.Next())