1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023012: Detection gives incorrect results

This commit is contained in:
ouv
2012-03-26 19:50:04 +04:00
committed by ouv
parent 476ed21f1b
commit 3c9825482f
11 changed files with 263 additions and 47 deletions

View File

@@ -90,6 +90,11 @@ is
---Purpose: Provides values for different types of edges. These
-- values are used to filter edges in frameworks
-- inheriting StdSelect_EdgeFilter.
enumeration SensitivityMode is SM_WINDOW, SM_VIEW;
---Purpose: 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.
class ViewerSelector3d;

View File

@@ -34,7 +34,8 @@ uses
Group from Graphic3d,
Structure from Graphic3d,
Array1OfReal from TColStd,
Array1OfPnt2d from TColgp
Array1OfPnt2d from TColgp,
SensitivityMode from StdSelect
is
@@ -50,12 +51,28 @@ is
-- in the active view ; to be done before the selection action...
Set(me:mutable; aSensitivity : Integer) is static;
---Purpose: Sets the sensitivity aSensitivity.
Set(me:mutable; aProj: Projector from Select3D) is static;
---Purpose: Sets the new projector aProj to replace the one used at construction time.
SetSensitivityMode(me : mutable;
aMode : SensitivityMode from StdSelect) is static;
---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;
---C++: inline
---Purpose: Returns the selection sensitivity mode.
SetPixelTolerance(me : mutable;
aTolerance : Integer) is static;
---Purpose: Sets the pixel tolerance aTolerance.
PixelTolerance(me) returns Integer from Standard;
---C++: inline
---Purpose: Returns the pixel tolerance.
Pick (me : mutable;XPix,YPix:Integer;
aView : View from V3d) is static;
@@ -147,6 +164,7 @@ fields
mycenter : Real from Standard[2];
myprevcenter : Real from Standard[2];
mylastzoom : Real from Standard;
mysensmode : SensitivityMode from StdSelect;
mypixtol : Integer ;
myupdatetol : Boolean;

View File

@@ -101,6 +101,7 @@ StdSelect_ViewerSelector3d
::StdSelect_ViewerSelector3d():
myprj(new Select3D_Projector()),
mylastzoom(0.0),
mysensmode(StdSelect_SM_WINDOW),
mypixtol(2),
myupdatetol(Standard_True)
{
@@ -118,6 +119,7 @@ StdSelect_ViewerSelector3d
::StdSelect_ViewerSelector3d(const Handle(Select3D_Projector)& aProj):
myprj(aProj),
mylastzoom(0.0),
mysensmode(StdSelect_SM_WINDOW),
mypixtol(2),
myupdatetol(Standard_True)
{
@@ -148,21 +150,6 @@ void StdSelect_ViewerSelector3d::Convert(const Handle(SelectMgr_Selection)& aSel
// Purpose :
//==================================================
void StdSelect_ViewerSelector3d
::Set(const Standard_Integer PixelTolerance)
{
if(mypixtol!=PixelTolerance)
{
mypixtol = PixelTolerance;
myupdatetol = Standard_True;
}
}
//==================================================
// Function: Set
// Purpose :
//==================================================
void StdSelect_ViewerSelector3d
::Set(const Handle(Select3D_Projector)& aProj)
{
@@ -170,6 +157,33 @@ void StdSelect_ViewerSelector3d
toupdate=Standard_True;
}
//==================================================
// Function: SetSensitivityMode
// Purpose :
//==================================================
void StdSelect_ViewerSelector3d
::SetSensitivityMode(const StdSelect_SensitivityMode aMode)
{
mysensmode = aMode;
toupdate = Standard_True;
}
//==================================================
// Function: SetPixelTolerance
// Purpose :
//==================================================
void StdSelect_ViewerSelector3d
::SetPixelTolerance(const Standard_Integer aTolerance)
{
if(mypixtol!=aTolerance)
{
mypixtol = aTolerance;
myupdatetol = Standard_True;
}
}
//==================================================
// Function: SelectPix
// Purpose :
@@ -247,7 +261,7 @@ void StdSelect_ViewerSelector3d
const Standard_Integer YPMax,
const Handle(V3d_View)& aView)
{
if (myupdatetol)
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
@@ -276,7 +290,7 @@ void StdSelect_ViewerSelector3d
::Pick(const TColgp_Array1OfPnt2d& aPolyline,
const Handle(V3d_View)& aView)
{
if (myupdatetol)
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
@@ -317,7 +331,7 @@ void StdSelect_ViewerSelector3d
void StdSelect_ViewerSelector3d::
DisplayAreas(const Handle(V3d_View)& aView)
{
if (myupdatetol)
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
@@ -500,7 +514,7 @@ UpdateProj(const Handle(V3d_View)& aView)
mylastzoom = aView->Scale();
}
if (myupdatetol)
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
@@ -519,7 +533,7 @@ UpdateProj(const Handle(V3d_View)& aView)
//=============================
void StdSelect_ViewerSelector3d::DisplaySensitive(const Handle(V3d_View)& aViou)
{
if (myupdatetol)
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aViou->Convert (mypixtol));
myupdatetol = Standard_False;

View File

@@ -16,6 +16,16 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
inline StdSelect_SensitivityMode StdSelect_ViewerSelector3d::SensitivityMode() const
{
return mysensmode;
}
inline Standard_Integer StdSelect_ViewerSelector3d::PixelTolerance() const
{
return mypixtol;
}
inline const Handle(Select3D_Projector)& StdSelect_ViewerSelector3d::Projector() const
{
return myprj;