mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-13 00:54:33 +05:00
Porting to VTK 6.
First compilable version of GEOM and SMESH modules.
This commit is contained in:
parent
32ceab19f3
commit
89a4e3c9e4
@ -119,7 +119,7 @@ GEOM_Actor::GEOM_Actor():
|
|||||||
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myPolyDataMapper->SetInput(myAppendFilter->GetOutput());
|
myPolyDataMapper->SetInputConnection(myAppendFilter->GetOutputPort());
|
||||||
vtkProperty* aProperty;
|
vtkProperty* aProperty;
|
||||||
|
|
||||||
myHighlightProp->SetAmbient(0.5);
|
myHighlightProp->SetAmbient(0.5);
|
||||||
@ -132,45 +132,45 @@ GEOM_Actor::GEOM_Actor():
|
|||||||
myHighlightProp->SetPointSize(SALOME_POINT_SIZE);
|
myHighlightProp->SetPointSize(SALOME_POINT_SIZE);
|
||||||
myHighlightActor->SetProperty(myHighlightProp.GetPointer());
|
myHighlightActor->SetProperty(myHighlightProp.GetPointer());
|
||||||
|
|
||||||
this->myHighlightActor->SetInput(myAppendFilter->GetOutput(),false);
|
this->myHighlightActor->SetInput(myAppendFilter->GetOutputPort(),false);
|
||||||
|
|
||||||
myPreHighlightProp->SetColor(0,1,1);
|
myPreHighlightProp->SetColor(0,1,1);
|
||||||
myPreHighlightProp->SetPointSize(SALOME_POINT_SIZE+2);
|
myPreHighlightProp->SetPointSize(SALOME_POINT_SIZE+2);
|
||||||
myPreHighlightProp->SetLineWidth(SALOME_LINE_WIDTH+1);
|
myPreHighlightProp->SetLineWidth(SALOME_LINE_WIDTH+1);
|
||||||
myPreHighlightProp->SetRepresentationToWireframe();
|
myPreHighlightProp->SetRepresentationToWireframe();
|
||||||
|
|
||||||
myAppendFilter->AddInput(myVertexSource->GetOutput());
|
myAppendFilter->AddInputConnection(myVertexSource->GetOutputPort());
|
||||||
myVertexActor->SetInput(myVertexSource->GetOutput(),false);
|
myVertexActor->SetInput(myVertexSource->GetOutputPort(),false);
|
||||||
aProperty = myVertexActor->GetProperty();
|
aProperty = myVertexActor->GetProperty();
|
||||||
aProperty->SetRepresentation(VTK_POINTS);
|
aProperty->SetRepresentation(VTK_POINTS);
|
||||||
aProperty->SetPointSize(3);
|
aProperty->SetPointSize(3);
|
||||||
aProperty->SetColor(1, 1, 0);
|
aProperty->SetColor(1, 1, 0);
|
||||||
|
|
||||||
myAppendFilter->AddInput(myIsolatedEdgeSource->GetOutput());
|
myAppendFilter->AddInputConnection(myIsolatedEdgeSource->GetOutputPort());
|
||||||
myIsolatedEdgeActor->SetInput(myIsolatedEdgeSource->GetOutput(),false);
|
myIsolatedEdgeActor->SetInput(myIsolatedEdgeSource->GetOutputPort(),false);
|
||||||
aProperty = myIsolatedEdgeActor->GetProperty();
|
aProperty = myIsolatedEdgeActor->GetProperty();
|
||||||
aProperty->SetRepresentation(VTK_WIREFRAME);
|
aProperty->SetRepresentation(VTK_WIREFRAME);
|
||||||
aProperty->SetColor(1, 0, 0);
|
aProperty->SetColor(1, 0, 0);
|
||||||
|
|
||||||
myAppendFilter->AddInput(myOneFaceEdgeSource->GetOutput());
|
myAppendFilter->AddInputConnection(myOneFaceEdgeSource->GetOutputPort());
|
||||||
myOneFaceEdgeActor->SetInput(myOneFaceEdgeSource->GetOutput(),false);
|
myOneFaceEdgeActor->SetInput(myOneFaceEdgeSource->GetOutputPort(),false);
|
||||||
aProperty = myOneFaceEdgeActor->GetProperty();
|
aProperty = myOneFaceEdgeActor->GetProperty();
|
||||||
aProperty->SetRepresentation(VTK_WIREFRAME);
|
aProperty->SetRepresentation(VTK_WIREFRAME);
|
||||||
aProperty->SetColor(0, 1, 0);
|
aProperty->SetColor(0, 1, 0);
|
||||||
|
|
||||||
myAppendFilter->AddInput(mySharedEdgeSource->GetOutput());
|
myAppendFilter->AddInputConnection(mySharedEdgeSource->GetOutputPort());
|
||||||
mySharedEdgeActor->SetInput(mySharedEdgeSource->GetOutput(),false);
|
mySharedEdgeActor->SetInput(mySharedEdgeSource->GetOutputPort(),false);
|
||||||
aProperty = mySharedEdgeActor->GetProperty();
|
aProperty = mySharedEdgeActor->GetProperty();
|
||||||
aProperty->SetRepresentation(VTK_WIREFRAME);
|
aProperty->SetRepresentation(VTK_WIREFRAME);
|
||||||
aProperty->SetColor(1, 1, 0);
|
aProperty->SetColor(1, 1, 0);
|
||||||
|
|
||||||
myAppendFilter->AddInput(myWireframeFaceSource->GetOutput());
|
myAppendFilter->AddInputConnection(myWireframeFaceSource->GetOutputPort());
|
||||||
myWireframeFaceActor->SetInput(myWireframeFaceSource->GetOutput(),false);
|
myWireframeFaceActor->SetInput(myWireframeFaceSource->GetOutputPort(),false);
|
||||||
aProperty = myWireframeFaceActor->GetProperty();
|
aProperty = myWireframeFaceActor->GetProperty();
|
||||||
aProperty->SetRepresentation(VTK_WIREFRAME);
|
aProperty->SetRepresentation(VTK_WIREFRAME);
|
||||||
aProperty->SetColor(0.5, 0.5, 0.5);
|
aProperty->SetColor(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
myShadingFaceActor->SetInput(myShadingFaceSource->GetOutput(),true);
|
myShadingFaceActor->SetInput(myShadingFaceSource->GetOutputPort(),true);
|
||||||
|
|
||||||
myShadingFaceProp->SetRepresentation(VTKViewer::Representation::Surface);
|
myShadingFaceProp->SetRepresentation(VTKViewer::Representation::Surface);
|
||||||
myShadingFaceProp->SetInterpolationToGouraud();
|
myShadingFaceProp->SetInterpolationToGouraud();
|
||||||
@ -218,7 +218,7 @@ New()
|
|||||||
void Write(vtkPolyData* theDataSet, const char* theFileName){
|
void Write(vtkPolyData* theDataSet, const char* theFileName){
|
||||||
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
|
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
|
||||||
MESSAGE ("Write - "<<theFileName<<"' : "<<theDataSet->GetNumberOfPoints()<<"; "<<theDataSet->GetNumberOfCells());
|
MESSAGE ("Write - "<<theFileName<<"' : "<<theDataSet->GetNumberOfPoints()<<"; "<<theDataSet->GetNumberOfCells());
|
||||||
aWriter->SetInput(theDataSet);
|
aWriter->SetInputData(theDataSet);
|
||||||
aWriter->SetFileName(theFileName);
|
aWriter->SetFileName(theFileName);
|
||||||
//aWriter->Write();
|
//aWriter->Write();
|
||||||
aWriter->Delete();
|
aWriter->Delete();
|
||||||
|
@ -38,8 +38,8 @@ GEOM_DeviceActor::GEOM_DeviceActor():
|
|||||||
myPolyDataNormals(vtkPolyDataNormals::New(),true),
|
myPolyDataNormals(vtkPolyDataNormals::New(),true),
|
||||||
myActor(VTKViewer_Actor::New(),true)
|
myActor(VTKViewer_Actor::New(),true)
|
||||||
{
|
{
|
||||||
myStripper->SetInput(myPolyDataNormals->GetOutput());
|
myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
|
||||||
myPolyDataMapper->SetInput(myStripper->GetOutput());
|
myPolyDataMapper->SetInputConnection(myStripper->GetOutputPort());
|
||||||
|
|
||||||
myActor->SetMapper(myPolyDataMapper.Get());
|
myActor->SetMapper(myPolyDataMapper.Get());
|
||||||
myActor->PickableOff();
|
myActor->PickableOff();
|
||||||
@ -51,12 +51,12 @@ GEOM_DeviceActor::~GEOM_DeviceActor()
|
|||||||
|
|
||||||
void
|
void
|
||||||
GEOM_DeviceActor::
|
GEOM_DeviceActor::
|
||||||
SetInput(vtkPolyData* thePolyData, bool theUseStripper)
|
SetInput(vtkAlgorithmOutput* thePolyData, bool theUseStripper)
|
||||||
{
|
{
|
||||||
if(theUseStripper)
|
if(theUseStripper)
|
||||||
myPolyDataNormals->SetInput(thePolyData);
|
myPolyDataNormals->SetInputConnection(thePolyData);
|
||||||
else
|
else
|
||||||
myPolyDataMapper->SetInput(thePolyData);
|
myPolyDataMapper->SetInputConnection(thePolyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -43,6 +43,7 @@ class vtkRenderer;
|
|||||||
|
|
||||||
#include <vtkObject.h>
|
#include <vtkObject.h>
|
||||||
|
|
||||||
|
class vtkAlgorithmOutput;
|
||||||
|
|
||||||
class VTK_EXPORT GEOM_DeviceActor: public vtkObject
|
class VTK_EXPORT GEOM_DeviceActor: public vtkObject
|
||||||
{
|
{
|
||||||
@ -59,7 +60,7 @@ public:
|
|||||||
void SetVisibility(int theVisibility);
|
void SetVisibility(int theVisibility);
|
||||||
int GetVisibility();
|
int GetVisibility();
|
||||||
|
|
||||||
void SetInput(vtkPolyData* thePolyData, bool theUseStripper);
|
void SetInput(vtkAlgorithmOutput* thePolyData, bool theUseStripper);
|
||||||
|
|
||||||
void AddToRender(vtkRenderer* theRenderer);
|
void AddToRender(vtkRenderer* theRenderer);
|
||||||
void RemoveFromRender(vtkRenderer* theRenderer);
|
void RemoveFromRender(vtkRenderer* theRenderer);
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include <vtkObjectFactory.h>
|
#include <vtkObjectFactory.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
|
#include <vtkInformation.h>
|
||||||
|
#include <vtkInformationVector.h>
|
||||||
|
|
||||||
// OpenCASCADE Includes
|
// OpenCASCADE Includes
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
@ -114,14 +116,18 @@ GEOM_OCCReader::~GEOM_OCCReader()
|
|||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function : Execute
|
// Function : RequestData
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
|
int GEOM_OCCReader::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
|
vtkInformationVector **inputVector,
|
||||||
|
vtkInformationVector *outputVector)
|
||||||
|
{
|
||||||
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
vtkPolyData *output = vtkPolyData::SafeDownCast(
|
||||||
|
outInfo->Get(vtkDataObject::DATA_OBJECT()));
|
||||||
|
|
||||||
void GEOM_OCCReader::Execute() {
|
|
||||||
|
|
||||||
vtkPolyData* output = this->GetOutput();
|
|
||||||
vtkPoints* Pts = NULL;
|
vtkPoints* Pts = NULL;
|
||||||
vtkCellArray* Cells = NULL;
|
vtkCellArray* Cells = NULL;
|
||||||
TopLoc_Location aLoc;
|
TopLoc_Location aLoc;
|
||||||
@ -143,7 +149,7 @@ void GEOM_OCCReader::Execute() {
|
|||||||
if(aPoly.IsNull()) {
|
if(aPoly.IsNull()) {
|
||||||
Pts->Delete();
|
Pts->Delete();
|
||||||
Cells->Delete();
|
Cells->Delete();
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nbpts = aPoly->NbNodes();
|
nbpts = aPoly->NbNodes();
|
||||||
@ -155,7 +161,7 @@ void GEOM_OCCReader::Execute() {
|
|||||||
else {
|
else {
|
||||||
Cells->Delete();
|
Cells->Delete();
|
||||||
Pts->Delete();
|
Pts->Delete();
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +183,7 @@ void GEOM_OCCReader::Execute() {
|
|||||||
}
|
}
|
||||||
Pts->Delete();
|
Pts->Delete();
|
||||||
Cells->Delete();
|
Cells->Delete();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "GEOM_OBJECT_defs.hxx"
|
#include "GEOM_OBJECT_defs.hxx"
|
||||||
|
|
||||||
#include <vtkPolyDataSource.h>
|
#include <vtkAlgorithm.h>
|
||||||
|
|
||||||
class vtkPoints;
|
class vtkPoints;
|
||||||
class vtkCellArray;
|
class vtkCellArray;
|
||||||
@ -46,7 +46,7 @@ class vtkCellArray;
|
|||||||
#include <GeomAbs_IsoType.hxx>
|
#include <GeomAbs_IsoType.hxx>
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
#include <BRepAdaptor_Surface.hxx>
|
||||||
|
|
||||||
class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource {
|
class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkAlgorithm {
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
|
||||||
@ -67,7 +67,8 @@ class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource {
|
|||||||
|
|
||||||
GEOM_OCCReader();
|
GEOM_OCCReader();
|
||||||
~GEOM_OCCReader();
|
~GEOM_OCCReader();
|
||||||
void Execute();
|
|
||||||
|
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||||
|
|
||||||
void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
|
void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
|
||||||
void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
|
void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
|
||||||
|
@ -254,11 +254,11 @@ void GEOM_VTKTrihedron::SetSize( vtkFloatingPointType theSize )
|
|||||||
aSrcZ->SetPoint2( aEndZ.X(), aEndZ.Y(), aEndZ.Z() );
|
aSrcZ->SetPoint2( aEndZ.X(), aEndZ.Y(), aEndZ.Z() );
|
||||||
|
|
||||||
vtkAppendPolyData* aRes = vtkAppendPolyData::New();
|
vtkAppendPolyData* aRes = vtkAppendPolyData::New();
|
||||||
aRes->AddInput( aSrcX->GetOutput() );
|
aRes->AddInputConnection( aSrcX->GetOutputPort() );
|
||||||
aRes->AddInput( aSrcY->GetOutput() );
|
aRes->AddInputConnection( aSrcY->GetOutputPort() );
|
||||||
aRes->AddInput( aSrcZ->GetOutput() );
|
aRes->AddInputConnection( aSrcZ->GetOutputPort() );
|
||||||
|
|
||||||
myMapper->SetInput( aRes->GetOutput() );
|
myMapper->SetInputConnection( aRes->GetOutputPort() );
|
||||||
SALOME_Actor::SetMapper( myMapper );
|
SALOME_Actor::SetMapper( myMapper );
|
||||||
|
|
||||||
aSrcX->Delete();
|
aSrcX->Delete();
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <vtkStripper.h>
|
#include <vtkStripper.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
|
#include <vtkInformation.h>
|
||||||
|
#include <vtkInformationVector.h>
|
||||||
|
|
||||||
vtkStandardNewMacro(GEOM_EdgeSource);
|
vtkStandardNewMacro(GEOM_EdgeSource);
|
||||||
|
|
||||||
@ -53,11 +55,14 @@ void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge,
|
|||||||
myIsVector = theIsVector;
|
myIsVector = theIsVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_EdgeSource::
|
vtkInformationVector **inputVector,
|
||||||
Execute()
|
vtkInformationVector *outputVector)
|
||||||
{
|
{
|
||||||
vtkPolyData* aPolyData = GetOutput();
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
vtkPolyData *aPolyData = vtkPolyData::SafeDownCast(
|
||||||
|
outInfo->Get(vtkDataObject::DATA_OBJECT()));
|
||||||
|
|
||||||
aPolyData->Allocate();
|
aPolyData->Allocate();
|
||||||
vtkPoints* aPts = vtkPoints::New();
|
vtkPoints* aPts = vtkPoints::New();
|
||||||
aPolyData->SetPoints(aPts);
|
aPolyData->SetPoints(aPts);
|
||||||
@ -71,6 +76,7 @@ Execute()
|
|||||||
anEdge.Orientation( TopAbs_FORWARD );
|
anEdge.Orientation( TopAbs_FORWARD );
|
||||||
OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode);
|
OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode);
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge,
|
void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge,
|
||||||
|
@ -28,12 +28,14 @@
|
|||||||
typedef NCollection_Set<TopoDS_Edge> TEdgeSet;
|
typedef NCollection_Set<TopoDS_Edge> TEdgeSet;
|
||||||
|
|
||||||
#include <vtkPoints.h>
|
#include <vtkPoints.h>
|
||||||
#include <vtkPolyDataSource.h>
|
#include <vtkAlgorithm.h>
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataSource
|
class vtkPolyData;
|
||||||
|
|
||||||
|
class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataSource);
|
vtkTypeMacro(GEOM_EdgeSource,vtkAlgorithm);
|
||||||
static GEOM_EdgeSource* New();
|
static GEOM_EdgeSource* New();
|
||||||
|
|
||||||
void AddEdge (const TopoDS_Edge& theEdge,
|
void AddEdge (const TopoDS_Edge& theEdge,
|
||||||
@ -59,7 +61,7 @@ protected:
|
|||||||
// representing a vector, can have only one edge.
|
// representing a vector, can have only one edge.
|
||||||
bool myIsVector, myIsVectorMode;
|
bool myIsVector, myIsVectorMode;
|
||||||
|
|
||||||
void Execute();
|
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||||
|
|
||||||
GEOM_EdgeSource();
|
GEOM_EdgeSource();
|
||||||
~GEOM_EdgeSource();
|
~GEOM_EdgeSource();
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
typedef NCollection_Set<TopoDS_Face> TFaceSet;
|
typedef NCollection_Set<TopoDS_Face> TFaceSet;
|
||||||
|
|
||||||
#include <vtkPoints.h>
|
#include <vtkPoints.h>
|
||||||
#include <vtkPolyDataSource.h>
|
#include <vtkAlgorithm.h>
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataSource
|
class vtkPolyData;
|
||||||
|
|
||||||
|
class OCC2VTK_EXPORT GEOM_FaceSource: public vtkAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vtkTypeMacro(GEOM_FaceSource,vtkPolyDataSource);
|
vtkTypeMacro(GEOM_FaceSource,vtkAlgorithm);
|
||||||
|
|
||||||
void AddFace(const TopoDS_Face& theFace);
|
void AddFace(const TopoDS_Face& theFace);
|
||||||
void Clear(){ myFaceSet.Clear();}
|
void Clear(){ myFaceSet.Clear();}
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include <vtkPolyDataMapper.h>
|
#include <vtkPolyDataMapper.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
|
#include <vtkInformation.h>
|
||||||
|
#include <vtkInformationVector.h>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
@ -41,11 +43,14 @@ GEOM_ShadingFace::~GEOM_ShadingFace()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_ShadingFace::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_ShadingFace::
|
vtkInformationVector **inputVector,
|
||||||
Execute()
|
vtkInformationVector *outputVector)
|
||||||
{
|
{
|
||||||
vtkPolyData* aPolyData = GetOutput();
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
vtkPolyData *aPolyData = vtkPolyData::SafeDownCast(
|
||||||
|
outInfo->Get(vtkDataObject::DATA_OBJECT()));
|
||||||
|
|
||||||
aPolyData->Allocate();
|
aPolyData->Allocate();
|
||||||
vtkPoints* aPts = vtkPoints::New();
|
vtkPoints* aPts = vtkPoints::New();
|
||||||
aPolyData->SetPoints(aPts);
|
aPolyData->SetPoints(aPts);
|
||||||
@ -56,6 +61,7 @@ Execute()
|
|||||||
const TopoDS_Face& aFace = anIter.Value();
|
const TopoDS_Face& aFace = anIter.Value();
|
||||||
OCC2VTK(aFace,aPolyData,aPts);
|
OCC2VTK(aFace,aPolyData,aPts);
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
vtkPoints* thePts);
|
vtkPoints* thePts);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Execute();
|
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||||
|
|
||||||
GEOM_ShadingFace();
|
GEOM_ShadingFace();
|
||||||
~GEOM_ShadingFace();
|
~GEOM_ShadingFace();
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <vtkCellArray.h>
|
#include <vtkCellArray.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
#include <vtkPolyDataMapper.h>
|
#include <vtkPolyDataMapper.h>
|
||||||
|
#include <vtkInformation.h>
|
||||||
|
#include <vtkInformationVector.h>
|
||||||
|
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
@ -46,11 +48,14 @@ AddVertex(const TopoDS_Vertex& theVertex)
|
|||||||
myVertexSet.Add(theVertex);
|
myVertexSet.Add(theVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_VertexSource::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_VertexSource::
|
vtkInformationVector **inputVector,
|
||||||
Execute()
|
vtkInformationVector *outputVector)
|
||||||
{
|
{
|
||||||
vtkPolyData* aPolyData = GetOutput();
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
vtkPolyData *aPolyData = vtkPolyData::SafeDownCast(
|
||||||
|
outInfo->Get(vtkDataObject::DATA_OBJECT()));
|
||||||
|
|
||||||
aPolyData->Allocate();
|
aPolyData->Allocate();
|
||||||
vtkPoints* aPts = vtkPoints::New();
|
vtkPoints* aPts = vtkPoints::New();
|
||||||
aPolyData->SetPoints(aPts);
|
aPolyData->SetPoints(aPts);
|
||||||
@ -61,6 +66,7 @@ Execute()
|
|||||||
const TopoDS_Vertex& aVertex = anIter.Value();
|
const TopoDS_Vertex& aVertex = anIter.Value();
|
||||||
OCC2VTK(aVertex,aPolyData,aPts);
|
OCC2VTK(aVertex,aPolyData,aPts);
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -28,12 +28,14 @@
|
|||||||
typedef NCollection_Set<TopoDS_Vertex> TVertexSet;
|
typedef NCollection_Set<TopoDS_Vertex> TVertexSet;
|
||||||
|
|
||||||
#include <vtkPoints.h>
|
#include <vtkPoints.h>
|
||||||
#include <vtkPolyDataSource.h>
|
#include <vtkAlgorithm.h>
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataSource
|
class vtkPolyData;
|
||||||
|
|
||||||
|
class OCC2VTK_EXPORT GEOM_VertexSource: public vtkAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vtkTypeMacro(GEOM_VertexSource,vtkPolyDataSource);
|
vtkTypeMacro(GEOM_VertexSource,vtkAlgorithm);
|
||||||
static GEOM_VertexSource* New();
|
static GEOM_VertexSource* New();
|
||||||
|
|
||||||
void AddVertex(const TopoDS_Vertex& theVertex);
|
void AddVertex(const TopoDS_Vertex& theVertex);
|
||||||
@ -47,7 +49,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
TVertexSet myVertexSet;
|
TVertexSet myVertexSet;
|
||||||
|
|
||||||
void Execute();
|
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||||
|
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||||
|
|
||||||
GEOM_VertexSource();
|
GEOM_VertexSource();
|
||||||
~GEOM_VertexSource();
|
~GEOM_VertexSource();
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include <vtkPolyDataMapper.h>
|
#include <vtkPolyDataMapper.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
|
#include <vtkInformation.h>
|
||||||
|
#include <vtkInformationVector.h>
|
||||||
|
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
@ -61,11 +63,14 @@ GEOM_WireframeFace::~GEOM_WireframeFace()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_WireframeFace::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_WireframeFace::
|
vtkInformationVector **inputVector,
|
||||||
Execute()
|
vtkInformationVector *outputVector)
|
||||||
{
|
{
|
||||||
vtkPolyData* aPolyData = GetOutput();
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
vtkPolyData *aPolyData = vtkPolyData::SafeDownCast(
|
||||||
|
outInfo->Get(vtkDataObject::DATA_OBJECT()));
|
||||||
|
|
||||||
aPolyData->Allocate();
|
aPolyData->Allocate();
|
||||||
vtkPoints* aPts = vtkPoints::New();
|
vtkPoints* aPts = vtkPoints::New();
|
||||||
aPolyData->SetPoints(aPts);
|
aPolyData->SetPoints(aPts);
|
||||||
@ -76,6 +81,7 @@ Execute()
|
|||||||
const TopoDS_Face& aFace = anIter.Value();
|
const TopoDS_Face& aFace = anIter.Value();
|
||||||
OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret);
|
OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret);
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_WireframeFace::SetNbIso(const int theNb[2])
|
void GEOM_WireframeFace::SetNbIso(const int theNb[2])
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <GeomAbs_IsoType.hxx>
|
#include <GeomAbs_IsoType.hxx>
|
||||||
#include <BRepAdaptor_Surface.hxx>
|
#include <BRepAdaptor_Surface.hxx>
|
||||||
|
|
||||||
#include <vtkPolyDataSource.h>
|
class vtkPolyData;
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_WireframeFace: public GEOM_FaceSource
|
class OCC2VTK_EXPORT GEOM_WireframeFace: public GEOM_FaceSource
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ protected:
|
|||||||
vtkPolyData* thePolyData,
|
vtkPolyData* thePolyData,
|
||||||
vtkPoints* thePts);
|
vtkPoints* thePts);
|
||||||
|
|
||||||
void Execute();
|
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||||
|
|
||||||
GEOM_WireframeFace();
|
GEOM_WireframeFace();
|
||||||
~GEOM_WireframeFace();
|
~GEOM_WireframeFace();
|
||||||
|
@ -81,12 +81,12 @@ extern "C"
|
|||||||
GEOM_ShadingFace* myShadingFaceSource = GEOM_ShadingFace::New();
|
GEOM_ShadingFace* myShadingFaceSource = GEOM_ShadingFace::New();
|
||||||
|
|
||||||
vtkAppendPolyData* myAppendFilter = vtkAppendPolyData::New();
|
vtkAppendPolyData* myAppendFilter = vtkAppendPolyData::New();
|
||||||
myAppendFilter->AddInput( myVertexSource->GetOutput() );
|
myAppendFilter->AddInputConnection( myVertexSource->GetOutputPort() );
|
||||||
myAppendFilter->AddInput( myIsolatedEdgeSource->GetOutput() );
|
myAppendFilter->AddInputConnection( myIsolatedEdgeSource->GetOutputPort() );
|
||||||
myAppendFilter->AddInput( myOneFaceEdgeSource->GetOutput() );
|
myAppendFilter->AddInputConnection( myOneFaceEdgeSource->GetOutputPort() );
|
||||||
myAppendFilter->AddInput( mySharedEdgeSource->GetOutput() );
|
myAppendFilter->AddInputConnection( mySharedEdgeSource->GetOutputPort() );
|
||||||
//myAppendFilter->AddInput( myWireframeFaceSource->GetOutput() ); // iso-lines are unnecessary
|
//myAppendFilter->AddInputConnection( myWireframeFaceSource->GetOutputPort() ); // iso-lines are unnecessary
|
||||||
myAppendFilter->AddInput( myShadingFaceSource->GetOutput() );
|
myAppendFilter->AddInputConnection( myShadingFaceSource->GetOutputPort() );
|
||||||
|
|
||||||
float aDeflection = 0.001;
|
float aDeflection = 0.001;
|
||||||
bool anIsVector = false;
|
bool anIsVector = false;
|
||||||
@ -131,7 +131,7 @@ extern "C"
|
|||||||
Kernel_Utils::Localizer loc;
|
Kernel_Utils::Localizer loc;
|
||||||
|
|
||||||
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
|
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
|
||||||
aWriter->SetInput( myAppendFilter->GetOutput() );
|
aWriter->SetInputConnection( myAppendFilter->GetOutputPort() );
|
||||||
aWriter->SetFileName( theFileName.ToCString() );
|
aWriter->SetFileName( theFileName.ToCString() );
|
||||||
aWriter->Write();
|
aWriter->Write();
|
||||||
aWriter->Delete();
|
aWriter->Delete();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user