mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 10:10:34 +05:00
Remove unnecessary dependency on VTK from GEOM engine
This commit is contained in:
parent
c818e008d4
commit
478182de8e
@ -30,7 +30,6 @@ INCLUDE_DIRECTORIES(
|
|||||||
${PROJECT_SOURCE_DIR}/src/BlockFix
|
${PROJECT_SOURCE_DIR}/src/BlockFix
|
||||||
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
|
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
|
||||||
${PROJECT_SOURCE_DIR}/src/GEOMUtils
|
${PROJECT_SOURCE_DIR}/src/GEOMUtils
|
||||||
${PROJECT_SOURCE_DIR}/src/OCC2VTK
|
|
||||||
${PROJECT_SOURCE_DIR}/src/SKETCHER
|
${PROJECT_SOURCE_DIR}/src/SKETCHER
|
||||||
${PROJECT_SOURCE_DIR}/src/ARCHIMEDE
|
${PROJECT_SOURCE_DIR}/src/ARCHIMEDE
|
||||||
${PROJECT_SOURCE_DIR}/src/XAO
|
${PROJECT_SOURCE_DIR}/src/XAO
|
||||||
@ -49,7 +48,7 @@ SET(_link_LIBRARIES
|
|||||||
${CAS_TKFeat}
|
${CAS_TKFeat}
|
||||||
${CAS_TKFillet}
|
${CAS_TKFillet}
|
||||||
${PYTHON_LIBRARIES}
|
${PYTHON_LIBRARIES}
|
||||||
ShHealOper GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede XAO OCC2VTK
|
ShHealOper GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede XAO
|
||||||
${KERNEL_SALOMELocalTrace}
|
${KERNEL_SALOMELocalTrace}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <GEOMAlgo_AlgoTools.hxx>
|
#include <GEOMAlgo_AlgoTools.hxx>
|
||||||
#include <GEOMAlgo_KindOfName.hxx>
|
#include <GEOMAlgo_KindOfName.hxx>
|
||||||
#include <GEOMAlgo_ShapeInfoFiller.hxx>
|
#include <GEOMAlgo_ShapeInfoFiller.hxx>
|
||||||
#include <OCC2VTK_Tools.h>
|
|
||||||
|
|
||||||
#include <GEOM_PythonDump.hxx>
|
#include <GEOM_PythonDump.hxx>
|
||||||
|
|
||||||
@ -1628,9 +1627,8 @@ bool GEOMImpl_IMeasureOperations::FastIntersect (Handle(GEOM_Object) theShape1,
|
|||||||
GEOMAlgo_AlgoTools::CopyShape(aShape1, aScopy1);
|
GEOMAlgo_AlgoTools::CopyShape(aShape1, aScopy1);
|
||||||
GEOMAlgo_AlgoTools::CopyShape(aShape2, aScopy2);
|
GEOMAlgo_AlgoTools::CopyShape(aShape2, aScopy2);
|
||||||
|
|
||||||
float aDeflection = (theDeflection <= 0.) ? 0.001 : theDeflection;
|
GEOMUtils::MeshShape(aScopy1, theDeflection);
|
||||||
GEOM::MeshShape(aScopy1, aDeflection);
|
GEOMUtils::MeshShape(aScopy2, theDeflection);
|
||||||
GEOM::MeshShape(aScopy2, aDeflection);
|
|
||||||
//
|
//
|
||||||
// Map sub-shapes and their indices
|
// Map sub-shapes and their indices
|
||||||
TopTools_IndexedMapOfShape anIndices1, anIndices2;
|
TopTools_IndexedMapOfShape anIndices1, anIndices2;
|
||||||
|
@ -99,6 +99,9 @@
|
|||||||
#include <Standard_NullObject.hxx>
|
#include <Standard_NullObject.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||||
|
|
||||||
|
#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y))
|
||||||
|
#define MAX3(X, Y, Z) (MAX2(MAX2(X,Y), Z))
|
||||||
|
|
||||||
#define STD_SORT_ALGO 1
|
#define STD_SORT_ALGO 1
|
||||||
|
|
||||||
// When the following macro is defined, ShapeFix_ShapeTolerance function is used to set max tolerance of curve
|
// When the following macro is defined, ShapeFix_ShapeTolerance function is used to set max tolerance of curve
|
||||||
@ -1193,3 +1196,43 @@ TopoDS_Shape GEOMUtils::ReduceCompound( const TopoDS_Shape& shape )
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GEOMUtils::MeshShape( const TopoDS_Shape shape,
|
||||||
|
double deflection, bool theForced )
|
||||||
|
{
|
||||||
|
Standard_Real aDeflection = ( deflection <= 0 ) ? DefaultDeflection() : deflection;
|
||||||
|
|
||||||
|
// Is shape triangulated?
|
||||||
|
Standard_Boolean alreadyMeshed = true;
|
||||||
|
TopExp_Explorer ex;
|
||||||
|
TopLoc_Location aLoc;
|
||||||
|
for ( ex.Init( shape, TopAbs_FACE ); ex.More() && alreadyMeshed; ex.Next() ) {
|
||||||
|
const TopoDS_Face& aFace = TopoDS::Face( ex.Current() );
|
||||||
|
Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation( aFace, aLoc );
|
||||||
|
alreadyMeshed = !aPoly.IsNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !alreadyMeshed || theForced ) {
|
||||||
|
// Compute bounding box
|
||||||
|
Bnd_Box B;
|
||||||
|
BRepBndLib::Add( shape, B );
|
||||||
|
if ( B.IsVoid() )
|
||||||
|
return; // NPAL15983 (Bug when displaying empty groups)
|
||||||
|
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||||
|
B.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
|
||||||
|
|
||||||
|
// This magic line comes from Prs3d_ShadedShape.gxx in OCCT
|
||||||
|
aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4;
|
||||||
|
|
||||||
|
// Clean triangulation before compute incremental mesh
|
||||||
|
BRepTools::Clean( shape );
|
||||||
|
|
||||||
|
// Compute triangulation
|
||||||
|
BRepMesh_IncrementalMesh mesh( shape, aDeflection );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double GEOMUtils::DefaultDeflection()
|
||||||
|
{
|
||||||
|
return 0.001;
|
||||||
|
}
|
||||||
|
@ -312,6 +312,22 @@ namespace GEOMUtils
|
|||||||
* \retval TopoDS_Shape resulting shape
|
* \retval TopoDS_Shape resulting shape
|
||||||
*/
|
*/
|
||||||
Standard_EXPORT TopoDS_Shape ReduceCompound( const TopoDS_Shape& shape );
|
Standard_EXPORT TopoDS_Shape ReduceCompound( const TopoDS_Shape& shape );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Generate triangulation for the shape.
|
||||||
|
*
|
||||||
|
* \param shape shape being meshed
|
||||||
|
* \param deflection deflection coefficient to be used
|
||||||
|
* \param forced if \c true, causes generation of mesh regardless it is already present in the shape
|
||||||
|
*/
|
||||||
|
Standard_EXPORT void MeshShape( const TopoDS_Shape shape,
|
||||||
|
double deflection, bool forced = true );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Get default deflection coefficient used for triangulation
|
||||||
|
* \return default deflection value
|
||||||
|
*/
|
||||||
|
Standard_EXPORT double DefaultDeflection();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "GEOM_WireframeFace.h"
|
#include "GEOM_WireframeFace.h"
|
||||||
#include "GEOM_ShadingFace.h"
|
#include "GEOM_ShadingFace.h"
|
||||||
#include "GEOM_PainterPolyDataMapper.h"
|
#include "GEOM_PainterPolyDataMapper.h"
|
||||||
|
#include "GEOMUtils.hxx"
|
||||||
#include "SVTK_Actor.h"
|
#include "SVTK_Actor.h"
|
||||||
|
|
||||||
#include <OCC2VTK_Tools.h>
|
#include <OCC2VTK_Tools.h>
|
||||||
@ -430,20 +431,19 @@ GEOM_Actor
|
|||||||
|
|
||||||
void
|
void
|
||||||
GEOM_Actor::
|
GEOM_Actor::
|
||||||
SetDeflection(float theDeflection)
|
SetDeflection(double theDeflection)
|
||||||
{
|
{
|
||||||
if( myDeflection == theDeflection )
|
double aDeflection = ( theDeflection <= 0 ) ? GEOMUtils::DefaultDeflection() : theDeflection;
|
||||||
return;
|
|
||||||
|
|
||||||
myDeflection = theDeflection;
|
|
||||||
|
|
||||||
GEOM::MeshShape(myShape,myDeflection);
|
|
||||||
|
|
||||||
|
if ( myDeflection != aDeflection ) {
|
||||||
|
myDeflection = aDeflection;
|
||||||
|
GEOMUtils::MeshShape( myShape, myDeflection );
|
||||||
SetModified();
|
SetModified();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
||||||
float theDeflection,
|
double theDeflection,
|
||||||
bool theIsVector)
|
bool theIsVector)
|
||||||
{
|
{
|
||||||
myShape = theShape;
|
myShape = theShape;
|
||||||
@ -469,7 +469,7 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
|||||||
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
|
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
|
||||||
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
|
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
|
||||||
|
|
||||||
GEOM::SetShape(theShape,anEdgeMap,theIsVector,
|
GEOM::ShapeToVTK(theShape,anEdgeMap,theIsVector,
|
||||||
myStandaloneVertexSource.Get(),
|
myStandaloneVertexSource.Get(),
|
||||||
myIsolatedEdgeSource.Get(),
|
myIsolatedEdgeSource.Get(),
|
||||||
myOneFaceEdgeSource.Get(),
|
myOneFaceEdgeSource.Get(),
|
||||||
@ -494,15 +494,6 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
|||||||
myAppendFilter->Update();
|
myAppendFilter->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// OLD METHODS
|
|
||||||
void GEOM_Actor::setDeflection(double adef) {
|
|
||||||
#ifdef MYDEBUG
|
|
||||||
MESSAGE ( "GEOM_Actor::setDeflection" );
|
|
||||||
#endif
|
|
||||||
SetDeflection((float)adef);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// warning! must be checked!
|
// warning! must be checked!
|
||||||
// SetHighlightProperty
|
// SetHighlightProperty
|
||||||
// SetWireframeProperty
|
// SetWireframeProperty
|
||||||
@ -689,15 +680,6 @@ void GEOM_Actor::setInputShape(const TopoDS_Shape& ashape, double adef1,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
double GEOM_Actor::getDeflection()
|
|
||||||
{
|
|
||||||
#ifdef MYDEBUG
|
|
||||||
MESSAGE ( "GEOM_Actor::getDeflection" );
|
|
||||||
#endif
|
|
||||||
return (double) GetDeflection();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double GEOM_Actor::isVector()
|
double GEOM_Actor::isVector()
|
||||||
{
|
{
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
|
@ -62,11 +62,11 @@ public:
|
|||||||
static GEOM_Actor* New();
|
static GEOM_Actor* New();
|
||||||
|
|
||||||
void SetShape(const TopoDS_Shape& theShape,
|
void SetShape(const TopoDS_Shape& theShape,
|
||||||
float theDeflection,
|
double theDeflection,
|
||||||
bool theIsVector = false);
|
bool theIsVector = false);
|
||||||
|
|
||||||
void SetDeflection(float theDeflection);
|
void SetDeflection(double theDeflection);
|
||||||
float GetDeflection() const{ return myDeflection;}
|
double GetDeflection() const{ return myDeflection;}
|
||||||
|
|
||||||
void AddToRender(vtkRenderer* theRenderer);
|
void AddToRender(vtkRenderer* theRenderer);
|
||||||
void RemoveFromRender(vtkRenderer* theRenderer);
|
void RemoveFromRender(vtkRenderer* theRenderer);
|
||||||
@ -93,7 +93,6 @@ public:
|
|||||||
vtkProperty* GetSharedEdgeProperty();
|
vtkProperty* GetSharedEdgeProperty();
|
||||||
vtkProperty* GetFaceEdgeProperty();
|
vtkProperty* GetFaceEdgeProperty();
|
||||||
|
|
||||||
void setDeflection(double adef);
|
|
||||||
virtual void setDisplayMode(int thenewmode);
|
virtual void setDisplayMode(int thenewmode);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
@ -108,7 +107,6 @@ public:
|
|||||||
const TopoDS_Shape& getTopo();
|
const TopoDS_Shape& getTopo();
|
||||||
void setInputShape(const TopoDS_Shape& ashape, double adef1,
|
void setInputShape(const TopoDS_Shape& ashape, double adef1,
|
||||||
int imode, bool isVector = false);
|
int imode, bool isVector = false);
|
||||||
double getDeflection();
|
|
||||||
double isVector();
|
double isVector();
|
||||||
|
|
||||||
// SubShape
|
// SubShape
|
||||||
@ -224,7 +222,7 @@ private:
|
|||||||
TopoDS_Shape myShape;
|
TopoDS_Shape myShape;
|
||||||
bool isOnlyVertex;
|
bool isOnlyVertex;
|
||||||
|
|
||||||
float myDeflection;
|
double myDeflection;
|
||||||
bool myIsForced;
|
bool myIsForced;
|
||||||
|
|
||||||
// EDisplayMode myDisplayMode;
|
// EDisplayMode myDisplayMode;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "GEOM_EdgeSource.h"
|
#include "GEOM_EdgeSource.h"
|
||||||
#include "GEOM_WireframeFace.h"
|
#include "GEOM_WireframeFace.h"
|
||||||
#include "GEOM_ShadingFace.h"
|
#include "GEOM_ShadingFace.h"
|
||||||
|
#include "GEOMUtils.hxx"
|
||||||
|
|
||||||
#include <Bnd_Box.hxx>
|
#include <Bnd_Box.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
@ -41,57 +42,9 @@
|
|||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
#include <BRepBuilderAPI_Copy.hxx>
|
#include <BRepBuilderAPI_Copy.hxx>
|
||||||
|
|
||||||
#define MAX2(X, Y) (Abs(X) > Abs(Y) ? Abs(X) : Abs(Y))
|
|
||||||
#define MAX3(X, Y, Z) (MAX2(MAX2(X,Y), Z))
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_DEFLECTION 0.001
|
|
||||||
|
|
||||||
namespace GEOM
|
namespace GEOM
|
||||||
{
|
{
|
||||||
void MeshShape(const TopoDS_Shape theShape,
|
void ShapeToVTK( const TopoDS_Shape& theShape,
|
||||||
float& theDeflection,
|
|
||||||
bool theForced ) {
|
|
||||||
|
|
||||||
Standard_Real aDeflection = theDeflection <= 0 ? DEFAULT_DEFLECTION : theDeflection;
|
|
||||||
|
|
||||||
//If deflection <= 0, than return default deflection
|
|
||||||
if(theDeflection <= 0)
|
|
||||||
theDeflection = aDeflection;
|
|
||||||
|
|
||||||
// Is shape triangulated?
|
|
||||||
Standard_Boolean alreadymeshed = Standard_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()) {
|
|
||||||
alreadymeshed = Standard_False;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!alreadymeshed || theForced) {
|
|
||||||
Bnd_Box B;
|
|
||||||
BRepBndLib::Add(theShape, B);
|
|
||||||
if ( B.IsVoid() )
|
|
||||||
return; // NPAL15983 (Bug when displaying empty groups)
|
|
||||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
|
||||||
B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
|
||||||
|
|
||||||
// This magic line comes from Prs3d_ShadedShape.gxx in OCCT
|
|
||||||
aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4;
|
|
||||||
|
|
||||||
//Clean triangulation before compute incremental mesh
|
|
||||||
BRepTools::Clean(theShape);
|
|
||||||
|
|
||||||
//Compute triangulation
|
|
||||||
BRepMesh_IncrementalMesh MESH(theShape,aDeflection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetShape(const TopoDS_Shape& theShape,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
|
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
|
||||||
bool theIsVector,
|
bool theIsVector,
|
||||||
GEOM_VertexSource* theStandaloneVertexSource,
|
GEOM_VertexSource* theStandaloneVertexSource,
|
||||||
@ -104,7 +57,7 @@ namespace GEOM
|
|||||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
||||||
TopoDS_Iterator anItr(theShape);
|
TopoDS_Iterator anItr(theShape);
|
||||||
for (; anItr.More(); anItr.Next()) {
|
for (; anItr.More(); anItr.Next()) {
|
||||||
SetShape(anItr.Value(),theEdgeMap,theIsVector,
|
ShapeToVTK( anItr.Value(),theEdgeMap,theIsVector,
|
||||||
theStandaloneVertexSource,
|
theStandaloneVertexSource,
|
||||||
theIsolatedEdgeSource,
|
theIsolatedEdgeSource,
|
||||||
theOneFaceEdgeSource,
|
theOneFaceEdgeSource,
|
||||||
@ -166,11 +119,12 @@ namespace GEOM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkPolyData* GetData(const TopoDS_Shape& theShape, float theDeflection) {
|
vtkPolyData* GetVTKData( const TopoDS_Shape& theShape, float theDeflection )
|
||||||
|
{
|
||||||
|
vtkPolyData* ret = 0;
|
||||||
|
|
||||||
BRepBuilderAPI_Copy aCopy(theShape);
|
BRepBuilderAPI_Copy aCopy(theShape);
|
||||||
if(!aCopy.IsDone()) {
|
if (aCopy.IsDone() ) {
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
TopoDS_Shape aShape = aCopy.Shape();
|
TopoDS_Shape aShape = aCopy.Shape();
|
||||||
|
|
||||||
@ -191,7 +145,7 @@ namespace GEOM
|
|||||||
|
|
||||||
bool anIsVector = false;
|
bool anIsVector = false;
|
||||||
|
|
||||||
GEOM::MeshShape( aShape, theDeflection );
|
GEOMUtils::MeshShape( aShape, theDeflection );
|
||||||
TopExp_Explorer aVertexExp( aShape, TopAbs_VERTEX );
|
TopExp_Explorer aVertexExp( aShape, TopAbs_VERTEX );
|
||||||
for( ; aVertexExp.More(); aVertexExp.Next() ) {
|
for( ; aVertexExp.More(); aVertexExp.Next() ) {
|
||||||
const TopoDS_Vertex& aVertex = TopoDS::Vertex( aVertexExp.Current() );
|
const TopoDS_Vertex& aVertex = TopoDS::Vertex( aVertexExp.Current() );
|
||||||
@ -201,7 +155,7 @@ namespace GEOM
|
|||||||
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
|
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
|
||||||
TopExp::MapShapesAndAncestors( aShape, TopAbs_EDGE, TopAbs_FACE, anEdgeMap );
|
TopExp::MapShapesAndAncestors( aShape, TopAbs_EDGE, TopAbs_FACE, anEdgeMap );
|
||||||
|
|
||||||
GEOM::SetShape( aShape,
|
ShapeToVTK( aShape,
|
||||||
anEdgeMap,
|
anEdgeMap,
|
||||||
anIsVector,
|
anIsVector,
|
||||||
0,
|
0,
|
||||||
@ -220,13 +174,13 @@ namespace GEOM
|
|||||||
myWireframeFaceSource->Delete();
|
myWireframeFaceSource->Delete();
|
||||||
myShadingFaceSource->Delete();
|
myShadingFaceSource->Delete();
|
||||||
|
|
||||||
vtkPolyData* ret = vtkPolyData::New();
|
ret = vtkPolyData::New();
|
||||||
ret->ShallowCopy(myAppendFilter->GetOutput());
|
ret->ShallowCopy(myAppendFilter->GetOutput());
|
||||||
myAppendFilter->Delete();
|
myAppendFilter->Delete();
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
catch(Standard_Failure) {
|
catch(Standard_Failure) {
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,23 @@ class GEOM_EdgeSource;
|
|||||||
class GEOM_WireframeFace;
|
class GEOM_WireframeFace;
|
||||||
class GEOM_ShadingFace;
|
class GEOM_ShadingFace;
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
|
|
||||||
namespace GEOM
|
namespace GEOM
|
||||||
{
|
{
|
||||||
// moved from GEOM_AssemblyBuilder
|
/*!
|
||||||
OCC2VTK_EXPORT void MeshShape(const TopoDS_Shape theShape,
|
* \brief Convert shape to the VTK data sources
|
||||||
float& theDeflection,
|
* \param theShape shape
|
||||||
bool theForced = true);
|
* \param theEdgeMape map that stores face-to-edge relations
|
||||||
|
* \param theIsVector boolen flag, when \c true causes generating additional
|
||||||
// moved from GEOM_Actor
|
* dataset for edges orientation vectors
|
||||||
OCC2VTK_EXPORT void SetShape(const TopoDS_Shape& theShape,
|
* \param theStandaloneVertexSource output standalone vertices data source
|
||||||
|
* \param theIsolatedEdgeSource output standalone edges data source
|
||||||
|
* \param theOneFaceEdgeSource output face edges data source
|
||||||
|
* \param theSharedEdgeSource output face shared edges data source
|
||||||
|
* \param theWireframeFaceSource output wireframe mode faces data source
|
||||||
|
* \param theShadingFaceSource output shading mode faces data source
|
||||||
|
*/
|
||||||
|
OCC2VTK_EXPORT void ShapeToVTK( const TopoDS_Shape& theShape,
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
|
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
|
||||||
bool theIsVector,
|
bool theIsVector,
|
||||||
GEOM_VertexSource* theStandaloneVertexSource,
|
GEOM_VertexSource* theStandaloneVertexSource,
|
||||||
@ -48,7 +56,13 @@ namespace GEOM
|
|||||||
GEOM_WireframeFace* theWireframeFaceSource,
|
GEOM_WireframeFace* theWireframeFaceSource,
|
||||||
GEOM_ShadingFace* theShadingFaceSource );
|
GEOM_ShadingFace* theShadingFaceSource );
|
||||||
|
|
||||||
OCC2VTK_EXPORT vtkPolyData* GetData(const TopoDS_Shape& theShape, float theDeflection);
|
/*!
|
||||||
|
* \brief Get VTK mesh data from the shape
|
||||||
|
* \param theShape shape
|
||||||
|
* \param theDeflection requested deflection coefficient
|
||||||
|
* \return VTK data set
|
||||||
|
*/
|
||||||
|
OCC2VTK_EXPORT vtkPolyData* GetVTKData( const TopoDS_Shape& theShape, float theDeflection );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OCC2VTK_TOOLS_H
|
#endif // OCC2VTK_TOOLS_H
|
||||||
|
@ -94,7 +94,7 @@ Standard_Integer VTKPlugin_ExportDriver::Execute( TFunction_Logbook& log ) const
|
|||||||
// Set "C" numeric locale to save numbers correctly
|
// Set "C" numeric locale to save numbers correctly
|
||||||
Kernel_Utils::Localizer loc;
|
Kernel_Utils::Localizer loc;
|
||||||
|
|
||||||
vtkPolyData* pd = GEOM::GetData( aShape, aDeflection );
|
vtkPolyData* pd = GEOM::GetVTKData( aShape, aDeflection );
|
||||||
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
|
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
|
||||||
aWriter->SetInputData( pd );
|
aWriter->SetInputData( pd );
|
||||||
aWriter->SetFileName( aFileName.ToCString() );
|
aWriter->SetFileName( aFileName.ToCString() );
|
||||||
|
Loading…
Reference in New Issue
Block a user