Porting to OCCT 7.4 dev

This commit is contained in:
mnt 2019-02-19 14:47:33 +03:00 committed by vsr
parent 3d5efd4572
commit bfd48ef62a
13 changed files with 136 additions and 46 deletions

View File

@ -375,11 +375,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
}
Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
Standard_Boolean ClosedFlag = Standard_False;
GeomConvert::ConcatC1(tab_c3d,
tabtolvertex,
ArrayOfIndices,
concatcurve,
Standard_False,
ClosedFlag,
Precision::Confusion()); //C1 concatenation
if (concatcurve->Length() > 1)
@ -425,11 +426,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
}
Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
Standard_Boolean ClosedFlag = Standard_False;
Geom2dConvert::ConcatC1(tab_c2d,
tabtolvertex,
ArrayOfInd2d,
concatc2d,
Standard_False,
ClosedFlag,
Precision::Confusion()); //C1 concatenation
if (concatc2d->Length() > 1)

View File

@ -17,6 +17,8 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Basics_OCCTVersion.hxx>
#include "CurveCreator_Utils.hxx"
#include "CurveCreator.hxx"
#include "CurveCreator_Curve.hxx"
@ -38,7 +40,10 @@
#include <AIS_Shape.hxx>
#include <AIS_Line.hxx>
#include <AIS_Trihedron.hxx>
#if OCC_VERSION_LARGE <= 0x07030000
#include <AIS_LocalContext.hxx>
#endif
#include <Geom_Point.hxx>
#include <Geom_BSplineCurve.hxx>
@ -646,7 +651,9 @@ void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theCo
//ASL: we switch on again automatic highlight (otherwise selection will not be shown)
// and call HilightPicked to draw selected owners
theContext->SetAutomaticHilight( Standard_True );
#if OCC_VERSION_LARGE <= 0x07030000
theContext->LocalContext()->HilightPicked( Standard_True );
#endif
}
//=======================================================================
@ -661,11 +668,15 @@ void CurveCreator_Utils::setLocalPointContext( const CurveCreator_ICurve* theCur
return;
if ( theOpen ) {
#if OCC_VERSION_LARGE <= 0x07030000
// Open local context if there is no one
if ( !theContext->HasOpenedContext() ) {
#endif
theContext->ClearCurrents( false );
#if OCC_VERSION_LARGE <= 0x07030000
theContext->OpenLocalContext( false/*use displayed objects*/, true/*allow shape decomposition*/ );
}
#endif
// load the curve AIS object to the local context with the point selection
Handle(AIS_InteractiveObject) anAIS = theCurve->getAISObject();
if ( !anAIS.IsNull() )
@ -678,8 +689,13 @@ void CurveCreator_Utils::setLocalPointContext( const CurveCreator_ICurve* theCur
}
}
else {
#if OCC_VERSION_LARGE <= 0x07030000
if ( theContext->HasOpenedContext() )
theContext->CloseAllContexts( Standard_True );
#else
theContext->Deactivate();
theContext->Activate(0);
#endif
}
}

View File

@ -17,6 +17,8 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Basics_OCCTVersion.hxx>
#include "CurveCreator_Widget.h"
#include "CurveCreator_TreeView.h"
#include "CurveCreator_NewSectionDlg.h"
@ -1520,7 +1522,11 @@ void CurveCreator_Widget::setSelectedPoints( const CurveCreator_ICurve::SectionT
if ( myDragStarted )
return;
Handle(AIS_InteractiveContext) aContext = getAISContext();
if ( aContext.IsNull() || !aContext->HasOpenedContext() )
if ( aContext.IsNull()
#if OCC_VERSION_LARGE <= 0x07030000
|| !aContext->HasOpenedContext()
#endif
)
return;
CurveCreator_Utils::setSelectedPoints( aContext, myCurve, thePoints );

View File

@ -50,6 +50,7 @@
#include <TColStd_IndexedMapOfInteger.hxx>
#include <NCollection_DataMap.hxx>
#include <Basics_OCCTVersion.hxx>
//================================================================
// Function : GEOMGUI_OCCSelector
@ -79,24 +80,24 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
return;
Handle(AIS_InteractiveContext) ic = vw->getAISContext();
#if OCC_VERSION_LARGE <= 0x07030000
if (ic->HasOpenedContext())
{
#endif
TopoDS_Shape curBigShape;
TopTools_IndexedMapOfShape subShapes;
for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected())
{
Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner());
if (anOwner.IsNull())
continue;
Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast( ic->SelectedInteractive() );
QString entryStr = entry(io);
int index = -1;
if (anOwner->ComesFromDecomposition()) // == Local Selection
Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast( ic->SelectedOwner() );
if (!anOwner.IsNull() && anOwner->ComesFromDecomposition()) // == Local Selection
{
TopoDS_Shape subShape = anOwner->Shape();
Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast(io);
@ -126,6 +127,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
aList.append(SUIT_DataOwnerPtr(owner));
}
}
#if OCC_VERSION_LARGE <= 0x07030000
}
else
{
@ -145,6 +147,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
}
}
}
#endif
// add externally selected objects
SUIT_DataOwnerPtrList::const_iterator anExtIter;
@ -347,8 +350,8 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
if ( owner->State() )
continue;
if ( ic->HasOpenedContext() )
ic->AddOrRemoveSelected( owner, false );
if ( owner->ComesFromDecomposition() )
ic->AddOrRemoveSelected( owner, false );
else
ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false );
}

