myClsTextProp->SetBold( bold );
myClsTextProp->SetItalic( italic );
myClsTextProp->SetShadow( shadow );
- myClsTextProp->SetColor( r, g, b );
+ myClsTextProp->SetColor( r, g, b );
}
void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled)
{
+ myIsCellsLabeled = theIsCellsLabeled;
+
+ myCellsLabels->SetVisibility(false);
+
myTransformFilter->Update();
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
- if ( !aGrid )
- return;
- myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
- if ( myIsCellsLabeled )
+ if ( myIsCellsLabeled && aGrid )
{
myCellsNumDataSet->ShallowCopy(aGrid);
vtkUnstructuredGrid *aDataSet = myCellsNumDataSet;
aDataSet->GetCellData()->SetScalars(anArray);
myCellCenters->SetInputData(aDataSet);
myCellsLabels->SetVisibility(GetVisibility());
- }else{
- myCellsLabels->SetVisibility(false);
}
}
/*!
Constructor.
*/
-SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
+SMESH_NodeLabelActor::SMESH_NodeLabelActor()
+{
//Definition of points numbering pipeline
//---------------------------------------
myPointsNumDataSet = vtkUnstructuredGrid::New();
myPtsSelectVisiblePoints->SetInputConnection(myPtsMaskPoints->GetOutputPort());
myPtsSelectVisiblePoints->SelectInvisibleOff();
myPtsSelectVisiblePoints->SetTolerance(0.1);
-
+
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
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();
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;
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,
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();
}