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

0024288: Provide flipping text for AIS_Dimensions

- OpenGl_Flipper class added to provide text flipping.
  - Added Graphic3d_Mat4, OpenGl_Mat4 definitions for use with TKOpenGl matrix types.
  - Added flipping parameters for dimensions with 3D text labels at AIS_Dimension class.
  - Test cases.
This commit is contained in:
aba 2013-11-21 17:24:09 +04:00 committed by bugmaster
parent 62b6361a46
commit 938d454409
22 changed files with 480 additions and 24 deletions

View File

@ -471,6 +471,8 @@ Standard_Real AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePres
// Set display parameters for advanced selection // Set display parameters for advanced selection
BRepBndLib::AddClose (aTextShape, myGeom.myTextBndBox); BRepBndLib::AddClose (aTextShape, myGeom.myTextBndBox);
// Drawing text // Drawing text
gp_Pnt aTextCenter = myGeom.myTextPosition.Translated (gp_Vec (theTextDir) * aTextWidth * 0.5);
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_True, gp_Ax2 (aTextCenter, myWorkingPlane.Axis().Direction(), aTextDir));
if (myDrawer->DimensionAspect()->IsTextShaded()) if (myDrawer->DimensionAspect()->IsTextShaded())
{ {
// Setting text shading and color parameters // Setting text shading and color parameters
@ -493,6 +495,7 @@ Standard_Real AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePres
StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer); StdPrs_WFShape::Add (thePresentation, aTextShape, myDrawer);
} }
// Creating new group for lines // Creating new group for lines
Prs3d_Root::CurrentGroup (thePresentation)->SetFlippingOptions (Standard_False, aPenAx3.Ax2());
Prs3d_Root::NewGroup (thePresentation); Prs3d_Root::NewGroup (thePresentation);
} }
else else

View File

@ -60,6 +60,7 @@ Graphic3d_Vec.hxx
Graphic3d_Vec2.hxx Graphic3d_Vec2.hxx
Graphic3d_Vec3.hxx Graphic3d_Vec3.hxx
Graphic3d_Vec4.hxx Graphic3d_Vec4.hxx
Graphic3d_Mat4.hxx
Graphic3d_Vertex.hxx Graphic3d_Vertex.hxx
Graphic3d_Vertex.cxx Graphic3d_Vertex.cxx
Graphic3d_MarkerImage.hxx Graphic3d_MarkerImage.hxx

View File

@ -420,6 +420,8 @@ is
primitive Vec2; primitive Vec2;
primitive Vec3; primitive Vec3;
primitive Vec4; primitive Vec4;
primitive Mat4;
primitive Mat4d;
-------------------- --------------------
-- Category: Classes -- Category: Classes

View File

@ -91,7 +91,8 @@ uses
NListOfHAsciiString from Graphic3d, NListOfHAsciiString from Graphic3d,
FontAspect from Font, FontAspect from Font,
CGraduatedTrihedron from Graphic3d, CGraduatedTrihedron from Graphic3d,
ClipPlane from Graphic3d ClipPlane from Graphic3d,
Ax2 from gp
raises raises
@ -457,6 +458,13 @@ is
is deferred; is deferred;
---Purpose: sets the stencil test to theIsEnabled state; ---Purpose: sets the stencil test to theIsEnabled state;
SetFlippingOptions (me : mutable;
theCGroup : CGroup from Graphic3d;
theIsEnabled: Boolean from Standard;
theRefPlane : Ax2 from gp)
is deferred;
---Purpose: sets the flipping to theIsEnabled state for the given graphic group.
---------------------------------------- ----------------------------------------
-- Category: Methods to create Text -- Category: Methods to create Text
-- for Purpose : see Graphic3d_Group.cdl -- for Purpose : see Graphic3d_Group.cdl

View File

@ -91,7 +91,8 @@ class Group from Graphic3d inherits TShared
ArrayOfPrimitives from Graphic3d, ArrayOfPrimitives from Graphic3d,
ListOfPArray from Graphic3d, ListOfPArray from Graphic3d,
TransModeFlags from Graphic3d, TransModeFlags from Graphic3d,
CBounds from Graphic3d CBounds from Graphic3d,
Ax2 from gp
raises raises
@ -373,6 +374,11 @@ class Group from Graphic3d inherits TShared
theIsEnabled: Boolean from Standard); theIsEnabled: Boolean from Standard);
---Purpose: sets the stencil test to theIsEnabled state; ---Purpose: sets the stencil test to theIsEnabled state;
SetFlippingOptions (me : mutable;
theIsEnabled : Boolean from Standard;
theRefPlane : Ax2 from gp);
---Purpose: sets the flipping to theIsEnabled state.
---------------------------- ----------------------------
-- Category: Inquire methods -- Category: Inquire methods
---------------------------- ----------------------------

