From ef27ece3930dd97dacf7b3a14a0792cb6ebb1af6 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Sun, 28 Jun 2020 23:12:12 +0200 Subject: [PATCH] compilation SALOME 9.5, OCC 7.4 --- src/HYDROData/HYDROData_ShapesGroup.cxx | 15 ++-- src/HYDROData/HYDROData_Transform.cxx | 62 ++++++++--------- src/HYDROGUI/HYDROGUI_AISShape.cxx | 3 +- .../HYDROGUI_BathymetrySelectionOp.cxx | 4 +- src/HYDROGUI/HYDROGUI_MeasurementToolOp.cxx | 46 ++++++------- src/HYDROGUI/HYDROGUI_OCCSelector.cxx | 14 ++-- src/HYDROGUI/HYDROGUI_Polyline.cxx | 22 +++--- src/HYDROGUI/HYDROGUI_Shape.cxx | 68 +++++++++---------- src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx | 12 ++-- src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx | 42 ++++++------ src/HYDROGUI/HYDROGUI_ZLayers.cxx | 10 +-- src/HYDRO_tests/TestViewer.cxx | 32 ++++----- 12 files changed, 163 insertions(+), 167 deletions(-) diff --git a/src/HYDROData/HYDROData_ShapesGroup.cxx b/src/HYDROData/HYDROData_ShapesGroup.cxx index c0d0c761..0944f545 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.cxx +++ b/src/HYDROData/HYDROData_ShapesGroup.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -105,20 +106,20 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* const TopTools_ListOfShape& listModified = theAlgo->History()->Modified(aShape); if (listModified.Extent() > 0) { - aModifSh = listModified.First(); + aModifSh = listModified.First(); // Edge has been modified aShapesToAdd.Append( aModifSh ); aGroupDef.Shapes.Remove( i ); - --i; + --i; } else if ( theAlgo->History()->IsRemoved(aShape) ) - { + { // Edge has been removed aGroupDef.Shapes.Remove( i ); --i; } - - } + + } } HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd ); @@ -156,7 +157,7 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* aShapesToAdd.Append( aGeneratedByAlgo ); aGroupDef.Shapes.Remove( i ); --i; - } + } } HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd ); @@ -246,7 +247,7 @@ void HYDROData_ShapesGroup::GetShapes( TopTools_SequenceOfShape& theShapes ) con TDF_ChildIDIterator aChildIt( aLabel, TNaming_NamedShape::GetID() ); for ( ; aChildIt.More(); aChildIt.Next() ) { - Handle(TNaming_NamedShape) aNamedShape = + Handle(TNaming_NamedShape) aNamedShape = Handle(TNaming_NamedShape)::DownCast( aChildIt.Value() ); if ( aNamedShape.IsNull() ) continue; diff --git a/src/HYDROData/HYDROData_Transform.cxx b/src/HYDROData/HYDROData_Transform.cxx index 5b01d0d4..3bf968c5 100644 --- a/src/HYDROData/HYDROData_Transform.cxx +++ b/src/HYDROData/HYDROData_Transform.cxx @@ -53,7 +53,7 @@ void HYDROData_Transform::SetFileName(const TCollection_AsciiString& theNameAfte } //======================================================================= //function : HYDROData_Transform -//purpose : +//purpose : //======================================================================= HYDROData_Transform::HYDROData_Transform() : @@ -69,7 +69,7 @@ HYDROData_Transform::HYDROData_Transform() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= HYDROData_Transform::~HYDROData_Transform() { @@ -77,7 +77,7 @@ HYDROData_Transform::~HYDROData_Transform() } //======================================================================= //function : Clear -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::Clear() { @@ -96,11 +96,11 @@ void HYDROData_Transform::Clear() myBuilder=NULL; } // - BOPAlgo_BuilderShape::PrepareHistory(); + //BOPAlgo_BuilderShape::PrepareHistory(); } //======================================================================= //function : SetArgument -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::SetArgument(const TopoDS_Shape& theShape) { @@ -108,7 +108,7 @@ void HYDROData_Transform::SetArgument(const TopoDS_Shape& theShape) } //======================================================================= //function : AddArgument -//purpose : +//purpose : //======================================================================= const TopoDS_Shape& HYDROData_Transform::Argument()const { @@ -116,7 +116,7 @@ const TopoDS_Shape& HYDROData_Transform::Argument()const } //======================================================================= //function : SetTreshold -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::SetTreshold(const Standard_Real theTreshold) { @@ -124,15 +124,15 @@ void HYDROData_Transform::SetTreshold(const Standard_Real theTreshold) } //======================================================================= //function : Treshold -//purpose : +//purpose : //======================================================================= -Standard_Real HYDROData_Transform::Treshold()const +Standard_Real HYDROData_Transform::Treshold()const { return myTreshold; } //======================================================================= //function : SetToTransform -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::SetToTransform(const Standard_Boolean theFlag) { @@ -140,7 +140,7 @@ void HYDROData_Transform::SetToTransform(const Standard_Boolean theFlag) } //======================================================================= //function : ToTransform -//purpose : +//purpose : //======================================================================= Standard_Boolean HYDROData_Transform::ToTransform()const { @@ -148,7 +148,7 @@ Standard_Boolean HYDROData_Transform::ToTransform()const } //======================================================================= //function : CheckData -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::CheckData() { @@ -158,7 +158,7 @@ void HYDROData_Transform::CheckData() } //======================================================================= //function : Prepare -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::Prepare() { @@ -170,7 +170,7 @@ void HYDROData_Transform::Prepare() } //======================================================================= //function : Perform -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::Perform() { @@ -205,13 +205,13 @@ void HYDROData_Transform::Perform() } //======================================================================= //function : Detect -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::Detect() { Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; Standard_Real aXc, aYc, aZc; - Bnd_Box aBox; + Bnd_Box aBox; gp_Vec aVec; // myErrorStatus=0; @@ -226,11 +226,11 @@ void HYDROData_Transform::Detect() //printf(" aVc : { %lf %lf %lf }\n", aXc, aYc, aZc); // myToTransform=Standard_False; - if (fabs(aXc)>myTreshold || - fabs(aYc)>myTreshold || + if (fabs(aXc)>myTreshold || + fabs(aYc)>myTreshold || fabs(aZc)>myTreshold) { myToTransform=!myToTransform; - } + } // aVec.SetCoord(-aXc, -aYc, -aZc); myTrsf1.SetTranslation(aVec); @@ -240,7 +240,7 @@ void HYDROData_Transform::Detect() } //======================================================================= //function : ComputeTrsf -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::ComputeTrsf() { @@ -253,10 +253,10 @@ void HYDROData_Transform::ComputeTrsf() } //======================================================================= //function : Transform1 -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::Transform1() -{ +{ myErrorStatus=0; // if (myToTransform) {//pkv ft @@ -275,7 +275,7 @@ void HYDROData_Transform::Transform1() } //======================================================================= //function : BuildFuse -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::BuildFuse() { @@ -306,7 +306,7 @@ void HYDROData_Transform::BuildFuse() aPF.SetArguments(aLC); // aPF.Perform(); - if (aPF.HasErrors()) + if (aPF.HasErrors()) { myErrorStatus=20; return; @@ -329,7 +329,7 @@ void HYDROData_Transform::BuildFuse() } //======================================================================= //function : Transform2 -//purpose : +//purpose : //======================================================================= void HYDROData_Transform::Transform2() { @@ -358,7 +358,7 @@ void HYDROData_Transform::Transform2() // //======================================================================= //function : Modified -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& HYDROData_Transform::Modified (const TopoDS_Shape& aS) @@ -403,7 +403,7 @@ const TopTools_ListOfShape& HYDROData_Transform::Modified } //======================================================================= //function : Generated -//purpose : +//purpose : //======================================================================= const TopTools_ListOfShape& HYDROData_Transform::Generated (const TopoDS_Shape& aS) @@ -447,7 +447,7 @@ const TopTools_ListOfShape& HYDROData_Transform::Generated } //======================================================================= //function : IsDeleted -//purpose : +//purpose : //======================================================================= Standard_Boolean HYDROData_Transform::IsDeleted(const TopoDS_Shape& aS) { @@ -467,7 +467,7 @@ Standard_Boolean HYDROData_Transform::IsDeleted(const TopoDS_Shape& aS) } //======================================================================= //function : HasDeleted -//purpose : +//purpose : //======================================================================= Standard_Boolean HYDROData_Transform::HasDeleted() { @@ -475,7 +475,7 @@ Standard_Boolean HYDROData_Transform::HasDeleted() } //======================================================================= //function : HasGenerated -//purpose : +//purpose : //======================================================================= Standard_Boolean HYDROData_Transform::HasGenerated() { @@ -483,7 +483,7 @@ Standard_Boolean HYDROData_Transform::HasGenerated() } //======================================================================= //function : HasModified -//purpose : +//purpose : //======================================================================= Standard_Boolean HYDROData_Transform::HasModified() { diff --git a/src/HYDROGUI/HYDROGUI_AISShape.cxx b/src/HYDROGUI/HYDROGUI_AISShape.cxx index e714a2e6..d3a160e0 100644 --- a/src/HYDROGUI/HYDROGUI_AISShape.cxx +++ b/src/HYDROGUI/HYDROGUI_AISShape.cxx @@ -17,6 +17,7 @@ // #include +#include #include #include #include @@ -46,7 +47,7 @@ void HYDROGUI_AISShape::SetBorderColor( const Quantity_Color& theBorderColor ) } void HYDROGUI_AISShape::Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, + const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode ) { thePresentation->Clear(); diff --git a/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx b/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx index dd5fb3cf..e9ec399b 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx @@ -99,7 +99,7 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) if( isActive ) { const int aSelectionMode = 1; - ctx->OpenLocalContext( Standard_True ); + //ctx->OpenLocalContext( Standard_True ); foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths ) { ctx->Activate( bath, aSelectionMode, Standard_True ); @@ -116,7 +116,7 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) bath->GetShape()->TextLabels( false ); ctx->Deactivate( bath ); } - ctx->CloseLocalContext( -1, Standard_True ); + //ctx->CloseLocalContext( -1, Standard_True ); } myIsActive = isActive; diff --git a/src/HYDROGUI/HYDROGUI_MeasurementToolOp.cxx b/src/HYDROGUI/HYDROGUI_MeasurementToolOp.cxx index e03abebf..73a2bd6e 100644 --- a/src/HYDROGUI/HYDROGUI_MeasurementToolOp.cxx +++ b/src/HYDROGUI/HYDROGUI_MeasurementToolOp.cxx @@ -82,7 +82,7 @@ void HYDROGUI_MeasurementToolOp::startOperation() myMeasDlg = new HYDROGUI_MeasurementToolDlg( module()->getApp()->desktop() ); myMeasDlg->setModal( false ); myMeasDlg->setWindowTitle(getName()); - myMeasDlg->show(); + myMeasDlg->show(); //Tool: draw a distance line LightApp_Application* anApp = module()->getApp(); @@ -97,9 +97,9 @@ void HYDROGUI_MeasurementToolOp::startOperation() OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer(); - disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), aViewer, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); //polyline names @@ -150,7 +150,7 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if ( aCtx.IsNull() ) - return; + return; gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( theEvent->x(), theEvent->y(), aView ); @@ -162,10 +162,10 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse { myLineMaker = new BRepLib_MakePolygon(); myLineMaker->Add(aPnt); - aRes = myLineMaker->FirstVertex(); + aRes = myLineMaker->FirstVertex(); } else - { + { myLineMaker->Add(aPnt); aRes = myLineMaker->Shape(); const TopoDS_Edge& aLE = myLineMaker->Edge(); @@ -178,8 +178,8 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse if ( !myAISLineM.IsNull() ) { - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); aCtx->Erase( myAISLineM, Standard_False ); } } @@ -203,7 +203,7 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse continue; TopExp_Explorer expW(W, TopAbs_EDGE); if (!expW.More()) - continue; + continue; TopoDS_Edge E = TopoDS::Edge(expW.Current()); expW.Next(); if (expW.More()) @@ -224,7 +224,7 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse params.push_back(aKnots(i)); } } - //in some cases, extrema gives inaccurate result -> + //in some cases, extrema gives inaccurate result -> //split bspline by knot params and try to find minimum distance //on each interval std::sort(params.begin(), params.end()); @@ -248,9 +248,9 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse double WinDiagDist = sqrt ((double)aWinSX*(double)aWinSX + (double)aWinSY*(double)aWinSY); if (fdist <= prec || pd / WinDiagDist < 0.08) { - if (fdist < fdist_min) + if (fdist < fdist_min) { - fdist_min = fdist; + fdist_min = fdist; minWire = W; minU = aProj.LowerDistanceParameter(); minC.Initialize(E); @@ -272,8 +272,8 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse { if (myFW.IsSame(minWire)) { - //calc distance on current curve - double LenAlongCurv = GCPnts_AbscissaPoint::Length(minC, myFu, minU); + //calc distance on current curve + double LenAlongCurv = GCPnts_AbscissaPoint::Length(minC, myFu, minU); myFW = TopoDS_Wire(); if (!BRep_Tool::IsClosed(minWire)) { @@ -317,12 +317,12 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse //anAspect->SetTypeOfMarker(Aspect_TOM_RING1); //anAspect->SetColor(Quantity_NOC_BLACK); //mySplitPointPreview->Attributes()->SetPointAspect( anAspect ); - + aCtx->SetZLayer(myAISLineM, Graphic3d_ZLayerId_Topmost); - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); - aCtx->Display( myAISLineM, Standard_False ); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); + aCtx->Display( myAISLineM, Standard_False ); aCtx->UpdateCurrentViewer(); } @@ -338,13 +338,13 @@ void HYDROGUI_MeasurementToolOp::eraseLine() Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if ( !aCtx.IsNull() ) { - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); aCtx->Erase( myAISLineM, Standard_False ); } myAISLineM.Nullify(); aCtx->UpdateCurrentViewer(); - } + } } } } @@ -363,10 +363,10 @@ void HYDROGUI_MeasurementToolOp::onExit() if (aViewManager && aViewer) { - disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), aViewManager->getOCCViewer(), SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); } diff --git a/src/HYDROGUI/HYDROGUI_OCCSelector.cxx b/src/HYDROGUI/HYDROGUI_OCCSelector.cxx index edd6effe..8f189c57 100644 --- a/src/HYDROGUI/HYDROGUI_OCCSelector.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCSelector.cxx @@ -48,21 +48,21 @@ void HYDROGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const return; Handle(AIS_InteractiveContext) aContext = aViewer->getAISContext(); - bool isLocalContext = aContext->HasOpenedContext(); + //bool isLocalContext = aContext->HasOpenedContext(); AIS_ListOfInteractive aSelList; aViewer->getSelectedObjects( aSelList ); for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() ) if ( !anIt.Value().IsNull() ) { - if ( !isLocalContext ) { + //if ( !isLocalContext ) { QString anEntry = entry( anIt.Value() ); if ( !anEntry.isEmpty() ) { aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) ); } else { aList.append( SUIT_DataOwnerPtr( new HYDROGUI_DataOwner( anIt.Value() ) ) ); } - } + //} } // add externally selected objects SUIT_DataOwnerPtrList::const_iterator anExtIter; @@ -80,7 +80,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) int aViewerId = (size_t)aViewer; Handle(AIS_InteractiveContext) aContext = aViewer->getAISContext(); - if ( aContext.IsNull() || aContext->HasOpenedContext() ) { + if ( aContext.IsNull() ) { return; } @@ -96,7 +96,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) if ( !entryStr.isEmpty() ) aDisplayed.insert( entryStr, it.Value() ); }*/ - + mySelectedExternals.clear(); for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) @@ -124,7 +124,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) mySelectedExternals.append(*itr); } } - + aViewer->unHighlightAll( false ); aViewer->setObjectsSelected( aSelList ); } @@ -136,7 +136,7 @@ QString HYDROGUI_OCCSelector::entry( const Handle(AIS_InteractiveObject)& anAIS if ( anAIS.IsNull() || !anAIS->HasOwner() ) return aRes; - Handle(HYDROData_Entity) anObj = + Handle(HYDROData_Entity) anObj = Handle(HYDROData_Entity)::DownCast( anAIS->GetOwner() ); if ( !anObj.IsNull() ) aRes = HYDROGUI_DataObject::dataObjectEntry( anObj ); diff --git a/src/HYDROGUI/HYDROGUI_Polyline.cxx b/src/HYDROGUI/HYDROGUI_Polyline.cxx index 0119af16..7943f339 100644 --- a/src/HYDROGUI/HYDROGUI_Polyline.cxx +++ b/src/HYDROGUI/HYDROGUI_Polyline.cxx @@ -38,7 +38,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_Polyline, AIS_Shape) HYDROGUI_Polyline::HYDROGUI_Polyline(const TopoDS_Shape& shape) : AIS_Shape(shape) -{ +{ } HYDROGUI_Polyline::~HYDROGUI_Polyline() @@ -81,16 +81,15 @@ bool HYDROGUI_Polyline::GetColorOfSubShape(const TopoDS_Shape& SubShape, Quantit void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPrs, const Standard_Integer aMode) -{ +{ //AIS_Shape::Compute(aPresentationManager, aPrs, aMode); // return; aPrs->Clear(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs ); - Quantity_Color aColor; - Aspect_TypeOfLine aType; - Standard_Real anWidth; - Attributes()->LineAspect()->Aspect()->Values( aColor, aType, anWidth ); + Quantity_Color aColor = Attributes()->LineAspect()->Aspect()->Color(); + Aspect_TypeOfLine aType = Attributes()->LineAspect()->Aspect()->Type(); + Standard_Real anWidth = Attributes()->LineAspect()->Aspect()->Width(); anWidth =2; Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth ); @@ -143,7 +142,7 @@ QList HYDROGUI_Polyline::createPresentations for ( ; Exp.More(); Exp.Next() ) { TopoDS_Edge anEdge = TopoDS::Edge(Exp.Current()); - if ( !anEdge.IsNull() ) + if ( !anEdge.IsNull() ) { Handle(HYDROGUI_Arrow) arrow = new HYDROGUI_Arrow( anEdge, aMPoly ); if( theType>=0 ) @@ -224,7 +223,7 @@ void HYDROGUI_Arrow::Compute( const Handle(PrsMgr_PresentationManager3d)& aPrese aPrs->Clear(); if( myType==None ) return; - + TopoDS_Edge anEdge = TopoDS::Edge( myshape ); if( anEdge.IsNull() ) return; @@ -267,10 +266,9 @@ void HYDROGUI_Arrow::Compute( const Handle(PrsMgr_PresentationManager3d)& aPrese } Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs ); - Quantity_Color aColor; - Aspect_TypeOfLine aType; - Standard_Real anWidth; - Attributes()->LineAspect()->Aspect()->Values( aColor, aType, anWidth ); + Quantity_Color aColor = Attributes()->LineAspect()->Aspect()->Color(); + Aspect_TypeOfLine aType = Attributes()->LineAspect()->Aspect()->Type(); + Standard_Real anWidth = Attributes()->LineAspect()->Aspect()->Width(); anWidth = 1; const Handle(HYDROGUI_Polyline)& aParentPoly = getParentPolyline(); diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index f180a82a..6ce0e1a1 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -133,7 +133,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, if ( !myObject.IsNull() ) { Handle(HYDROData_Document) aDocument = HYDROData_Document::Document(); - + if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ImmersibleZone) ) ) { Handle(HYDROData_ImmersibleZone) aZoneObj = @@ -172,7 +172,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) { TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape ); - setWire( aPolylineWire, false, false ); + setWire( aPolylineWire, false, false ); } else { @@ -195,7 +195,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, QColor aColor; aPolyline->GetSectionColor(i, aColor); aSectColors.push_back(aColor); - } + } // //setBorderColor( aWireColor, false, false ); @@ -215,7 +215,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, for (int i=0;iIsKind( STANDARD_TYPE(HYDROData_Polyline3D) ) ) @@ -239,7 +239,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, if ( !aPolylineShape.IsNull() ) { if ( aPolylineShape.ShapeType() == TopAbs_WIRE ) { TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolylineShape ); - setWire( aPolylineWire, false, false ); + setWire( aPolylineWire, false, false ); } else { myTopoShape = aPolylineShape; // Set shading mode to avoid that hilight presentation is equal to "normal" object presentation. @@ -283,13 +283,13 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, if ( aProfile->IsValid() ) { TopoDS_Shape aProfileShape = aProfile->GetShape3D(); - if ( !aProfileShape.IsNull() && + if ( !aProfileShape.IsNull() && aProfileShape.ShapeType() == TopAbs_WIRE ) { aProfileWire = TopoDS::Wire( aProfileShape ); } } - setWire( aProfileWire, false, false ); + setWire( aProfileWire, false, false ); QColor aWireColor = aProfile->GetBorderColor(); setBorderColor( aWireColor, false, false ); @@ -343,21 +343,21 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, aCompoundBuilder.Add( aCompound, aShape ); } - setShape( aCompound, false, false ); + setShape( aCompound, false, false ); } else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_BCPolygon) ) ) { Handle(HYDROData_BCPolygon) aBCObj = Handle(HYDROData_BCPolygon)::DownCast( myObject ); TopoDS_Shape aBCShape = aBCObj->GetTopShape(); - if ( !aBCShape.IsNull() ) + if ( !aBCShape.IsNull() ) { - if ( aBCShape.ShapeType() == TopAbs_FACE ) + if ( aBCShape.ShapeType() == TopAbs_FACE ) { TopoDS_Face aBCFace = TopoDS::Face( aBCShape ); setFace( aBCFace, false, false, "" ); - } - else + } + else { myTopoShape = aBCShape; myDisplayMode = AIS_Shaded; @@ -375,7 +375,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer, } } - + if ( myShapes.empty() || !isVisible() ) return; @@ -522,7 +522,7 @@ QColor HYDROGUI_Shape::getFillingColor() const void HYDROGUI_Shape::setBorderColor( const QColor& theColor, const bool theToDisplay, const bool theIsUpdateViewer ) -{ +{ myBorderColor = theColor; updateShape( theToDisplay, theIsUpdateViewer ); } @@ -636,7 +636,7 @@ void HYDROGUI_Shape::buildShape() anIsoAspect->SetNumber( 0 ); anAttributes->SetUIsoAspect( anIsoAspect ); } - + anIsoAspect = anAttributes->VIsoAspect(); if ( !anIsoAspect.IsNull() ) { @@ -666,33 +666,33 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay, { if ( myDisplayMode == AIS_Shaded && myFillingColor.isValid() ) { - Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), + Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), getQuantityColorVal( myFillingColor.green() ), getQuantityColorVal( myFillingColor.blue() ), Quantity_TOC_RGB ); - + aShape->SetColor( aFillingColor ); aShape->SetTransparency( 1 - getQuantityColorVal( myFillingColor.alpha() ) ); } else if ( myDisplayMode == AIS_WireFrame ) { } - + // Coloring borders } } - + colorShapeBorder( myBorderColor ); if ( !theToDisplay || !isVisible() || myContext.IsNull() ) return; - + displayShape( theIsUpdateViewer ); } void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer ) { - if ( myContext->HasOpenedContext() && mySelectionMode > 0 ) - myContext->CloseLocalContext(); +// if ( myContext->HasOpenedContext() && mySelectionMode > 0 ) +// myContext->CloseLocalContext(); foreach( Handle(AIS_InteractiveObject) aShape, myShapes ) { @@ -701,18 +701,18 @@ void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer ) myContext->Display( aShape, myDisplayMode, mySelectionMode, Standard_False, Standard_False ); else { - if ( !myContext->HasOpenedContext() ) - // Ordinary display of object published in the Object Browser - myContext->Display( aShape, Standard_False ); - else +// if ( !myContext->HasOpenedContext() ) +// Ordinary display of object published in the Object Browser +// myContext->Display( aShape, Standard_False ); +// else // Display object in local context without selection myContext->Display( aShape, myDisplayMode, -1, Standard_False, Standard_False ); } } - + if ( mySelectionMode > 0 ) { - myContext->OpenLocalContext(); + //myContext->OpenLocalContext(); foreach( Handle(AIS_InteractiveObject) aShape, myShapes ) myContext->Activate( aShape, mySelectionMode, Standard_True ); } @@ -730,8 +730,8 @@ void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer ) void HYDROGUI_Shape::eraseShape( const bool theIsUpdateViewer ) { - if ( myContext->HasOpenedContext() && mySelectionMode > 0 ) - myContext->CloseLocalContext(); +// if ( myContext->HasOpenedContext() && mySelectionMode > 0 ) +// myContext->CloseLocalContext(); foreach( Handle(AIS_InteractiveObject) aShape, myShapes ) myContext->Erase( aShape, Standard_False ); @@ -758,11 +758,11 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor ) if ( anAttributes.IsNull() ) continue; - Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ), + Quantity_Color aBorderColor( getQuantityColorVal( theColor.red() ), getQuantityColorVal( theColor.green() ), getQuantityColorVal( theColor.blue() ), Quantity_TOC_RGB ); - + if( !myTopoShape.IsNull() ) { if ( myTopoShape.ShapeType() == TopAbs_WIRE ) // Note that we display polylines in shaded mode diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index b3d39014..105d1329 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -173,7 +173,7 @@ void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const { if( !myRangeInitialized ) { - HYDROGUI_ShapeBathymetry* that = + HYDROGUI_ShapeBathymetry* that = const_cast( this ); that->RescaleDefault(); that->myRangeInitialized = true; @@ -235,17 +235,13 @@ QVector HYDROGUI_ShapeBathymetry::selected() const Handle(AIS_InteractiveContext) c = getContext(); if( !c.IsNull() ) { - Handle(AIS_LocalContext) lc = c->LocalContext(); - if( !lc.IsNull() ) - { - for( lc->InitSelected(); lc->MoreSelected(); lc->NextSelected() ) + for( c->InitSelected(); c->MoreSelected(); c->NextSelected() ) { - Handle(HYDROGUI_BathymetryPointOwner) anOwner = - Handle(HYDROGUI_BathymetryPointOwner)::DownCast( lc->SelectedOwner() ); + Handle(HYDROGUI_BathymetryPointOwner) anOwner = + Handle(HYDROGUI_BathymetryPointOwner)::DownCast( c->SelectedOwner() ); if( !anOwner.IsNull() && anOwner->Selectable()==obj ) selected.append( anOwner->GetIndex() ); } - } } return selected; } diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx index 439af525..d6aa45b5 100644 --- a/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx @@ -58,7 +58,7 @@ void HYDROGUI_SplitPolylinesOp::startOperation() { HYDROGUI_Operation::startOperation(); - HYDROGUI_SplitPolylinesDlg* aPanel = + HYDROGUI_SplitPolylinesDlg* aPanel = ::qobject_cast( inputPanel() ); if ( !aPanel ) return; @@ -120,7 +120,7 @@ bool HYDROGUI_SplitPolylinesOp::processApply( int& theUpdateFlags, anOp.Split( doc(), aPolylinesList, aTolerance ); break; } - + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; return true; } @@ -145,7 +145,7 @@ void HYDROGUI_SplitPolylinesOp::erasePreview() myPreviewPrs = 0; } - HYDROGUI_SplitPolylinesDlg* aPanel = + HYDROGUI_SplitPolylinesDlg* aPanel = ::qobject_cast( inputPanel() ); if ( !aPanel ) return; @@ -160,18 +160,18 @@ void HYDROGUI_SplitPolylinesOp::erasePreview() Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if ( !aCtx.IsNull() ) { - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); aCtx->Erase( mySplitPointPreview, Standard_False ); } mySplitPointPreview = 0; } - + if ( aPanel->GetMode() == HYDROGUI_SplitPolylinesDlg::ByPoint ) { - disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), aViewer, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); } } @@ -198,15 +198,15 @@ void HYDROGUI_SplitPolylinesOp::OnUpdatePreview() if ( mySplitPointPreview ) { - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); if ( aPanel->GetMode() == HYDROGUI_SplitPolylinesDlg::ByPoint ) { if ( !aCtx->IsDisplayed( mySplitPointPreview ) ) aCtx->Display( mySplitPointPreview, Standard_False ); } else - aCtx->Erase( mySplitPointPreview, Standard_False ); + aCtx->Erase( mySplitPointPreview, Standard_False ); } aCtx->ClearSelected(true); @@ -214,16 +214,16 @@ void HYDROGUI_SplitPolylinesOp::OnUpdatePreview() if ( aPanel->GetMode() == HYDROGUI_SplitPolylinesDlg::ByPoint ) { - disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), aViewer, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); } else { - disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), aViewer, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); } } @@ -303,18 +303,18 @@ void HYDROGUI_SplitPolylinesOp::onMousePress(SUIT_ViewWindow* theWindow, QMouseE TopoDS_Compound aShape; aBuilder.MakeCompound(aShape); aBuilder.Add(aShape, BRepBuilderAPI_MakeVertex( aPnt ) ); - + if ( mySplitPointPreview ) { - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); aCtx->Erase( mySplitPointPreview, Standard_False ); } mySplitPointPreview = new AIS_Shape( aShape ); - if ( aCtx->HasOpenedContext() ) - aCtx->CloseLocalContext(); +// if ( aCtx->HasOpenedContext() ) +// aCtx->CloseLocalContext(); aCtx->Display( mySplitPointPreview, Standard_False ); - + aCtx->UpdateCurrentViewer(); } diff --git a/src/HYDROGUI/HYDROGUI_ZLayers.cxx b/src/HYDROGUI/HYDROGUI_ZLayers.cxx index 4cd49e8b..1d7ca667 100644 --- a/src/HYDROGUI/HYDROGUI_ZLayers.cxx +++ b/src/HYDROGUI/HYDROGUI_ZLayers.cxx @@ -18,7 +18,7 @@ #include #include -#include +#include #include void SetZLayerForPrs( const Handle(PrsMgr_Presentation)& thePrs, int theLayerId ); @@ -29,8 +29,8 @@ void SetPrsZLayer( const Handle(PrsMgr_PresentableObject)& thePresentableObject, PrsMgr_Presentations& aPresentations = thePresentableObject->Presentations(); for (Standard_Integer aIdx = 1; aIdx <= aPresentations.Length (); aIdx++) { - Handle(PrsMgr_Presentation) aPrs = aPresentations (aIdx).Presentation (); - if ( aPresentations (aIdx).Mode() == theMode ) + Handle(PrsMgr_Presentation) aPrs = aPresentations (aIdx); + if ( aPrs->Mode() == theMode ) { SetZLayerForPrs( aPrs, theLayerId ); } @@ -91,7 +91,7 @@ void HYDROGUI_ZLayersIterator::Init( const Handle(V3d_Viewer)& theViewer ) { TColStd_SequenceOfInteger anExistingZLayers; theViewer->GetAllZLayers( anExistingZLayers ); - + int n = anExistingZLayers.Length(); for( int i=1; i<=n; i++ ) { int aLayerId = anExistingZLayers( i ); @@ -112,7 +112,7 @@ void HYDROGUI_ZLayersIterator::Next() { myIndex++; - if( myIndex >= (int)myZLayers.size() && + if( myIndex >= (int)myZLayers.size() && !myViewer.IsNull() ) { myNewZLayer = CreateTopZLayer( myViewer ); } diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 3f886a5c..c4219ae2 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -102,12 +102,12 @@ QColor TestViewer::GetColor(int i) static QVector aCV; if( aCV.isEmpty() ) { - aCV << QColor(0,0,255) + aCV << QColor(0,0,255) << QColor(0,255,0) << QColor(255,0,0) - << QColor(255,255,20) - << QColor(20,255,255) - << QColor(100,100,20) + << QColor(255,255,20) + << QColor(20,255,255) + << QColor(100,100,20) << QColor(10,100,150); } if (i < aCV.size()) @@ -115,8 +115,8 @@ QColor TestViewer::GetColor(int i) else { QColor TestColor = aCV[i % aCV.size()]; - QColor NewColor((TestColor.red() + i * 41) % 256, - (TestColor.green() + i * 13) % 256, + QColor NewColor((TestColor.red() + i * 41) % 256, + (TestColor.green() + i * 13) % 256, (TestColor.blue() + i * 23) % 256); return NewColor; } @@ -124,10 +124,10 @@ QColor TestViewer::GetColor(int i) void TestViewer::eraseAll( bool isUpdate, bool eraseStructures ) { - context()->CloseLocalContext( -1, Standard_False ); + //context()->CloseLocalContext( -1, Standard_False ); context()->EraseAll( isUpdate ); if( eraseStructures ) - { + { Graphic3d_MapOfStructure GmapS; viewer()->getViewer3d()->StructureManager()->DisplayedStructures(GmapS); for (Graphic3d_MapOfStructure::Iterator it(GmapS); it.More(); it.Next()) @@ -149,10 +149,10 @@ void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject, myKey = aNewKey; eraseAll( false, true ); } - + if( theSelectionMode > 0 ) { - context()->OpenLocalContext(); + //context()->OpenLocalContext(); context()->Display( theObject, theMode, theSelectionMode, true ); context()->Activate( theObject, theSelectionMode, Standard_True ); } @@ -173,7 +173,7 @@ void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, int theUIANb, int theVIANb) { Handle(AIS_Shape) aShape = new AIS_Shape( theShape ); - cout <Attributes()->PointAspect()->SetTypeOfMarker( Aspect_TOM_X ); if (theShape.ShapeType()==TopAbs_FACE) @@ -318,7 +318,7 @@ bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, cons QString anExpectedRefFilePath = REF_DATA_PATH; anExpectedRefFilePath += "/" + myKey + ".png"; - QImage anExpectedRefImage; + QImage anExpectedRefImage; anExpectedRefImage.load( anExpectedRefFilePath ); //std::cout << "Expected image loading: " << anExpectedRefFilePath.toStdString() << std::endl; @@ -331,10 +331,10 @@ bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, cons QString aPath = TMP_DIR + "/" + myKey + ".png"; anActualImage.save( aPath ); //std::cout << "Actual image: " << aPath.toStdString() << std::endl; - + //std::cout << anActualImage.width() << "x" << anActualImage.height() << std::endl; theMessage = "The viewer contents does not correspond to the reference image: " + myKey; - + QImage aDiff = diff( anExpectedRefImage, anActualImage ); QString aDiffFilePath = TMP_DIR + "/" + myKey + "_diff.png"; @@ -424,7 +424,7 @@ bool TestViewer::areScriptsEqual( const QString& theBaseName, { QString anExpectedRefFilePath = REF_DATA_PATH; anExpectedRefFilePath += "/" + theBaseName; - + QString anActualFilePath = TMP_DIR + "/" + theBaseName; QFile anExpected( anExpectedRefFilePath ); @@ -455,7 +455,7 @@ bool TestViewer::areScriptsEqual( const QString& theBaseName, theMsg = QString( "line %1\nActual: %2\nExpected: %3" ).arg( i ).arg( anActualLine ).arg( anExpectedLine ); i++; } - + while( !anActual.atEnd() && isEqual ) { QString anActualLine = GetLine( anActual, isActualUtf8 ); -- 2.39.2