mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-12 00:29:18 +05:00
Merge from BR_PORTING_VTK6 01/03/2013
This commit is contained in:
parent
2488be88d9
commit
cb06d0db39
@ -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,48 +132,48 @@ 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);
|
||||||
myIsolatedEdgeColor[0] = 1; myIsolatedEdgeColor[1] = 0; myIsolatedEdgeColor[2] = 0;
|
myIsolatedEdgeColor[0] = 1; myIsolatedEdgeColor[1] = 0; myIsolatedEdgeColor[2] = 0;
|
||||||
aProperty->SetColor(myIsolatedEdgeColor[0], myIsolatedEdgeColor[1], myIsolatedEdgeColor[2]);
|
aProperty->SetColor(myIsolatedEdgeColor[0], myIsolatedEdgeColor[1], myIsolatedEdgeColor[2]);
|
||||||
|
|
||||||
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);
|
||||||
myOneFaceEdgeColor[0] = 0; myOneFaceEdgeColor[1] = 1; myOneFaceEdgeColor[2] = 0;
|
myOneFaceEdgeColor[0] = 0; myOneFaceEdgeColor[1] = 1; myOneFaceEdgeColor[2] = 0;
|
||||||
aProperty->SetColor(myOneFaceEdgeColor[0], myOneFaceEdgeColor[1], myOneFaceEdgeColor[2]);
|
aProperty->SetColor(myOneFaceEdgeColor[0], myOneFaceEdgeColor[1], myOneFaceEdgeColor[2]);
|
||||||
|
|
||||||
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);
|
||||||
mySharedEdgeColor[0] = 1; mySharedEdgeColor[1] = 1; mySharedEdgeColor[2] = 0;
|
mySharedEdgeColor[0] = 1; mySharedEdgeColor[1] = 1; mySharedEdgeColor[2] = 0;
|
||||||
aProperty->SetColor(mySharedEdgeColor[0], mySharedEdgeColor[1], mySharedEdgeColor[2]);
|
aProperty->SetColor(mySharedEdgeColor[0], mySharedEdgeColor[1], mySharedEdgeColor[2]);
|
||||||
|
|
||||||
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();
|
||||||
@ -219,7 +219,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();
|
||||||
@ -601,10 +601,10 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
|
|||||||
/* if(myShape.ShapeType() == TopAbs_VERTEX) {
|
/* if(myShape.ShapeType() == TopAbs_VERTEX) {
|
||||||
if(ren){
|
if(ren){
|
||||||
//The parameter determine size of vertex actor relate to diagonal of RendererWindow
|
//The parameter determine size of vertex actor relate to diagonal of RendererWindow
|
||||||
static vtkFloatingPointType delta = 0.01;
|
static double delta = 0.01;
|
||||||
vtkFloatingPointType X1 = -1, Y1 = -1, Z1 = 0;
|
double X1 = -1, Y1 = -1, Z1 = 0;
|
||||||
ren->ViewToWorld(X1,Y1,Z1);
|
ren->ViewToWorld(X1,Y1,Z1);
|
||||||
vtkFloatingPointType X2 = +1, Y2 = +1, Z2 = 0;
|
double X2 = +1, Y2 = +1, Z2 = 0;
|
||||||
ren->ViewToWorld(X2,Y2,Z2);
|
ren->ViewToWorld(X2,Y2,Z2);
|
||||||
Z2 = sqrt((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1) + (Z2-Z1)*(Z2-Z1));
|
Z2 = sqrt((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1) + (Z2-Z1)*(Z2-Z1));
|
||||||
this->SetScale(Z2*delta);
|
this->SetScale(Z2*delta);
|
||||||
@ -696,7 +696,7 @@ void GEOM_Actor::highlight(bool highlight)
|
|||||||
SALOME_Actor::highlight(highlight);
|
SALOME_Actor::highlight(highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
|
void GEOM_Actor::SetOpacity(double opa)
|
||||||
{
|
{
|
||||||
// enk:tested OK
|
// enk:tested OK
|
||||||
myShadingFaceProp->SetOpacity(opa);
|
myShadingFaceProp->SetOpacity(opa);
|
||||||
@ -706,13 +706,13 @@ void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
|
|||||||
myVertexActor->GetProperty()->SetOpacity(opa);
|
myVertexActor->GetProperty()->SetOpacity(opa);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkFloatingPointType GEOM_Actor::GetOpacity()
|
double GEOM_Actor::GetOpacity()
|
||||||
{
|
{
|
||||||
// enk:tested OK
|
// enk:tested OK
|
||||||
return myShadingFaceProp->GetOpacity();
|
return myShadingFaceProp->GetOpacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
|
void GEOM_Actor::SetColor(double r,double g,double b)
|
||||||
{
|
{
|
||||||
// set the same color to all sub-actors:
|
// set the same color to all sub-actors:
|
||||||
// - points
|
// - points
|
||||||
@ -728,9 +728,9 @@ void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloat
|
|||||||
myShadingBackFaceProp->SetColor(r,g,b); // back face shading color
|
myShadingBackFaceProp->SetColor(r,g,b); // back face shading color
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
|
void GEOM_Actor::GetColor(double& r,double& g,double& b)
|
||||||
{
|
{
|
||||||
vtkFloatingPointType aRGB[3];
|
double aRGB[3];
|
||||||
myShadingFaceProp->GetColor(aRGB);
|
myShadingFaceProp->GetColor(aRGB);
|
||||||
r = aRGB[0];
|
r = aRGB[0];
|
||||||
g = aRGB[1];
|
g = aRGB[1];
|
||||||
@ -741,7 +741,7 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo
|
|||||||
\brief Set color of points
|
\brief Set color of points
|
||||||
Points actor is shown in Wireframe mode only, see SetVisibility()
|
Points actor is shown in Wireframe mode only, see SetVisibility()
|
||||||
*/
|
*/
|
||||||
void GEOM_Actor::SetPointColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
|
void GEOM_Actor::SetPointColor(double r, double g, double b)
|
||||||
{
|
{
|
||||||
myVertexActor->GetProperty()->SetColor(r, g, b);
|
myVertexActor->GetProperty()->SetColor(r, g, b);
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ void GEOM_Actor::SetPointColor(vtkFloatingPointType r, vtkFloatingPointType g,
|
|||||||
This actor is shown in all display mode, see SetVisibility()
|
This actor is shown in all display mode, see SetVisibility()
|
||||||
TODO: check - this color seems to be used not only for standalone edges
|
TODO: check - this color seems to be used not only for standalone edges
|
||||||
*/
|
*/
|
||||||
void GEOM_Actor::SetIsolatedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
|
void GEOM_Actor::SetIsolatedEdgeColor(double r, double g, double b)
|
||||||
{
|
{
|
||||||
myIsolatedEdgeColor[0] = r; myIsolatedEdgeColor[1] = g; myIsolatedEdgeColor[2] = b;
|
myIsolatedEdgeColor[0] = r; myIsolatedEdgeColor[1] = g; myIsolatedEdgeColor[2] = b;
|
||||||
if ( myDisplayMode != (int)eShadingWithEdges )
|
if ( myDisplayMode != (int)eShadingWithEdges )
|
||||||
@ -763,7 +763,7 @@ void GEOM_Actor::SetIsolatedEdgeColor(vtkFloatingPointType r, vtkFloatingPointTy
|
|||||||
This actor is shown only in wireframe and shading+edges display modes, see SetVisibility()
|
This actor is shown only in wireframe and shading+edges display modes, see SetVisibility()
|
||||||
TODO: check - this seems to be not working currently
|
TODO: check - this seems to be not working currently
|
||||||
*/
|
*/
|
||||||
void GEOM_Actor::SetSharedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
|
void GEOM_Actor::SetSharedEdgeColor(double r, double g, double b)
|
||||||
{
|
{
|
||||||
mySharedEdgeColor[0] = r; mySharedEdgeColor[1] = g; mySharedEdgeColor[2] = b;
|
mySharedEdgeColor[0] = r; mySharedEdgeColor[1] = g; mySharedEdgeColor[2] = b;
|
||||||
if ( myDisplayMode != (int)eShadingWithEdges )
|
if ( myDisplayMode != (int)eShadingWithEdges )
|
||||||
@ -775,7 +775,7 @@ void GEOM_Actor::SetSharedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType
|
|||||||
This actor is shown only in wireframe and shading+edges display modes, see SetVisibility()
|
This actor is shown only in wireframe and shading+edges display modes, see SetVisibility()
|
||||||
TODO: this color should be used not only for faces
|
TODO: this color should be used not only for faces
|
||||||
*/
|
*/
|
||||||
void GEOM_Actor::SetFreeEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
|
void GEOM_Actor::SetFreeEdgeColor(double r, double g, double b)
|
||||||
{
|
{
|
||||||
myOneFaceEdgeColor[0] = r; myOneFaceEdgeColor[1] = g; myOneFaceEdgeColor[2] = b;
|
myOneFaceEdgeColor[0] = r; myOneFaceEdgeColor[1] = g; myOneFaceEdgeColor[2] = b;
|
||||||
if ( myDisplayMode != (int)eShadingWithEdges )
|
if ( myDisplayMode != (int)eShadingWithEdges )
|
||||||
@ -786,7 +786,7 @@ void GEOM_Actor::SetFreeEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g
|
|||||||
\brief Set color of iso-lines
|
\brief Set color of iso-lines
|
||||||
This actor is shown only in wireframe display mode, see SetVisibility()
|
This actor is shown only in wireframe display mode, see SetVisibility()
|
||||||
*/
|
*/
|
||||||
void GEOM_Actor::SetIsosColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
|
void GEOM_Actor::SetIsosColor(double r, double g, double b)
|
||||||
{
|
{
|
||||||
myWireframeFaceActor->GetProperty()->SetColor(r, g, b);
|
myWireframeFaceActor->GetProperty()->SetColor(r, g, b);
|
||||||
}
|
}
|
||||||
@ -1072,7 +1072,7 @@ void GEOM_Actor::GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result)
|
|||||||
this->Transform->Pop();
|
this->Transform->Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_Actor::SetEdgesInShadingColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
|
void GEOM_Actor::SetEdgesInShadingColor(double r,double g,double b)
|
||||||
{
|
{
|
||||||
myEdgesInShadingColor[0] = r;
|
myEdgesInShadingColor[0] = r;
|
||||||
myEdgesInShadingColor[1] = g;
|
myEdgesInShadingColor[1] = g;
|
||||||
|
@ -121,24 +121,24 @@ public:
|
|||||||
void ShallowCopy(vtkProp *prop);
|
void ShallowCopy(vtkProp *prop);
|
||||||
|
|
||||||
// Opacity
|
// Opacity
|
||||||
void SetOpacity(vtkFloatingPointType opa);
|
void SetOpacity(double opa);
|
||||||
vtkFloatingPointType GetOpacity();
|
double GetOpacity();
|
||||||
|
|
||||||
// Color (same to all sub-actors/display modes)
|
// Color (same to all sub-actors/display modes)
|
||||||
void SetColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetColor(double r, double g, double b);
|
||||||
void GetColor(vtkFloatingPointType& r, vtkFloatingPointType& g, vtkFloatingPointType& b);
|
void GetColor(double& r, double& g, double& b);
|
||||||
// Color of points
|
// Color of points
|
||||||
void SetPointColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetPointColor(double r, double g, double b);
|
||||||
// Color of standalone edges, wires, vectors
|
// Color of standalone edges, wires, vectors
|
||||||
void SetIsolatedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetIsolatedEdgeColor(double r, double g, double b);
|
||||||
// Color of shared edges
|
// Color of shared edges
|
||||||
void SetSharedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetSharedEdgeColor(double r, double g, double b);
|
||||||
// Color of free edges
|
// Color of free edges
|
||||||
void SetFreeEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetFreeEdgeColor(double r, double g, double b);
|
||||||
// Color of edges in shading+edges display mode
|
// Color of edges in shading+edges display mode
|
||||||
void SetEdgesInShadingColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetEdgesInShadingColor(double r, double g, double b);
|
||||||
// Color of iso-lines
|
// Color of iso-lines
|
||||||
void SetIsosColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
|
void SetIsosColor(double r, double g, double b);
|
||||||
|
|
||||||
|
|
||||||
// Material
|
// Material
|
||||||
@ -263,11 +263,11 @@ private:
|
|||||||
GEOM_Actor(const GEOM_Actor&);
|
GEOM_Actor(const GEOM_Actor&);
|
||||||
void operator=(const GEOM_Actor&);
|
void operator=(const GEOM_Actor&);
|
||||||
|
|
||||||
vtkFloatingPointType myEdgesInWireframeColor[3];
|
double myEdgesInWireframeColor[3];
|
||||||
vtkFloatingPointType myEdgesInShadingColor[3];
|
double myEdgesInShadingColor[3];
|
||||||
vtkFloatingPointType myIsolatedEdgeColor[3];
|
double myIsolatedEdgeColor[3];
|
||||||
vtkFloatingPointType mySharedEdgeColor[3];
|
double mySharedEdgeColor[3];
|
||||||
vtkFloatingPointType myOneFaceEdgeColor[3];
|
double myOneFaceEdgeColor[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //GEOM_ACTOR_H
|
#endif //GEOM_ACTOR_H
|
||||||
|
@ -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,16 @@ 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);
|
||||||
|
myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
|
||||||
|
myPolyDataMapper->SetInputConnection(myStripper->GetOutputPort());
|
||||||
|
}
|
||||||
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);
|
||||||
|
@ -66,15 +66,15 @@ public:
|
|||||||
vtkTypeMacro( GEOM_VTKTrihedronAxis, VTKViewer_Axis );
|
vtkTypeMacro( GEOM_VTKTrihedronAxis, VTKViewer_Axis );
|
||||||
static GEOM_VTKTrihedronAxis* New();
|
static GEOM_VTKTrihedronAxis* New();
|
||||||
|
|
||||||
void SetAxis( const gp_Ax1& theAxis, const int theRot, vtkFloatingPointType theColor[ 3 ] );
|
void SetAxis( const gp_Ax1& theAxis, const int theRot, double theColor[ 3 ] );
|
||||||
virtual void Render( vtkRenderer* theRenderer );
|
virtual void Render( vtkRenderer* theRenderer );
|
||||||
virtual void SetSize( vtkFloatingPointType theSize );
|
virtual void SetSize( double theSize );
|
||||||
gp_Pnt GetOri() const;
|
gp_Pnt GetOri() const;
|
||||||
void SetColor( const vtkFloatingPointType theColor[ 3 ] );
|
void SetColor( const double theColor[ 3 ] );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
vtkFloatingPointType myOri[ 3 ];
|
double myOri[ 3 ];
|
||||||
vtkMatrix4x4* myMatrix;
|
vtkMatrix4x4* myMatrix;
|
||||||
vtkTransform* myTrsf;
|
vtkTransform* myTrsf;
|
||||||
};
|
};
|
||||||
@ -94,9 +94,9 @@ GEOM_VTKTrihedronAxis::~GEOM_VTKTrihedronAxis()
|
|||||||
myTrsf->Delete();
|
myTrsf->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_VTKTrihedronAxis::SetSize( vtkFloatingPointType theSize )
|
void GEOM_VTKTrihedronAxis::SetSize( double theSize )
|
||||||
{
|
{
|
||||||
vtkFloatingPointType aPosition[ 3 ] = { myOri[ 0 ] + myDir[ 0 ] * theSize,
|
double aPosition[ 3 ] = { myOri[ 0 ] + myDir[ 0 ] * theSize,
|
||||||
myOri[ 1 ] + myDir[ 1 ] * theSize,
|
myOri[ 1 ] + myDir[ 1 ] * theSize,
|
||||||
myOri[ 2 ] + myDir[ 2 ] * theSize };
|
myOri[ 2 ] + myDir[ 2 ] * theSize };
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ gp_Pnt GEOM_VTKTrihedronAxis::GetOri() const
|
|||||||
|
|
||||||
void GEOM_VTKTrihedronAxis::SetAxis( const gp_Ax1& theAxis,
|
void GEOM_VTKTrihedronAxis::SetAxis( const gp_Ax1& theAxis,
|
||||||
const int theRot,
|
const int theRot,
|
||||||
vtkFloatingPointType theColor[ 3 ] )
|
double theColor[ 3 ] )
|
||||||
{
|
{
|
||||||
gp_Pnt aLoc = theAxis.Location();
|
gp_Pnt aLoc = theAxis.Location();
|
||||||
gp_Dir aDir = theAxis.Direction();
|
gp_Dir aDir = theAxis.Direction();
|
||||||
@ -167,7 +167,7 @@ void GEOM_VTKTrihedronAxis::SetAxis( const gp_Ax1& theAxis,
|
|||||||
myDir[ 1 ] = aDir.Y();
|
myDir[ 1 ] = aDir.Y();
|
||||||
myDir[ 2 ] = aDir.Z();
|
myDir[ 2 ] = aDir.Z();
|
||||||
|
|
||||||
vtkFloatingPointType aColor[ 3 ] = { 0, 0, 0 };
|
double aColor[ 3 ] = { 0, 0, 0 };
|
||||||
aColor[ theRot ] = 1;
|
aColor[ theRot ] = 1;
|
||||||
if ( theColor[ 0 ] == -1 )
|
if ( theColor[ 0 ] == -1 )
|
||||||
VTKViewer_Axis::SetColor( aColor[ 0 ], aColor[ 1 ], aColor[ 2 ] );
|
VTKViewer_Axis::SetColor( aColor[ 0 ], aColor[ 1 ], aColor[ 2 ] );
|
||||||
@ -185,7 +185,7 @@ void GEOM_VTKTrihedronAxis::SetAxis( const gp_Ax1& theAxis,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_VTKTrihedronAxis::SetColor( const vtkFloatingPointType theColor[ 3 ] )
|
void GEOM_VTKTrihedronAxis::SetColor( const double theColor[ 3 ] )
|
||||||
{
|
{
|
||||||
VTKViewer_Axis::SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] );
|
VTKViewer_Axis::SetColor( theColor[ 0 ], theColor[ 1 ], theColor[ 2 ] );
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ GEOM_VTKTrihedron::~GEOM_VTKTrihedron()
|
|||||||
myMapper->Delete();
|
myMapper->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_VTKTrihedron::SetSize( vtkFloatingPointType theSize )
|
void GEOM_VTKTrihedron::SetSize( double theSize )
|
||||||
{
|
{
|
||||||
mySize = theSize;
|
mySize = theSize;
|
||||||
for ( int i = 0; i < 3; i++ )
|
for ( int i = 0; i < 3; i++ )
|
||||||
@ -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();
|
||||||
@ -362,7 +362,7 @@ void GEOM_VTKTrihedron::Render(vtkRenderer* r, vtkMapper *)
|
|||||||
( (GEOM_VTKTrihedronAxis*)myAxis[ 2 ] )->Render( r );
|
( (GEOM_VTKTrihedronAxis*)myAxis[ 2 ] )->Render( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_VTKTrihedron::SetColor( vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
|
void GEOM_VTKTrihedron::SetColor( double r, double g, double b )
|
||||||
{
|
{
|
||||||
myColor[ 0 ] = r;
|
myColor[ 0 ] = r;
|
||||||
myColor[ 1 ] = g;
|
myColor[ 1 ] = g;
|
||||||
@ -373,7 +373,7 @@ void GEOM_VTKTrihedron::SetColor( vtkFloatingPointType r, vtkFloatingPointType g
|
|||||||
if ( myAxis[ 2 ] ) ( (GEOM_VTKTrihedronAxis*)myAxis[ 2 ] )->SetColor( myColor );
|
if ( myAxis[ 2 ] ) ( (GEOM_VTKTrihedronAxis*)myAxis[ 2 ] )->SetColor( myColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_VTKTrihedron::GetColor( vtkFloatingPointType& r, vtkFloatingPointType& g, vtkFloatingPointType& b )
|
void GEOM_VTKTrihedron::GetColor( double& r, double& g, double& b )
|
||||||
{
|
{
|
||||||
r = myColor[ 0 ];
|
r = myColor[ 0 ];
|
||||||
g = myColor[ 1 ];
|
g = myColor[ 1 ];
|
||||||
@ -426,7 +426,7 @@ void GEOM_VTKTrihedron::ResetAxesColors()
|
|||||||
SetAxesColors( myDefaultColor, true );
|
SetAxesColors( myDefaultColor, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_VTKTrihedron::SetAxesColors( vtkFloatingPointType theColor[3], bool theIsDiffuse )
|
void GEOM_VTKTrihedron::SetAxesColors( double theColor[3], bool theIsDiffuse )
|
||||||
{
|
{
|
||||||
myAxis[ 0 ]->SetColor( theColor[0], theIsDiffuse ? 0.0 : theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
|
myAxis[ 0 ]->SetColor( theColor[0], theIsDiffuse ? 0.0 : theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
|
||||||
myAxis[ 1 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
|
myAxis[ 1 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
vtkTypeMacro( GEOM_VTKTrihedron, SALOME_Actor );
|
vtkTypeMacro( GEOM_VTKTrihedron, SALOME_Actor );
|
||||||
static GEOM_VTKTrihedron* New();
|
static GEOM_VTKTrihedron* New();
|
||||||
|
|
||||||
virtual vtkFloatingPointType GetSize() { return mySize;}
|
virtual double GetSize() { return mySize;}
|
||||||
|
|
||||||
virtual void SetVisibility( int theVisibility );
|
virtual void SetVisibility( int theVisibility );
|
||||||
virtual void SetVisibility( VTKViewer_Trihedron::TVisibility theVis );
|
virtual void SetVisibility( VTKViewer_Trihedron::TVisibility theVis );
|
||||||
@ -74,11 +74,11 @@ public:
|
|||||||
virtual void Render(vtkRenderer *, vtkMapper *);
|
virtual void Render(vtkRenderer *, vtkMapper *);
|
||||||
virtual bool IsSetCamera() const;
|
virtual bool IsSetCamera() const;
|
||||||
virtual bool IsResizable() const;
|
virtual bool IsResizable() const;
|
||||||
virtual void SetSize( vtkFloatingPointType );
|
virtual void SetSize( double );
|
||||||
virtual void SetCamera( vtkCamera* );
|
virtual void SetCamera( vtkCamera* );
|
||||||
|
|
||||||
void SetColor( vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b );
|
void SetColor( double r, double g, double b );
|
||||||
void GetColor( vtkFloatingPointType& r, vtkFloatingPointType& g, vtkFloatingPointType& b );
|
void GetColor( double& r, double& g, double& b );
|
||||||
|
|
||||||
virtual bool hasHighlight() { return true; }
|
virtual bool hasHighlight() { return true; }
|
||||||
|
|
||||||
@ -89,18 +89,18 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ResetAxesColors();
|
virtual void ResetAxesColors();
|
||||||
virtual void SetAxesColors( vtkFloatingPointType theColor[3], bool theIsDiffuse = false );
|
virtual void SetAxesColors( double theColor[3], bool theIsDiffuse = false );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VTKViewer_Axis* myAxis[3];
|
VTKViewer_Axis* myAxis[3];
|
||||||
vtkPolyDataMapper* myMapper;
|
vtkPolyDataMapper* myMapper;
|
||||||
vtkFloatingPointType mySize;
|
double mySize;
|
||||||
gp_Pnt myLocation;
|
gp_Pnt myLocation;
|
||||||
gp_Dir myDirX, myDirY, myDirZ;
|
gp_Dir myDirX, myDirY, myDirZ;
|
||||||
vtkFloatingPointType myColor[ 3 ];
|
double myColor[ 3 ];
|
||||||
vtkFloatingPointType myDefaultColor[ 3 ];
|
double myDefaultColor[ 3 ];
|
||||||
vtkFloatingPointType myPreHighlightColor[ 3 ];
|
double myPreHighlightColor[ 3 ];
|
||||||
vtkFloatingPointType myHighlightColor[ 3 ];
|
double myHighlightColor[ 3 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,12 +34,15 @@
|
|||||||
|
|
||||||
#include <vtkStripper.h>
|
#include <vtkStripper.h>
|
||||||
#include <vtkPolyData.h>
|
#include <vtkPolyData.h>
|
||||||
|
#include <vtkInformation.h>
|
||||||
|
#include <vtkInformationVector.h>
|
||||||
|
|
||||||
vtkStandardNewMacro(GEOM_EdgeSource);
|
vtkStandardNewMacro(GEOM_EdgeSource);
|
||||||
|
|
||||||
GEOM_EdgeSource::GEOM_EdgeSource() :
|
GEOM_EdgeSource::GEOM_EdgeSource() :
|
||||||
myIsVector(false)
|
myIsVector(false)
|
||||||
{
|
{
|
||||||
|
this->SetNumberOfInputPorts(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_EdgeSource::~GEOM_EdgeSource()
|
GEOM_EdgeSource::~GEOM_EdgeSource()
|
||||||
@ -53,11 +56,14 @@ void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge,
|
|||||||
myIsVector = theIsVector;
|
myIsVector = theIsVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_EdgeSource::
|
vtkInformationVector **vtkNotUsed(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 +77,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 <vtkPolyDataAlgorithm.h>
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataSource
|
class vtkPolyData;
|
||||||
|
|
||||||
|
class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataSource);
|
vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataAlgorithm);
|
||||||
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,6 +29,7 @@
|
|||||||
|
|
||||||
GEOM_FaceSource::GEOM_FaceSource()
|
GEOM_FaceSource::GEOM_FaceSource()
|
||||||
{
|
{
|
||||||
|
this->SetNumberOfInputPorts(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_FaceSource::~GEOM_FaceSource()
|
GEOM_FaceSource::~GEOM_FaceSource()
|
||||||
|
@ -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 <vtkPolyDataAlgorithm.h>
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataSource
|
class vtkPolyData;
|
||||||
|
|
||||||
|
class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vtkTypeMacro(GEOM_FaceSource,vtkPolyDataSource);
|
vtkTypeMacro(GEOM_FaceSource,vtkPolyDataAlgorithm);
|
||||||
|
|
||||||
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>
|
||||||
@ -35,17 +37,21 @@ vtkStandardNewMacro(GEOM_ShadingFace);
|
|||||||
|
|
||||||
GEOM_ShadingFace::GEOM_ShadingFace()
|
GEOM_ShadingFace::GEOM_ShadingFace()
|
||||||
{
|
{
|
||||||
|
this->SetNumberOfInputPorts(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_ShadingFace::~GEOM_ShadingFace()
|
GEOM_ShadingFace::~GEOM_ShadingFace()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_ShadingFace::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_ShadingFace::
|
vtkInformationVector **vtkNotUsed(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 +62,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>
|
||||||
@ -33,6 +35,7 @@ vtkStandardNewMacro(GEOM_VertexSource);
|
|||||||
|
|
||||||
GEOM_VertexSource::GEOM_VertexSource()
|
GEOM_VertexSource::GEOM_VertexSource()
|
||||||
{
|
{
|
||||||
|
this->SetNumberOfInputPorts(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_VertexSource::~GEOM_VertexSource()
|
GEOM_VertexSource::~GEOM_VertexSource()
|
||||||
@ -46,11 +49,14 @@ AddVertex(const TopoDS_Vertex& theVertex)
|
|||||||
myVertexSet.Add(theVertex);
|
myVertexSet.Add(theVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_VertexSource::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_VertexSource::
|
vtkInformationVector **vtkNotUsed(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 +67,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 <vtkPolyDataAlgorithm.h>
|
||||||
|
|
||||||
class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataSource
|
class vtkPolyData;
|
||||||
|
|
||||||
|
class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
vtkTypeMacro(GEOM_VertexSource,vtkPolyDataSource);
|
vtkTypeMacro(GEOM_VertexSource,vtkPolyDataAlgorithm);
|
||||||
static GEOM_VertexSource* New();
|
static GEOM_VertexSource* New();
|
||||||
|
|
||||||
void AddVertex(const TopoDS_Vertex& theVertex);
|
void AddVertex(const TopoDS_Vertex& theVertex);
|
||||||
@ -47,7 +49,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
TVertexSet myVertexSet;
|
TVertexSet myVertexSet;
|
||||||
|
|
||||||
void Execute();
|
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>
|
||||||
@ -55,17 +57,22 @@ GEOM_WireframeFace::GEOM_WireframeFace():
|
|||||||
{
|
{
|
||||||
NbIso[0] = 1;
|
NbIso[0] = 1;
|
||||||
NbIso[1] = 1;
|
NbIso[1] = 1;
|
||||||
|
|
||||||
|
this->SetNumberOfInputPorts(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_WireframeFace::~GEOM_WireframeFace()
|
GEOM_WireframeFace::~GEOM_WireframeFace()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int GEOM_WireframeFace::RequestData(vtkInformation *vtkNotUsed(request),
|
||||||
GEOM_WireframeFace::
|
vtkInformationVector **vtkNotUsed(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 +83,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();
|
||||||
|
@ -154,7 +154,7 @@ void OperationGUI_ClippingDlg::Init()
|
|||||||
double position[3];
|
double position[3];
|
||||||
anActiveCamera->GetPosition( position );
|
anActiveCamera->GetPosition( position );
|
||||||
|
|
||||||
vtkFloatingPointType bounds[6];
|
double bounds[6];
|
||||||
aRenderer->ComputeVisiblePropBounds( bounds );
|
aRenderer->ComputeVisiblePropBounds( bounds );
|
||||||
|
|
||||||
double center[3];
|
double center[3];
|
||||||
@ -170,7 +170,7 @@ void OperationGUI_ClippingDlg::Init()
|
|||||||
( position[1]-center[1] ) * ( position[1]-center[1] ) +
|
( position[1]-center[1] ) * ( position[1]-center[1] ) +
|
||||||
( position[2]-center[2] ) * ( position[2]-center[2] ) );
|
( position[2]-center[2] ) * ( position[2]-center[2] ) );
|
||||||
|
|
||||||
vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 };
|
double range[2] = { distance - width/2.0, distance + width/2.0 };
|
||||||
|
|
||||||
SpinBox_Near->setValue( range[0] );
|
SpinBox_Near->setValue( range[0] );
|
||||||
SpinBox_Far->setValue( range[1] );
|
SpinBox_Far->setValue( range[1] );
|
||||||
@ -220,7 +220,7 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkFloatingPointType range[2] = { SpinBox_Near->value(), SpinBox_Far->value() };
|
double range[2] = { SpinBox_Near->value(), SpinBox_Far->value() };
|
||||||
if ( range[0] < 0.0 ) range[0] = 0.0;
|
if ( range[0] < 0.0 ) range[0] = 0.0;
|
||||||
anActiveCamera->SetClippingRange( range );
|
anActiveCamera->SetClippingRange( range );
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ void OperationGUI_ClippingDlg::onReset()
|
|||||||
double position[3];
|
double position[3];
|
||||||
anActiveCamera->GetPosition( position );
|
anActiveCamera->GetPosition( position );
|
||||||
|
|
||||||
vtkFloatingPointType bounds[6];
|
double bounds[6];
|
||||||
aRenderer->ComputeVisiblePropBounds( bounds );
|
aRenderer->ComputeVisiblePropBounds( bounds );
|
||||||
|
|
||||||
double center[3];
|
double center[3];
|
||||||
@ -318,7 +318,7 @@ void OperationGUI_ClippingDlg::onReset()
|
|||||||
( position[1]-center[1] ) * ( position[1]-center[1] ) +
|
( position[1]-center[1] ) * ( position[1]-center[1] ) +
|
||||||
( position[2]-center[2] ) * ( position[2]-center[2] ) );
|
( position[2]-center[2] ) * ( position[2]-center[2] ) );
|
||||||
|
|
||||||
vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 };
|
double range[2] = { distance - width/2.0, distance + width/2.0 };
|
||||||
|
|
||||||
SpinBox_Near->setValue( range[0] );
|
SpinBox_Near->setValue( range[0] );
|
||||||
SpinBox_Far->setValue( range[1] );
|
SpinBox_Far->setValue( range[1] );
|
||||||
|
@ -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…
Reference in New Issue
Block a user