1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "GEOM_VertexSource.h"
24 #include <vtkObjectFactory.h>
26 #include <vtkPoints.h>
27 #include <vtkCellArray.h>
28 #include <vtkPolyData.h>
29 #include <vtkPolyDataMapper.h>
32 #include <BRep_Tool.hxx>
34 vtkStandardNewMacro(GEOM_VertexSource);
36 GEOM_VertexSource::GEOM_VertexSource()
40 GEOM_VertexSource::~GEOM_VertexSource()
46 AddVertex(const TopoDS_Vertex& theVertex)
48 myVertexSet.Add(theVertex);
55 vtkPolyData* aPolyData = GetOutput();
56 aPolyData->Allocate();
57 vtkPoints* aPts = vtkPoints::New();
58 aPolyData->SetPoints(aPts);
61 TVertexSet::Iterator anIter(myVertexSet);
62 for(; anIter.More(); anIter.Next()){
63 const TopoDS_Vertex& aVertex = anIter.Value();
64 OCC2VTK(aVertex,aPolyData,aPts);
70 OCC2VTK(const TopoDS_Vertex& theVertex,
71 vtkPolyData* thePolyData,
74 gp_Pnt aPnt = BRep_Tool::Pnt(theVertex);
75 vtkIdType anId = thePts->InsertNextPoint(aPnt.X(),aPnt.Y(),aPnt.Z());
76 thePolyData->InsertNextCell(VTK_VERTEX,1,&anId);