1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0032907: Coding Rules - eliminate MSVC warning C5054 on VS2019/C++20 (operator &,|: deprecated between enumerations of different types)

operator `&`,`|`: deprecated between enumerations of different types
This commit is contained in:
ddzama 2022-03-30 10:06:01 +03:00 committed by smoskvin
parent e9a13cf123
commit 9416ba5fb0
6 changed files with 160 additions and 139 deletions

View File

@ -117,24 +117,37 @@ AIS_ViewController::AIS_ViewController()
myRubberBand->SetDisplayMode (0);
myRubberBand->SetMutable (true);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_SHIFT, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT, AIS_MouseGesture_SelectRectangle);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_SHIFT, AIS_MouseGesture_SelectRectangle);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton,
AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_MouseGesture_Pan);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT,
AIS_MouseGesture_SelectRectangle);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_MouseGesture_SelectRectangle);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton, AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT, AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_SHIFT, AIS_SelectionScheme_XOR);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_SHIFT, AIS_SelectionScheme_XOR);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton,
AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT,
AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_SelectionScheme_XOR);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_SelectionScheme_XOR);
myMouseGestureMap.Bind (Aspect_VKeyMouse_RightButton, AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind (Aspect_VKeyMouse_RightButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_RightButton,
AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_RightButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_MiddleButton,
AIS_MouseGesture_Pan);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_MiddleButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
AIS_MouseGesture_Pan);
myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);
myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);
myXRTeleportHaptic.Duration = 3600.0f;
myXRTeleportHaptic.Frequency = 0.1f;

View File

@ -96,7 +96,7 @@ public:
void Orientation (const Standard_Integer I, const TopAbs_Orientation Or)
{
myFlags(I) &= ~EMaskOrient;
myFlags(I) |= (Or & EMaskOrient);
myFlags(I) |= ((Standard_Integer)Or & (Standard_Integer)EMaskOrient);
}
TopAbs_Orientation Orientation (const Standard_Integer I) const

View File

