Porting to OCCT 7.4.1 dev

This commit is contained in:
jfa 2020-04-30 15:53:38 +03:00
parent bb27da6b38
commit c94d2e489e
11 changed files with 164 additions and 30 deletions

View File

@ -51,6 +51,8 @@
#include <SalomeApp_Study.h> #include <SalomeApp_Study.h>
#include <Basics_OCCTVersion.hxx>
#include <utilities.h> #include <utilities.h>
#include <Precision.hxx> #include <Precision.hxx>
@ -67,7 +69,7 @@
#include <AIS_Shape.hxx> #include <AIS_Shape.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <StdSelect_DisplayMode.hxx> //#include <StdSelect_DisplayMode.hxx>
#include <Graphic3d_MaterialAspect.hxx> #include <Graphic3d_MaterialAspect.hxx>
@ -84,7 +86,7 @@
#endif #endif
// Constructors // Constructors
enum{ enum {
CONTOURS, CONTOURS,
CORNERS, CORNERS,
LINES LINES

View File

@ -26,6 +26,8 @@
#include "GEOMGUI_DimensionProperty.h" #include "GEOMGUI_DimensionProperty.h"
#include <Basics_OCCTVersion.hxx>
// OCCT includes // OCCT includes
#include <Standard_ProgramError.hxx> #include <Standard_ProgramError.hxx>
#include <gp_Trsf.hxx> #include <gp_Trsf.hxx>
@ -72,7 +74,11 @@ namespace
// function : Length::Init // function : Length::Init
// purpose : // purpose :
//================================================================================= //=================================================================================
#if OCC_VERSION_LARGE > 0x07040000
void GEOMGUI_DimensionProperty::Length::Init( const Handle(PrsDim_LengthDimension)& theIO, const gp_Ax3& theLCS )
#else
void GEOMGUI_DimensionProperty::Length::Init( const Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS ) void GEOMGUI_DimensionProperty::Length::Init( const Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS )
#endif
{ {
gp_Trsf aFromLCS; gp_Trsf aFromLCS;
aFromLCS.SetTransformation( gp_Ax3(), theLCS ); aFromLCS.SetTransformation( gp_Ax3(), theLCS );
@ -90,7 +96,11 @@ void GEOMGUI_DimensionProperty::Length::Init( const Handle(AIS_LengthDimension)&
// function : Length::Update // function : Length::Update
// purpose : // purpose :
//================================================================================= //=================================================================================
#if OCC_VERSION_LARGE > 0x07040000
void GEOMGUI_DimensionProperty::Length::Update( Handle(PrsDim_LengthDimension)& theIO, const gp_Ax3& theLCS )
#else
void GEOMGUI_DimensionProperty::Length::Update( Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS ) void GEOMGUI_DimensionProperty::Length::Update( Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS )
#endif
{ {
gp_Trsf aToLCS; gp_Trsf aToLCS;
aToLCS.SetTransformation( theLCS, gp_Ax3() ); aToLCS.SetTransformation( theLCS, gp_Ax3() );
@ -840,8 +850,13 @@ void GEOMGUI_DimensionProperty::AddRecord( const Handle(AIS_Dimension)& theIO, c
{ {
case DimensionType_Length : case DimensionType_Length :
{ {
#if OCC_VERSION_LARGE > 0x07040000
Handle(PrsDim_LengthDimension) aLength =
Handle(PrsDim_LengthDimension)::DownCast( theIO );
#else
Handle(AIS_LengthDimension) aLength = Handle(AIS_LengthDimension) aLength =
Handle(AIS_LengthDimension)::DownCast( theIO ); Handle(AIS_LengthDimension)::DownCast( theIO );
#endif
aNewRecord = RecordPtr( new Length() ); aNewRecord = RecordPtr( new Length() );
aNewRecord->AsLength()->Init( aLength, theLCS ); aNewRecord->AsLength()->Init( aLength, theLCS );
@ -922,8 +937,13 @@ void GEOMGUI_DimensionProperty::SetRecord( const int theIndex,
{ {
case DimensionType_Length : case DimensionType_Length :
{ {
#if OCC_VERSION_LARGE > 0x07040000
Handle(PrsDim_LengthDimension) aLength =
Handle(PrsDim_LengthDimension)::DownCast( theIO );
#else
Handle(AIS_LengthDimension) aLength = Handle(AIS_LengthDimension) aLength =
Handle(AIS_LengthDimension)::DownCast( theIO ); Handle(AIS_LengthDimension)::DownCast( theIO );
#endif
aChangeRecord = RecordPtr( new Length() ); aChangeRecord = RecordPtr( new Length() );
aChangeRecord->AsLength()->Init( aLength, theLCS ); aChangeRecord->AsLength()->Init( aLength, theLCS );
@ -1118,7 +1138,11 @@ void GEOMGUI_DimensionProperty::SaveToAttribute( const std::string &theEntry )
//================================================================================= //=================================================================================
int GEOMGUI_DimensionProperty::TypeFromIO( const Handle(AIS_Dimension)& theIO ) const int GEOMGUI_DimensionProperty::TypeFromIO( const Handle(AIS_Dimension)& theIO ) const
{ {
#if OCC_VERSION_LARGE > 0x07040000
if ( theIO->IsKind( STANDARD_TYPE( PrsDim_LengthDimension ) ) )
#else
if ( theIO->IsKind( STANDARD_TYPE( AIS_LengthDimension ) ) ) if ( theIO->IsKind( STANDARD_TYPE( AIS_LengthDimension ) ) )
#endif
{ {
return DimensionType_Length; return DimensionType_Length;
} }

View File

@ -27,9 +27,16 @@
#ifndef GEOMGUI_DIMENSIONPROPERTY_H #ifndef GEOMGUI_DIMENSIONPROPERTY_H
#define GEOMGUI_DIMENSIONPROPERTY_H #define GEOMGUI_DIMENSIONPROPERTY_H
#include <Basics_OCCTVersion.hxx>
// OCCT includes // OCCT includes
#include <AIS_Dimension.hxx>
#include <AIS_DiameterDimension.hxx> #include <AIS_DiameterDimension.hxx>
#if OCC_VERSION_LARGE > 0x07040000
#include <PrsDim_LengthDimension.hxx>
#else
#include <AIS_LengthDimension.hxx> #include <AIS_LengthDimension.hxx>
#endif
#include <AIS_AngleDimension.hxx> #include <AIS_AngleDimension.hxx>
#include <gp_Ax3.hxx> #include <gp_Ax3.hxx>
#include <QVariant> #include <QVariant>
@ -137,14 +144,22 @@ public:
* \param theIO [in] the interactive presentation. * \param theIO [in] the interactive presentation.
* \param theLCS [in] the local coordinate system of parent object. * \param theLCS [in] the local coordinate system of parent object.
*/ */
#if OCC_VERSION_LARGE > 0x07040000
void Init( const Handle(PrsDim_LengthDimension)& theIO, const gp_Ax3& theLCS );
#else
void Init( const Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS ); void Init( const Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS );
#endif
/*! /*!
* \brief Updates length object properties from the fields. * \brief Updates length object properties from the fields.
* \param theIO [in/out] the interactive presentation. * \param theIO [in/out] the interactive presentation.
* \param theLCS [in] the local coordinate system of parent object. * \param theLCS [in] the local coordinate system of parent object.
*/ */
#if OCC_VERSION_LARGE > 0x07040000
void Update( Handle(PrsDim_LengthDimension)& theIO, const gp_Ax3& theLCS );
#else
void Update( Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS ); void Update( Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS );
#endif
/*! /*!
* \brief Packs properties to array of doubles. * \brief Packs properties to array of doubles.

View File

@ -92,7 +92,7 @@
#include <Prs3d_PointAspect.hxx> #include <Prs3d_PointAspect.hxx>
#include <StdSelect_TypeOfEdge.hxx> #include <StdSelect_TypeOfEdge.hxx>
#include <StdSelect_TypeOfFace.hxx> #include <StdSelect_TypeOfFace.hxx>
#include <StdSelect_DisplayMode.hxx> //#include <StdSelect_DisplayMode.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <Geom_Plane.hxx> #include <Geom_Plane.hxx>
@ -1348,12 +1348,21 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
if ( aUnitsAngle == "deg" ) if ( aUnitsAngle == "deg" )
{ {
aPrs->SetSpecialSymbol(0xB0); aPrs->SetSpecialSymbol(0xB0);
#if OCC_VERSION_LARGE > 0x07040000
aPrs->SetDisplaySpecialSymbol( isUnitsShown ? PrsDim_DisplaySpecialSymbol_After :
PrsDim_DisplaySpecialSymbol_No );
#else
aPrs->SetDisplaySpecialSymbol( isUnitsShown ? AIS_DSS_After : AIS_DSS_No ); aPrs->SetDisplaySpecialSymbol( isUnitsShown ? AIS_DSS_After : AIS_DSS_No );
#endif
aStyle->MakeUnitsDisplayed(Standard_False); aStyle->MakeUnitsDisplayed(Standard_False);
} }
else else
{ {
#if OCC_VERSION_LARGE > 0x07040000
aPrs->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No);
#else
aPrs->SetDisplaySpecialSymbol(AIS_DSS_No); aPrs->SetDisplaySpecialSymbol(AIS_DSS_No);
#endif
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
} }
} }

View File

@ -40,9 +40,11 @@
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <Basics_OCCTVersion.hxx>
// OCCT Includes // OCCT Includes
#include <AIS_AngleDimension.hxx> #include <AIS_AngleDimension.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx> //#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx> #include <BRepBuilderAPI_MakeVertex.hxx>
@ -52,7 +54,13 @@
#include <Geom_Plane.hxx> #include <Geom_Plane.hxx>
#include <gce_MakePln.hxx> #include <gce_MakePln.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#if OCC_VERSION_LARGE > 0x07040000
#include <PrsDim.hxx>
#else
#include <AIS.hxx> #include <AIS.hxx>
#endif
#include <Prs3d_LineAspect.hxx> #include <Prs3d_LineAspect.hxx>
#include <IntTools_EdgeEdge.hxx> #include <IntTools_EdgeEdge.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx> #include <IntTools_SequenceOfCommonPrts.hxx>
@ -309,7 +317,7 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
TopoDS_Shape S1, S2; TopoDS_Shape S1, S2;
if (GEOMBase::GetShape(myObj.get() , S1, TopAbs_EDGE) && if (GEOMBase::GetShape(myObj.get() , S1, TopAbs_EDGE) &&
GEOMBase::GetShape(myObj2.get(), S2, TopAbs_EDGE)) { GEOMBase::GetShape(myObj2.get(), S2, TopAbs_EDGE)) {
TopoDS_Edge anEdge1 = TopoDS::Edge(S1); TopoDS_Edge anEdge1 = TopoDS::Edge(S1);
TopoDS_Edge anEdge2 = TopoDS::Edge(S2); TopoDS_Edge anEdge2 = TopoDS::Edge(S2);
@ -323,19 +331,17 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
Handle(Geom_Curve) extCurv; Handle(Geom_Curve) extCurv;
Standard_Integer extShape; Standard_Integer extShape;
Handle(Geom_Plane) aPlane; Handle(Geom_Plane) aPlane;
if (AIS::ComputeGeometry(anEdge1, #if OCC_VERSION_LARGE > 0x07040000
anEdge2, if (PrsDim::ComputeGeometry (anEdge1, anEdge2,
extShape, #else
geom_lin1, if (AIS::ComputeGeometry (anEdge1, anEdge2,
geom_lin2, #endif
ptat11, extShape,
ptat12, geom_lin1, geom_lin2,
ptat21, ptat11, ptat12, ptat21, ptat22,
ptat22, extCurv,
extCurv, isInfinite1, isInfinite2,
isInfinite1, aPlane)) {
isInfinite2,
aPlane)) {
Standard_Real arrSize1 = aDimensionStyle->ArrowAspect()->Length(); Standard_Real arrSize1 = aDimensionStyle->ArrowAspect()->Length();
Standard_Real arrSize2 = aDimensionStyle->ArrowAspect()->Length(); Standard_Real arrSize2 = aDimensionStyle->ArrowAspect()->Length();
if (!isInfinite1) arrSize1 = ptat11.Distance(ptat12)/10.; if (!isInfinite1) arrSize1 = ptat11.Distance(ptat12)/10.;
@ -356,7 +362,11 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
anIO->SetDimensionAspect( aDimensionStyle ); anIO->SetDimensionAspect( aDimensionStyle );
anIO->SetDisplayUnits( aUnitsAngle.toUtf8().data() ); anIO->SetDisplayUnits( aUnitsAngle.toUtf8().data() );
if (aUnitsAngle == "rad") if (aUnitsAngle == "rad")
#if OCC_VERSION_LARGE > 0x07040000
anIO->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No);
#else
anIO->SetDisplaySpecialSymbol(AIS_DSS_No); anIO->SetDisplaySpecialSymbol(AIS_DSS_No);
#endif
SOCC_Prs* aPrs = SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));

View File

@ -439,10 +439,18 @@ void MeasureGUI_CreateDimensionDlg::StartLocalEditing()
#if OCC_VERSION_LARGE <= 0x07030000 #if OCC_VERSION_LARGE <= 0x07030000
anAISContext->OpenLocalContext( Standard_False, Standard_False ); anAISContext->OpenLocalContext( Standard_False, Standard_False );
#endif #endif
#if OCC_VERSION_LARGE > 0x07040000
anAISContext->Load( myDimension, PrsDim_DimensionSelectionMode_All );
anAISContext->SetZLayer( myDimension, myEditingLayer );
anAISContext->Activate( myDimension, PrsDim_DimensionSelectionMode_Line );
anAISContext->Activate( myDimension, PrsDim_DimensionSelectionMode_Text );
#else
anAISContext->Load( myDimension, AIS_DSM_All ); anAISContext->Load( myDimension, AIS_DSM_All );
anAISContext->SetZLayer( myDimension, myEditingLayer ); anAISContext->SetZLayer( myDimension, myEditingLayer );
anAISContext->Activate( myDimension, AIS_DSM_Line ); anAISContext->Activate( myDimension, AIS_DSM_Line );
anAISContext->Activate( myDimension, AIS_DSM_Text ); anAISContext->Activate( myDimension, AIS_DSM_Text );
#endif
anAISContext->Redisplay( myDimension , Standard_True ); anAISContext->Redisplay( myDimension , Standard_True );
} }
@ -634,12 +642,21 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
if ( aUnitsAngle == "deg" ) if ( aUnitsAngle == "deg" )
{ {
aDimensionIO->SetSpecialSymbol(0xB0); aDimensionIO->SetSpecialSymbol(0xB0);
#if OCC_VERSION_LARGE > 0x07040000
aDimensionIO->SetDisplaySpecialSymbol( isUnitsShown ? PrsDim_DisplaySpecialSymbol_After :
PrsDim_DisplaySpecialSymbol_No );
#else
aDimensionIO->SetDisplaySpecialSymbol( isUnitsShown ? AIS_DSS_After : AIS_DSS_No ); aDimensionIO->SetDisplaySpecialSymbol( isUnitsShown ? AIS_DSS_After : AIS_DSS_No );
#endif
aStyle->MakeUnitsDisplayed(Standard_False); aStyle->MakeUnitsDisplayed(Standard_False);
} }
else else
{ {
#if OCC_VERSION_LARGE > 0x07040000
aDimensionIO->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No);
#else
aDimensionIO->SetDisplaySpecialSymbol(AIS_DSS_No); aDimensionIO->SetDisplaySpecialSymbol(AIS_DSS_No);
#endif
aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
} }
} }

View File

@ -35,6 +35,8 @@
#include <SUIT_ViewWindow.h> #include <SUIT_ViewWindow.h>
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <Basics_OCCTVersion.hxx>
#include <QMouseEvent> #include <QMouseEvent>
#include <AIS_InteractiveContext.hxx> #include <AIS_InteractiveContext.hxx>
@ -157,7 +159,11 @@ MeasureGUI_DimensionInteractor::Operation
return Operation_None; return Operation_None;
} }
#if OCC_VERSION_LARGE > 0x07040000
Handle(PrsDim_DimensionOwner) anOwner = Handle(PrsDim_DimensionOwner)::DownCast( theEntity );
#else
Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast( theEntity ); Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast( theEntity );
#endif
if ( anOwner.IsNull() ) if ( anOwner.IsNull() )
{ {
return Operation_None; return Operation_None;
@ -167,7 +173,11 @@ MeasureGUI_DimensionInteractor::Operation
switch ( anOwner->SelectionMode() ) switch ( anOwner->SelectionMode() )
{ {
#if OCC_VERSION_LARGE > 0x07040000
case PrsDim_DimensionSelectionMode_Line :
#else
case AIS_DSM_Line : case AIS_DSM_Line :
#endif
{ {
if ( ( theKeys & Qt::ControlModifier ) == 0 ) if ( ( theKeys & Qt::ControlModifier ) == 0 )
{ {
@ -184,7 +194,11 @@ MeasureGUI_DimensionInteractor::Operation
return Operation_MoveFlyoutFree; return Operation_MoveFlyoutFree;
} }
#if OCC_VERSION_LARGE > 0x07040000
case PrsDim_DimensionSelectionMode_Text : return Operation_MoveText;
#else
case AIS_DSM_Text : return Operation_MoveText; case AIS_DSM_Text : return Operation_MoveText;
#endif
default : return Operation_None; default : return Operation_None;
} }
} }

View File

@ -1280,8 +1280,14 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con
if ( isLocal ) if ( isLocal )
{ {
#endif #endif
#if OCC_VERSION_LARGE > 0x07040000
anAISContext->Deactivate( anIO, PrsDim_DimensionSelectionMode_Line );
anAISContext->Deactivate( anIO, PrsDim_DimensionSelectionMode_Text );
#else
anAISContext->Deactivate( anIO, AIS_DSM_Line ); anAISContext->Deactivate( anIO, AIS_DSM_Line );
anAISContext->Deactivate( anIO, AIS_DSM_Text ); anAISContext->Deactivate( anIO, AIS_DSM_Text );
#endif
} }
continue; continue;
#if OCC_VERSION_LARGE <= 0x07030000 #if OCC_VERSION_LARGE <= 0x07030000
@ -1291,8 +1297,15 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con
{ {
#endif #endif
anAISContext->AddOrRemoveSelected( anIO, Standard_False ); anAISContext->AddOrRemoveSelected( anIO, Standard_False );
#if OCC_VERSION_LARGE > 0x07040000
anAISContext->Activate( anIO, PrsDim_DimensionSelectionMode_Line );
anAISContext->Activate( anIO, PrsDim_DimensionSelectionMode_Text );
#else
anAISContext->Activate( anIO, AIS_DSM_Line ); anAISContext->Activate( anIO, AIS_DSM_Line );
anAISContext->Activate( anIO, AIS_DSM_Text ); anAISContext->Activate( anIO, AIS_DSM_Text );
#endif
#if OCC_VERSION_LARGE <= 0x07030000 #if OCC_VERSION_LARGE <= 0x07030000
} }
else else

View File

@ -36,6 +36,9 @@
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx> #include <GCPnts_AbscissaPoint.hxx>
#include <GeomAdaptor_Curve.hxx> #include <GeomAdaptor_Curve.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Graphic3d_ArrayOfPoints.hxx> #include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_AspectFillArea3d.hxx> #include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx> #include <Graphic3d_AspectLine3d.hxx>
@ -45,14 +48,15 @@
#include <Prs3d_Arrow.hxx> #include <Prs3d_Arrow.hxx>
#include <Prs3d_IsoAspect.hxx> #include <Prs3d_IsoAspect.hxx>
#include <Prs3d_ShadingAspect.hxx> #include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_VertexDrawMode.hxx>
#include <SelectBasics_SensitiveEntity.hxx> #include <SelectBasics_SensitiveEntity.hxx>
#include <SelectMgr_EntityOwner.hxx> #include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx> #include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_Selection.hxx> #include <SelectMgr_Selection.hxx>
#include <StdPrs_ShadedShape.hxx> #include <StdPrs_ShadedShape.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx> #include <StdPrs_ToolTriangulatedShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <StdSelect_BRepOwner.hxx> #include <StdSelect_BRepOwner.hxx>
#include <StdSelect_DisplayMode.hxx>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx> #include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
@ -64,13 +68,13 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <V3d_View.hxx> #include <V3d_View.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Prs3d_VertexDrawMode.hxx>
#include <StdPrs_WFShape.hxx>
#include <Basics_OCCTVersion.hxx> #include <Basics_OCCTVersion.hxx>
#if OCC_VERSION_LARGE > 0x07040000
#include <Graphic3d_Text.hxx>
#else
#include <StdSelect_DisplayMode.hxx>
#endif
#include <SalomeApp_Tools.h> #include <SalomeApp_Tools.h>
#include <SUIT_Session.h> #include <SUIT_Session.h>
@ -109,8 +113,7 @@ static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj,
Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive(); Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive();
if ( entity.IsNull() ) if ( entity.IsNull() )
continue; continue;
Handle(SelectMgr_EntityOwner) owner = const Handle(SelectMgr_EntityOwner)& owner = entity->OwnerId();
Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId());
if ( !owner.IsNull() ) if ( !owner.IsNull() )
theMap.Add( owner ); theMap.Add( owner );
} }
@ -247,9 +250,11 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
{ {
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True); StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
#if OCC_VERSION_LARGE <= 0x07040000
// After this call if type of deflection is relative // After this call if type of deflection is relative
// computed deflection coefficient is stored as absolute. // computed deflection coefficient is stored as absolute.
Prs3d::GetDeflection (myshape, myDrawer); Prs3d::GetDeflection (myshape, myDrawer);
#endif
} }
// End 0023271 // End 0023271
case CustomHighlight: case CustomHighlight:
@ -593,14 +598,20 @@ void GEOM_AISShape::drawField( const Handle(Prs3d_Presentation)& thePrs,
gp_Pnt aCenter; gp_Pnt aCenter;
if( computeMassCenter( aSubShape, aCenter ) ) if( computeMassCenter( aSubShape, aCenter ) )
{ {
Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() );
Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d();
anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION ); anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION );
anAspectText3d->SetColor( myLabelColor ); anAspectText3d->SetColor( myLabelColor );
aGroup->SetPrimitivesAspect( anAspectText3d ); aGroup->SetPrimitivesAspect( anAspectText3d );
#if OCC_VERSION_LARGE > 0x07040000
Handle(Graphic3d_Text) aText = new Graphic3d_Text (14.);
aText->SetText (aString.toUtf8().constData());
aText->SetPosition (aCenter);
aGroup->AddText (aText);
#else
Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() );
aGroup->Text( aString.toUtf8().constData(), aVertex, 14 ); aGroup->Text( aString.toUtf8().constData(), aVertex, 14 );
#endif
} }
} }
else else
@ -661,15 +672,21 @@ void GEOM_AISShape::drawName( const Handle(Prs3d_Presentation)& thePrs )
gp_Ax3 anAx3 = GEOMUtils::GetPosition(myshape); gp_Ax3 anAx3 = GEOMUtils::GetPosition(myshape);
gp_Pnt aCenter = anAx3.Location(); gp_Pnt aCenter = anAx3.Location();
Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() );
Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d();
anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION ); anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION );
anAspectText3d->SetColor( myLabelColor ); anAspectText3d->SetColor( myLabelColor );
aGroup->SetPrimitivesAspect( anAspectText3d ); aGroup->SetPrimitivesAspect( anAspectText3d );
const char* aName = getIO()->getName(); const char* aName = getIO()->getName();
#if OCC_VERSION_LARGE > 0x07040000
Handle(Graphic3d_Text) aText = new Graphic3d_Text (16.);
aText->SetText (aName);
aText->SetPosition (aCenter);
aGroup->AddText(aText);
#else
Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() );
aGroup->Text( TCollection_ExtendedString( aName ), aVertex, 16 ); aGroup->Text( TCollection_ExtendedString( aName ), aVertex, 16 );
#endif
} }
Standard_Boolean GEOM_AISShape::computeMassCenter( const TopoDS_Shape& theShape, Standard_Boolean GEOM_AISShape::computeMassCenter( const TopoDS_Shape& theShape,

View File

@ -538,11 +538,20 @@ Bnd_Box GEOM_Annotation::TextBoundingBox() const
{ {
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect(); Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
Font_FTFont aFont; Font_FTFont aFont;
#if OCC_VERSION_LARGE > 0x07040000
Font_FTFontParams aFontParams;
aFontParams.PointSize = (unsigned int)anAsp->Height();
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
if ( aFont.FindAndInit(anAsp->Aspect()->Font().ToCString(),
anAsp->Aspect()->GetTextFontAspect(),
aFontParams) )
#else
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution; unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
if ( aFont.Init( anAsp->Aspect()->Font().ToCString(), if ( aFont.Init( anAsp->Aspect()->Font().ToCString(),
anAsp->Aspect()->GetTextFontAspect(), anAsp->Aspect()->GetTextFontAspect(),
(unsigned int)anAsp->Height(), (unsigned int)anAsp->Height(),
aResolution ) ) aResolution ) )
#endif
{ {
const NCollection_String aText( (Standard_Utf16Char* )myText.ToExtString() ); const NCollection_String aText( (Standard_Utf16Char* )myText.ToExtString() );
const Font_Rect aFontRect = aFont.BoundingBox( aText, Graphic3d_HTA_CENTER, Graphic3d_VTA_CENTER ); const Font_Rect aFontRect = aFont.BoundingBox( aText, Graphic3d_HTA_CENTER, Graphic3d_VTA_CENTER );

View File

@ -274,7 +274,11 @@ private:
virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection, virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode ) Standard_OVERRIDE; const Standard_Integer theMode ) Standard_OVERRIDE;
#if OCC_VERSION_LARGE > 0x07040000
virtual void setLocalTransformation( const Handle(TopLoc_Datum3D)& /*theTransformation*/ ) Standard_OVERRIDE {}
#else
virtual void setLocalTransformation( const Handle(Geom_Transformation)& /*theTransformation*/ ) Standard_OVERRIDE {} virtual void setLocalTransformation( const Handle(Geom_Transformation)& /*theTransformation*/ ) Standard_OVERRIDE {}
#endif
virtual void SetTransformPersistence( const Handle(Graphic3d_TransformPers)& /*theTrsfPers*/ ) Standard_OVERRIDE {} virtual void SetTransformPersistence( const Handle(Graphic3d_TransformPers)& /*theTrsfPers*/ ) Standard_OVERRIDE {}