-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 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 <vtkRenderer.h>
+#include <vtkPlaneCollection.h>
+
#include "utilities.h"
#ifdef _DEBUG_
myProperty = vtkProperty::New();
myMapper = VTKViewer_PolyDataMapper::New();
+ myPlaneCollection = vtkPlaneCollection::New();
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
myPolygonOffsetUnits);
anId++; // 5
myMapper->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
+ if( myPlaneCollection->GetNumberOfItems() )
+ myMapper->SetClippingPlanes( myPlaneCollection );
vtkLODActor::SetMapper( myMapper );
Modified();
}
}
+void
+SMESH_DeviceActor
+::SetPlaneCollection( vtkPlaneCollection* theCollection )
+{
+ myPlaneCollection = theCollection;
+}
VTKViewer_ExtractUnstructuredGrid*
SMESH_DeviceActor
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] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,aValue.myLength);
+ aScalars->SetValue(aNbCells,aValue.myLength);
+ aNbCells++;
}
}
-
+ aCellTypesArray->SetNumberOfTuples( aNbCells );
+ aScalars->SetNumberOfTuples( aNbCells );
+
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
-
+
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, 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->SetScalarsData(aDataSet);
aDataSet->Delete();
}
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] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,(*anIter).second);
+ aScalars->SetValue( aNbCells,(*anIter).second);
+ aNbCells++;
}
}
-
+ aCellTypesArray->SetNumberOfTuples( aNbCells );
+ aScalars->SetNumberOfTuples( aNbCells );
+
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
-
+
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, 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->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();
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++ ){
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);
}