X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_SVTKActor.cxx;h=abaeeaaa810b5be7802cc4c9ab15d54e98a8c07a;hp=de143a7901df15960ba33ab8bff1b8f6ae19f8da;hb=499f29d24922cec66e41b41a0039a954993bc6df;hpb=e0528f4426fbfb1ab5d8285045a3bcf703b4f041 diff --git a/src/OBJECT/SMESH_SVTKActor.cxx b/src/OBJECT/SMESH_SVTKActor.cxx index de143a790..abaeeaaa8 100644 --- a/src/OBJECT/SMESH_SVTKActor.cxx +++ b/src/OBJECT/SMESH_SVTKActor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 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 @@ -39,10 +39,11 @@ #include #include #include +#include #include -vtkStandardNewMacro(SMESH_SVTKActor); +vtkStandardNewMacro(SMESH_SVTKActor) /*! Constructor @@ -53,6 +54,7 @@ SMESH_SVTKActor::SMESH_SVTKActor(): { my0DActor = SVTK_DeviceActor::New(); myBallActor = SVTK_DeviceActor::New(); + myBallActor->SetBallEnabled(true); myBallActor->SetResolveCoincidentTopology(false); myBallActor->SetCoincident3DAllowed(true); @@ -106,7 +108,7 @@ SMESH_SVTKActor void SMESH_SVTKActor ::MapCells(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex) + const SVTK_TIndexedMapOfVtkId& theMapIndex) { myUnstructuredGrid->Initialize(); myUnstructuredGrid->Allocate(); @@ -117,23 +119,38 @@ SMESH_SVTKActor myBallGrid->Initialize(); myBallGrid->Allocate(); - vtkDataSet *aSourceDataSet = theMapActor->GetInput(); - SVTK::CopyPoints( GetSource(), aSourceDataSet ); - SVTK::CopyPoints( myBallGrid, aSourceDataSet ); - SVTK::CopyPoints( my0DGrid, aSourceDataSet ); + vtkUnstructuredGrid * aSourceGrid = (vtkUnstructuredGrid *)theMapActor->GetInput(); + GetSource()->SetPoints( aSourceGrid->GetPoints() ); + myBallGrid->SetPoints( aSourceGrid->GetPoints() ); + my0DGrid->SetPoints( aSourceGrid->GetPoints() ); int aNbOfParts = theMapIndex.Extent(); - for(int ind = 1; ind <= aNbOfParts; ind++){ - int aPartId = theMapIndex( ind ); + + vtkCellData* cd = 0; + vtkCellData* outputCD = 0; + //Copy deamaters of the balls + if(myVisualObj) { + outputCD = myBallGrid->GetCellData(); + cd = aSourceGrid->GetCellData(); + } + outputCD->CopyAllocate(cd,aNbOfParts,aNbOfParts/2); + for(int ind = 1; ind <= aNbOfParts; ind++) + { + vtkIdType aPartId = theMapIndex( ind ); if(vtkCell* aCell = theMapActor->GetElemCell(aPartId)) { if (aCell->GetCellType() != VTK_POLYHEDRON) { 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 { + } + 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()); } } @@ -182,3 +199,11 @@ void SMESH_SVTKActor::SetBallSize(float theSize) { myBallActor->GetProperty()->SetPointSize(theSize); } +void SMESH_SVTKActor::SetBallScale(double theScale) { + myBallActor->SetBallScale(theScale); +} + +void SMESH_SVTKActor::SetVisualObject(TVisualObjPtr theVisualObj) { + myVisualObj = theVisualObj; +} +