Select3D_SensitiveEntity::Select3D_SensitiveEntity(const Handle(SelectBasics_EntityOwner)& OwnerId):
SelectBasics_SensitiveEntity(OwnerId),
-mylastprj(NULL),
-mylastdepth(0.0)
+mylastprj(),
+mylastdepth(ShortRealLast())
{}
//=======================================================================
//purpose :
//=======================================================================
-void Select3D_SensitiveEntity::Project(const Select3D_Projector& aPrj)
+void Select3D_SensitiveEntity::Project(const Handle(Select3D_Projector)& aPrj)
{
- mylastprj = (Standard_Address*)&aPrj;
+ mylastprj = aPrj;
}
//=======================================================================
const Standard_Real aTol,
Standard_Real& DMin)
{
- gp_Lin L;
- if(mylastprj!=NULL)
- L = (* ((Select3D_Projector*) mylastprj)).Shoot(X,Y);
- SetLastDepth( ComputeDepth(L) );
-
- return (Abs(mylastdepth)>Precision::Confusion());
+ if (!mylastprj.IsNull())
+ {
+ gp_Lin L = mylastprj->Shoot (X, Y);
+ SetLastDepth (ComputeDepth (L));
+ return (mylastdepth > mylastprj->DepthMin()) && (mylastdepth < mylastprj->DepthMax());
+ }
+ else
+ {
+ SetLastDepth (ComputeDepth (gp_Lin())); // how we determine depth without eyeline here?
+ return (mylastdepth > ShortRealFirst()) && (mylastdepth < ShortRealLast());
+ }
}
//=======================================================================
const Standard_Real Y) const
{
gp_Lin L;
- if(mylastprj!=NULL)
- L = (* ((Select3D_Projector*) mylastprj)).Shoot(X,Y);
+ if (!mylastprj.IsNull())
+ {
+ L = mylastprj->Shoot (X, Y);
+ }
return L;
}
//purpose :
//=======================================================================
-void Select3D_SensitiveEntity::SetLastPrj(const Select3D_Projector& aprj)
-{ mylastprj = (Standard_Address*)& aprj;}
+void Select3D_SensitiveEntity::SetLastPrj(const Handle(Select3D_Projector)& aprj)
+{ mylastprj = aprj; }
//=======================================================================