View File

@ -118,6 +118,7 @@
#include <vtkActorCollection.h>
#include <vtkProperty.h>
#include <Basics_OCCTVersion.hxx>
// CORBA Headers
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
@ -2050,8 +2051,13 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
Handle(AIS_InteractiveContext) ic = vf->getAISContext();
if ( !ic.IsNull() )
{
#if OCC_VERSION_LARGE <= 0x07030000
if ( ic->HasOpenedContext() )
ic->CloseAllContexts(Standard_True);
#else
ic->Deactivate();
ic->Activate( 0 );
#endif
}
}
}

View File

@ -47,6 +47,8 @@
#include <Material_ResourceMgr.h>
#include <Material_Model.h>
#include <Basics_OCCTVersion.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
@ -2428,10 +2430,16 @@ void GeometryGUI::createPreferences()
aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
// add enginier font into combobox
/*int fontID =*/ QFontDatabase::addApplicationFont( aFontFile );
#if OCC_VERSION_LARGE <= 0x07030000
Handle(Font_SystemFont) sf = new Font_SystemFont(
new TCollection_HAsciiString("Y14.5M-2009"),
Font_FA_Regular,
new TCollection_HAsciiString(aFontFile.toLatin1().data()) );
# else
Handle(Font_SystemFont) sf = new Font_SystemFont( TCollection_AsciiString("Y14.5M-2009") );
sf->SetFontPath( Font_FA_Regular,
TCollection_AsciiString( aFontFile.toLatin1().data() ) );
#endif
// register font in OCC font manager
fmgr->RegisterFont( sf, Standard_False );

View File

@ -45,6 +45,8 @@
#include <StdFail_NotDone.hxx>
#include <Basics_OCCTVersion.hxx>
//=======================================================================
//function : GetID
//purpose :
@ -128,7 +130,11 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(Handle(TFunction_Logbook)& log)
if (!BRepTools::IsReallyClosed(E, F) &&
!BRep_Tool::Degenerated(E) &&
M.FindFromIndex(i).Extent() == 2)
#if OCC_VERSION_LARGE <= 0x07030000
fill.Add(aD, E, F);
#else
fill.Add(aD, aD, E, F);
#endif
}
}
else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {

View File

@ -48,6 +48,7 @@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BRepTools_History.hxx>
// Depth of self-intersection check (see BOPAlgo_CheckerSI::SetLevelOfCheck() for more details)
// Default value for BOPAlgo_CheckerSI gives very long computation when checking face-to-face intersections;
@ -440,10 +441,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo
TopTools_IndexedMapOfShape aResIndices;
TopExp::MapShapes(aShape, aResIndices);
// Map: source_shape/images of source_shape in Result
const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
//const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
// history for all argument shapes
// be sure to use aCopyMap
TDF_LabelSequence aLabelSeq;
@ -467,37 +464,39 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
if (!BRepTools_History::IsSupportedType(anEntity))
continue;
// be sure to use aCopyMap here
if (aCopyMap.IsBound(anEntity))
anEntity = aCopyMap.Find(anEntity);
//
if (!aMR.Contains(anEntity)) continue;
if (PS.IsDeleted(anEntity))
// The shape has been deleted
continue;
const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
//const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
Standard_Integer nbModified = aModified.Extent();
if (nbModified > 0) { // Mantis issue 0021182
int ih = 1;
TopTools_ListIteratorOfListOfShape itM (aModified);
for (; itM.More() && nbModified > 0; itM.Next(), ++ih) {
if (!aResIndices.Contains(itM.Value())) {
nbModified = 0;
}
}
// Check if the shape has been modified during the operation.
// If it was - use its splits, otherwise use the shape itself
const TopTools_ListOfShape *pModified;
TopTools_ListOfShape aLItself;
const TopTools_ListOfShape& aPSModified = PS.Modified(anEntity);
if (!aPSModified.IsEmpty())
pModified = &aPSModified;
else
{
aLItself.Append(anEntity);
pModified = &aLItself;
}
if (nbModified > 0) {
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
Handle(TDataStd_IntegerArray) anAttr =
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
Handle(TDataStd_IntegerArray) anAttr =
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, pModified->Extent());
int ih = 1;
TopTools_ListIteratorOfListOfShape itM (aModified);
//TopTools_ListIteratorOfListOfShape itM (aModified);
for (; itM.More(); itM.Next(), ++ih) {
int id = aResIndices.FindIndex(itM.Value());
anAttr->SetValue(ih, id);
}
int ih = 1;
TopTools_ListIteratorOfListOfShape itM (*pModified);
for (; itM.More(); itM.Next(), ++ih) {
int id = aResIndices.FindIndex(itM.Value());
anAttr->SetValue(ih, id);
}
}
}

