mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0026886: Visualization, TKV3d - eliminate global variables
- AIS_InteractiveContext - create new dummy class field to have an empty TopoDS_Shape object. - AIS_Point, PrsMgr_PresentableObject - rename static variables to local function variables. - AIS_Shape, SelectMgr_SelectableObject - remove unused static variables. - Graphic3d_MaterialAspect, V3d_Viewer - make global static variables as constant. - V3d_View - move global variable zRotation to class field. - Move a variable theCurrentSelection as a field of AIS_InteractiveContext and AIS_LocalContext classes. Multiple selection is not used now, so each Context have an own selection. - Move myStructGenId from Graphic3d_StructureManager to Graphic3d_GraphicDriver for identifying the structures in the driver. - Move default variable (no shading light) from static value to the class field of OpenGL_View. Porting note: - Static methods of AIS_Selection is not used now. Methods of AIS_InteractiveContext::InitSelected(),::MoreSelected(),::NextSelected() should be used instead of static methods of AIS_Selection.
This commit is contained in:
@@ -131,6 +131,7 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView th
|
||||
MyActiveLights(),
|
||||
myActiveLightsIterator(),
|
||||
SwitchSetFront (Standard_False),
|
||||
myZRotation (Standard_False),
|
||||
MyTrsf (1, 4, 1, 4)
|
||||
{
|
||||
myView = theViewer->Driver()->CreateView (theViewer->StructureManager());
|
||||
@@ -188,6 +189,7 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const Handle(V3d_View)&
|
||||
MyActiveLights(),
|
||||
myActiveLightsIterator(),
|
||||
SwitchSetFront(Standard_False),
|
||||
myZRotation (Standard_False),
|
||||
MyTrsf (1, 4, 1, 4)
|
||||
{
|
||||
myView = theViewer->Driver()->CreateView (theViewer->StructureManager());
|
||||
@@ -2777,7 +2779,6 @@ void V3d_View::FitAll(const Handle(Aspect_Window)& aWindow,
|
||||
//function : StartRotation
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
static Standard_Boolean zRotation = Standard_False;
|
||||
void V3d_View::StartRotation(const Standard_Integer X,
|
||||
const Standard_Integer Y,
|
||||
const Quantity_Ratio zRotationThreshold)
|
||||
@@ -2789,13 +2790,13 @@ void V3d_View::StartRotation(const Standard_Integer X,
|
||||
ry = Standard_Real(Convert(y));
|
||||
Gravity(gx,gy,gz);
|
||||
Rotate(0.,0.,0.,gx,gy,gz,Standard_True);
|
||||
zRotation = Standard_False;
|
||||
myZRotation = Standard_False;
|
||||
if( zRotationThreshold > 0. ) {
|
||||
Standard_Real dx = Abs(sx - rx/2.);
|
||||
Standard_Real dy = Abs(sy - ry/2.);
|
||||
// if( dx > rx/3. || dy > ry/3. ) zRotation = Standard_True;
|
||||
// if( dx > rx/3. || dy > ry/3. ) myZRotation = Standard_True;
|
||||
Standard_Real dd = zRotationThreshold * (rx + ry)/2.;
|
||||
if( dx > dd || dy > dd ) zRotation = Standard_True;
|
||||
if( dx > dd || dy > dd ) myZRotation = Standard_True;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2812,7 +2813,7 @@ void V3d_View::Rotation(const Standard_Integer X,
|
||||
return;
|
||||
}
|
||||
Standard_Real dx=0.,dy=0.,dz=0.;
|
||||
if( zRotation ) {
|
||||
if( myZRotation ) {
|
||||
dz = atan2(Standard_Real(X)-rx/2., ry/2.-Standard_Real(Y)) -
|
||||
atan2(sx-rx/2.,ry/2.-sy);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user