From e940a353aef79efcdc4fef991701cf4439fcc276 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 23 Mar 2015 11:54:22 +0300 Subject: [PATCH] porting on the recent SALOME version --- src/HYDROGUI/CMakeLists.txt | 1 + src/HYDROGUI/GEOM_Actor_patched.h | 52 ++++++++++++++--------- src/HYDROGUI/HYDROGUI_VTKPrs.cxx | 3 +- src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx | 4 +- src/HYDROGUI/HYDROGUI_ZLayers.cxx | 25 ++++------- src/HYDROGUI/HYDROGUI_ZLayers3.cxx | 39 +++++++++++++++++ 6 files changed, 86 insertions(+), 38 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_ZLayers3.cxx diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index a1928801..937afe37 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -202,6 +202,7 @@ set(PROJECT_SOURCES HYDROGUI_ListSelector.cxx HYDROGUI_ZLayers.cxx HYDROGUI_ZLayers2.cxx + HYDROGUI_ZLayers3.cxx HYDROGUI_PriorityWidget.cxx HYDROGUI_PriorityTableModel.cxx ) diff --git a/src/HYDROGUI/GEOM_Actor_patched.h b/src/HYDROGUI/GEOM_Actor_patched.h index efa756d8..7834ad61 100644 --- a/src/HYDROGUI/GEOM_Actor_patched.h +++ b/src/HYDROGUI/GEOM_Actor_patched.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -51,6 +51,7 @@ class GEOM_ShadingFace; typedef GEOM_SmartPtr PSFaceSource; class vtkRenderer; +class vtkTextActor; class vtkAppendPolyData; typedef GEOM_SmartPtr PAppendFilter; @@ -62,11 +63,11 @@ public: static GEOM_Actor* New(); void SetShape(const TopoDS_Shape& theShape, - float theDeflection, + double theDeflection, bool theIsVector = false); - void SetDeflection(float theDeflection); - float GetDeflection() const{ return myDeflection;} + void SetDeflection(double theDeflection); + double GetDeflection() const{ return myDeflection;} void AddToRender(vtkRenderer* theRenderer); void RemoveFromRender(vtkRenderer* theRenderer); @@ -89,10 +90,10 @@ public: vtkProperty* GetShadingProperty(); vtkProperty* GetIsolatedEdgeProperty(); vtkProperty* GetVertexProperty(); + vtkProperty* GetStandaloneVertexProperty(); vtkProperty* GetSharedEdgeProperty(); vtkProperty* GetFaceEdgeProperty(); - void setDeflection(double adef); virtual void setDisplayMode(int thenewmode); // Description: @@ -107,7 +108,6 @@ public: const TopoDS_Shape& getTopo(); void setInputShape(const TopoDS_Shape& ashape, double adef1, int imode, bool isVector = false); - double getDeflection(); double isVector(); // SubShape @@ -201,40 +201,54 @@ public: virtual bool GetVectorMode(); - - void - StoreIsoNumbers(); + //! Vertices mode management + virtual void - RestoreIsoNumbers(); - + SetVerticesMode(const bool theMode); + + virtual + bool + GetVerticesMode(); + + //! Name mode management + virtual void - ResetIsoNumbers(); + SetNameMode(const bool theMode); + + virtual + bool + GetNameMode(); protected: void SetModified(); void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result); + void SetShapeName(const TopoDS_Shape& theShape); GEOM_Actor(); ~GEOM_Actor(); private: TopoDS_Shape myShape; - int myNbIsos[2]; bool isOnlyVertex; - float myDeflection; + double myDeflection; bool myIsForced; // EDisplayMode myDisplayMode; bool myIsSelected; bool myVectorMode; + bool myVerticesMode; + bool myNameMode; -protected: +public: PDeviceActor myVertexActor; PVertexSource myVertexSource; + PDeviceActor myStandaloneVertexActor; + PVertexSource myStandaloneVertexSource; + PDeviceActor myIsolatedEdgeActor; PEdgeSource myIsolatedEdgeSource; @@ -252,15 +266,14 @@ protected: PDeviceActor myHighlightActor; -private: + vtkTextActor* myTextActor; + vtkSmartPointer myHighlightProp; vtkSmartPointer myPreHighlightProp; vtkSmartPointer myShadingFaceProp; vtkSmartPointer myShadingBackFaceProp; PAppendFilter myAppendFilter; - -protected: PPolyGeomPainterDataMapper myPolyDataMapper; private: @@ -269,6 +282,7 @@ private: GEOM_Actor(const GEOM_Actor&); void operator=(const GEOM_Actor&); +public: double myEdgesInWireframeColor[3]; double myEdgesInShadingColor[3]; double myIsolatedEdgeColor[3]; diff --git a/src/HYDROGUI/HYDROGUI_VTKPrs.cxx b/src/HYDROGUI/HYDROGUI_VTKPrs.cxx index 87a86d5c..600bb253 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrs.cxx @@ -31,7 +31,8 @@ // Purpose : Constructor //======================================================================= HYDROGUI_VTKPrs::HYDROGUI_VTKPrs( const Handle(HYDROData_Entity)& theObject ) -: myObject( theObject ), +: SVTK_Prs( "" ), + myObject( theObject ), myIsToUpdate( false ) { // Define IO for actors to be added: diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx index 00009b47..d1108150 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx @@ -33,7 +33,7 @@ #include #include #include -#include +//#include #include #include #include @@ -132,7 +132,7 @@ void HYDROGUI_VTKPrsDisplayer::EraseAll( const int theViewerId ) SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId ); if( aViewer ) { - aViewer->EraseAll( true ); + aViewer->EraseAll( 0, true ); module()->removeViewVTKPrs( (size_t)aViewer ); EraseScalarBar( theViewerId ); } diff --git a/src/HYDROGUI/HYDROGUI_ZLayers.cxx b/src/HYDROGUI/HYDROGUI_ZLayers.cxx index 3e06521d..828f6963 100644 --- a/src/HYDROGUI/HYDROGUI_ZLayers.cxx +++ b/src/HYDROGUI/HYDROGUI_ZLayers.cxx @@ -25,27 +25,20 @@ #include #include -class PrsMgr_PresentationManager +void SetZLayerForPrs( const Handle(PrsMgr_Presentation)& thePrs, int theLayerId ); + +void SetPrsZLayer( const Handle_PrsMgr_PresentableObject& thePresentableObject, + const int theMode, const int theLayerId ) { -public: - static void SetZLayer( const Handle_PrsMgr_PresentableObject& thePresentableObject, - const Standard_Integer theMode, - const Standard_Integer theLayerId ) + PrsMgr_Presentations& aPresentations = thePresentableObject->Presentations(); + for (Standard_Integer aIdx = 1; aIdx <= aPresentations.Length (); aIdx++) { - 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).Presentation (); - if ( aPresentations (aIdx).Mode() == theMode ) - aPrs->SetZLayer (theLayerId); + SetZLayerForPrs( aPrs, theLayerId ); } } -}; - -void SetPrsZLayer( const Handle_PrsMgr_PresentableObject& thePresentableObject, - const int theMode, const int theLayerId ) -{ - PrsMgr_PresentationManager::SetZLayer( thePresentableObject, theMode, theLayerId ); } void SetZLayerSettings( const Handle_V3d_Viewer& theViewer3d, int theLayerId, bool theIsOrdered ) diff --git a/src/HYDROGUI/HYDROGUI_ZLayers3.cxx b/src/HYDROGUI/HYDROGUI_ZLayers3.cxx new file mode 100644 index 00000000..b52649fb --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ZLayers3.cxx @@ -0,0 +1,39 @@ +// Copyright (C) 2007-2013 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 +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +class PrsMgr_PresentationManager +{ +public: + static void SetZLayer( const Handle(PrsMgr_Presentation)& thePrs, + int theLayerId ) + { + thePrs->SetZLayer( theLayerId ); + } +}; + +void SetZLayerForPrs( const Handle(PrsMgr_Presentation)& thePrs, + int theLayerId ) +{ + PrsMgr_PresentationManager::SetZLayer( thePrs, theLayerId ); +} -- 2.39.2