From: rnv Date: Fri, 28 Sep 2012 07:26:48 +0000 (+0000) Subject: Implementation of the "21459: EDF 1495 SMESH: Manipulation of discrete elements with... X-Git-Tag: V6_6_0a1~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=23ee6729d589b8a461953bbd238fe108f532090c;p=modules%2Fgui.git Implementation of the "21459: EDF 1495 SMESH: Manipulation of discrete elements with attributes" issue: visualization of the 0D and balls elements. --- diff --git a/src/SVTK/Makefile.am b/src/SVTK/Makefile.am index 144ad705e..c048c3f49 100755 --- a/src/SVTK/Makefile.am +++ b/src/SVTK/Makefile.am @@ -60,7 +60,8 @@ salomeinclude_HEADERS= \ SVTK_Recorder.h \ SVTK_RecorderDlg.h \ SVTK_ImageWriter.h \ - SVTK_ImageWriterMgr.h + SVTK_ImageWriterMgr.h \ + SVTK_Utils.h dist_libSVTK_la_SOURCES= \ SVTK_Prs.cxx \ @@ -92,6 +93,7 @@ dist_libSVTK_la_SOURCES= \ SVTK_RecorderDlg.cxx \ SVTK_ImageWriter.cxx \ SVTK_ImageWriterMgr.cxx \ + SVTK_Utils.cxx \ vtkPVAxesActor.h \ vtkPVAxesActor.cxx \ vtkPVAxesWidget.h \ diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index ad20490b2..8af1876fc 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -273,8 +273,8 @@ SALOME_Actor myRenderer = theRenderer; - theRenderer->AddActor( myPreHighlightActor.GetPointer() ); - theRenderer->AddActor( myHighlightActor.GetPointer() ); + myHighlightActor->AddToRender(theRenderer); + myPreHighlightActor->AddToRender(theRenderer); theRenderer->AddActor( myOutlineActor.GetPointer() ); theRenderer->AddActor( myNameActor.GetPointer() ); } @@ -288,6 +288,9 @@ SALOME_Actor { Superclass::RemoveFromRender(theRenderer); + myHighlightActor->RemoveFromRender(theRenderer); + myPreHighlightActor->RemoveFromRender(theRenderer); + theRenderer->RemoveActor( myPreHighlightActor.GetPointer() ); theRenderer->RemoveActor( myHighlightActor.GetPointer() ); theRenderer->RemoveActor( myOutlineActor.GetPointer() ); diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index 2ea4910cf..0155b629a 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -22,6 +22,7 @@ #include "SVTK_Actor.h" #include "SALOME_Actor.h" +#include "SVTK_Utils.h" #include "SALOME_InteractiveObject.hxx" @@ -41,19 +42,6 @@ #include "Utils_SALOME_Exception.hxx" #include "utilities.h" -static -void -CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet) -{ - vtkPoints *aPoints = vtkPoints::New(); - vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints(); - aPoints->SetNumberOfPoints(iEnd); - for(vtkIdType i = 0; i < iEnd; i++){ - aPoints->SetPoint(i,theSourceDataSet->GetPoint(i)); - } - theGrid->SetPoints(aPoints); - aPoints->Delete(); -} vtkStandardNewMacro(SVTK_Actor); @@ -123,7 +111,7 @@ SVTK_Actor myUnstructuredGrid->Allocate(); vtkDataSet *aSourceDataSet = theMapActor->GetInput(); - CopyPoints(GetSource(),aSourceDataSet); + SVTK::CopyPoints(GetSource(),aSourceDataSet); int aNbOfParts = theMapIndex.Extent(); for(int ind = 1; ind <= aNbOfParts; ind++){ @@ -194,7 +182,7 @@ SVTK_Actor myUnstructuredGrid->Allocate(); vtkDataSet *aSourceDataSet = theMapActor->GetInput(); - CopyPoints(GetSource(),aSourceDataSet); + SVTK::CopyPoints(GetSource(),aSourceDataSet); if(theMapIndex.Extent() == 2){ @@ -223,3 +211,20 @@ SVTK_Actor myMapIndex = theMapIndex; } + +/*! + To publish the actor an all its internal devices +*/ +void +SVTK_Actor +::AddToRender(vtkRenderer* theRenderer) +{ + theRenderer->AddActor(this); +} + +void +SVTK_Actor +::RemoveFromRender(vtkRenderer* theRenderer) +{ + theRenderer->RemoveActor(this); +} diff --git a/src/SVTK/SVTK_Actor.h b/src/SVTK/SVTK_Actor.h index 00e92d4ce..d2b10164e 100644 --- a/src/SVTK/SVTK_Actor.h +++ b/src/SVTK/SVTK_Actor.h @@ -50,7 +50,7 @@ public: vtkTypeMacro(SVTK_Actor,SVTK_DeviceActor); //! Initialiaze the instance completely - void + virtual void Initialize(); //! Allows to set an external source @@ -61,18 +61,25 @@ public: vtkUnstructuredGrid* GetSource(); + virtual void + AddToRender(vtkRenderer* theRenderer); + + virtual void + RemoveFromRender(vtkRenderer* theRenderer); + + //! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes - void + virtual void MapCells(SALOME_Actor* theMapActor, const TColStd_IndexedMapOfInteger& theMapIndex); //! Allow to recostruct selected points from source SALOME_Actor and map of subindexes - void + virtual void MapPoints(SALOME_Actor* theMapActor, const TColStd_IndexedMapOfInteger& theMapIndex); //! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes - void + virtual void MapEdge(SALOME_Actor* theMapActor, const TColStd_IndexedMapOfInteger& theMapIndex); diff --git a/src/SVTK/SVTK_DeviceActor.cxx b/src/SVTK/SVTK_DeviceActor.cxx index 94e6ee09d..bea8a52ff 100644 --- a/src/SVTK/SVTK_DeviceActor.cxx +++ b/src/SVTK/SVTK_DeviceActor.cxx @@ -749,3 +749,11 @@ void SVTK_DeviceActor::SetCoincident3DAllowed(bool theFlag) { bool SVTK_DeviceActor::IsCoincident3DAllowed() const { return myGeomFilter->GetAppendCoincident3D(); } + +void +SVTK_DeviceActor +::SetResolveCoincidentTopology(bool theIsResolve) +{ + myIsResolveCoincidentTopology = theIsResolve; +} + \ No newline at end of file diff --git a/src/SVTK/SVTK_DeviceActor.h b/src/SVTK/SVTK_DeviceActor.h index 12d10220f..681f25263 100644 --- a/src/SVTK/SVTK_DeviceActor.h +++ b/src/SVTK/SVTK_DeviceActor.h @@ -249,6 +249,10 @@ class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor virtual bool IsCoincident3DAllowed() const; + + void + SetResolveCoincidentTopology(bool theIsResolve); + protected: diff --git a/src/SVTK/SVTK_Utils.cxx b/src/SVTK/SVTK_Utils.cxx new file mode 100644 index 000000000..77415a704 --- /dev/null +++ b/src/SVTK/SVTK_Utils.cxx @@ -0,0 +1,43 @@ +// Copyright (C) 2007-2012 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 +// + +// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers +// File : SVTK_Utils.cxx +// Author : Roman NIKOLAEV + +#include "SVTK_Utils.h" + +#include + +namespace SVTK { + void CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet) + { + vtkPoints *aPoints = vtkPoints::New(); + vtkIdType iEnd = theSourceDataSet->GetNumberOfPoints(); + aPoints->SetNumberOfPoints(iEnd); + for(vtkIdType i = 0; i < iEnd; i++){ + aPoints->SetPoint(i,theSourceDataSet->GetPoint(i)); + } + theGrid->SetPoints(aPoints); + aPoints->Delete(); + } +} diff --git a/src/SVTK/SVTK_Utils.h b/src/SVTK/SVTK_Utils.h new file mode 100644 index 000000000..b5136300e --- /dev/null +++ b/src/SVTK/SVTK_Utils.h @@ -0,0 +1,41 @@ +// Copyright (C) 2007-2012 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 +// + +// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers +// File : SVTK_Utils.h +// Author : Roman NIKOLAEV + +#ifndef SVTK_UTILS_H +#define SVTK_UTILS_H + +#include "SVTK.h" + +class vtkUnstructuredGrid; +class vtkDataSet; + +namespace SVTK { + + SVTK_EXPORT void CopyPoints(vtkUnstructuredGrid* theGrid, vtkDataSet *theSourceDataSet); + +} + +#endif