-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// 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
// 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
//
+
+// VISU OBJECT : interactive object for VISU entities implementation
// File: VISU_DataSetMapperHolder.cxx
// Author: Alexey PETROV
// Module : VISU
-
-
+//
#include "VISU_DataSetMapperHolder.hxx"
#include "SALOME_ExtractGeometry.h"
+#include "VISU_ElnoDisassembleFilter.hxx"
#include "VISU_LookupTable.hxx"
#include "VISU_PipeLineUtils.hxx"
#include <vtkImplicitFunctionCollection.h>
#include <vtkMath.h>
+#include <cmath>
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
//----------------------------------------------------------------------------
VISU_DataSetMapperHolder
::VISU_DataSetMapperHolder():
- myExtractGeometry(SALOME_ExtractGeometry::New())
+ myElnoDisassembleFilter( VISU_ElnoDisassembleFilter::New() ),
+ myExtractGeometry( SALOME_ExtractGeometry::New() )
{
if(MYDEBUG) MESSAGE("VISU_DataSetMapperHolder::VISU_DataSetMapperHolder - "<<this);
+ myElnoDisassembleFilter->Delete();
+
// Clipping functionality
myExtractGeometry->Delete();
myExtractGeometry->SetStoreMapping(true);
void
VISU_DataSetMapperHolder
::ShallowCopy(VISU_MapperHolder *theMapperHolder,
- bool theIsCopyInput)
+ bool theIsCopyInput)
{
if(VISU_DataSetMapperHolder* aMapperHolder = dynamic_cast<VISU_DataSetMapperHolder*>(theMapperHolder)){
if(theIsCopyInput)
SetUnstructuredGridIDMapper(aMapperHolder->GetUnstructuredGridIDMapper());
VISU::CopyDataSetMapper(GetDataSetMapper(),
- aMapperHolder->GetDataSetMapper(),
- theIsCopyInput);
+ aMapperHolder->GetDataSetMapper(),
+ theIsCopyInput);
+ myExtractGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction());
}
}
+//----------------------------------------------------------------------------
+void
+VISU_DataSetMapperHolder
+::SetElnoDisassembleState( bool theIsShrunk )
+{
+ vtkFloatingPointType aShrinkFactor = std::abs( myElnoDisassembleFilter->GetShrinkFactor() );
+ if ( theIsShrunk )
+ myElnoDisassembleFilter->SetShrinkFactor( aShrinkFactor );
+ else
+ myElnoDisassembleFilter->SetShrinkFactor( -aShrinkFactor );
+}
+
+
//----------------------------------------------------------------------------
unsigned long int
VISU_DataSetMapperHolder
VISU_DataSetMapperHolder
::SetUnstructuredGridIDMapper(const VISU::PUnstructuredGridIDMapper& theIDMapper)
{
- myExtractGeometry->SetInput(theIDMapper->GetUnstructuredGridOutput());
+ myElnoDisassembleFilter->SetInput( theIDMapper->GetUnstructuredGridOutput() );
+ myExtractGeometry->SetInput( myElnoDisassembleFilter->GetOutput() );
myUnstructuredGridIDMapper = theIDMapper;
- SetIDMapper(theIDMapper);
+ SetIDMapper( theIDMapper );
}
//----------------------------------------------------------------------------
vtkFloatingPointType*
VISU_DataSetMapperHolder
-::GetNodeCoord(int theObjID)
+::GetNodeCoord(vtkIdType theObjID)
{
return Superclass::GetNodeCoord(theObjID);
}
if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
aFunction->AddItem(thePlane);
+ aBoolean->Modified();
// Check, that at least one cell present after clipping.
// This check was introduced because of bug IPAL8849.
vtkDataSet* aClippedDataSet = GetClippedInput();
vtkImplicitFunction* aFun = NULL;
aFunction->InitTraversal();
for(vtkIdType anID = 0; anID <= theID; anID++)
- aFun = aFunction->GetNextItem();
+ aFun = aFunction->GetNextItem();
aPlane = dynamic_cast<vtkPlane*>(aFun);
}
}
return aPlane;
}
+//----------------------------------------------------------------------------
+void VISU_DataSetMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+ aFunctions->RemoveItem(theID);
+ aBoolean->Modified();
+ }
+ }
+}
+
+
//----------------------------------------------------------------------------
void
VISU_DataSetMapperHolder