SelectionManager from SelectMgr,
PresentationManager3d from PrsMgr,
ViewerSelector3d from StdSelect,
+ SensitivityMode from StdSelect,
MapOfInteractive from AIS,
InteractiveObject from AIS,
DisplayMode from AIS,
-- Removes selection mode from Interactive Objects.
-- 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;
aPrecision: Real from Standard);
---Level: Public
-- When a local context is open, the defined sensitivity applies to
-- 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);
---Level: Public
---Purpose: Define the current selection pixel sensitivity
-- Warning: When a local context is open the sensitivity is apply on it
-- instead on the main context.
+ PixelTolerance(me) returns Integer from Standard;
+ ---Level: Public
+ ---Purpose: Returns the pixel tolerance.
+
---Category: put locations on objects....
--
{
InitAttributes();
mgrSelector->Add(myCollectorSel);
-#ifdef BUC60688
- SetSensitivity();
-#else
- myCollectorSel->Set(4);
-#endif
-
+ SetPixelTolerance();
}
void AIS_InteractiveContext::Delete() const
{
}
-#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
//purpose :
}
//=======================================================================
-//function : SetSensitivity
+//function : Sensitivity
//purpose :
//=======================================================================
-void AIS_InteractiveContext::SetSensitivity(const Standard_Integer aPrecision) {
+Standard_Real AIS_InteractiveContext::Sensitivity() const {
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 {
- myMainSel->Set(aPrecision);
- if( !myCollectorSel.IsNull() ) myCollectorSel->Set(aPrecision);
+ myMainSel->SetPixelTolerance(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
HLA->SetTypeOfLine(Aspect_TOL_DASH);
// tolerance to 4 pixels...
-#ifdef BUC60688
- SetSensitivity();
-#else
- myMainSel->Set(4);
-#endif
+ SetPixelTolerance();
// Customizing the drawer for trihedrons and planes...
ListOfFilter from SelectMgr,
BRepOwner from StdSelect,
ViewerSelector3d from StdSelect,
+ SensitivityMode from StdSelect,
InteractiveContext from AIS,
ClearMode from AIS,
InteractiveObject from AIS,
HiCol : out NameOfColor from Quantity)
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;
aPrecision: Real from Standard);
---Level: Public
---Purpose: Define the current selection sensitivity for
-- 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);
---Level: Public
---Purpose: Define the current selection sensitivity for
-- this local context according to the view size.
+ PixelTolerance(me) returns Integer from Standard;
+ ---Level: Public
+ ---Purpose: Returns the pixel tolerance.
+
---Category: IMMEDIATE MODE
Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const
{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) {
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
---Purpose: changes the Sensitivity of picking
-- 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;
---Level: Public
---Purpose: sets the clipping limits of dynamic picking
#define OCC9026 //AEL Additional method to optimize performance
//of the FindSelectedOwnerFromShape() method.
+inline Standard_Real SelectMgr_ViewerSelector::Sensitivity() const
+{
+ return mytolerance;
+}
+
inline void SelectMgr_ViewerSelector::Init()
{
myCurRank = 1;
---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;
Group from Graphic3d,
Structure from Graphic3d,
Array1OfReal from TColStd,
- Array1OfPnt2d from TColgp
+ Array1OfPnt2d from TColgp,
+ SensitivityMode from StdSelect
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;
mycenter : Real from Standard[2];
myprevcenter : Real from Standard[2];
mylastzoom : Real from Standard;
+ mysensmode : SensitivityMode from StdSelect;
mypixtol : Integer ;
myupdatetol : Boolean;
::StdSelect_ViewerSelector3d():
myprj(new Select3D_Projector()),
mylastzoom(0.0),
+mysensmode(StdSelect_SM_WINDOW),
mypixtol(2),
myupdatetol(Standard_True)
{
::StdSelect_ViewerSelector3d(const Handle(Select3D_Projector)& aProj):
myprj(aProj),
mylastzoom(0.0),
+mysensmode(StdSelect_SM_WINDOW),
mypixtol(2),
myupdatetol(Standard_True)
{
//==================================================
void StdSelect_ViewerSelector3d
-::Set(const Standard_Integer PixelTolerance)
+::Set(const Handle(Select3D_Projector)& aProj)
{
- if(mypixtol!=PixelTolerance)
- {
- mypixtol = PixelTolerance;
- myupdatetol = Standard_True;
- }
+ myprj = aProj;
+ toupdate=Standard_True;
}
//==================================================
-// Function: Set
+// Function: SetSensitivityMode
// Purpose :
//==================================================
void StdSelect_ViewerSelector3d
-::Set(const Handle(Select3D_Projector)& aProj)
+::SetSensitivityMode(const StdSelect_SensitivityMode aMode)
{
- myprj = aProj;
- toupdate=Standard_True;
+ mysensmode = aMode;
+ toupdate = Standard_True;
+}
+
+//==================================================
+// Function: SetPixelTolerance
+// Purpose :
+//==================================================
+
+void StdSelect_ViewerSelector3d
+::SetPixelTolerance(const Standard_Integer aTolerance)
+{
+ if(mypixtol!=aTolerance)
+ {
+ mypixtol = aTolerance;
+ myupdatetol = Standard_True;
+ }
}
//==================================================
const Standard_Integer YPMax,
const Handle(V3d_View)& aView)
{
- if (myupdatetol)
+ if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
::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;
void StdSelect_ViewerSelector3d::
DisplayAreas(const Handle(V3d_View)& aView)
{
- if (myupdatetol)
+ if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
mylastzoom = aView->Scale();
}
- if (myupdatetol)
+ if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
myupdatetol = Standard_False;
//=============================
void StdSelect_ViewerSelector3d::DisplaySensitive(const Handle(V3d_View)& aViou)
{
- if (myupdatetol)
+ if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aViou->Convert (mypixtol));
myupdatetol = Standard_False;
// 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;
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
//purpose : To dump the active view snapshot to image file
"vardisp : erase active entities",
__FILE__,VClearSensi,group);
+ theCommands.Add("vselprecision",
+ "vselprecision : vselprecision [precision_mode [tolerance_value]]",
+ __FILE__,VSelPrecision,group);
+
theCommands.Add("vperf",
"vperf: vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)",
__FILE__,VPerf,group);