View File

@ -21,6 +21,11 @@
#include <Graphic3d_Group.pxx> #include <Graphic3d_Group.pxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
// =======================================================================
// function : AddPrimitiveArray
// purpose :
// =======================================================================
void Graphic3d_Group :: AddPrimitiveArray ( const Handle(Graphic3d_ArrayOfPrimitives)& elem,const Standard_Boolean EvalMinMax ) void Graphic3d_Group :: AddPrimitiveArray ( const Handle(Graphic3d_ArrayOfPrimitives)& elem,const Standard_Boolean EvalMinMax )
{ {
if (IsDeleted () ) return; if (IsDeleted () ) return;
@ -60,6 +65,11 @@ void Graphic3d_Group :: AddPrimitiveArray ( const Handle(Graphic3d_ArrayOfPrimit
Update (); Update ();
} }
// =======================================================================
// function : UserDraw
// purpose :
// =======================================================================
void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject, void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
const Standard_Boolean EvalMinMax, const Standard_Boolean EvalMinMax,
const Standard_Boolean ContainsFacet ) const Standard_Boolean ContainsFacet )
@ -83,6 +93,21 @@ void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
Update (); Update ();
} }
// =======================================================================
// function : SetFlippingOptions
// purpose :
// =======================================================================
void Graphic3d_Group::SetFlippingOptions (const Standard_Boolean theIsEnabled,
const gp_Ax2& theRefPlane)
{
MyGraphicDriver->SetFlippingOptions (MyCGroup, theIsEnabled, theRefPlane);
}
// =======================================================================
// function : SetStencilTestOptions
// purpose :
// =======================================================================
void Graphic3d_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled) void Graphic3d_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
{ {
MyGraphicDriver->SetStencilTestOptions (MyCGroup, theIsEnabled); MyGraphicDriver->SetStencilTestOptions (MyCGroup, theIsEnabled);

View File

@ -0,0 +1,27 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _Graphic3d_Mat4_HeaderFile
#define _Graphic3d_Mat4_HeaderFile
#include <NCollection_Mat4.hxx>
#include <Standard_TypeDef.hxx>
typedef NCollection_Mat4<Standard_ShortReal> Graphic3d_Mat4;
typedef NCollection_Mat4<Standard_Real> Graphic3d_Mat4d;
#endif // _Graphic3d_Mat4_HeaderFile

View File

@ -23,5 +23,6 @@
#include <Graphic3d_Vec2.hxx> #include <Graphic3d_Vec2.hxx>
#include <Graphic3d_Vec3.hxx> #include <Graphic3d_Vec3.hxx>
#include <Graphic3d_Vec4.hxx> #include <Graphic3d_Vec4.hxx>
#include <Graphic3d_Mat4.hxx>
#endif // _Graphic3d_Vec_H__ #endif // _Graphic3d_Vec_H__

View File

@ -16,11 +16,6 @@
// limitation, any warranties of merchantability, fitness for a particular // limitation, any warranties of merchantability, fitness for a particular
// 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
//
// The code was inspired by "sView" project by
// Kirill GAVRILOV: https://github.com/gkv311/sview.
// Files: StGLMatrix.hxx, StGLMatrix.cxx.
// Copyright (c) 2010-2013 Kirill Gavrilov <kirill@sview.ru>
#ifndef _NCollection_Mat4_HeaderFile #ifndef _NCollection_Mat4_HeaderFile
#define _NCollection_Mat4_HeaderFile #define _NCollection_Mat4_HeaderFile
@ -210,9 +205,10 @@ public:
} }
//! Raw access to the data (for OpenGL exchange). //! Raw access to the data (for OpenGL exchange).
const Element_t* GetData() const { return myMat; } const Element_t* GetData() const { return myMat; }
operator const Element_t*() const { return myMat; } Element_t* ChangeData() { return myMat; }
operator Element_t*() { return myMat; } operator const Element_t*() const { return myMat; }
operator Element_t*() { return myMat; }
//! Multiply by the vector (M * V). //! Multiply by the vector (M * V).
//! @param theVec [in] the vector to multiply. //! @param theVec [in] the vector to multiply.
@ -267,7 +263,7 @@ public:
//! @return result of multiplication. //! @return result of multiplication.
NCollection_Mat4 operator* (const NCollection_Mat4& theMat) const NCollection_Mat4 operator* (const NCollection_Mat4& theMat) const
{ {
return Mutiplied (theMat); return Multiplied (theMat);
} }
//! Compute matrix multiplication product. //! Compute matrix multiplication product.
@ -325,6 +321,24 @@ public:
this->Multiply (aTempMat); this->Multiply (aTempMat);
} }
//! Transpose the matrix.
//! @return transposed copy of the matrix.
NCollection_Mat4 Transposed() const
{
NCollection_Mat4 aTempMat;
aTempMat.SetRow (0, GetColumn (0));
aTempMat.SetRow (1, GetColumn (1));
aTempMat.SetRow (2, GetColumn (2));
aTempMat.SetRow (3, GetColumn (3));
return aTempMat;
}
//! Transpose the matrix.
void Transpose()
{
*this = Transposed();
}
//! Compute inverted matrix. //! Compute inverted matrix.
//! @param theOutMx [out] the inverted matrix. //! @param theOutMx [out] the inverted matrix.
//! @return true if reversion success. //! @return true if reversion success.
@ -421,4 +435,4 @@ private:
}; };
#endif // _NCollection_Matrix_H__ #endif // _NCollection_Mat4_HeaderFile

