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 <Basics_OCCTVersion.hxx>
#include <utilities.h>
#include <Precision.hxx>
@ -67,7 +69,7 @@
#include <AIS_Shape.hxx>
#include <TCollection_AsciiString.hxx>
#include <StdSelect_DisplayMode.hxx>
//#include <StdSelect_DisplayMode.hxx>
#include <Graphic3d_MaterialAspect.hxx>
@ -84,7 +86,7 @@
#endif
// Constructors
enum{
enum {
CONTOURS,
CORNERS,
LINES

View File

@ -26,6 +26,8 @@
#include "GEOMGUI_DimensionProperty.h"
#include <Basics_OCCTVersion.hxx>
// OCCT includes
#include <Standard_ProgramError.hxx>
#include <gp_Trsf.hxx>
@ -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;
}

View File

@ -27,9 +27,16 @@
#ifndef GEOMGUI_DIMENSIONPROPERTY_H
#define GEOMGUI_DIMENSIONPROPERTY_H
#include <Basics_OCCTVersion.hxx>
// OCCT includes
#include <AIS_Dimension.hxx>
#include <AIS_DiameterDimension.hxx>
#if OCC_VERSION_LARGE > 0x07040000
#include <PrsDim_LengthDimension.hxx>
#else
#include <AIS_LengthDimension.hxx>
#endif
#include <AIS_AngleDimension.hxx>
#include <gp_Ax3.hxx>
#include <QVariant>
@ -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.

View File

@ -92,7 +92,7 @@
#include <Prs3d_PointAspect.hxx>
#include <StdSelect_TypeOfEdge.hxx>
#include <StdSelect_TypeOfFace.hxx>
#include <StdSelect_DisplayMode.hxx>
//#include <StdSelect_DisplayMode.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Plane.hxx>
@ -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 );
}
}

View File

@ -40,9 +40,11 @@
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <Basics_OCCTVersion.hxx>
// OCCT Includes
#include <AIS_AngleDimension.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
//#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
@ -52,7 +54,13 @@
#include <Geom_Plane.hxx>
#include <gce_MakePln.hxx>
#include <Precision.hxx>
#if OCC_VERSION_LARGE > 0x07040000
#include <PrsDim.hxx>
#else
#include <AIS.hxx>
#endif
#include <Prs3d_LineAspect.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
@ -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_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));

View File

@ -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 );
}
}

View File

@ -35,6 +35,8 @@
#include <SUIT_ViewWindow.h>
#include <SUIT_Desktop.h>
#include <Basics_OCCTVersion.hxx>
#include <QMouseEvent>
#include <AIS_InteractiveContext.hxx>
@ -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;
}
}

View File

@ -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

View File

@ -36,6 +36,9 @@
#include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
@ -45,14 +48,15 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_VertexDrawMode.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_Selection.hxx>
#include <StdPrs_ShadedShape.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <StdSelect_DisplayMode.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
@ -64,13 +68,13 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.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>
#if OCC_VERSION_LARGE > 0x07040000
#include <Graphic3d_Text.hxx>
#else
#include <StdSelect_DisplayMode.hxx>
#endif
#include <SalomeApp_Tools.h>
#include <SUIT_Session.h>
@ -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,

View File

@ -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 );

View File

@ -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 {}