-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 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 "SMESH_ControlsDef.hxx"
#include "SMESH_ActorUtils.h"
#include "SMESH_FaceOrientationFilter.h"
-#include "VTKViewer_CellLocationsArray.h"
+//#include "VTKViewer_CellLocationsArray.h"
#include "VTKViewer_PolyDataMapper.h"
#include <VTKViewer_Transform.h>
#include <VTKViewer_TransformFilter.h>
#include <VTKViewer_ExtractUnstructuredGrid.h>
+#include <VTKViewer_Actor.h>
// VTK Includes
#include <vtkObjectFactory.h>
#include <vtkUnsignedCharArray.h>
#include <vtkImplicitBoolean.h>
-#include <vtkPassThroughFilter.h>
+#include <vtkPassThrough.h>
#include <vtkRenderer.h>
+#include <vtkPlaneCollection.h>
+
#include "utilities.h"
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
using namespace std;
-vtkStandardNewMacro(SMESH_DeviceActor);
+vtkStandardNewMacro(SMESH_DeviceActor)
SMESH_DeviceActor
::SMESH_DeviceActor()
{
- if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<<this);
+ MESSAGE("SMESH_DeviceActor - "<<this);
myIsShrinkable = false;
myIsShrunk = false;
myIsHighlited = false;
- myRepresentation = eSurface;
+ myRepresentation = SMESH_DeviceActor::EReperesent(-1);
myProperty = vtkProperty::New();
myMapper = VTKViewer_PolyDataMapper::New();
+ myPlaneCollection = vtkPlaneCollection::New();
- vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ VTKViewer_Actor::GetDefaultPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
myMapper->UseLookupTableScalarRangeOn();
myMapper->SetColorModeToMapScalars();
myTransformFilter = VTKViewer_TransformFilter::New();
for(int i = 0; i < 6; i++)
- myPassFilter.push_back(vtkPassThroughFilter::New());
+ myPassFilter.push_back(vtkPassThrough::New());
// Orientation of faces
myIsFacesOriented = false;
- vtkFloatingPointType anRGB[3] = { 1, 1, 1 };
+ double anRGB[3] = { 1, 1, 1 };
SMESH::GetColor( "SMESH", "orientation_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
myFaceOrientationFilter = SMESH_FaceOrientationFilter::New();
myFaceOrientationDataMapper = vtkPolyDataMapper::New();
- myFaceOrientationDataMapper->SetInput(myFaceOrientationFilter->GetOutput());
+ myFaceOrientationDataMapper->SetInputConnection(myFaceOrientationFilter->GetOutputPort());
myFaceOrientation = vtkActor::New();
myFaceOrientation->SetMapper(myFaceOrientationDataMapper);
SMESH_DeviceActor
::~SMESH_DeviceActor()
{
- if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
-
- myProperty->Delete();
+ MESSAGE("~SMESH_DeviceActor - "<<this);
myMapper->Delete();
+ // myPlaneCollection->Delete(); -- it is vtkSmartPointer
+ myProperty->Delete();
- myShrinkFilter->Delete();
+ myExtractGeometry->Delete();
+ myMergeFilter->Delete();
myExtractUnstructuredGrid->Delete();
- myMergeFilter->Delete();
+ // Orientation of faces
+ myFaceOrientationFilter->Delete();
+ myFaceOrientationDataMapper->RemoveAllInputs();
+ myFaceOrientationDataMapper->Delete();
+ myFaceOrientation->Delete();
myGeomFilter->Delete();
- myExtractGeometry->Delete();
-
myTransformFilter->Delete();
- for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
+ for(size_t i = 0, iEnd = myPassFilter.size(); i < iEnd; i++)
myPassFilter[i]->Delete();
- }
-
- // Orientation of faces
- myFaceOrientationFilter->Delete();
-
- myFaceOrientationDataMapper->RemoveAllInputs();
- myFaceOrientationDataMapper->Delete();
- myFaceOrientation->Delete();
+ myShrinkFilter->Delete();
}
::SetStoreGemetryMapping(bool theStoreMapping)
{
myGeomFilter->SetStoreMapping(theStoreMapping);
- SetStoreClippingMapping(theStoreMapping);
+ // for optimization, switch the mapping explicitly in each filter/algorithm
+ //SetStoreClippingMapping(theStoreMapping);
}
{
myStoreClippingMapping = theStoreMapping;
myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
- SetStoreIDMapping(theStoreMapping);
+ // EAP, 23315
+ // Mapping in myExtractUnstructuredGrid and myGeomFilter is ON in the pickable DeviceActor only.
+ // To show labels, the mapping is computed explicitly via myExtractUnstructuredGrid->BuildOut2InMap();
+ //SetStoreIDMapping(theStoreMapping);
}
SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
}
-
void
SMESH_DeviceActor
::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
{
int anId = 0;
if(theIsImplicitFunctionUsed)
- myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
+ myPassFilter[ anId ]->SetInputConnection( myExtractGeometry->GetOutputPort() );
else
- myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
+ myPassFilter[ anId ]->SetInputConnection( myMergeFilter->GetOutputPort() );
myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
SetStoreClippingMapping(myStoreClippingMapping);
SMESH_DeviceActor
::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid)
{
- if(theGrid){
- //myIsShrinkable = theGrid->GetNumberOfCells() > 10;
+ myExtractUnstructuredGrid->SetInputData(theGrid);
+
+ if ( theGrid )
+ {
myIsShrinkable = true;
- myExtractUnstructuredGrid->SetInput(theGrid);
+ myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
- myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
+ //Pass diameters of the balls
+ if(myMapper->GetBallEnabled()) {
+ myMergeFilter->SetScalarsConnection(myExtractUnstructuredGrid->GetOutputPort());
+ }
- myExtractGeometry->SetInput(myMergeFilter->GetOutput());
+ myExtractGeometry->SetInputConnection(myMergeFilter->GetOutputPort());
int anId = 0;
SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
- myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
-
+ myPassFilter[ anId + 1]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
+
anId++; // 1
- myTransformFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
+ myTransformFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
anId++; // 2
- myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
- myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+ myPassFilter[ anId ]->SetInputConnection( myTransformFilter->GetOutputPort() );
+ myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
anId++; // 3
- myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
+ myGeomFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
anId++; // 4
- myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
- myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+ myPassFilter[ anId ]->SetInputConnection( myGeomFilter->GetOutputPort() );
+ myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
anId++; // 5
- myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+ myMapper->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
+ if( myPlaneCollection->GetNumberOfItems() )
+ myMapper->SetClippingPlanes( myPlaneCollection );
vtkLODActor::SetMapper( myMapper );
- Modified();
}
+ Modified();
}
+void
+SMESH_DeviceActor
+::SetPlaneCollection( vtkPlaneCollection* theCollection )
+{
+ myPlaneCollection = theCollection;
+}
VTKViewer_ExtractUnstructuredGrid*
SMESH_DeviceActor
return myExtractUnstructuredGrid;
}
+#include "SMDS_Mesh.hxx"
vtkUnstructuredGrid*
SMESH_DeviceActor
SMESH_ScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
- bool anIsInitialized = theFunctor;
+ bool anIsInitialized = theFunctor != NULL;
if(anIsInitialized){
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
- SetStoreIDMapping(true);
+ // SetStoreIDMapping(true);
myExtractUnstructuredGrid->Update();
vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
aScalars->SetNumberOfComponents(1);
aScalars->SetNumberOfTuples(aNbCells);
+ double* range = 0;// = aScalars->GetRange();
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
- if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
- for(vtkIdType i = 0; i < aNbCells; i++){
+ if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get()))
+ {
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ {
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
double aValue = aNumericalFunctor->GetValue(anObjId);
aScalars->SetValue(i,aValue);
}
- }else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
- for(vtkIdType i = 0; i < aNbCells; i++){
+ range = aScalars->GetRange();
+ if ( range[1] - range[0] < ( qMax(qAbs(range[0]),qAbs(range[1])) + 1e-100 ) * 1e-6 )
+ {
+ range[1] = range[0];
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ aScalars->SetValue(i,range[0]);
+ }
+ }
+ else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get()))
+ {
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ {
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
bool aValue = aPredicate->IsSatisfy(anObjId);
aScalars->SetValue(i,aValue);
}
+ range = aScalars->GetRange();
}
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
-
- theLookupTable->SetRange(aScalars->GetRange());
+
+ theLookupTable->SetRange( range );
theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
theLookupTable->Build();
- myMergeFilter->SetScalars(aDataSet);
+ myMergeFilter->SetScalarsData(aDataSet);
aDataSet->Delete();
}
GetMapper()->SetScalarVisibility(anIsInitialized);
SMESH_ScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
- bool anIsInitialized = theFunctor;
+ bool anIsInitialized = theFunctor != NULL;
myExtractUnstructuredGrid->ClearRegisteredCells();
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
-
+
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(2);
-
+
Length2D::TValues::const_iterator anIter = aValues.begin();
- for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
+ aNbCells = 0;
+ for(; anIter != aValues.end(); anIter++){
const Length2D::Value& aValue = *anIter;
- int aNode[2] = {
+ vtkIdType aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,aValue.myLength);
+ aScalars->SetValue(aNbCells,aValue.myLength);
+ aNbCells++;
}
}
-
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ aCellTypesArray->SetNumberOfTuples( aNbCells );
+ aScalars->SetNumberOfTuples( aNbCells );
+
+ vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
-
+
aConnectivity->InitTraversal();
- for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+ vtkIdType const *pts(nullptr);
+ for( vtkIdType idType = 0, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
-
- aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+
+ aDataSet->SetCells( aCellTypesArray, aCellLocationsArray, aConnectivity );
SetUnstructuredGrid(aDataSet);
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
-
+
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->Build();
-
- myMergeFilter->SetScalars(aDataSet);
+
+ myMergeFilter->SetScalarsData(aDataSet);
aDataSet->Delete();
}
else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
vtkIdType aCellsSize = 3*aNbCells;
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate( aCellsSize, 0 );
-
+
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
-
+
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(2);
-
+
MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
- for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
+ aNbCells = 0;
+ for(; anIter != aValues.end(); anIter++){
const MultiConnection2D::Value& aValue = (*anIter).first;
- int aNode[2] = {
+ vtkIdType aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,(*anIter).second);
+ aScalars->SetValue( aNbCells,(*anIter).second);
+ aNbCells++;
}
}
-
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ aCellTypesArray->SetNumberOfTuples( aNbCells );
+ aScalars->SetNumberOfTuples( aNbCells );
+
+ vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
-
+
aConnectivity->InitTraversal();
- for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+ vtkIdType const *pts(nullptr);
+ for( vtkIdType idType = 0, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
-
+
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
-
+
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->Build();
-
- myMergeFilter->SetScalars(aDataSet);
+
+ myMergeFilter->SetScalarsData(aDataSet);
aDataSet->Delete();
}
}
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
- if ( dynamic_cast<FreeBorders *>(theFunctor.get()) ||
- dynamic_cast<FreeFaces *>(theFunctor.get()) ||
- dynamic_cast<BareBorderVolume *>(theFunctor.get()) ||
- dynamic_cast<BareBorderFace *>(theFunctor.get()) ||
- dynamic_cast<OverConstrainedVolume*>(theFunctor.get()) ||
- dynamic_cast<CoincidentElements1D *>(theFunctor.get()) ||
- dynamic_cast<CoincidentElements2D *>(theFunctor.get()) ||
- dynamic_cast<CoincidentElements3D *>(theFunctor.get()) ||
- dynamic_cast<OverConstrainedFace *>(theFunctor.get()))
+ Predicate* aPredicate = 0;
+ if (( aPredicate = dynamic_cast<FreeBorders *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<FreeFaces *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<BareBorderVolume *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<BareBorderFace *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<OverConstrainedVolume*>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<CoincidentElements1D *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<CoincidentElements2D *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<CoincidentElements3D *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<OverConstrainedFace *>(theFunctor.get())))
{
- Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get());
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
for(; anIter != aBorders.end(); anIter++){
const FreeEdges::Border& aBorder = *anIter;
- int aNode[2] = {
+ vtkIdType aNode[2] = {
myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
};
}
}
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
aConnectivity->InitTraversal();
- for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+ vtkIdType const *pts(nullptr);
+ for( vtkIdType idType = 0, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
aDataSet->Delete();
}
- else if(dynamic_cast<FreeNodes *>(theFunctor.get()) ||
- dynamic_cast<CoincidentNodes*>(theFunctor.get()))
+ else if (( aPredicate = dynamic_cast<FreeNodes *>(theFunctor.get())) ||
+ ( aPredicate = dynamic_cast<CoincidentNodes*>(theFunctor.get())))
{
- Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get());
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
- vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node);
+ vtkIdType aNbNodes = FromSmIdType<vtkIdType>(myVisualObj->GetNbEntities(SMDSAbs_Node));
for( vtkIdType i = 0; i < aNbNodes; i++ ){
vtkIdType anObjId = myVisualObj->GetNodeObjId(i);
if(aPredicate->IsSatisfy(anObjId))
-unsigned long int
+vtkMTimeType
SMESH_DeviceActor
::GetMTime()
{
- unsigned long mTime = this->Superclass::GetMTime();
+ // cout << "DA " << this
+ // << " GF " << myGeomFilter;
+ // if ( this->Property )
+ // cout << " P " << this->Property->GetMTime();
+ // if ( this->BackfaceProperty != NULL )
+ // cout << " BP " << BackfaceProperty->GetMTime();
+ // if ( this->Texture != NULL )
+ // cout << " T " << this->Texture->GetMTime();
+ // cout << " U " << this->GetUserTransformMatrixMTime()
+ // << " M " << this->MTime.GetMTime() << endl;
+
+ // cout << "DA " << this
+ // << " GF " << myGeomFilter
+ // << " " << this->Superclass::GetMTime()
+ // << " " << myExtractGeometry->GetMTime()
+ // << " " << myExtractUnstructuredGrid->GetMTime()
+ // << " " << myMergeFilter->GetMTime()
+ // << " " << myGeomFilter->GetMTime()
+ // << " " << myTransformFilter->GetMTime()
+ // << " " << myFaceOrientationFilter->GetMTime() << endl;
+
+ vtkMTimeType mTime = this->Superclass::GetMTime();
mTime = max(mTime,myExtractGeometry->GetMTime());
mTime = max(mTime,myExtractUnstructuredGrid->GetMTime());
mTime = max(mTime,myMergeFilter->GetMTime());
::SetShrink()
{
if ( !myIsShrinkable ) return;
- if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
+ if ( vtkAlgorithmOutput* aDataSet = myPassFilter[ 0 ]->GetOutputPort() )
{
- myShrinkFilter->SetInput( aDataSet );
- myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
+ myShrinkFilter->SetInputConnection( aDataSet );
+ myPassFilter[ 1 ]->SetInputConnection( myShrinkFilter->GetOutputPort() );
myIsShrunk = true;
}
}
::UnShrink()
{
if ( !myIsShrunk ) return;
- if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
+ if ( vtkAlgorithmOutput* aDataSet = myPassFilter[ 0 ]->GetOutputPort() )
{
- myPassFilter[ 1 ]->SetInput( aDataSet );
+ myPassFilter[ 1 ]->SetInputConnection( aDataSet );
myPassFilter[ 1 ]->Modified();
myIsShrunk = false;
Modified();
SMESH_DeviceActor
::SetFacesOriented(bool theIsFacesOriented)
{
- if ( vtkDataSet* aDataSet = myTransformFilter->GetOutput() )
+ if ( vtkAlgorithmOutput* aDataSet = myTransformFilter->GetOutputPort() )
{
myIsFacesOriented = theIsFacesOriented;
if( theIsFacesOriented )
- myFaceOrientationFilter->SetInput( aDataSet );
+ myFaceOrientationFilter->SetInputConnection( aDataSet );
UpdateFaceOrientation();
}
}
void
SMESH_DeviceActor
-::SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
+::SetFacesOrientationColor(double r,double g,double b)
{
myFaceOrientation->GetProperty()->SetColor( r, g, b );
}
void
SMESH_DeviceActor
-::GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
+::GetFacesOrientationColor(double& r,double& g,double& b)
{
myFaceOrientation->GetProperty()->GetColor( r, g, b );
}
void
SMESH_DeviceActor
-::SetFacesOrientationScale(vtkFloatingPointType theScale)
+::SetFacesOrientationScale(double theScale)
{
myFaceOrientationFilter->SetOrientationScale( theScale );
}
-vtkFloatingPointType
+double
SMESH_DeviceActor
::GetFacesOrientationScale()
{
::UpdateFaceOrientation()
{
bool aShowFaceOrientation = myIsFacesOriented;
- aShowFaceOrientation &= GetVisibility();
- aShowFaceOrientation &= myRepresentation == eSurface;
+ aShowFaceOrientation &= vtkLODActor::GetVisibility(); //GetVisibility(); -- avoid calling GetUnstructuredGrid()
+ aShowFaceOrientation &= ( myRepresentation != ePoint );
myFaceOrientation->SetVisibility(aShowFaceOrientation);
}
SMESH_DeviceActor
::SetRepresentation(EReperesent theMode)
{
+ if ( myRepresentation == theMode )
+ return;
switch(theMode){
case ePoint:
myGeomFilter->SetInside(true);
myGeomFilter->SetInside(false);
myGeomFilter->SetWireframeMode(false);
GetProperty()->SetRepresentation(theMode);
+ case eNoneRepr:
+ return;
}
SetMarkerEnabled(theMode == ePoint);
myRepresentation = theMode;
SMESH_DeviceActor
::SetVisibility(int theMode)
{
- if(!myExtractUnstructuredGrid->GetInput() ||
- GetUnstructuredGrid()->GetNumberOfCells())
+ if(( theMode ) &&
+ ( !myExtractUnstructuredGrid->GetInput() ||
+ GetUnstructuredGrid()->GetNumberOfCells()))
{
vtkLODActor::SetVisibility(theMode);
}else{
SMESH_DeviceActor
::GetVisibility()
{
- if(!GetUnstructuredGrid()->GetNumberOfCells()){
+ int visibi = vtkLODActor::GetVisibility();
+ if(visibi && !GetUnstructuredGrid()->GetNumberOfCells()){
vtkLODActor::SetVisibility(false);
+ visibi = 0;
}
- return vtkLODActor::GetVisibility();
+ return visibi;
}
}
-int
+vtkIdType
SMESH_DeviceActor
-::GetNodeObjId(int theVtkID)
+::GetNodeObjId(vtkIdType theVtkID)
{
vtkIdType anID = theVtkID;
anID = myExtractGeometry->GetNodeObjId(theVtkID);
vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
- if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
+ MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
return aRetID;
}
-vtkFloatingPointType*
+double*
SMESH_DeviceActor
-::GetNodeCoord(int theObjID)
+::GetNodeCoord(vtkIdType theObjID)
{
vtkDataSet* aDataSet = myMergeFilter->GetOutput();
vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
- vtkFloatingPointType* aCoord = (anID >=0) ? aDataSet->GetPoint(anID) : NULL;
- if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
+ double* aCoord = (anID >=0 && anID < aDataSet->GetNumberOfPoints()) ? aDataSet->GetPoint(anID) : NULL;
+ MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
return aCoord;
}
+vtkIdType
+SMESH_DeviceActor
+::GetNodeVtkId(vtkIdType theObjID)
+{
+ return myVisualObj->GetNodeVTKId(theObjID);
+}
-int
+vtkIdType
SMESH_DeviceActor
-::GetElemObjId(int theVtkID)
+::GetElemObjId(vtkIdType theVtkID)
{
vtkIdType anId = myGeomFilter->GetElemObjId(theVtkID);
if(anId < 0)
return -1;
vtkIdType aRetID = myVisualObj->GetElemObjId(anId3);
- if(MYDEBUG)
- MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID);
+
+ MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID);
return aRetID;
}
vtkCell*
SMESH_DeviceActor
-::GetElemCell(int theObjID)
+::GetElemCell(vtkIdType theObjID)
{
vtkDataSet* aDataSet = myVisualObj->GetUnstructuredGrid();
vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID);
vtkCell* aCell = (aGridID >= 0 ) ? aDataSet->GetCell(aGridID) : NULL;
- if(MYDEBUG)
- MESSAGE("GetElemCell - theObjID = "<<theObjID<<"; aGridID = "<<aGridID);
+
+ MESSAGE("GetElemCell - theObjID = "<<theObjID<<"; aGridID = "<<aGridID);
return aCell;
}
-vtkFloatingPointType
+double
SMESH_DeviceActor
::GetShrinkFactor()
{
void
SMESH_DeviceActor
-::SetShrinkFactor(vtkFloatingPointType theValue)
+::SetShrinkFactor(double theValue)
{
theValue = theValue > 0.1? theValue: 0.8;
myShrinkFilter->SetShrinkFactor(theValue);
::Render(vtkRenderer *ren, vtkMapper* m)
{
int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
- vtkFloatingPointType aStoredFactor, aStoredUnit;
+ double aStoredFactor, aStoredUnit;
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
- vtkFloatingPointType aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
+ double aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
if(myIsHighlited){
- static vtkFloatingPointType EPS = .01;
+ static double EPS = .01;
aUnits *= (1.0-EPS);
}
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnits);
void
SMESH_DeviceActor
-::SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units)
+::SetPolygonOffsetParameters(double factor,
+ double units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
/*!
* Set Max angle for representation 2D quadratic element as arked polygon
*/
-void SMESH_DeviceActor::SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle){
+void SMESH_DeviceActor::SetQuadraticArcAngle(double theMaxAngle){
myGeomFilter->SetQuadraticArcAngle(theMaxAngle);
}
/*!
* Return Max angle of the representation 2D quadratic element as arked polygon
*/
-vtkFloatingPointType SMESH_DeviceActor::GetQuadraticArcAngle(){
+double SMESH_DeviceActor::GetQuadraticArcAngle(){
return myGeomFilter->GetQuadraticArcAngle();
}
myMapper->SetMarkerEnabled( theMarkerEnabled );
}
+/*!
+ * Set point marker enabled
+ * \param theBallEnabled flag to enable/disable ball drawing
+ */
+void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
+ myMapper->SetBallEnabled( theBallEnabled );
+}
+
+/*!
+ * Set point marker scale factor
+ * \param theBallScale double value which specifies a scale factor of ball element
+ */
+void SMESH_DeviceActor::SetBallScale( double theBallScale )
+{
+ myMapper->SetBallScale( theBallScale );
+ myMapper->Modified();
+}
+
/*!
* Set standard point marker
* \param theMarkerType type of the marker
return myMapper->GetMarkerTexture();
}
+/*!
+ * Get scale factor of ball element
+ * \return scale factor of ball element
+ */
+double SMESH_DeviceActor::GetBallScale()
+{
+ return myMapper->GetBallScale();
+}
+
void SMESH_DeviceActor::SetCoincident3DAllowed(bool theFlag) {
myGeomFilter->SetAppendCoincident3D(theFlag);
}