mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0023012: Detection gives incorrect results
This commit is contained in:
parent
476ed21f1b
commit
3c9825482f
@ -114,6 +114,7 @@ uses
|
|||||||
SelectionManager from SelectMgr,
|
SelectionManager from SelectMgr,
|
||||||
PresentationManager3d from PrsMgr,
|
PresentationManager3d from PrsMgr,
|
||||||
ViewerSelector3d from StdSelect,
|
ViewerSelector3d from StdSelect,
|
||||||
|
SensitivityMode from StdSelect,
|
||||||
MapOfInteractive from AIS,
|
MapOfInteractive from AIS,
|
||||||
InteractiveObject from AIS,
|
InteractiveObject from AIS,
|
||||||
DisplayMode from AIS,
|
DisplayMode from AIS,
|
||||||
@ -525,6 +526,17 @@ is
|
|||||||
-- Removes selection mode from Interactive Objects.
|
-- Removes selection mode from Interactive Objects.
|
||||||
-- aMode provides the selection mode index of the entity aniobj.
|
-- 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;
|
SetSensitivity(me:mutable;
|
||||||
aPrecision: Real from Standard);
|
aPrecision: Real from Standard);
|
||||||
---Level: Public
|
---Level: Public
|
||||||
@ -537,7 +549,11 @@ is
|
|||||||
-- When a local context is open, the defined sensitivity applies to
|
-- When a local context is open, the defined sensitivity applies to
|
||||||
-- this local context instead of the main context.
|
-- this local context instead of the main context.
|
||||||
|
|
||||||
SetSensitivity(me:mutable;
|
Sensitivity (me) returns Real from Standard;
|
||||||
|
---Level: Public
|
||||||
|
---Purpose: Returns the selection sensitivity value.
|
||||||
|
|
||||||
|
SetPixelTolerance(me:mutable;
|
||||||
aPrecision: Integer from Standard = 4);
|
aPrecision: Integer from Standard = 4);
|
||||||
---Level: Public
|
---Level: Public
|
||||||
---Purpose: Define the current selection pixel sensitivity
|
---Purpose: Define the current selection pixel sensitivity
|
||||||
@ -545,6 +561,10 @@ is
|
|||||||
-- Warning: When a local context is open the sensitivity is apply on it
|
-- Warning: When a local context is open the sensitivity is apply on it
|
||||||
-- instead on the main context.
|
-- instead on the main context.
|
||||||
|
|
||||||
|
PixelTolerance(me) returns Integer from Standard;
|
||||||
|
---Level: Public
|
||||||
|
---Purpose: Returns the pixel tolerance.
|
||||||
|
|
||||||
---Category: put locations on objects....
|
---Category: put locations on objects....
|
||||||
--
|
--
|
||||||
|
|
||||||
|
@ -188,12 +188,7 @@ myIsAutoActivateSelMode( Standard_True )
|
|||||||
{
|
{
|
||||||
InitAttributes();
|
InitAttributes();
|
||||||
mgrSelector->Add(myCollectorSel);
|
mgrSelector->Add(myCollectorSel);
|
||||||
#ifdef BUC60688
|
SetPixelTolerance();
|
||||||
SetSensitivity();
|
|
||||||
#else
|
|
||||||
myCollectorSel->Set(4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIS_InteractiveContext::Delete() const
|
void AIS_InteractiveContext::Delete() const
|
||||||
@ -2977,7 +2972,33 @@ void AIS_InteractiveContext::UnsetSelectionMode(const Handle_AIS_InteractiveObje
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUC60688
|
//=======================================================================
|
||||||
|
//function : SetSensitivityMode
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void AIS_InteractiveContext::SetSensitivityMode(const StdSelect_SensitivityMode aMode) {
|
||||||
|
|
||||||
|
if( HasOpenedContext() )
|
||||||
|
myLocalContexts(myCurLocalIndex)->SetSensitivityMode(aMode);
|
||||||
|
else {
|
||||||
|
myMainSel->SetSensitivityMode(aMode);
|
||||||
|
if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivityMode(aMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SensitivityMode
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const {
|
||||||
|
|
||||||
|
if( HasOpenedContext() )
|
||||||
|
return myLocalContexts(myCurLocalIndex)->SensitivityMode();
|
||||||
|
return myMainSel->SensitivityMode();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetSensitivity
|
//function : SetSensitivity
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -2994,20 +3015,43 @@ void AIS_InteractiveContext::SetSensitivity(const Standard_Real aPrecision) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetSensitivity
|
//function : Sensitivity
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void AIS_InteractiveContext::SetSensitivity(const Standard_Integer aPrecision) {
|
Standard_Real AIS_InteractiveContext::Sensitivity() const {
|
||||||
|
|
||||||
if( HasOpenedContext() )
|
if( HasOpenedContext() )
|
||||||
myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
|
return myLocalContexts(myCurLocalIndex)->Sensitivity();
|
||||||
|
return myMainSel->Sensitivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetPixelTolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void AIS_InteractiveContext::SetPixelTolerance(const Standard_Integer aPrecision) {
|
||||||
|
|
||||||
|
if( HasOpenedContext() )
|
||||||
|
myLocalContexts(myCurLocalIndex)->SetPixelTolerance(aPrecision);
|
||||||
else {
|
else {
|
||||||
myMainSel->Set(aPrecision);
|
myMainSel->SetPixelTolerance(aPrecision);
|
||||||
if( !myCollectorSel.IsNull() ) myCollectorSel->Set(aPrecision);
|
if( !myCollectorSel.IsNull() ) myCollectorSel->SetPixelTolerance(aPrecision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : PixelTolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Integer AIS_InteractiveContext::PixelTolerance() const {
|
||||||
|
|
||||||
|
if( HasOpenedContext() )
|
||||||
|
return myLocalContexts(myCurLocalIndex)->PixelTolerance();
|
||||||
|
return myMainSel->PixelTolerance();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsInLocal
|
//function : IsInLocal
|
||||||
@ -3063,11 +3107,7 @@ void AIS_InteractiveContext::InitAttributes()
|
|||||||
HLA->SetTypeOfLine(Aspect_TOL_DASH);
|
HLA->SetTypeOfLine(Aspect_TOL_DASH);
|
||||||
|
|
||||||
// tolerance to 4 pixels...
|
// tolerance to 4 pixels...
|
||||||
#ifdef BUC60688
|
SetPixelTolerance();
|
||||||
SetSensitivity();
|
|
||||||
#else
|
|
||||||
myMainSel->Set(4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Customizing the drawer for trihedrons and planes...
|
// Customizing the drawer for trihedrons and planes...
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ uses
|
|||||||
ListOfFilter from SelectMgr,
|
ListOfFilter from SelectMgr,
|
||||||
BRepOwner from StdSelect,
|
BRepOwner from StdSelect,
|
||||||
ViewerSelector3d from StdSelect,
|
ViewerSelector3d from StdSelect,
|
||||||
|
SensitivityMode from StdSelect,
|
||||||
InteractiveContext from AIS,
|
InteractiveContext from AIS,
|
||||||
ClearMode from AIS,
|
ClearMode from AIS,
|
||||||
InteractiveObject from AIS,
|
InteractiveObject from AIS,
|
||||||
@ -443,18 +444,37 @@ is
|
|||||||
HiCol : out NameOfColor from Quantity)
|
HiCol : out NameOfColor from Quantity)
|
||||||
returns Boolean from Standard;
|
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;
|
SetSensitivity(me:mutable;
|
||||||
aPrecision: Real from Standard);
|
aPrecision: Real from Standard);
|
||||||
---Level: Public
|
---Level: Public
|
||||||
---Purpose: Define the current selection sensitivity for
|
---Purpose: Define the current selection sensitivity for
|
||||||
-- this local context according to the view size.
|
-- this local context according to the view size.
|
||||||
|
|
||||||
SetSensitivity(me:mutable;
|
Sensitivity (me) returns Real from Standard;
|
||||||
|
---Level: Public
|
||||||
|
---Purpose: Returns the selection sensitivity value.
|
||||||
|
|
||||||
|
SetPixelTolerance(me:mutable;
|
||||||
aPrecision: Integer from Standard = 2);
|
aPrecision: Integer from Standard = 2);
|
||||||
---Level: Public
|
---Level: Public
|
||||||
---Purpose: Define the current selection sensitivity for
|
---Purpose: Define the current selection sensitivity for
|
||||||
-- this local context according to the view size.
|
-- this local context according to the view size.
|
||||||
|
|
||||||
|
PixelTolerance(me) returns Integer from Standard;
|
||||||
|
---Level: Public
|
||||||
|
---Purpose: Returns the pixel tolerance.
|
||||||
|
|
||||||
---Category: IMMEDIATE MODE
|
---Category: IMMEDIATE MODE
|
||||||
|
|
||||||
|
|
||||||
|
@ -1224,17 +1224,35 @@ Standard_Boolean AIS_LocalContext::EndImmediateDraw(const Handle(V3d_View)& aVie
|
|||||||
Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const
|
Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const
|
||||||
{return myMainPM->IsImmediateModeOn();}
|
{return myMainPM->IsImmediateModeOn();}
|
||||||
|
|
||||||
#ifdef BUC60688
|
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) {
|
void AIS_LocalContext::SetSensitivity(const Standard_Real aPrecision) {
|
||||||
|
|
||||||
myMainVS->SetSensitivity(aPrecision);
|
myMainVS->SetSensitivity(aPrecision);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIS_LocalContext::SetSensitivity(const Standard_Integer aPrecision) {
|
Standard_Real AIS_LocalContext::Sensitivity() const {
|
||||||
|
|
||||||
myMainVS->Set(aPrecision);
|
return myMainVS->Sensitivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AIS_LocalContext::SetPixelTolerance(const Standard_Integer aPrecision) {
|
||||||
|
|
||||||
|
myMainVS->SetPixelTolerance(aPrecision);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer AIS_LocalContext::PixelTolerance() const {
|
||||||
|
|
||||||
|
return myMainVS->PixelTolerance();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetZLayer
|
//function : SetZLayer
|
||||||
|
@ -154,6 +154,11 @@ is
|
|||||||
---Purpose: changes the Sensitivity of picking
|
---Purpose: changes the Sensitivity of picking
|
||||||
-- Input value is Real.
|
-- Input value is Real.
|
||||||
|
|
||||||
|
Sensitivity (me) returns Real from Standard;
|
||||||
|
---Level: Public
|
||||||
|
---Purpose: returns the Sensitivity of picking
|
||||||
|
---C++: inline
|
||||||
|
|
||||||
SetClipping(me:mutable ; Xc,Yc,Height,Width:Real) is static;
|
SetClipping(me:mutable ; Xc,Yc,Height,Width:Real) is static;
|
||||||
---Level: Public
|
---Level: Public
|
||||||
---Purpose: sets the clipping limits of dynamic picking
|
---Purpose: sets the clipping limits of dynamic picking
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
#define OCC9026 //AEL Additional method to optimize performance
|
#define OCC9026 //AEL Additional method to optimize performance
|
||||||
//of the FindSelectedOwnerFromShape() method.
|
//of the FindSelectedOwnerFromShape() method.
|
||||||
|
|
||||||
|
inline Standard_Real SelectMgr_ViewerSelector::Sensitivity() const
|
||||||
|
{
|
||||||
|
return mytolerance;
|
||||||
|
}
|
||||||
|
|
||||||
inline void SelectMgr_ViewerSelector::Init()
|
inline void SelectMgr_ViewerSelector::Init()
|
||||||
{
|
{
|
||||||
myCurRank = 1;
|
myCurRank = 1;
|
||||||
|
@ -90,6 +90,11 @@ is
|
|||||||
---Purpose: Provides values for different types of edges. These
|
---Purpose: Provides values for different types of edges. These
|
||||||
-- values are used to filter edges in frameworks
|
-- values are used to filter edges in frameworks
|
||||||
-- inheriting StdSelect_EdgeFilter.
|
-- 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;
|
class ViewerSelector3d;
|
||||||
|
@ -34,7 +34,8 @@ uses
|
|||||||
Group from Graphic3d,
|
Group from Graphic3d,
|
||||||
Structure from Graphic3d,
|
Structure from Graphic3d,
|
||||||
Array1OfReal from TColStd,
|
Array1OfReal from TColStd,
|
||||||
Array1OfPnt2d from TColgp
|
Array1OfPnt2d from TColgp,
|
||||||
|
SensitivityMode from StdSelect
|
||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
@ -50,12 +51,28 @@ is
|
|||||||
-- in the active view ; to be done before the selection action...
|
-- 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;
|
Set(me:mutable; aProj: Projector from Select3D) is static;
|
||||||
---Purpose: Sets the new projector aProj to replace the one used at construction time.
|
---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;
|
Pick (me : mutable;XPix,YPix:Integer;
|
||||||
aView : View from V3d) is static;
|
aView : View from V3d) is static;
|
||||||
@ -147,6 +164,7 @@ fields
|
|||||||
mycenter : Real from Standard[2];
|
mycenter : Real from Standard[2];
|
||||||
myprevcenter : Real from Standard[2];
|
myprevcenter : Real from Standard[2];
|
||||||
mylastzoom : Real from Standard;
|
mylastzoom : Real from Standard;
|
||||||
|
mysensmode : SensitivityMode from StdSelect;
|
||||||
mypixtol : Integer ;
|
mypixtol : Integer ;
|
||||||
myupdatetol : Boolean;
|
myupdatetol : Boolean;
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ StdSelect_ViewerSelector3d
|
|||||||
::StdSelect_ViewerSelector3d():
|
::StdSelect_ViewerSelector3d():
|
||||||
myprj(new Select3D_Projector()),
|
myprj(new Select3D_Projector()),
|
||||||
mylastzoom(0.0),
|
mylastzoom(0.0),
|
||||||
|
mysensmode(StdSelect_SM_WINDOW),
|
||||||
mypixtol(2),
|
mypixtol(2),
|
||||||
myupdatetol(Standard_True)
|
myupdatetol(Standard_True)
|
||||||
{
|
{
|
||||||
@ -118,6 +119,7 @@ StdSelect_ViewerSelector3d
|
|||||||
::StdSelect_ViewerSelector3d(const Handle(Select3D_Projector)& aProj):
|
::StdSelect_ViewerSelector3d(const Handle(Select3D_Projector)& aProj):
|
||||||
myprj(aProj),
|
myprj(aProj),
|
||||||
mylastzoom(0.0),
|
mylastzoom(0.0),
|
||||||
|
mysensmode(StdSelect_SM_WINDOW),
|
||||||
mypixtol(2),
|
mypixtol(2),
|
||||||
myupdatetol(Standard_True)
|
myupdatetol(Standard_True)
|
||||||
{
|
{
|
||||||
@ -148,21 +150,6 @@ void StdSelect_ViewerSelector3d::Convert(const Handle(SelectMgr_Selection)& aSel
|
|||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
|
|
||||||
void StdSelect_ViewerSelector3d
|
|
||||||
::Set(const Standard_Integer PixelTolerance)
|
|
||||||
{
|
|
||||||
if(mypixtol!=PixelTolerance)
|
|
||||||
{
|
|
||||||
mypixtol = PixelTolerance;
|
|
||||||
myupdatetol = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==================================================
|
|
||||||
// Function: Set
|
|
||||||
// Purpose :
|
|
||||||
//==================================================
|
|
||||||
|
|
||||||
void StdSelect_ViewerSelector3d
|
void StdSelect_ViewerSelector3d
|
||||||
::Set(const Handle(Select3D_Projector)& aProj)
|
::Set(const Handle(Select3D_Projector)& aProj)
|
||||||
{
|
{
|
||||||
@ -170,6 +157,33 @@ void StdSelect_ViewerSelector3d
|
|||||||
toupdate=Standard_True;
|
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
|
// Function: SelectPix
|
||||||
// Purpose :
|
// Purpose :
|
||||||
@ -247,7 +261,7 @@ void StdSelect_ViewerSelector3d
|
|||||||
const Standard_Integer YPMax,
|
const Standard_Integer YPMax,
|
||||||
const Handle(V3d_View)& aView)
|
const Handle(V3d_View)& aView)
|
||||||
{
|
{
|
||||||
if (myupdatetol)
|
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
|
||||||
{
|
{
|
||||||
SetSensitivity (aView->Convert (mypixtol));
|
SetSensitivity (aView->Convert (mypixtol));
|
||||||
myupdatetol = Standard_False;
|
myupdatetol = Standard_False;
|
||||||
@ -276,7 +290,7 @@ void StdSelect_ViewerSelector3d
|
|||||||
::Pick(const TColgp_Array1OfPnt2d& aPolyline,
|
::Pick(const TColgp_Array1OfPnt2d& aPolyline,
|
||||||
const Handle(V3d_View)& aView)
|
const Handle(V3d_View)& aView)
|
||||||
{
|
{
|
||||||
if (myupdatetol)
|
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
|
||||||
{
|
{
|
||||||
SetSensitivity (aView->Convert (mypixtol));
|
SetSensitivity (aView->Convert (mypixtol));
|
||||||
myupdatetol = Standard_False;
|
myupdatetol = Standard_False;
|
||||||
@ -317,7 +331,7 @@ void StdSelect_ViewerSelector3d
|
|||||||
void StdSelect_ViewerSelector3d::
|
void StdSelect_ViewerSelector3d::
|
||||||
DisplayAreas(const Handle(V3d_View)& aView)
|
DisplayAreas(const Handle(V3d_View)& aView)
|
||||||
{
|
{
|
||||||
if (myupdatetol)
|
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
|
||||||
{
|
{
|
||||||
SetSensitivity (aView->Convert (mypixtol));
|
SetSensitivity (aView->Convert (mypixtol));
|
||||||
myupdatetol = Standard_False;
|
myupdatetol = Standard_False;
|
||||||
@ -500,7 +514,7 @@ UpdateProj(const Handle(V3d_View)& aView)
|
|||||||
mylastzoom = aView->Scale();
|
mylastzoom = aView->Scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myupdatetol)
|
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
|
||||||
{
|
{
|
||||||
SetSensitivity (aView->Convert (mypixtol));
|
SetSensitivity (aView->Convert (mypixtol));
|
||||||
myupdatetol = Standard_False;
|
myupdatetol = Standard_False;
|
||||||
@ -519,7 +533,7 @@ UpdateProj(const Handle(V3d_View)& aView)
|
|||||||
//=============================
|
//=============================
|
||||||
void StdSelect_ViewerSelector3d::DisplaySensitive(const Handle(V3d_View)& aViou)
|
void StdSelect_ViewerSelector3d::DisplaySensitive(const Handle(V3d_View)& aViou)
|
||||||
{
|
{
|
||||||
if (myupdatetol)
|
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
|
||||||
{
|
{
|
||||||
SetSensitivity (aViou->Convert (mypixtol));
|
SetSensitivity (aViou->Convert (mypixtol));
|
||||||
myupdatetol = Standard_False;
|
myupdatetol = Standard_False;
|
||||||
|
@ -16,6 +16,16 @@
|
|||||||
// purpose or non-infringement. Please see the License for the specific terms
|
// purpose or non-infringement. Please see the License for the specific terms
|
||||||
// and conditions governing the rights and limitations under the License.
|
// 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
|
inline const Handle(Select3D_Projector)& StdSelect_ViewerSelector3d::Projector() const
|
||||||
{
|
{
|
||||||
return myprj;
|
return myprj;
|
||||||
|
@ -754,6 +754,63 @@ static int VDebug(Draw_Interpretor& di, Standard_Integer , const char** )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//function : VSelPrecision
|
||||||
|
//purpose : To set the selection precision mode and tolerance value
|
||||||
|
//Draw arg : Selection precision mode (0 for window, 1 for view) and tolerance
|
||||||
|
// value (integer number of pixel for window mode, double value of
|
||||||
|
// sensitivity for view mode). Without arguments the function just
|
||||||
|
// prints the current precision mode and the corresponding tolerance.
|
||||||
|
//==============================================================================
|
||||||
|
static int VSelPrecision(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
|
{
|
||||||
|
if( argc > 3 )
|
||||||
|
{
|
||||||
|
di << "Use: " << argv[0] << " [precision_mode [tolerance_value]]\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||||
|
if( aContext.IsNull() )
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if( argc == 1 )
|
||||||
|
{
|
||||||
|
StdSelect_SensitivityMode aMode = aContext->SensitivityMode();
|
||||||
|
if( aMode == StdSelect_SM_WINDOW )
|
||||||
|
{
|
||||||
|
Standard_Integer aPixelTolerance = aContext->PixelTolerance();
|
||||||
|
di << "Precision mode : 0 (window)\n";
|
||||||
|
di << "Pixel tolerance : " << aPixelTolerance << "\n";
|
||||||
|
}
|
||||||
|
else if( aMode == StdSelect_SM_VIEW )
|
||||||
|
{
|
||||||
|
Standard_Real aSensitivity = aContext->Sensitivity();
|
||||||
|
di << "Precision mode : 1 (view)\n";
|
||||||
|
di << "Sensitivity : " << aSensitivity << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( argc > 1 )
|
||||||
|
{
|
||||||
|
StdSelect_SensitivityMode aMode = ( StdSelect_SensitivityMode )atoi( argv[1] );
|
||||||
|
aContext->SetSensitivityMode( aMode );
|
||||||
|
if( argc > 2 )
|
||||||
|
{
|
||||||
|
if( aMode == StdSelect_SM_WINDOW )
|
||||||
|
{
|
||||||
|
Standard_Integer aPixelTolerance = atoi( argv[2] );
|
||||||
|
aContext->SetPixelTolerance( aPixelTolerance );
|
||||||
|
}
|
||||||
|
else if( aMode == StdSelect_SM_VIEW )
|
||||||
|
{
|
||||||
|
Standard_Real aSensitivity = atof( argv[2] );
|
||||||
|
aContext->SetSensitivity( aSensitivity );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : VDump
|
//function : VDump
|
||||||
//purpose : To dump the active view snapshot to image file
|
//purpose : To dump the active view snapshot to image file
|
||||||
@ -3482,6 +3539,10 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
"vardisp : erase active entities",
|
"vardisp : erase active entities",
|
||||||
__FILE__,VClearSensi,group);
|
__FILE__,VClearSensi,group);
|
||||||
|
|
||||||
|
theCommands.Add("vselprecision",
|
||||||
|
"vselprecision : vselprecision [precision_mode [tolerance_value]]",
|
||||||
|
__FILE__,VSelPrecision,group);
|
||||||
|
|
||||||
theCommands.Add("vperf",
|
theCommands.Add("vperf",
|
||||||
"vperf: vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)",
|
"vperf: vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)",
|
||||||
__FILE__,VPerf,group);
|
__FILE__,VPerf,group);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user