View File

@ -98,6 +98,8 @@
#include <SALOMEDS_wrap.hxx>
#include <GEOMImpl_Types.hxx>
#include <Basics_OCCTVersion.hxx>
#ifdef max
#undef max
#endif
@ -905,9 +907,11 @@ bool MeasureGUI_AnnotationDlg::getPickedPoint( gp_Pnt& thePnt, const TopoDS_Shap
Handle(AIS_InteractiveContext) anAISContext = aViewer->getAISContext();
Handle(SelectMgr_ViewerSelector) aSelector;
#if OCC_VERSION_LARGE <= 0x07030000
if ( anAISContext->HasOpenedContext() )
aSelector = anAISContext->LocalSelector();
else
#endif
aSelector = anAISContext->MainSelector();
if ( aSelector->NbPicked() < 1 )

View File

@ -52,6 +52,8 @@
#include <Aspect_PolygonOffsetMode.hxx>
#include <Basics_OCCTVersion.hxx>
//=================================================================================
// function : Constructor
// purpose :
@ -434,8 +436,9 @@ void MeasureGUI_CreateDimensionDlg::StartLocalEditing()
Handle(V3d_Viewer) aViewer3d = myEditingViewer->getViewer3d();
aViewer3d->AddZLayer( myEditingLayer );
#if OCC_VERSION_LARGE <= 0x07030000
anAISContext->OpenLocalContext( Standard_False, Standard_False );
#endif
anAISContext->Load( myDimension, AIS_DSM_All );
anAISContext->SetZLayer( myDimension, myEditingLayer );
anAISContext->Activate( myDimension, AIS_DSM_Line );
@ -460,7 +463,12 @@ void MeasureGUI_CreateDimensionDlg::StopLocalEditing()
Handle(V3d_Viewer) aViewer3d = myEditingViewer->getViewer3d();
aViewer3d->RemoveZLayer( myEditingLayer );
#if OCC_VERSION_LARGE <= 0x07030000
anAISContext->CloseLocalContext( Standard_True );
#else
anAISContext->Deactivate();
anAISContext->Activate(0);
#endif
myEditingViewer = NULL;
}

View File

