#include <SalomeApp_Study.h>
+#include <Basics_OCCTVersion.hxx>
+
#include <utilities.h>
#include <Precision.hxx>
#include <AIS_Shape.hxx>
#include <TCollection_AsciiString.hxx>
-#include <StdSelect_DisplayMode.hxx>
+//#include <StdSelect_DisplayMode.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#endif
// Constructors
-enum{
+enum {
CONTOURS,
CORNERS,
LINES
#include "GEOMGUI_DimensionProperty.h"
+#include <Basics_OCCTVersion.hxx>
+
// OCCT includes
#include <Standard_ProgramError.hxx>
#include <gp_Trsf.hxx>
// 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 );
// 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() );
{
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 );
{
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 );
//=================================================================================
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;
}
#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>
* \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.
#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>
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 );
}
}
#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>
#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>
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);
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.;
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));
#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 );
}
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 );
}
}
#include <SUIT_ViewWindow.h>
#include <SUIT_Desktop.h>
+#include <Basics_OCCTVersion.hxx>
+
#include <QMouseEvent>
#include <AIS_InteractiveContext.hxx>
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;
switch ( anOwner->SelectionMode() )
{
+#if OCC_VERSION_LARGE > 0x07040000
+ case PrsDim_DimensionSelectionMode_Line :
+#else
case AIS_DSM_Line :
+#endif
{
if ( ( theKeys & Qt::ControlModifier ) == 0 )
{
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;
}
}
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
{
#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
#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>
#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>
#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>
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 );
}
{
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:
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
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,
{
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 );
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 {}