View File

@ -91,10 +91,11 @@ public:
//! Alias to 2nd component as Y coordinate in XY. //! Alias to 2nd component as Y coordinate in XY.
Element_t& y() { return v[1]; } Element_t& y() { return v[1]; }
//! Raw access to the data (to simplify OpenGL exchange). //! Raw access to the data (for OpenGL exchange).
const Element_t* GetData() const { return v; } const Element_t* GetData() const { return v; }
operator const Element_t*() const { return v; } Element_t* ChangeData() { return v; }
operator Element_t*() { return v; } operator const Element_t*() const { return v; }
operator Element_t*() { return v; }
//! Compute per-component summary. //! Compute per-component summary.
NCollection_Vec2& operator+= (const NCollection_Vec2& theAdd) NCollection_Vec2& operator+= (const NCollection_Vec2& theAdd)

View File

@ -147,9 +147,10 @@ public:
} }
//! Raw access to the data (for OpenGL exchange). //! Raw access to the data (for OpenGL exchange).
const Element_t* GetData() const { return v; } const Element_t* GetData() const { return v; }
operator const Element_t*() const { return v; } Element_t* ChangeData() { return v; }
operator Element_t*() { return v; } operator const Element_t*() const { return v; }
operator Element_t*() { return v; }
//! Compute per-component summary. //! Compute per-component summary.
NCollection_Vec3& operator+= (const NCollection_Vec3& theAdd) NCollection_Vec3& operator+= (const NCollection_Vec3& theAdd)

View File

@ -193,9 +193,10 @@ public:
} }
//! Raw access to the data (for OpenGL exchange). //! Raw access to the data (for OpenGL exchange).
const Element_t* GetData() const { return v; } const Element_t* GetData() const { return v; }
operator const Element_t*() const { return v; } Element_t* ChangeData() { return v; }
operator Element_t*() { return v; } operator const Element_t*() const { return v; }
operator Element_t*() { return v; }
//! Compute per-component summary. //! Compute per-component summary.
NCollection_Vec4& operator+= (const NCollection_Vec4& theAdd) NCollection_Vec4& operator+= (const NCollection_Vec4& theAdd)

View File

@ -143,3 +143,5 @@ OpenGl_SceneGeometry.cxx
OpenGl_RaytraceTypes.hxx OpenGl_RaytraceTypes.hxx
OpenGl_RaytraceSource.cxx OpenGl_RaytraceSource.cxx
OpenGl_Workspace_Raytrace.cxx OpenGl_Workspace_Raytrace.cxx
OpenGl_Flipper.hxx
OpenGl_Flipper.cxx

View File

