-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "GEOMGUI_DimensionProperty.h"
+#include <Basics_OCCTVersion.hxx>
+
// OCCT includes
#include <Standard_ProgramError.hxx>
#include <gp_Trsf.hxx>
-#include <SalomeApp_Study.h>
+#include <SalomeApp_Application.h>
// Static patterns for casting value-to-string & value-from-string. The patterns are:
// ITEM: { name[string] : visibility : type : values[composite] };
PATTERN_XYZ.arg( "Point1" ) + ":" +
PATTERN_XYZ.arg( "Point2" ) + ":" +
PATTERN_XYZ.arg( "Point3" );
-};
+}
//=================================================================================
// function : Length::Init
// purpose :
//=================================================================================
+#if OCC_VERSION_LARGE >= 0x070400ff
+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 );
// function : Length::Update
// purpose :
//=================================================================================
+#if OCC_VERSION_LARGE >= 0x070400ff
+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() );
// function : Init constructor
// purpose :
//=================================================================================
-GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( SalomeApp_Study* theStudy, const std::string& theEntry )
+GEOMGUI_DimensionProperty::GEOMGUI_DimensionProperty( const std::string& theEntry )
{
- LoadFromAttribute( theStudy, theEntry );
+ LoadFromAttribute( theEntry );
}
//=================================================================================
{
case DimensionType_Length :
{
+#if OCC_VERSION_LARGE >= 0x070400ff
+ 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 );
{
case DimensionType_Length :
{
+#if OCC_VERSION_LARGE >= 0x070400ff
+ 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 );
// function : LoadFromAttribute
// purpose :
//=================================================================================
-void GEOMGUI_DimensionProperty::LoadFromAttribute( SalomeApp_Study* theStudy,
- const std::string& theEntry )
+void GEOMGUI_DimensionProperty::LoadFromAttribute( const std::string& theEntry )
{
Clear();
- _PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
+ _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry );
if ( !aSObj )
{
return;
}
- _PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder();
+ _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder();
_PTR(GenericAttribute) aSeekAtt;
_PTR(AttributeTableOfReal) aRecordsAtt;
// function : SaveToAttribute
// purpose :
//=================================================================================
-void GEOMGUI_DimensionProperty::SaveToAttribute( SalomeApp_Study *theStudy,
- const std::string &theEntry )
+void GEOMGUI_DimensionProperty::SaveToAttribute( const std::string &theEntry )
{
- _PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
+ _PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID( theEntry );
if ( !aSObj )
{
return;
}
- _PTR(StudyBuilder) aBuilder = theStudy->studyDS()->NewBuilder();
+ _PTR(StudyBuilder) aBuilder = SalomeApp_Application::getStudy()->NewBuilder();
_PTR(AttributeTableOfReal) aRecordsAtt;
//=================================================================================
int GEOMGUI_DimensionProperty::TypeFromIO( const Handle(AIS_Dimension)& theIO ) const
{
+#if OCC_VERSION_LARGE >= 0x070400ff
+ if ( theIO->IsKind( STANDARD_TYPE( PrsDim_LengthDimension ) ) )
+#else
if ( theIO->IsKind( STANDARD_TYPE( AIS_LengthDimension ) ) )
+#endif
{
return DimensionType_Length;
}