@ -20,7 +20,7 @@
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Selected() const
{ return (myFlags & FMaskSelected) != 0; }
{ return (myFlags & (Standard_Integer)FMaskSelected) != 0; }
//=======================================================================
//function : Selected
@ -29,8 +29,8 @@ inline Standard_Boolean HLRBRep_FaceData::Selected() const
inline void HLRBRep_FaceData::Selected(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSelected;
else myFlags &= ~FMaskSelected;
if (B) myFlags |= (Standard_Integer)FMaskSelected;
else myFlags &= ~((Standard_Integer)FMaskSelected);
}
//=======================================================================
@ -39,7 +39,7 @@ inline void HLRBRep_FaceData::Selected(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Back() const
{ return (myFlags & FMaskBack) != 0; }
{ return (myFlags & (Standard_Integer)FMaskBack) != 0; }
//=======================================================================
//function : Back
@ -48,8 +48,8 @@ inline Standard_Boolean HLRBRep_FaceData::Back() const
inline void HLRBRep_FaceData::Back(const Standard_Boolean B)
{
if (B) myFlags |= FMaskBack;
else myFlags &= ~FMaskBack;
if (B) myFlags |= (Standard_Integer)FMaskBack;
else myFlags &= ~((Standard_Integer)FMaskBack);
}
//=======================================================================
@ -58,7 +58,7 @@ inline void HLRBRep_FaceData::Back(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Side() const
{ return (myFlags & FMaskSide) != 0; }
{ return (myFlags & (Standard_Integer)FMaskSide) != 0; }
//=======================================================================
//function : Side
@ -67,8 +67,8 @@ inline Standard_Boolean HLRBRep_FaceData::Side() const
inline void HLRBRep_FaceData::Side(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSide;
else myFlags &= ~FMaskSide;
if (B) myFlags |= (Standard_Integer)FMaskSide;
else myFlags &= ~((Standard_Integer)FMaskSide);
}
//=======================================================================
@ -77,7 +77,7 @@ inline void HLRBRep_FaceData::Side(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Closed() const
{ return (myFlags & FMaskClosed) != 0; }
{ return (myFlags & (Standard_Integer)FMaskClosed) != 0; }
//=======================================================================
//function : Closed
@ -86,8 +86,8 @@ inline Standard_Boolean HLRBRep_FaceData::Closed() const
inline void HLRBRep_FaceData::Closed(const Standard_Boolean B)
{
if (B) myFlags |= FMaskClosed;
else myFlags &= ~FMaskClosed;
if (B) myFlags |= (Standard_Integer)FMaskClosed;
else myFlags &= ~((Standard_Integer)FMaskClosed);
}
//=======================================================================
@ -96,7 +96,7 @@ inline void HLRBRep_FaceData::Closed(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Hiding() const
{ return (myFlags & FMaskHiding) != 0; }
{ return (myFlags & (Standard_Integer)FMaskHiding) != 0; }
//=======================================================================
//function : Hiding
@ -105,8 +105,8 @@ inline Standard_Boolean HLRBRep_FaceData::Hiding() const
inline void HLRBRep_FaceData::Hiding(const Standard_Boolean B)
{
if (B) myFlags |= FMaskHiding;
else myFlags &= ~FMaskHiding;
if (B) myFlags |= (Standard_Integer)FMaskHiding;
else myFlags &= ~((Standard_Integer)FMaskHiding);
}
//=======================================================================
@ -115,7 +115,7 @@ inline void HLRBRep_FaceData::Hiding(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Simple() const
{ return (myFlags & FMaskSimple) != 0; }
{ return (myFlags & (Standard_Integer)FMaskSimple) != 0; }
//=======================================================================
//function : Simple
@ -124,8 +124,8 @@ inline Standard_Boolean HLRBRep_FaceData::Simple() const
inline void HLRBRep_FaceData::Simple(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSimple;
else myFlags &= ~FMaskSimple;
if (B) myFlags |= (Standard_Integer)FMaskSimple;
else myFlags &= ~((Standard_Integer)FMaskSimple);
}
//=======================================================================
@ -134,7 +134,7 @@ inline void HLRBRep_FaceData::Simple(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Cut() const
{ return (myFlags & FMaskCut) != 0; }
{ return (myFlags & (Standard_Integer)FMaskCut) != 0; }
//=======================================================================
//function : Cut
@ -143,8 +143,8 @@ inline Standard_Boolean HLRBRep_FaceData::Cut() const
inline void HLRBRep_FaceData::Cut(const Standard_Boolean B)
{
if (B) myFlags |= FMaskCut;
else myFlags &= ~FMaskCut;
if (B) myFlags |= (Standard_Integer)FMaskCut;
else myFlags &= ~((Standard_Integer)FMaskCut);
}
//=======================================================================
@ -153,7 +153,7 @@ inline void HLRBRep_FaceData::Cut(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::WithOutL() const
{ return (myFlags & FMaskWithOutL) != 0; }
{ return (myFlags & (Standard_Integer)FMaskWithOutL) != 0; }
//=======================================================================
//function : WithOutL
@ -162,8 +162,8 @@ inline Standard_Boolean HLRBRep_FaceData::WithOutL() const
inline void HLRBRep_FaceData::WithOutL(const Standard_Boolean B)
{
if (B) myFlags |= FMaskWithOutL;
else myFlags &= ~FMaskWithOutL;
if (B) myFlags |= (Standard_Integer)FMaskWithOutL;
else myFlags &= ~((Standard_Integer)FMaskWithOutL);
}
//=======================================================================
@ -172,7 +172,7 @@ inline void HLRBRep_FaceData::WithOutL(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Plane() const
{ return (myFlags & FMaskPlane) != 0; }
{ return (myFlags & (Standard_Integer)FMaskPlane) != 0; }
//=======================================================================
//function : Plane
@ -181,8 +181,8 @@ inline Standard_Boolean HLRBRep_FaceData::Plane() const
inline void HLRBRep_FaceData::Plane(const Standard_Boolean B)
{
if (B) myFlags |= FMaskPlane;
else myFlags &= ~FMaskPlane;
if (B) myFlags |= (Standard_Integer)FMaskPlane;
else myFlags &= ~((Standard_Integer)FMaskPlane);
}
//=======================================================================
@ -191,7 +191,7 @@ inline void HLRBRep_FaceData::Plane(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Cylinder() const
{ return (myFlags & FMaskCylinder) != 0; }
{ return (myFlags & (Standard_Integer)FMaskCylinder) != 0; }
//=======================================================================
//function : Cylinder
@ -200,8 +200,8 @@ inline Standard_Boolean HLRBRep_FaceData::Cylinder() const
inline void HLRBRep_FaceData::Cylinder(const Standard_Boolean B)
{
if (B) myFlags |= FMaskCylinder;
else myFlags &= ~FMaskCylinder;
if (B) myFlags |= (Standard_Integer)FMaskCylinder;
else myFlags &= ~((Standard_Integer)FMaskCylinder);
}
//=======================================================================
@ -210,7 +210,7 @@ inline void HLRBRep_FaceData::Cylinder(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Cone() const
{ return (myFlags & FMaskCone) != 0; }
{ return (myFlags & (Standard_Integer)FMaskCone) != 0; }
//=======================================================================
//function : Cone
@ -219,8 +219,8 @@ inline Standard_Boolean HLRBRep_FaceData::Cone() const
inline void HLRBRep_FaceData::Cone(const Standard_Boolean B)
{
if (B) myFlags |= FMaskCone;
else myFlags &= ~FMaskCone;
if (B) myFlags |= (Standard_Integer)FMaskCone;
else myFlags &= ~((Standard_Integer)FMaskCone);
}
//=======================================================================
@ -229,7 +229,7 @@ inline void HLRBRep_FaceData::Cone(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Sphere() const
{ return (myFlags & FMaskSphere) != 0; }
{ return (myFlags & (Standard_Integer)FMaskSphere) != 0; }
//=======================================================================
//function : Sphere
@ -238,8 +238,8 @@ inline Standard_Boolean HLRBRep_FaceData::Sphere() const
inline void HLRBRep_FaceData::Sphere(const Standard_Boolean B)
{
if (B) myFlags |= FMaskSphere;
else myFlags &= ~FMaskSphere;
if (B) myFlags |= (Standard_Integer)FMaskSphere;
else myFlags &= ~((Standard_Integer)FMaskSphere);
}
//=======================================================================
@ -248,7 +248,7 @@ inline void HLRBRep_FaceData::Sphere(const Standard_Boolean B)
//=======================================================================
inline Standard_Boolean HLRBRep_FaceData::Torus() const
{ return (myFlags & FMaskTorus) != 0; }
{ return (myFlags & (Standard_Integer)FMaskTorus) != 0; }
//=======================================================================
//function : Torus
@ -257,8 +257,8 @@ inline Standard_Boolean HLRBRep_FaceData::Torus() const
inline void HLRBRep_FaceData::Torus(const Standard_Boolean B)
{
if (B) myFlags |= FMaskTorus;
else myFlags &= ~FMaskTorus;
if (B) myFlags |= (Standard_Integer)FMaskTorus;
else myFlags &= ~((Standard_Integer)FMaskTorus);
}
//=======================================================================
@ -283,7 +283,7 @@ inline void HLRBRep_FaceData::Size(const Standard_Real S)
//=======================================================================
inline TopAbs_Orientation HLRBRep_FaceData::Orientation() const
{ return ((TopAbs_Orientation)(myFlags & EMaskOrient)); }
{ return ((TopAbs_Orientation)(myFlags & (Standard_Integer)EMaskOrient)); }
//=======================================================================
//function : Orientation
@ -292,8 +292,8 @@ inline TopAbs_Orientation HLRBRep_FaceData::Orientation() const
inline void HLRBRep_FaceData::Orientation(const TopAbs_Orientation O)
{
myFlags &= ~EMaskOrient;
myFlags |= (O & EMaskOrient);
myFlags &= ~(Standard_Integer)EMaskOrient;
myFlags |= ((Standard_Integer)O & (Standard_Integer)EMaskOrient);
}
//=======================================================================

View File

@ -31,86 +31,84 @@
*
* The flags are grouped in semantic groups:
* - No flags means nothing done
* - Done flags correspond to some operation succesffuly completed
* - Done flags correspond to some operation successfully completed
* - Warning flags correspond to warning messages on some
* potentially wrong situation, not harming algorithm execution
* - Alarm flags correspond to more severe warnings about incorrect
* user data, while not breaking algorithm execution
* - Fail flags correspond to cases when algorithm failed to complete
*/
class Message_ExecStatus
{
private:
private:
//! Mask to separate bits indicating status type and index within the type
enum StatusMask {
MType = 0x0000ff00,
MIndex = 0x000000ff
};
static inline int getBitFlag (int status)
enum StatusMask
{
return 0x1 << (status & MIndex);
MType = 0x0000ff00,
MIndex = 0x000000ff
};
static inline int getBitFlag (int theStatus)
{
return 0x1 << (theStatus & MIndex);
}
public:
public:
//!@name Creation and simple operations with statuses
//!@{
//! Create empty execution status
Message_ExecStatus ()
: myDone( Message_None), myWarn( Message_None),
myAlarm( Message_None), myFail( Message_None)
Message_ExecStatus()
: myDone (Message_None), myWarn (Message_None),
myAlarm (Message_None), myFail (Message_None)
{}
//! Initialise the execution status
Message_ExecStatus ( Message_Status status )
: myDone( Message_None), myWarn( Message_None),
myAlarm( Message_None), myFail( Message_None)
Message_ExecStatus (Message_Status theStatus)
: myDone (Message_None), myWarn (Message_None),
myAlarm (Message_None), myFail (Message_None)
{
Set( status );
Set (theStatus);
}
//! Sets a status flag
void Set (Message_Status status)
{
switch( status & MType )
void Set (Message_Status theStatus)
{
switch (TypeOfStatus (theStatus))
{
case Message_DONE: myDone |= (getBitFlag( status )); break;
case Message_WARN: myWarn |= (getBitFlag( status )); break;
case Message_ALARM:myAlarm |= (getBitFlag( status )); break;
case Message_FAIL: myFail |= (getBitFlag( status )); break;
default: break;
case Message_DONE: myDone |= (getBitFlag (theStatus)); break;
case Message_WARN: myWarn |= (getBitFlag (theStatus)); break;
case Message_ALARM: myAlarm |= (getBitFlag (theStatus)); break;
case Message_FAIL: myFail |= (getBitFlag (theStatus)); break;
}
}
//! Check status for being set
Standard_Boolean IsSet (Message_Status status) const
Standard_Boolean IsSet (Message_Status theStatus) const
{
switch( status & MType )
switch (TypeOfStatus (theStatus))
{
case Message_DONE: return ( myDone & getBitFlag( status ) ? Standard_True : Standard_False );
case Message_WARN: return ( myWarn & getBitFlag( status ) ? Standard_True : Standard_False );
case Message_ALARM:return ( myAlarm & getBitFlag( status ) ? Standard_True : Standard_False );
case Message_FAIL: return ( myFail & getBitFlag( status ) ? Standard_True : Standard_False );
default: return Standard_False;
case Message_DONE: return (myDone & getBitFlag (theStatus)) != 0;
case Message_WARN: return (myWarn & getBitFlag (theStatus)) != 0;
case Message_ALARM: return (myAlarm & getBitFlag (theStatus)) != 0;
case Message_FAIL: return (myFail & getBitFlag (theStatus)) != 0;
}
return Standard_False;
}
//! Clear one status
void Clear (Message_Status status)
void Clear (Message_Status theStatus)
{
switch( status & MType )
switch (TypeOfStatus (theStatus))
{
case Message_DONE: myDone &= ~(getBitFlag( status )); return;
case Message_WARN: myWarn &= ~(getBitFlag( status )); return;
case Message_ALARM:myAlarm &= ~(getBitFlag( status )); return;
case Message_FAIL: myFail &= ~(getBitFlag( status )); return;
default: return;
case Message_DONE: myDone &= ~(getBitFlag (theStatus)); return;
case Message_WARN: myWarn &= ~(getBitFlag (theStatus)); return;
case Message_ALARM:myAlarm &= ~(getBitFlag (theStatus)); return;
case Message_FAIL: myFail &= ~(getBitFlag (theStatus)); return;
}
}
//!@}
//!@name Advanced: Group operations (useful for analysis)
@ -121,7 +119,7 @@ class Message_ExecStatus
Standard_Boolean IsFail () const { return myFail != Message_None; }
Standard_Boolean IsWarn () const { return myWarn != Message_None; }
Standard_Boolean IsAlarm () const { return myAlarm != Message_None; }
//! Set all statuses of each type
void SetAllDone () { myDone = ~0; }
void SetAllWarn () { myWarn = ~0; }
@ -139,7 +137,7 @@ class Message_ExecStatus
{
myDone = myWarn = myAlarm = myFail = Message_None;
}
//! Add statuses to me from theOther execution status
void Add ( const Message_ExecStatus& theOther )
{
@ -164,11 +162,11 @@ class Message_ExecStatus
//@}
public:
public:
//!@name Advanced: Iteration and analysis of status flags
//!@{
//! Definitions of range of available statuses
enum StatusRange
{
@ -179,29 +177,29 @@ class Message_ExecStatus
};
//! Returns index of status in whole range [FirstStatus, LastStatus]
static Standard_Integer StatusIndex( Message_Status status )
static Standard_Integer StatusIndex (Message_Status theStatus)
{
switch( status & MType )
switch (TypeOfStatus (theStatus))
{
case Message_DONE: return 0 * StatusesPerType + LocalStatusIndex(status);
case Message_WARN: return 1 * StatusesPerType + LocalStatusIndex(status);
case Message_ALARM: return 2 * StatusesPerType + LocalStatusIndex(status);
case Message_FAIL: return 3 * StatusesPerType + LocalStatusIndex(status);
default: return 0;
case Message_DONE: return 0 * StatusesPerType + LocalStatusIndex(theStatus);
case Message_WARN: return 1 * StatusesPerType + LocalStatusIndex(theStatus);
case Message_ALARM: return 2 * StatusesPerType + LocalStatusIndex(theStatus);
case Message_FAIL: return 3 * StatusesPerType + LocalStatusIndex(theStatus);
}
return 0;
}
//! Returns index of status inside type of status (Done or Warn or, etc)
//! in range [1, StatusesPerType]
static Standard_Integer LocalStatusIndex( Message_Status status )
static Standard_Integer LocalStatusIndex (Message_Status theStatus)
{
return (status & MIndex) + 1;
return ((Standard_UInteger )theStatus & (Standard_UInteger )MIndex) + 1;
}
//! Returns status type (DONE, WARN, ALARM, or FAIL)
static Message_StatusType TypeOfStatus( Message_Status status )
static Message_StatusType TypeOfStatus (Message_Status theStatus)
{
return (Message_StatusType)(status & MType);
return (Message_StatusType )((Standard_UInteger )theStatus & (Standard_UInteger )MType);
}
//! Returns status with index theIndex in whole range [FirstStatus, LastStatus]
@ -221,8 +219,7 @@ class Message_ExecStatus
//!@}
private:
// ---------- PRIVATE FIELDS ----------
private:
Standard_Integer myDone;
Standard_Integer myWarn;
Standard_Integer myAlarm;

View File

@ -59,6 +59,7 @@
#include <Standard_Macro.hxx>
typedef int Standard_Integer;
typedef unsigned int Standard_UInteger;
typedef double Standard_Real;
typedef bool Standard_Boolean;
typedef float Standard_ShortReal;

View File

@ -88,27 +88,37 @@ ViewerTest_EventManager::ViewerTest_EventManager (const Handle(V3d_View)&
{
myViewAnimation = GlobalViewAnimation();
addActionHotKeys (Aspect_VKey_NavForward, Aspect_VKey_W, Aspect_VKey_W | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavBackward , Aspect_VKey_S, Aspect_VKey_S | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideLeft, Aspect_VKey_A, Aspect_VKey_A | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideRight, Aspect_VKey_D, Aspect_VKey_D | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavRollCCW, Aspect_VKey_Q, Aspect_VKey_Q | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavRollCW, Aspect_VKey_E, Aspect_VKey_E | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavForward, (Standard_UInteger )Aspect_VKey_W,
(Standard_UInteger )Aspect_VKey_W | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavBackward , (Standard_UInteger )Aspect_VKey_S,
(Standard_UInteger )Aspect_VKey_S | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideLeft, (Standard_UInteger )Aspect_VKey_A,
(Standard_UInteger )Aspect_VKey_A | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideRight, (Standard_UInteger )Aspect_VKey_D,
(Standard_UInteger )Aspect_VKey_D | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavRollCCW, (Standard_UInteger )Aspect_VKey_Q,
(Standard_UInteger )Aspect_VKey_Q | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavRollCW, (Standard_UInteger )Aspect_VKey_E,
(Standard_UInteger )Aspect_VKey_E | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSpeedIncrease, Aspect_VKey_Plus, Aspect_VKey_Plus | Aspect_VKeyFlags_SHIFT,
Aspect_VKey_Equal,
Aspect_VKey_NumpadAdd, Aspect_VKey_NumpadAdd | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSpeedDecrease, Aspect_VKey_Minus, Aspect_VKey_Minus | Aspect_VKeyFlags_SHIFT,
Aspect_VKey_NumpadSubtract, Aspect_VKey_NumpadSubtract | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSpeedIncrease, (Standard_UInteger )Aspect_VKey_Plus,
(Standard_UInteger )Aspect_VKey_Plus | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
(Standard_UInteger )Aspect_VKey_Equal,
(Standard_UInteger )Aspect_VKey_NumpadAdd,
(Standard_UInteger )Aspect_VKey_NumpadAdd | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSpeedDecrease, (Standard_UInteger )Aspect_VKey_Minus,
(Standard_UInteger )Aspect_VKey_Minus | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
(Standard_UInteger )Aspect_VKey_NumpadSubtract,
(Standard_UInteger )Aspect_VKey_NumpadSubtract | (Standard_UInteger )Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavLookUp, Aspect_VKey_Up);
addActionHotKeys (Aspect_VKey_NavLookDown, Aspect_VKey_Down);
addActionHotKeys (Aspect_VKey_NavLookLeft, Aspect_VKey_Left);
addActionHotKeys (Aspect_VKey_NavLookRight, Aspect_VKey_Right);
addActionHotKeys (Aspect_VKey_NavSlideLeft, Aspect_VKey_Left | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideRight, Aspect_VKey_Right | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideUp, Aspect_VKey_Up | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideDown, Aspect_VKey_Down | Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavLookUp, (Standard_UInteger )Aspect_VKey_Up);
addActionHotKeys (Aspect_VKey_NavLookDown, (Standard_UInteger )Aspect_VKey_Down);
addActionHotKeys (Aspect_VKey_NavLookLeft, (Standard_UInteger )Aspect_VKey_Left);
addActionHotKeys (Aspect_VKey_NavLookRight, (Standard_UInteger )Aspect_VKey_Right);
addActionHotKeys (Aspect_VKey_NavSlideLeft, (Standard_UInteger )Aspect_VKey_Left | (Standard_UInteger)Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideRight, (Standard_UInteger )Aspect_VKey_Right | (Standard_UInteger)Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideUp, (Standard_UInteger )Aspect_VKey_Up | (Standard_UInteger)Aspect_VKeyFlags_SHIFT);
addActionHotKeys (Aspect_VKey_NavSlideDown, (Standard_UInteger )Aspect_VKey_Down | (Standard_UInteger)Aspect_VKeyFlags_SHIFT);
// window could be actually not yet set to the View
//SetupWindowCallbacks (theView->Window());
@ -508,11 +518,11 @@ void ViewerTest_EventManager::ProcessKeyPress (Aspect_VKey theKey)
myCtx->UpdateCurrentViewer();
break;
}
case Aspect_VKey_S | Aspect_VKeyFlags_CTRL:
case Aspect_VKey_W | Aspect_VKeyFlags_CTRL:
case (Standard_UInteger)Aspect_VKey_S | (Standard_UInteger)Aspect_VKeyFlags_CTRL:
case (Standard_UInteger)Aspect_VKey_W | (Standard_UInteger)Aspect_VKeyFlags_CTRL:
{
Standard_Integer aDispMode = AIS_Shaded;
if (theKey == (Aspect_VKey_S | Aspect_VKeyFlags_CTRL))
if (theKey == ((Standard_UInteger)Aspect_VKey_S | (Standard_UInteger)Aspect_VKeyFlags_CTRL))
{
aDispMode = AIS_Shaded;
std::cout << "setup Shaded display mode\n";