@ -0,0 +1,144 @@
// Created on: 2013-11-11
// Created by: Anastasia BORISOVA
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <OpenGl_Flipper.hxx>
#include <OpenGl_Vec.hxx>
#include <OpenGl_Workspace.hxx>
#include <gp_Ax2.hxx>
// =======================================================================
// function : Constructor
// purpose :
// =======================================================================
OpenGl_Flipper::OpenGl_Flipper (const gp_Ax2& theReferenceSystem)
: OpenGl_Element(),
myReferenceOrigin ((Standard_ShortReal )theReferenceSystem.Location().X(),
(Standard_ShortReal )theReferenceSystem.Location().Y(),
(Standard_ShortReal )theReferenceSystem.Location().Z(),
1.0f),
myReferenceX ((Standard_ShortReal )theReferenceSystem.XDirection().X(),
(Standard_ShortReal )theReferenceSystem.XDirection().Y(),
(Standard_ShortReal )theReferenceSystem.XDirection().Z(),
1.0f),
myReferenceY ((Standard_ShortReal )theReferenceSystem.YDirection().X(),
(Standard_ShortReal )theReferenceSystem.YDirection().Y(),
(Standard_ShortReal )theReferenceSystem.YDirection().Z(),
1.0f),
myReferenceZ ((Standard_ShortReal )theReferenceSystem.Axis().Direction().X(),
(Standard_ShortReal )theReferenceSystem.Axis().Direction().Y(),
(Standard_ShortReal )theReferenceSystem.Axis().Direction().Z(),
1.0f),
myIsEnabled (Standard_True)
{
//
}
// =======================================================================
// function : Release
// purpose :
// =======================================================================
void OpenGl_Flipper::Release (const Handle(OpenGl_Context)& )
{
//
}
// =======================================================================
// function : Render
// purpose :
// =======================================================================
void OpenGl_Flipper::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
{
if (!myIsEnabled)
{
glMatrixMode (GL_MODELVIEW);
glLoadMatrixf ((GLfloat*) theWorkspace->ViewMatrix());
return;
}
OpenGl_Mat4 aMatrixMV;
glGetFloatv (GL_MODELVIEW_MATRIX, aMatrixMV.ChangeData());
const OpenGl_Vec4 aMVReferenceOrigin = aMatrixMV * myReferenceOrigin;
const OpenGl_Vec4 aMVReferenceX = aMatrixMV * OpenGl_Vec4 (myReferenceX.xyz() + myReferenceOrigin.xyz(), 1.0f);
const OpenGl_Vec4 aMVReferenceY = aMatrixMV * OpenGl_Vec4 (myReferenceY.xyz() + myReferenceOrigin.xyz(), 1.0f);
const OpenGl_Vec4 aMVReferenceZ = aMatrixMV * OpenGl_Vec4 (myReferenceZ.xyz() + myReferenceOrigin.xyz(), 1.0f);
const OpenGl_Vec4 aDirX = aMVReferenceX - aMVReferenceOrigin;
const OpenGl_Vec4 aDirY = aMVReferenceY - aMVReferenceOrigin;
const OpenGl_Vec4 aDirZ = aMVReferenceZ - aMVReferenceOrigin;
Standard_Boolean isReversedX = aDirX.xyz().Dot (OpenGl_Vec3::DX()) < 0.0f;
Standard_Boolean isReversedY = aDirY.xyz().Dot (OpenGl_Vec3::DY()) < 0.0f;
Standard_Boolean isReversedZ = aDirZ.xyz().Dot (OpenGl_Vec3::DZ()) < 0.0f;
// compute flipping (rotational transform)
OpenGl_Mat4 aTransform;
if ((isReversedX || isReversedY) && !isReversedZ)
{
// invert by Z axis: left, up vectors mirrored
aTransform.SetColumn (0, -aTransform.GetColumn (0).xyz());
aTransform.SetColumn (1, -aTransform.GetColumn (1).xyz());
}
else if (isReversedY && isReversedZ)
{
// rotate by X axis: up, forward vectors mirrored
aTransform.SetColumn (1, -aTransform.GetColumn (1).xyz());
aTransform.SetColumn (2, -aTransform.GetColumn (2).xyz());
}
else if (isReversedZ)
{
// rotate by Y axis: left, forward vectors mirrored
aTransform.SetColumn (0, -aTransform.GetColumn (0).xyz());
aTransform.SetColumn (2, -aTransform.GetColumn (2).xyz());
}
else
{
return;
}
// do rotation in origin around reference system "forward" direction
OpenGl_Mat4 aRefAxes;
OpenGl_Mat4 aRefInv;
aRefAxes.SetColumn (0, myReferenceX.xyz());
aRefAxes.SetColumn (1, myReferenceY.xyz());
aRefAxes.SetColumn (2, myReferenceZ.xyz());
aRefAxes.SetColumn (3, myReferenceOrigin.xyz());
aRefAxes.Inverted (aRefInv);
aTransform = aRefAxes * aTransform * aRefInv;
// transform model-view matrix
aMatrixMV = aMatrixMV * aTransform;
// load transformed model-view matrix
GLint aCurrMode = GL_MODELVIEW;
glGetIntegerv (GL_MATRIX_MODE, &aCurrMode);
if (aCurrMode != GL_MODELVIEW)
{
glMatrixMode (GL_MODELVIEW);
}
glLoadMatrixf ((GLfloat*) aMatrixMV);
if (aCurrMode != GL_MODELVIEW)
{
glMatrixMode (aCurrMode);
}
}

