// VTK Includes
#include <vtkObjectFactory.h>
#include <vtkShrinkFilter.h>
+#include <vtkFeatureEdges.h>
#include <vtkPolyData.h>
#include <vtkUnstructuredGrid.h>
myIsShrunk = false;
myIsShrinkable = true;
+ myIsFeatureEdgesAllowed = false;
+ myIsFeatureEdgesEnabled = false;
+
myIsShaded = true;
myProperty = vtkProperty::New();
myRepresentation = SVTK::Representation::Surface;
myShrinkFilter = vtkShrinkFilter::New();
+ myFeatureEdges = vtkFeatureEdges::New();
+
myGeomFilter = VTKViewer_GeometryFilter::New();
myTransformFilter = VTKViewer_TransformFilter::New();
myShrinkFilter->Delete();
+ myFeatureEdges->Delete();
+
for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
myPassFilter[i]->Delete();
}
if(myIsShrunk)
mTime = max(mTime,myShrinkFilter->GetMTime());
+ if(myIsFeatureEdgesEnabled)
+ mTime = max(mTime,myFeatureEdges->GetMTime());
+
for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
max(mTime,myPassFilter[i]->GetMTime());
myShrinkFilter->SetShrinkFactor(theValue);
}
+/*!
+ \return true if feature edges are allowed for this actor
+*/
+bool
+SVTK_DeviceActor
+::IsFeatureEdgesAllowed()
+{
+ return myIsFeatureEdgesAllowed;
+}
+
+/*!
+ Allows feature edges for this actor on or off
+ \param theIsFeatureEdgesAllowed - flag which allows feature edges for this actor on or off
+*/
+void
+SVTK_DeviceActor
+::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
+{
+ myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed;
+}
+
+/*!
+ \return true if feature edges are enabled
+*/
+bool
+SVTK_DeviceActor
+::IsFeatureEdgesEnabled()
+{
+ return myIsFeatureEdgesEnabled;
+}
+
+/*!
+ Enables feature edges on or off
+ \param theIsFeatureEdgesEnabled - flag which enables feature edges on or off
+*/
+void
+SVTK_DeviceActor
+::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
+{
+ if ( !myIsFeatureEdgesAllowed || myIsFeatureEdgesEnabled == theIsFeatureEdgesEnabled )
+ return;
+
+ if ( vtkPolyData* aPolyData = myPassFilter[ 2 ]->GetPolyDataOutput() )
+ {
+ if( theIsFeatureEdgesEnabled )
+ {
+ aPolyData->Update();
+ myFeatureEdges->SetInput( aPolyData );
+ myPassFilter[ 3 ]->SetInput( myFeatureEdges->GetOutput() );
+ myIsFeatureEdgesEnabled = true;
+ }
+ else
+ {
+ myPassFilter[3]->SetInput( aPolyData );
+ myIsFeatureEdgesEnabled = false;
+ }
+ myIsFeatureEdgesEnabled = theIsFeatureEdgesEnabled;
+ }
+}
+
+/*!
+ \return angle of feature edges' filter
+*/
+vtkFloatingPointType
+SVTK_DeviceActor
+::GetFeatureEdgesAngle()
+{
+ return myFeatureEdges->GetFeatureAngle();
+}
+
+/*!
+ Sets angle of feature edges' filter
+ \param theAngle angle of feature edges' filter
+*/
+void
+SVTK_DeviceActor
+::SetFeatureEdgesAngle(vtkFloatingPointType theAngle)
+{
+ myFeatureEdges->SetFeatureAngle(theAngle);
+}
+
+/*!
+ Gets information about kinds of edges which are displayed by feature edges' filter
+ \param theIsFeatureEdges flag which shows whether feature edges are displayed
+ \param theIsBoundaryEdges flag which shows whether boundary edges are displayed
+ \param theIsManifoldEdges flag which shows whether manifold edges are displayed
+ \param theIsNonManifoldEdges flag which shows whether non-manifold edges are displayed
+*/
+void
+SVTK_DeviceActor
+::GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+ bool& theIsBoundaryEdges,
+ bool& theIsManifoldEdges,
+ bool& theIsNonManifoldEdges)
+{
+ theIsFeatureEdges = myFeatureEdges->GetFeatureEdges();
+ theIsBoundaryEdges = myFeatureEdges->GetBoundaryEdges();
+ theIsManifoldEdges = myFeatureEdges->GetManifoldEdges();
+ theIsNonManifoldEdges = myFeatureEdges->GetNonManifoldEdges();
+}
+
+/*!
+ Sets different kinds of edges to be displayed by feature edges' filter
+ \param theIsFeatureEdges flag which displays feature edges
+ \param theIsBoundaryEdges flag which displays boundary edges
+ \param theIsManifoldEdges flag which displays manifold edges
+ \param theIsNonManifoldEdges flag which displays non-manifold edges
+*/
+void
+SVTK_DeviceActor
+::SetFeatureEdgesFlags(bool theIsFeatureEdges,
+ bool theIsBoundaryEdges,
+ bool theIsManifoldEdges,
+ bool theIsNonManifoldEdges)
+{
+ myFeatureEdges->SetFeatureEdges(theIsFeatureEdges);
+ myFeatureEdges->SetBoundaryEdges(theIsBoundaryEdges);
+ myFeatureEdges->SetManifoldEdges(theIsManifoldEdges);
+ myFeatureEdges->SetNonManifoldEdges(theIsNonManifoldEdges);
+}
+
+/*!
+ \return feature edges' coloring flag
+*/
+bool
+SVTK_DeviceActor
+::GetFeatureEdgesColoring()
+{
+ return myFeatureEdges->GetColoring();
+}
+
+/*!
+ Sets feature edges' coloring flag
+ \param theIsColoring feature edges' coloring flag
+*/
+void
+SVTK_DeviceActor
+::SetFeatureEdgesColoring(bool theIsColoring)
+{
+ myFeatureEdges->SetColoring(theIsColoring);
+}
+
/*!
Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
param theMode - new mode
class vtkCell;
class vtkDataSet;
class vtkShrinkFilter;
+class vtkFeatureEdges;
class vtkDataSetMapper;
class vtkPassThroughFilter;
UnShrink();
//@}
+ /** @name For feature edges management purpose */
+ //@{
+ virtual
+ bool
+ IsFeatureEdgesAllowed();
+
+ virtual
+ void
+ SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
+
+ virtual
+ bool
+ IsFeatureEdgesEnabled();
+
+ virtual
+ void
+ SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled);
+
+ virtual
+ vtkFloatingPointType
+ GetFeatureEdgesAngle();
+
+ virtual
+ void
+ SetFeatureEdgesAngle(vtkFloatingPointType theAngle);
+
+ virtual
+ void
+ GetFeatureEdgesFlags(bool& theIsFeatureEdges,
+ bool& theIsBoundaryEdges,
+ bool& theIsManifoldEdges,
+ bool& theIsNonManifoldEdges);
+ virtual
+ void
+ SetFeatureEdgesFlags(bool theIsFeatureEdges,
+ bool theIsBoundaryEdges,
+ bool theIsManifoldEdges,
+ bool theIsNonManifoldEdges);
+
+ virtual
+ bool
+ GetFeatureEdgesColoring();
+
+ virtual
+ void
+ SetFeatureEdgesColoring(bool theIsColoring);
+ //@}
+
/** @name For representation mamnagement purpose */
virtual
void
VTKViewer_TransformFilter *myTransformFilter;
std::vector<vtkPassThroughFilter*> myPassFilter;
vtkShrinkFilter* myShrinkFilter;
+ vtkFeatureEdges* myFeatureEdges;
vtkDataSetMapper* myMapper;
bool myIsShrinkable;
bool myIsShrunk;
+ bool myIsFeatureEdgesAllowed;
+ bool myIsFeatureEdgesEnabled;
+
bool myIsResolveCoincidentTopology;
vtkFloatingPointType myPolygonOffsetFactor;
vtkFloatingPointType myPolygonOffsetUnits;