X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FOBJECT%2FSMESH_SVTKActor.cxx;h=1b21525bdae91de8a891b4b06a7fdc5449b2f59a;hb=38a77c4a9810f4715212368ac53315689ba9150f;hp=b86c81d5481eb3f6e9ada5502a43c2c285e103d8;hpb=f5016d85b7b4b88623723027a1585c6414c4dc66;p=modules%2Fsmesh.git diff --git a/src/OBJECT/SMESH_SVTKActor.cxx b/src/OBJECT/SMESH_SVTKActor.cxx index b86c81d54..1b21525bd 100644 --- a/src/OBJECT/SMESH_SVTKActor.cxx +++ b/src/OBJECT/SMESH_SVTKActor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 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 @@ -31,7 +31,6 @@ #include #include - #include #include #include @@ -39,6 +38,10 @@ #include #include #include +#include +#include + +#include vtkStandardNewMacro(SMESH_SVTKActor); @@ -51,6 +54,7 @@ SMESH_SVTKActor::SMESH_SVTKActor(): { my0DActor = SVTK_DeviceActor::New(); myBallActor = SVTK_DeviceActor::New(); + myBallActor->SetBallEnabled(true); myBallActor->SetResolveCoincidentTopology(false); myBallActor->SetCoincident3DAllowed(true); @@ -119,34 +123,46 @@ SMESH_SVTKActor SVTK::CopyPoints( GetSource(), aSourceDataSet ); SVTK::CopyPoints( myBallGrid, aSourceDataSet ); SVTK::CopyPoints( my0DGrid, aSourceDataSet ); + int aNbOfParts = theMapIndex.Extent(); + + vtkCellData* cd = 0; + vtkCellData* outputCD = 0; + //Copy deamaters of the balls + if(myVisualObj) { + outputCD = myBallGrid->GetCellData(); + cd = aSourceDataSet->GetCellData(); + } + outputCD->CopyAllocate(cd,aNbOfParts,aNbOfParts/2); for(int ind = 1; ind <= aNbOfParts; ind++){ int aPartId = theMapIndex( ind ); if(vtkCell* aCell = theMapActor->GetElemCell(aPartId)) - { -#if VTK_XVERSION > 50700 + { if (aCell->GetCellType() != VTK_POLYHEDRON) -#endif - if(aCell->GetCellType() == VTK_VERTEX ) { - my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); - } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) { - myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); - } else { - myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + { + if(aCell->GetCellType() == VTK_VERTEX ) { + my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) { + vtkIdType newCellId = myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + if(myVisualObj) { + outputCD->CopyData(cd, myVisualObj->GetElemVTKId(aPartId), newCellId); + } + } else { + myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + } } -#if VTK_XVERSION > 50700 else - { - vtkPolyhedron *polyhedron = dynamic_cast(aCell); - if (!polyhedron) - throw SALOME_Exception(LOCALIZED ("not a polyhedron")); - vtkIdType *pts = polyhedron->GetFaces(); - myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1); - } -#endif + { + vtkPolyhedron *polyhedron = dynamic_cast(aCell); + if (!polyhedron) + throw SALOME_Exception(LOCALIZED ("not a polyhedron")); + vtkIdType *pts = polyhedron->GetFaces(); + myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1); } - + } + } + UnShrink(); if(theMapActor->IsShrunk()){ SetShrinkFactor(theMapActor->GetShrinkFactor()); @@ -154,16 +170,15 @@ SMESH_SVTKActor } myMapIndex = theMapIndex; - } } - + void SMESH_SVTKActor ::Initialize() { Superclass::Initialize(); - my0DActor->SetInput(my0DGrid); - myBallActor->SetInput(myBallGrid); + my0DActor->SetInputData(my0DGrid); + myBallActor->SetInputData(myBallGrid); } @@ -182,3 +197,7 @@ void SMESH_SVTKActor::SetBallSize(float theSize) { myBallActor->GetProperty()->SetPointSize(theSize); } +void SMESH_SVTKActor::SetVisualObject(TVisualObjPtr theVisualObj) { + myVisualObj = theVisualObj; +} +