View File

@ -0,0 +1,64 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef OpenGl_Flipper_Header
#define OpenGl_Flipper_Header
#include <OpenGl_Element.hxx>
#include <OpenGl_Vec.hxx>
#include <Handle_OpenGl_Workspace.hxx>
class gp_Ax2;
//! Being rendered, the elements modifies current model-view matrix such that the axes of
//! the specified reference system (in model space) become oriented in the following way:
//! - X - heads to the right side of view.
//! - Y - heads to the up side of view.
//! - N(Z) - heads towards the screen.
//! Originally, this element serves for need of flipping the 3D text of dimension presentations.
class OpenGl_Flipper : public OpenGl_Element
{
public:
//! Construct rendering element to flip model-view matrix
//! along the reference system to ensure up-Y, right-X orientation.
//! @param theReferenceSystem [in] the reference coordinate system.
Standard_EXPORT OpenGl_Flipper (const gp_Ax2& theReferenceSystem);
//! Set options for the element.
//! @param theIsEnabled [in] flag indicates whether the flipper
//! matrix modification should be set up or restored back.
void SetOptions (const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theCtx);
public:
DEFINE_STANDARD_ALLOC
protected:
OpenGl_Vec4 myReferenceOrigin;
OpenGl_Vec4 myReferenceX;
OpenGl_Vec4 myReferenceY;
OpenGl_Vec4 myReferenceZ;
Standard_Boolean myIsEnabled;
};
#endif // OpenGl_Flipper_Header

View File

@ -22,8 +22,8 @@
#endif #endif
#include <OpenGl_GraphicDriver.hxx> #include <OpenGl_GraphicDriver.hxx>
#include <OpenGl_Context.hxx> #include <OpenGl_Context.hxx>
#include <OpenGl_Flipper.hxx>
#include <OpenGl_GraduatedTrihedron.hxx> #include <OpenGl_GraduatedTrihedron.hxx>
#include <OpenGl_Group.hxx> #include <OpenGl_Group.hxx>
#include <OpenGl_CView.hxx> #include <OpenGl_CView.hxx>
@ -582,3 +582,16 @@ void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues (const Standard_ShortR
{ {
OpenGl_GraduatedTrihedron::SetMinMax (theMinX, theMinY, theMinZ, theMaxX, theMaxY, theMaxZ); OpenGl_GraduatedTrihedron::SetMinMax (theMinX, theMinY, theMinZ, theMaxX, theMaxY, theMaxZ);
} }
// =======================================================================
// function : SetFlippingOptions
// purpose : Enable or disable flipping option for the given group
// =======================================================================
void OpenGl_GraphicDriver::SetFlippingOptions (const Graphic3d_CGroup& theCGroup,
const Standard_Boolean theIsEnabled,
const gp_Ax2& theRefPlane)
{
OpenGl_Flipper* aFlipper = new OpenGl_Flipper (theRefPlane);
aFlipper->SetOptions (theIsEnabled);
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aFlipper);
}

View File

@ -44,7 +44,7 @@
#include <Aspect_TypeOfTriedronEcho.hxx> #include <Aspect_TypeOfTriedronEcho.hxx>
#include <Aspect_Handle.hxx> #include <Aspect_Handle.hxx>
#include <Aspect_PrintAlgo.hxx> #include <Aspect_PrintAlgo.hxx>
#include <gp_Ax2.hxx>
#include <Graphic3d_CView.hxx> #include <Graphic3d_CView.hxx>
#include <Graphic3d_CStructure.hxx> #include <Graphic3d_CStructure.hxx>
#include <Graphic3d_CGroup.hxx> #include <Graphic3d_CGroup.hxx>
@ -215,6 +215,7 @@ public:
Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency); Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
Standard_EXPORT void UnsetTransparency (); Standard_EXPORT void UnsetTransparency ();
Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width); Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
Standard_EXPORT void SetFlippingOptions (const Graphic3d_CGroup& theCGroup, const Standard_Boolean theIsEnabled, const gp_Ax2& theRefPlane);
//! Set text attributes for under-/overlayer. <br> //! Set text attributes for under-/overlayer. <br>
//! <Font> argument defines the name of the font to be used, <br> //! <Font> argument defines the name of the font to be used, <br>

