-// File: MeshVS_SensitiveMesh.cxx
-// Created: Thu Jan 29 2007
-// Author: Sergey KOCHETKOV
-// Copyright: Open CASCADE 2007
+// Created on: 2007-01-29
+// Created by: Sergey KOCHETKOV
+// Copyright (c) 2007-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
#include <MeshVS_SensitiveMesh.ixx>
// name : Matches
// Purpose :
//=======================================================================
-Standard_Boolean MeshVS_SensitiveMesh::Matches(const Standard_Real X,
- const Standard_Real Y,
- const Standard_Real aTol,
- Standard_Real& DMin)
+Standard_Boolean MeshVS_SensitiveMesh::Matches (const SelectBasics_PickArgs& thePickArgs,
+ Standard_Real& theMatchDMin,
+ Standard_Real& theMatchDepth)
{
- DMin = 0.;
-
+ theMatchDMin = 0.0;
+ theMatchDepth = Precision::Infinite();
+
Handle(MeshVS_MeshOwner) anOwner = Handle(MeshVS_MeshOwner)::DownCast( OwnerId() );
if( anOwner.IsNull() ) return Standard_False;
Handle(MeshVS_Mesh) aMeshPrs = Handle(MeshVS_Mesh)::DownCast( anOwner->Selectable() );
if( aDS.IsNull() ) return Standard_False;
Handle(TColStd_HPackedMapOfInteger) NodesMap;
Handle(TColStd_HPackedMapOfInteger) ElemsMap;
+
// Mesh data source should provide the algorithm for computation
// of detected entities from 2D point
- Standard_Boolean isDetected = aDS->GetDetectedEntities( aMeshPrs, X, Y, aTol, NodesMap, ElemsMap, DMin );
+ Standard_Boolean isDetected =
+ aDS->GetDetectedEntities (aMeshPrs, thePickArgs.X(), thePickArgs.Y(),
+ thePickArgs.Tolerance(), NodesMap,
+ ElemsMap, theMatchDMin);
+
// The detected entites will be available from mesh owner
anOwner->SetDetectedEntities( NodesMap, ElemsMap );
-
+
return isDetected;
}
return aMeshEnt;
}
-//=======================================================================
-//function : ComputeDepth
-//purpose :
-//=======================================================================
-Standard_Real MeshVS_SensitiveMesh::ComputeDepth( const gp_Lin& /*EyeLine*/ ) const
-{
- return 0.;
-}
-
//==================================================
// Function: ProjectOneCorner
// Purpose :
//==================================================
-void MeshVS_SensitiveMesh::ProjectOneCorner(const Select3D_Projector& theProj,
+void MeshVS_SensitiveMesh::ProjectOneCorner(const Handle(Select3D_Projector)& theProj,
const Standard_Real theX,
const Standard_Real theY,
const Standard_Real theZ)
gp_Pnt aPnt( theX, theY, theZ );
gp_Pnt2d aProjPnt;
if( HasLocation() )
- theProj.Project( aPnt.Transformed(Location().Transformation()), aProjPnt );
+ theProj->Project( aPnt.Transformed(Location().Transformation()), aProjPnt );
else
- theProj.Project( aPnt, aProjPnt );
+ theProj->Project( aPnt, aProjPnt );
mybox2d.Add( aProjPnt );
}
// Function: Project
// Purpose :
//==================================================
-void MeshVS_SensitiveMesh::Project(const Select3D_Projector& aProj)
+void MeshVS_SensitiveMesh::Project(const Handle(Select3D_Projector)& aProj)
{
- Select3D_SensitiveEntity::Project(aProj); // to set the field last proj...
-
mybox2d.SetVoid();
if (mybox.IsVoid())
return;