X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKExport%2FVTKExport.cxx;h=4b2f27b5cf78e9570d6dcc0004023357f2cd6e05;hb=f43bdeb895071d4bbaabb94d401da24f5973ba6e;hp=4d0f3ac7a618c3885c8e9f8740c9fe91cb90b29c;hpb=16f91b82f447624718787d47955b307588fa9fa8;p=modules%2Fgeom.git diff --git a/src/VTKExport/VTKExport.cxx b/src/VTKExport/VTKExport.cxx index 4d0f3ac7a..4b2f27b5c 100644 --- a/src/VTKExport/VTKExport.cxx +++ b/src/VTKExport/VTKExport.cxx @@ -1,23 +1,23 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2011 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File: VTKExport.cxx @@ -42,6 +42,9 @@ #include #include #include +#include +#include +#include #ifdef WIN32 # if defined VTKEXPORT_EXPORTS || defined VTKExport_EXPORTS @@ -85,12 +88,23 @@ extern "C" //myAppendFilter->AddInput( myWireframeFaceSource->GetOutput() ); // iso-lines are unnecessary myAppendFilter->AddInput( myShadingFaceSource->GetOutput() ); - float aDeflection = 1.0; - bool anIsForced = true; - bool anIsRelative = false; + float aDeflection = 0.001; bool anIsVector = false; - GEOM::MeshShape( theShape, aDeflection, anIsForced ); + // Is shape triangulated? + bool wasMeshed = true; + TopExp_Explorer ex; + TopLoc_Location aLoc; + for (ex.Init(theShape, TopAbs_FACE); ex.More(); ex.Next()) { + const TopoDS_Face& aFace = TopoDS::Face(ex.Current()); + Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); + if(aPoly.IsNull()) { + wasMeshed = false; + break; + } + } + + GEOM::MeshShape( theShape, aDeflection ); TopExp_Explorer aVertexExp( theShape, TopAbs_VERTEX ); for( ; aVertexExp.More(); aVertexExp.Next() ) @@ -99,8 +113,6 @@ extern "C" myVertexSource->AddVertex( aVertex ); } - GEOM::MeshShape2( theShape, aDeflection, anIsRelative ); - TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap; TopExp::MapShapesAndAncestors( theShape, TopAbs_EDGE, TopAbs_FACE, anEdgeMap ); @@ -133,6 +145,9 @@ extern "C" myAppendFilter->Delete(); + if(!wasMeshed) + BRepTools::Clean(theShape); + return 1; } catch(Standard_Failure)