X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_DeviceActor.cxx;h=d53765d79baf12703c580dad0c702028a1d3c08c;hb=70bcc2ddff02a8390065e549f766c0088746b143;hp=4be8cadec51d855ad2af99e58b2fdf3d1a0c9b83;hpb=9357f5c87098aff2b95b754d69f66c76d2df9c24;p=modules%2Fsmesh.git diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 4be8cadec..d53765d79 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -1,23 +1,23 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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. +// 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. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // SMESH OBJECT : interactive object for SMESH visualization @@ -26,6 +26,7 @@ // Module : SMESH // #include "SMESH_DeviceActor.h" +#include "SMESH_ScalarBarActor.h" #include "SMESH_ExtractGeometry.h" #include "SMESH_ControlsDef.hxx" #include "SMESH_ActorUtils.h" @@ -48,7 +49,6 @@ #include #include -#include #include #include #include @@ -240,17 +240,17 @@ SMESH_DeviceActor myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 1 - myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); + myTransformFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 2 - myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); + myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() ); myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 3 - myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); + myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 4 - myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() ); + myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 5 @@ -282,7 +282,7 @@ SMESH_DeviceActor void SMESH_DeviceActor ::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, + SMESH_ScalarBarActor* theScalarBarActor, vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; @@ -336,7 +336,7 @@ SMESH_DeviceActor void SMESH_DeviceActor ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, + SMESH_ScalarBarActor* theScalarBarActor, vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; @@ -484,21 +484,31 @@ SMESH_DeviceActor myVisualObj->UpdateFunctor(theFunctor); using namespace SMESH::Controls; - if ( dynamic_cast(theFunctor.get()) || - dynamic_cast(theFunctor.get()) ) { - Predicate* aFreePredicate = dynamic_cast(theFunctor.get()); + if ( dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get())) + { + Predicate* aPredicate = dynamic_cast(theFunctor.get()); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid(); vtkIdType aNbCells = aGrid->GetNumberOfCells(); for( vtkIdType i = 0; i < aNbCells; i++ ){ vtkIdType anObjId = myVisualObj->GetElemObjId(i); - if(aFreePredicate->IsSatisfy(anObjId)) + if(aPredicate->IsSatisfy(anObjId)) myExtractUnstructuredGrid->RegisterCell(i); } if(!myExtractUnstructuredGrid->IsCellsRegistered()) myExtractUnstructuredGrid->RegisterCell(-1); SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); - }else if(FreeEdges* aFreeEdges = dynamic_cast(theFunctor.get())){ + } + else if(FreeEdges* aFreeEdges = dynamic_cast(theFunctor.get())) + { SMESH::Controls::FreeEdges::TBorders aBorders; aFreeEdges->GetBoreders(aBorders); vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New(); @@ -545,12 +555,16 @@ SMESH_DeviceActor SetUnstructuredGrid(aDataSet); aDataSet->Delete(); - }else if(FreeNodes* aFreeNodes = dynamic_cast(theFunctor.get())){ + } + else if(dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get())) + { + Predicate* aPredicate = dynamic_cast(theFunctor.get()); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node); for( vtkIdType i = 0; i < aNbNodes; i++ ){ vtkIdType anObjId = myVisualObj->GetNodeObjId(i); - if(aFreeNodes->IsSatisfy(anObjId)) + if(aPredicate->IsSatisfy(anObjId)) myExtractUnstructuredGrid->RegisterCell(i); } if(!myExtractUnstructuredGrid->IsCellsRegistered()) @@ -617,7 +631,7 @@ void SMESH_DeviceActor ::SetFacesOriented(bool theIsFacesOriented) { - if ( vtkDataSet* aDataSet = myPassFilter[ 1 ]->GetOutput() ) + if ( vtkDataSet* aDataSet = myTransformFilter->GetOutput() ) { myIsFacesOriented = theIsFacesOriented; if( theIsFacesOriented ) @@ -628,16 +642,16 @@ SMESH_DeviceActor void SMESH_DeviceActor -::SetFacesOrientationColor(vtkFloatingPointType theColor[3]) +::SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) { - myFaceOrientation->GetProperty()->SetColor( theColor ); + myFaceOrientation->GetProperty()->SetColor( r, g, b ); } void SMESH_DeviceActor -::GetFacesOrientationColor(vtkFloatingPointType theColor[3]) +::GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) { - myFaceOrientation->GetProperty()->GetColor( theColor ); + myFaceOrientation->GetProperty()->GetColor( r, g, b ); } void @@ -958,3 +972,11 @@ int SMESH_DeviceActor::GetMarkerTexture() { return myMapper->GetMarkerTexture(); } + +void SMESH_DeviceActor::SetCoincident3DAllowed(bool theFlag) { + myGeomFilter->SetAppendCoincident3D(theFlag); +} + +bool SMESH_DeviceActor::IsCoincident3DAllowed() const { + return myGeomFilter->GetAppendCoincident3D(); +}