View File

@ -46,4 +46,7 @@ typedef Graphic3d_Vec2d OpenGl_Vec2d;
typedef Graphic3d_Vec3d OpenGl_Vec3d; typedef Graphic3d_Vec3d OpenGl_Vec3d;
typedef Graphic3d_Vec4d OpenGl_Vec4d; typedef Graphic3d_Vec4d OpenGl_Vec4d;
typedef Graphic3d_Mat4 OpenGl_Mat4;
typedef Graphic3d_Mat4d OpenGl_Mat4d;
#endif // _OpenGl_Vec_H__ #endif // _OpenGl_Vec_H__

View File

@ -1,5 +1,6 @@
TKernel TKernel
TKService TKService
TKMath
TKV3d TKV3d
CSF_OpenGlLibs CSF_OpenGlLibs
CSF_objc CSF_objc

46
tests/bugs/vis/bug24288_1 Normal file
View File

@ -0,0 +1,46 @@
puts "============"
puts "CR24288"
puts "============"
puts ""
#######################################################################
# Provide a text flipping
# Test for text flipping after X rotation
#######################################################################
pload VISUALIZATION
set m_pi 3,14
set m_pi2 1,57
vinit
vpoint radP1 0 0 0
vpoint radP2 50 50 0
vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
vrotate 0 -$m_pi2 0
verase radP1 radP2 radP3
vdim -radius -name=dim -text=3d circle
vdisplay dim
vfit
vmoveto 102 144
set x_coord 153
set y_coord 153
checkcolor $x_coord $y_coord 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting of radius dimension with 3d text before flipping is wrong."
}
# X axis rotation
vrotate $m_pi 0 0
vfit
vmoveto 201 206
set x_coord 269
set y_coord 123
checkcolor $x_coord $y_coord 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting of radius dimension with 3d text with flipping after x rotation is wrong."
}
set only_screen 1

46
tests/bugs/vis/bug24288_2 Normal file
View File

@ -0,0 +1,46 @@
puts "============"
puts "CR24288"
puts "============"
puts ""
#######################################################################
# Provide a text flipping
# Test for text flipping after Y rotation
#######################################################################
pload VISUALIZATION
set m_pi 3,14
set m_pi2 1,57
vinit
vpoint radP1 0 0 0
vpoint radP2 50 50 0
vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
vrotate 0 -$m_pi2 0
verase radP1 radP2 radP3
vdim -radius -name=dim -text=3d circle
vdisplay dim
vfit
vmoveto 102 144
set x_coord 153
set y_coord 153
checkcolor $x_coord $y_coord 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting of radius dimension with 3d text before flipping is wrong."
}
# Y axis rotation
vrotate 0 $m_pi 0
vfit
vmoveto 205 205
set x_coord 96
set y_coord 296
checkcolor $x_coord $y_coord 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting of radius dimension with 3d text with flipping after y rotation is wrong."
}
set only_screen 1

46
tests/bugs/vis/bug24288_3 Normal file
View File

@ -0,0 +1,46 @@
puts "============"
puts "CR24288"
puts "============"
puts ""
#######################################################################
# Provide a text flipping
# Test for text flipping after Z rotation
#######################################################################
pload VISUALIZATION
set m_pi 3,14
set m_pi2 1,57
vinit
vpoint radP1 0 0 0
vpoint radP2 50 50 0
vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
vrotate 0 -$m_pi2 0
verase radP1 radP2 radP3
vdim -radius -name=dim -text=3d circle
vdisplay dim
vfit
vmoveto 102 144
set x_coord 153
set y_coord 153
checkcolor $x_coord $y_coord 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting of radius dimension with 3d text before flipping is wrong."
}
# Z axis rotation
vrotate 0 0 $m_pi
vfit
vmoveto 176 184
set x_coord 294
set y_coord 257
checkcolor $x_coord $y_coord 0 1 1
if { $stat != 1 } {
puts "Error : Highlighting of radius dimension with 3d text with flipping after z rotation is wrong."
}
set only_screen 1