@ -61,6 +61,8 @@
#include <QHBoxLayout>
#include <QPixmap>
#include <Basics_OCCTVersion.hxx>
//=================================================================================
// function : Constructor
// purpose :
@ -196,8 +198,9 @@ void MeasureGUI_ManageDimensionsDlg::StartSelection( const Selection theSelectio
anAISContext->ClearCurrents( Standard_False );
anAISContext->ClearSelected( Standard_False );
#if OCC_VERSION_LARGE <= 0x07030000
anAISContext->OpenLocalContext( Standard_True, Standard_False );
#endif
Handle(MeasureGUI_DimensionFilter) aFilter = new MeasureGUI_DimensionFilter( myEditObject->GetStudyEntry() );
anAISContext->AddFilter( aFilter );
@ -261,8 +264,12 @@ void MeasureGUI_ManageDimensionsDlg::StopSelection()
* ------------------------------------------------ */
Handle(AIS_InteractiveContext) anAISContext = myOperatedViewer->getAISContext();
#if OCC_VERSION_LARGE <= 0x07030000
anAISContext->CloseLocalContext();
#else
anAISContext->Deactivate();
anAISContext->Activate(0);
#endif
LightApp_SelectionMgr* aSelectionMgr = myGeomGUI->getApp()->selectionMgr();
@ -355,7 +362,7 @@ void MeasureGUI_ManageDimensionsDlg::SelectionIntoArgument( const Selection theS
anAISContext->InitSelected();
Handle(AIS_InteractiveObject) anAIS;
#if OCC_VERSION_LARGE <= 0x07030000
if ( anAISContext->HasOpenedContext() )
{
Handle(SelectMgr_EntityOwner) anAISOwner = anAISContext->SelectedOwner();
@ -363,8 +370,11 @@ void MeasureGUI_ManageDimensionsDlg::SelectionIntoArgument( const Selection theS
}
else
{
#endif
anAIS = anAISContext->Current();
#if OCC_VERSION_LARGE <= 0x07030000
}
#endif
int aDimensionId = IdFromPrs( anAIS );
@ -1239,7 +1249,7 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con
{
return;
}
#if OCC_VERSION_LARGE <= 0x07030000
Standard_Boolean isLocal = anAISContext->HasOpenedContext();
if ( isLocal )
{
@ -1247,9 +1257,11 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con
}
else
{
#endif
anAISContext->ClearCurrents( Standard_False );
#if OCC_VERSION_LARGE <= 0x07030000
}
#endif
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( theViewer->CreatePrs( myEditObject->GetStudyEntry() ) );
AIS_ListOfInteractive aListOfIO;
@ -1261,24 +1273,32 @@ void MeasureGUI_ManageDimensionsDlg::SelectInViewer( SOCC_Viewer* theViewer, con
const Handle(AIS_InteractiveObject)& anIO = anIt.Value();
if ( IdFromPrs( anIO ) != theId )
{
#if OCC_VERSION_LARGE <= 0x07030000
if ( isLocal )
{
#endif
anAISContext->Deactivate( anIO, AIS_DSM_Line );
anAISContext->Deactivate( anIO, AIS_DSM_Text );
}
continue;
#if OCC_VERSION_LARGE <= 0x07030000
}
if ( isLocal )
{
#endif
anAISContext->AddOrRemoveSelected( anIO, Standard_False );
anAISContext->Activate( anIO, AIS_DSM_Line );
anAISContext->Activate( anIO, AIS_DSM_Text );
#if OCC_VERSION_LARGE <= 0x07030000
}
else
{
#endif
anAISContext->AddOrRemoveCurrentObject( anIO, Standard_False );
#if OCC_VERSION_LARGE <= 0x07030000
}
#endif
anAISContext->UpdateCurrentViewer();
}

View File

@ -70,6 +70,8 @@
#include <Prs3d_VertexDrawMode.hxx>
#include <StdPrs_WFShape.hxx>
#include <Basics_OCCTVersion.hxx>
#include <SalomeApp_Tools.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
@ -358,7 +360,11 @@ void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndex
{
Handle(AIS_InteractiveObject) anObj = this;
Handle(AIS_InteractiveContext) anIC = GetContext();
if ( anIC.IsNull() || !anIC->HasOpenedContext() )
if ( anIC.IsNull()
#if OCC_VERSION_LARGE <= 0x07030000
|| !anIC->HasOpenedContext()
#endif
)
return;
Standard_Boolean isAutoHilight = anIC->AutomaticHilight();

View File

@ -44,6 +44,8 @@
#include <StdSelect_Shape.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Basics_OCCTVersion.hxx>
class OpenGl_GraphicDriver;
class OpenGl_PrimitiveArray;
class OpenGl_Text;
@ -401,7 +403,11 @@ public:
const Standard_Boolean isMatches = Select3D_SensitiveBox::Matches( theMgr, thePickResult );
if ( !myIsDepthCulling )
{
#if OCC_VERSION_LARGE <= 0x07030000
thePickResult = SelectBasics_PickResult( -DBL_MAX, thePickResult.DistToGeomCenter() );
#else
thePickResult = SelectBasics_PickResult( -DBL_MAX, thePickResult.DistToGeomCenter(), thePickResult.PickedPoint() );
#endif
}
return isMatches;
}