-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 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);
myExtractUnstructuredGrid->SetInputData(theGrid);
myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
+
+ //Pass diameters of the balls
+ if(myMapper->GetBallEnabled()) {
+ myMergeFilter->SetScalarsConnection(myExtractUnstructuredGrid->GetOutputPort());
+ }
myExtractGeometry->SetInputConnection(myMergeFilter->GetOutputPort());
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
vtkIdType aNbCells = aGrid->GetNumberOfCells();
aScalars->SetNumberOfComponents(1);
aScalars->SetNumberOfTuples(aNbCells);
+ double* range;// = aScalars->GetRange();
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
- if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
+ if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get()))
+ {
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())){
+ 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()))
+ {
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();
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);
}