-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <vtkRenderer.h>
#include <vtkUnstructuredGrid.h>
-vtkStandardNewMacro(SMESH_NodeLabelActor);
+vtkStandardNewMacro(SMESH_NodeLabelActor)
/*!
Constructor.
*/
-SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
+SMESH_NodeLabelActor::SMESH_NodeLabelActor()
+{
//Definition of points numbering pipeline
//---------------------------------------
myPointsNumDataSet = vtkUnstructuredGrid::New();
myPtsMaskPoints = vtkMaskPoints::New();
- myPtsMaskPoints->SetInput(myPointsNumDataSet);
+ myPtsMaskPoints->SetInputData(myPointsNumDataSet);
myPtsMaskPoints->SetOnRatio(1);
myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
- myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
+ myPtsSelectVisiblePoints->SetInputConnection(myPtsMaskPoints->GetOutputPort());
myPtsSelectVisiblePoints->SelectInvisibleOff();
myPtsSelectVisiblePoints->SetTolerance(0.1);
-
+
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
- myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
+ myPtsLabeledDataMapper->SetInputConnection(myPtsSelectVisiblePoints->GetOutputPort());
myPtsLabeledDataMapper->SetLabelFormat("%d");
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
-
+
myPtsTextProp = vtkTextProperty::New();
myPtsTextProp->SetFontFamilyToTimes();
myPtsTextProp->SetFontSize(10);
/*!
Destructor
*/
-SMESH_NodeLabelActor::~SMESH_NodeLabelActor() {
+SMESH_NodeLabelActor::~SMESH_NodeLabelActor()
+{
//Deleting of points numbering pipeline
//---------------------------------------
myPointsNumDataSet->Delete();
-
+
// commented: porting to vtk 5.0
// myPtsLabeledDataMapper->RemoveAllInputs();
myPtsLabeledDataMapper->Delete();
-
+
// commented: porting to vtk 5.0
// myPtsSelectVisiblePoints->UnRegisterAllOutputs();
myPtsSelectVisiblePoints->Delete();
-
+
// commented: porting to vtk 5.0
// myPtsMaskPoints->UnRegisterAllOutputs();
myPtsMaskPoints->Delete();
void SMESH_NodeLabelActor::SetFontProperties( SMESH::LabelFont family, int size,
bool bold, bool italic, bool shadow,
- vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
+ double r, double g, double b )
{
switch ( family ) {
case SMESH::FntArial:
myPtsTextProp->SetColor( r, g, b );
}
-void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
+void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled)
+{
+ myIsPointsLabeled = theIsPointsLabeled;
+
+ myPointLabels->SetVisibility( false );
+
myTransformFilter->Update();
vtkDataSet* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
- if(!aGrid)
- return;
-
- myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
-
- if ( myIsPointsLabeled )
+ if ( myIsPointsLabeled && aGrid )
{
myPointsNumDataSet->ShallowCopy(aGrid);
vtkUnstructuredGrid *aDataSet = myPointsNumDataSet;
}
aDataSet->GetPointData()->SetScalars( anArray );
- myPtsMaskPoints->SetInput( aDataSet );
+ myPtsMaskPoints->SetInputData( aDataSet );
myPointLabels->SetVisibility( GetVisibility() );
anArray->Delete();
}
- else
- {
- myPointLabels->SetVisibility( false );
- }
}
SMESH_DeviceActor::RemoveFromRender(theRenderer);
}
-void SMESH_NodeLabelActor::UpdateLabels() {
+void SMESH_NodeLabelActor::UpdateLabels()
+{
if(myIsPointsLabeled)
SetPointsLabeled(myIsPointsLabeled);
}
void SMESH_NodeLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
+ unsigned long /*theEvent*/,
void* theClientData,
- void* vtkNotUsed(theCallData)) {
- SMESH_NodeLabelActor* self = reinterpret_cast<SMESH_NodeLabelActor*>(theClientData);
+ void* vtkNotUsed(theCallData))
+{
+ SMESH_NodeLabelActor* self = reinterpret_cast<SMESH_NodeLabelActor*>(theClientData);
if(self)
self->UpdateLabels();
}