-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
myIsShrunk = false;
myIsHighlited = false;
- myRepresentation = eSurface;
+ myRepresentation = SMESH_DeviceActor::EReperesent(-1);
myProperty = vtkProperty::New();
myMapper = VTKViewer_PolyDataMapper::New();
if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
myMapper->Delete();
-
+ // myPlaneCollection->Delete(); -- it is vtkSmartPointer
myProperty->Delete();
myExtractGeometry->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)
SMESH_DeviceActor
::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid)
{
- if(theGrid){
- //myIsShrinkable = theGrid->GetNumberOfCells() > 10;
- myIsShrinkable = true;
+ myExtractUnstructuredGrid->SetInputData(theGrid);
- myExtractUnstructuredGrid->SetInputData(theGrid);
+ if ( theGrid )
+ {
+ myIsShrinkable = true;
myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
-
+
//Pass diameters of the balls
if(myMapper->GetBallEnabled()) {
myMergeFilter->SetScalarsConnection(myExtractUnstructuredGrid->GetOutputPort());
int anId = 0;
SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
myPassFilter[ anId + 1]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
-
+
anId++; // 1
myTransformFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
myGeomFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
anId++; // 4
- myPassFilter[ anId ]->SetInputConnection( myGeomFilter->GetOutputPort() );
+ myPassFilter[ anId ]->SetInputConnection( myGeomFilter->GetOutputPort() );
myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
anId++; // 5
myMapper->SetClippingPlanes( myPlaneCollection );
vtkLODActor::SetMapper( myMapper );
- Modified();
}
+ Modified();
}
void
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;// = aScalars->GetRange();
+ 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++){
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ {
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
double aValue = aNumericalFunctor->GetValue(anObjId);
}
else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get()))
{
- for(vtkIdType i = 0; i < aNbCells; i++){
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ {
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
bool aValue = aPredicate->IsSatisfy(anObjId);
SMESH_ScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
- bool anIsInitialized = theFunctor;
+ bool anIsInitialized = theFunctor != NULL;
myExtractUnstructuredGrid->ClearRegisteredCells();
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
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();
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);
for( vtkIdType i = 0; i < aNbNodes; i++ ){
-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());
::UpdateFaceOrientation()
{
bool aShowFaceOrientation = myIsFacesOriented;
- aShowFaceOrientation &= GetVisibility();
+ aShowFaceOrientation &= vtkLODActor::GetVisibility(); //GetVisibility(); -- avoid calling GetUnstructuredGrid()
aShowFaceOrientation &= myRepresentation == eSurface;
myFaceOrientation->SetVisibility(aShowFaceOrientation);
}
SMESH_DeviceActor
::SetRepresentation(EReperesent theMode)
{
+ if ( myRepresentation == theMode )
+ return;
switch(theMode){
case ePoint:
myGeomFilter->SetInside(true);
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;
}
{
vtkDataSet* aDataSet = myMergeFilter->GetOutput();
vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
- double* aCoord = (anID >=0) ? aDataSet->GetPoint(anID) : NULL;
+ double* aCoord = (anID >=0 && anID < aDataSet->GetNumberOfPoints()) ? aDataSet->GetPoint(anID) : NULL;
if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
return aCoord;
}