From: jfa Date: Thu, 30 Apr 2020 12:53:38 +0000 (+0300) Subject: Porting to OCCT 7.4.1 dev X-Git-Tag: V9_5_0b1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c94d2e489e561f0566378c3db4004c428ca2e1dc;p=modules%2Fgeom.git Porting to OCCT 7.4.1 dev --- diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx index bbc32bb89..89d86c11b 100644 --- a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx @@ -51,6 +51,8 @@ #include +#include + #include #include @@ -67,7 +69,7 @@ #include #include -#include +//#include #include @@ -84,7 +86,7 @@ #endif // Constructors -enum{ +enum { CONTOURS, CORNERS, LINES diff --git a/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx b/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx index 19b57870b..25249f185 100644 --- a/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx +++ b/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx @@ -26,6 +26,8 @@ #include "GEOMGUI_DimensionProperty.h" +#include + // OCCT includes #include #include @@ -72,7 +74,11 @@ namespace // function : Length::Init // 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 ) +#endif { gp_Trsf aFromLCS; aFromLCS.SetTransformation( gp_Ax3(), theLCS ); @@ -90,7 +96,11 @@ void GEOMGUI_DimensionProperty::Length::Init( const Handle(AIS_LengthDimension)& // function : Length::Update // 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 ) +#endif { gp_Trsf aToLCS; aToLCS.SetTransformation( theLCS, gp_Ax3() ); @@ -840,8 +850,13 @@ void GEOMGUI_DimensionProperty::AddRecord( const Handle(AIS_Dimension)& theIO, c { 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)::DownCast( theIO ); +#endif aNewRecord = RecordPtr( new Length() ); aNewRecord->AsLength()->Init( aLength, theLCS ); @@ -922,8 +937,13 @@ void GEOMGUI_DimensionProperty::SetRecord( const int theIndex, { 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)::DownCast( theIO ); +#endif aChangeRecord = RecordPtr( new Length() ); 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 { +#if OCC_VERSION_LARGE > 0x07040000 + if ( theIO->IsKind( STANDARD_TYPE( PrsDim_LengthDimension ) ) ) +#else if ( theIO->IsKind( STANDARD_TYPE( AIS_LengthDimension ) ) ) +#endif { return DimensionType_Length; } diff --git a/src/GEOMGUI/GEOMGUI_DimensionProperty.h b/src/GEOMGUI/GEOMGUI_DimensionProperty.h index 72b16870d..9ae98ce48 100644 --- a/src/GEOMGUI/GEOMGUI_DimensionProperty.h +++ b/src/GEOMGUI/GEOMGUI_DimensionProperty.h @@ -27,9 +27,16 @@ #ifndef GEOMGUI_DIMENSIONPROPERTY_H #define GEOMGUI_DIMENSIONPROPERTY_H +#include + // OCCT includes +#include #include +#if OCC_VERSION_LARGE > 0x07040000 +#include +#else #include +#endif #include #include #include @@ -137,14 +144,22 @@ public: * \param theIO [in] the interactive presentation. * \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 ); +#endif /*! * \brief Updates length object properties from the fields. * \param theIO [in/out] the interactive presentation. * \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 ); +#endif /*! * \brief Packs properties to array of doubles. diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index cdfc09293..5c9236b76 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -92,7 +92,7 @@ #include #include #include -#include +//#include #include #include #include @@ -1348,12 +1348,21 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t if ( aUnitsAngle == "deg" ) { 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 ); +#endif aStyle->MakeUnitsDisplayed(Standard_False); } else { +#if OCC_VERSION_LARGE > 0x07040000 + aPrs->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No); +#else aPrs->SetDisplaySpecialSymbol(AIS_DSS_No); +#endif aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); } } diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx index d93b51c71..c893d0182 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx @@ -40,9 +40,11 @@ #include #include +#include + // OCCT Includes #include -#include +//#include #include #include #include @@ -52,7 +54,13 @@ #include #include #include + +#if OCC_VERSION_LARGE > 0x07040000 +#include +#else #include +#endif + #include #include #include @@ -309,7 +317,7 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() OCC_CATCH_SIGNALS; TopoDS_Shape S1, S2; 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 anEdge2 = TopoDS::Edge(S2); @@ -323,19 +331,17 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() Handle(Geom_Curve) extCurv; Standard_Integer extShape; Handle(Geom_Plane) aPlane; - if (AIS::ComputeGeometry(anEdge1, - anEdge2, - extShape, - geom_lin1, - geom_lin2, - ptat11, - ptat12, - ptat21, - ptat22, - extCurv, - isInfinite1, - isInfinite2, - aPlane)) { +#if OCC_VERSION_LARGE > 0x07040000 + if (PrsDim::ComputeGeometry (anEdge1, anEdge2, +#else + if (AIS::ComputeGeometry (anEdge1, anEdge2, +#endif + extShape, + geom_lin1, geom_lin2, + ptat11, ptat12, ptat21, ptat22, + extCurv, + isInfinite1, isInfinite2, + aPlane)) { Standard_Real arrSize1 = aDimensionStyle->ArrowAspect()->Length(); Standard_Real arrSize2 = aDimensionStyle->ArrowAspect()->Length(); if (!isInfinite1) arrSize1 = ptat11.Distance(ptat12)/10.; @@ -356,7 +362,11 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() anIO->SetDimensionAspect( aDimensionStyle ); anIO->SetDisplayUnits( aUnitsAngle.toUtf8().data() ); if (aUnitsAngle == "rad") +#if OCC_VERSION_LARGE > 0x07040000 + anIO->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No); +#else anIO->SetDisplaySpecialSymbol(AIS_DSS_No); +#endif SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx index 560fb5957..bcccbf157 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx @@ -439,10 +439,18 @@ void MeasureGUI_CreateDimensionDlg::StartLocalEditing() #if OCC_VERSION_LARGE <= 0x07030000 anAISContext->OpenLocalContext( Standard_False, Standard_False ); #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->SetZLayer( myDimension, myEditingLayer ); anAISContext->Activate( myDimension, AIS_DSM_Line ); anAISContext->Activate( myDimension, AIS_DSM_Text ); +#endif anAISContext->Redisplay( myDimension , Standard_True ); } @@ -634,12 +642,21 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension() if ( aUnitsAngle == "deg" ) { 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 ); +#endif aStyle->MakeUnitsDisplayed(Standard_False); } else { +#if OCC_VERSION_LARGE > 0x07040000 + aDimensionIO->SetDisplaySpecialSymbol(PrsDim_DisplaySpecialSymbol_No); +#else aDimensionIO->SetDisplaySpecialSymbol(AIS_DSS_No); +#endif aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); } } diff --git a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx index 5a8405d5c..bb5fecac5 100644 --- a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx +++ b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx @@ -35,6 +35,8 @@ #include #include +#include + #include #include @@ -157,7 +159,11 @@ MeasureGUI_DimensionInteractor::Operation 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 ); +#endif if ( anOwner.IsNull() ) { return Operation_None; @@ -167,7 +173,11 @@ MeasureGUI_DimensionInteractor::Operation switch ( anOwner->SelectionMode() ) { +#if OCC_VERSION_LARGE > 0x07040000 + case PrsDim_DimensionSelectionMode_Line : +#else case AIS_DSM_Line : +#endif { if ( ( theKeys & Qt::ControlModifier ) == 0 ) { @@ -184,7 +194,11 @@ MeasureGUI_DimensionInteractor::Operation return Operation_MoveFlyoutFree; } +#if OCC_VERSION_LARGE > 0x07040000 + case PrsDim_DimensionSelectionMode_Text : return Operation_MoveText; +#else case AIS_DSM_Text : return Operation_MoveText; +#endif default : return Operation_None; } } diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx index e6c705d0d..d4624cb93 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx @@ -1280,8 +1280,14 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con if ( isLocal ) { #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_Text ); +#endif } continue; #if OCC_VERSION_LARGE <= 0x07030000 @@ -1291,8 +1297,15 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con { #endif 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_Text ); +#endif + #if OCC_VERSION_LARGE <= 0x07030000 } else diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index bbfeaac2f..88aa3ecf1 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -36,6 +36,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -45,14 +48,15 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include -#include #include #include #include @@ -64,13 +68,13 @@ #include #include #include -#include -#include -#include -#include -#include #include +#if OCC_VERSION_LARGE > 0x07040000 +#include +#else +#include +#endif #include #include @@ -109,8 +113,7 @@ static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive(); if ( entity.IsNull() ) continue; - Handle(SelectMgr_EntityOwner) owner = - Handle(SelectMgr_EntityOwner)::DownCast(entity->OwnerId()); + const Handle(SelectMgr_EntityOwner)& owner = entity->OwnerId(); if ( !owner.IsNull() ) theMap.Add( owner ); } @@ -247,9 +250,11 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent { StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True); +#if OCC_VERSION_LARGE <= 0x07040000 // After this call if type of deflection is relative // computed deflection coefficient is stored as absolute. Prs3d::GetDeflection (myshape, myDrawer); +#endif } // End 0023271 case CustomHighlight: @@ -593,14 +598,20 @@ void GEOM_AISShape::drawField( const Handle(Prs3d_Presentation)& thePrs, gp_Pnt aCenter; if( computeMassCenter( aSubShape, aCenter ) ) { - Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() ); - Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION ); anAspectText3d->SetColor( myLabelColor ); 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 ); +#endif } } else @@ -661,15 +672,21 @@ void GEOM_AISShape::drawName( const Handle(Prs3d_Presentation)& thePrs ) gp_Ax3 anAx3 = GEOMUtils::GetPosition(myshape); gp_Pnt aCenter = anAx3.Location(); - Graphic3d_Vertex aVertex( aCenter.X(), aCenter.Y(), aCenter.Z() ); - Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION ); anAspectText3d->SetColor( myLabelColor ); aGroup->SetPrimitivesAspect( anAspectText3d ); 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 ); +#endif } Standard_Boolean GEOM_AISShape::computeMassCenter( const TopoDS_Shape& theShape, diff --git a/src/OBJECT/GEOM_Annotation.cxx b/src/OBJECT/GEOM_Annotation.cxx index c5f5ab9e8..53db84454 100644 --- a/src/OBJECT/GEOM_Annotation.cxx +++ b/src/OBJECT/GEOM_Annotation.cxx @@ -538,11 +538,20 @@ Bnd_Box GEOM_Annotation::TextBoundingBox() const { Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect(); 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; if ( aFont.Init( anAsp->Aspect()->Font().ToCString(), anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution ) ) +#endif { const NCollection_String aText( (Standard_Utf16Char* )myText.ToExtString() ); const Font_Rect aFontRect = aFont.BoundingBox( aText, Graphic3d_HTA_CENTER, Graphic3d_VTA_CENTER ); diff --git a/src/OBJECT/GEOM_Annotation.hxx b/src/OBJECT/GEOM_Annotation.hxx index 750a81fcc..902fca98f 100644 --- a/src/OBJECT/GEOM_Annotation.hxx +++ b/src/OBJECT/GEOM_Annotation.hxx @@ -274,7 +274,11 @@ private: virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection, 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 {} +#endif virtual void SetTransformPersistence( const Handle(Graphic3d_TransformPers)& /*theTrsfPers*/ ) Standard_OVERRIDE {}