X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOCC2VTK%2FGEOM_EdgeSource.cxx;h=df75c684f342aee14480379ef30ea3c70a6635b1;hb=ddba4567471480cd43b3f2731ede2db3e7b61bf0;hp=d7d3a41747fd0b1435b427f73e4fbb361460e204;hpb=73555c78ebf12a1fdb85157b8e7934ad566ae90a;p=modules%2Fgeom.git diff --git a/src/OCC2VTK/GEOM_EdgeSource.cxx b/src/OCC2VTK/GEOM_EdgeSource.cxx old mode 100755 new mode 100644 index d7d3a4174..df75c684f --- a/src/OCC2VTK/GEOM_EdgeSource.cxx +++ b/src/OCC2VTK/GEOM_EdgeSource.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // // 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 @@ -34,12 +34,16 @@ #include #include +#include +#include -vtkStandardNewMacro(GEOM_EdgeSource); +vtkStandardNewMacro(GEOM_EdgeSource) GEOM_EdgeSource::GEOM_EdgeSource() : - myIsVector(false) + myIsVector(false), + myIsVectorMode(false) { + this->SetNumberOfInputPorts(0); } GEOM_EdgeSource::~GEOM_EdgeSource() @@ -53,11 +57,14 @@ void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge, myIsVector = theIsVector; } -void -GEOM_EdgeSource:: -Execute() +int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request), + vtkInformationVector **vtkNotUsed(inputVector), + vtkInformationVector *outputVector) { - vtkPolyData* aPolyData = GetOutput(); + vtkInformation *outInfo = outputVector->GetInformationObject(0); + vtkPolyData *aPolyData = vtkPolyData::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); + aPolyData->Allocate(); vtkPoints* aPts = vtkPoints::New(); aPolyData->SetPoints(aPts); @@ -71,6 +78,7 @@ Execute() anEdge.Orientation( TopAbs_FORWARD ); OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode); } + return 1; } void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, @@ -119,11 +127,11 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, pt2.Transform(edgeTransf); } - float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()}; + float aCoord1[3] = {(float)pt1.X(), (float)pt1.Y(), (float)pt1.Z()}; vtkIdType anIds[2]; anIds[0] = thePts->InsertNextPoint(aCoord1); - float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()}; + float aCoord2[3] = {(float)pt2.X(), (float)pt2.Y(), (float)pt2.Z()}; anIds[1] = thePts->InsertNextPoint(aCoord2); thePolyData->InsertNextCell(VTK_LINE,2,anIds); @@ -131,17 +139,16 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, } else { Standard_Integer aNbNodes = aEdgePoly->NbNodes(); const TColStd_Array1OfInteger& aNodeIds = aEdgePoly->Nodes(); - const TColgp_Array1OfPnt& anId2Pnts = T->Nodes(); - aP1 = anId2Pnts(aNodeIds(1)); - aP2 = anId2Pnts(aNodeIds(aNbNodes)); + aP1 = T->Node(aNodeIds(1)); + aP2 = T->Node(aNodeIds(aNbNodes)); for(int j = 1; j < aNbNodes; j++) { Standard_Integer id1 = aNodeIds(j); Standard_Integer id2 = aNodeIds(j+1); - gp_Pnt pt1 = anId2Pnts(id1); - gp_Pnt pt2 = anId2Pnts(id2); + gp_Pnt pt1 = T->Node(id1); + gp_Pnt pt2 = T->Node(id2); if(!isidtrsf) { // apply edge transformation @@ -149,11 +156,11 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, pt2.Transform(edgeTransf); } - float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()}; + float aCoord1[3] = {(float)pt1.X(), (float)pt1.Y(), (float)pt1.Z()}; vtkIdType anIds[2]; anIds[0] = thePts->InsertNextPoint(aCoord1); - float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()}; + float aCoord2[3] = {(float)pt2.X(), (float)pt2.Y(), (float)pt2.Z()}; anIds[1] = thePts->InsertNextPoint(aCoord2); thePolyData->InsertNextCell(VTK_LINE,2,anIds); @@ -219,7 +226,7 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, // Add points and segments, composing the arrow Standard_Real cosinus, sinus, Tg = tan(anAngle); - float coord[3] = {xo, yo, zo}; + float coord[3] = {(float)xo, (float)yo, (float)zo}; vtkIdType ptLoc = thePts->InsertNextPoint(coord); vtkIdType ptFirst = 0;