1 // SMESH OBJECT : interactive object for SMESH visualization
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SMESH_DeviceActor.cxx
30 #include "SMESH_DeviceActor.h"
31 #include "SMESH_ExtractGeometry.h"
32 #include "SMESH_ControlsDef.hxx"
33 #include "SMESH_ActorUtils.h"
34 #include "VTKViewer_CellLocationsArray.h"
36 #include <VTKViewer_Transform.h>
37 #include <VTKViewer_TransformFilter.h>
38 #include <VTKViewer_ExtractUnstructuredGrid.h>
41 #include <vtkObjectFactory.h>
42 #include <vtkShrinkFilter.h>
43 #include <vtkShrinkPolyData.h>
45 #include <vtkProperty.h>
46 #include <vtkPolyData.h>
47 #include <vtkMergeFilter.h>
48 #include <vtkPolyDataMapper.h>
49 #include <vtkUnstructuredGrid.h>
51 #include <vtkScalarBarActor.h>
52 #include <vtkLookupTable.h>
53 #include <vtkDoubleArray.h>
54 #include <vtkCellData.h>
57 #include <vtkIdList.h>
58 #include <vtkCellArray.h>
59 #include <vtkUnsignedCharArray.h>
61 #include <vtkImplicitBoolean.h>
62 #include <vtkPassThroughFilter.h>
64 #include "utilities.h"
67 static int MYDEBUG = 0;
69 static int MYDEBUG = 0;
75 vtkStandardNewMacro(SMESH_DeviceActor);
81 if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<<this);
83 myIsShrinkable = false;
85 myIsHighlited = false;
87 myRepresentation = eSurface;
89 myProperty = vtkProperty::New();
90 myMapper = vtkPolyDataMapper::New();
92 vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
93 myPolygonOffsetUnits);
95 myMapper->UseLookupTableScalarRangeOn();
96 myMapper->SetColorModeToMapScalars();
98 myShrinkFilter = vtkShrinkFilter::New();
100 myStoreClippingMapping = false;
102 myExtractGeometry = SMESH_ExtractGeometry::New();
103 myExtractGeometry->SetReleaseDataFlag(true);
104 myIsImplicitFunctionUsed = false;
106 myExtractUnstructuredGrid = VTKViewer_ExtractUnstructuredGrid::New();
108 myMergeFilter = vtkMergeFilter::New();
110 myGeomFilter = VTKViewer_GeometryFilter::New();
112 myTransformFilter = VTKViewer_TransformFilter::New();
114 for(int i = 0; i < 6; i++)
115 myPassFilter.push_back(vtkPassThroughFilter::New());
120 ::~SMESH_DeviceActor()
122 if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
124 myProperty->Delete();
128 myShrinkFilter->Delete();
130 myExtractUnstructuredGrid->Delete();
132 myMergeFilter->Delete();
134 myGeomFilter->Delete();
136 myExtractGeometry->Delete();
138 myTransformFilter->Delete();
140 for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
141 myPassFilter[i]->Delete();
148 ::SetStoreGemetryMapping(bool theStoreMapping)
150 myGeomFilter->SetStoreMapping(theStoreMapping);
151 SetStoreClippingMapping(theStoreMapping);
157 ::SetStoreClippingMapping(bool theStoreMapping)
159 myStoreClippingMapping = theStoreMapping;
160 myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
161 SetStoreIDMapping(theStoreMapping);
167 ::SetStoreIDMapping(bool theStoreMapping)
169 myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping);
175 ::Init(TVisualObjPtr theVisualObj,
176 vtkImplicitBoolean* theImplicitBoolean)
178 myVisualObj = theVisualObj;
179 myExtractGeometry->SetImplicitFunction(theImplicitBoolean);
180 SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
186 ::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
189 if(theIsImplicitFunctionUsed)
190 myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
192 myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
194 myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
195 SetStoreClippingMapping(myStoreClippingMapping);
201 ::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid)
204 //myIsShrinkable = theGrid->GetNumberOfCells() > 10;
205 myIsShrinkable = true;
207 myExtractUnstructuredGrid->SetInput(theGrid);
209 myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
211 myExtractGeometry->SetInput(myMergeFilter->GetOutput());
214 SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
215 myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
218 myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
221 myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
222 myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
225 myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
226 myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
229 myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
230 myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
231 myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
232 myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
235 myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
236 myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
238 vtkLODActor::SetMapper( myMapper );
244 VTKViewer_ExtractUnstructuredGrid*
246 ::GetExtractUnstructuredGrid()
248 return myExtractUnstructuredGrid;
254 ::GetUnstructuredGrid()
256 myExtractUnstructuredGrid->Update();
257 return myExtractUnstructuredGrid->GetOutput();
263 ::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
264 vtkScalarBarActor* theScalarBarActor,
265 vtkLookupTable* theLookupTable)
267 bool anIsInitialized = theFunctor;
269 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
271 SetStoreIDMapping(true);
272 myExtractUnstructuredGrid->Update();
273 vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
275 aDataSet->ShallowCopy(aGrid);
277 vtkDoubleArray *aScalars = vtkDoubleArray::New();
278 vtkIdType aNbCells = aGrid->GetNumberOfCells();
279 aScalars->SetNumberOfComponents(1);
280 aScalars->SetNumberOfTuples(aNbCells);
282 myVisualObj->UpdateFunctor(theFunctor);
284 using namespace SMESH::Controls;
285 if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
286 for(vtkIdType i = 0; i < aNbCells; i++){
287 vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
288 vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
289 double aValue = aNumericalFunctor->GetValue(anObjId);
290 aScalars->SetValue(i,aValue);
292 }else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
293 for(vtkIdType i = 0; i < aNbCells; i++){
294 vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
295 vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
296 bool aValue = aPredicate->IsSatisfy(anObjId);
297 aScalars->SetValue(i,aValue);
301 aDataSet->GetCellData()->SetScalars(aScalars);
304 theLookupTable->SetRange(aScalars->GetRange());
305 theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
306 theLookupTable->Build();
308 myMergeFilter->SetScalars(aDataSet);
311 GetMapper()->SetScalarVisibility(anIsInitialized);
312 theScalarBarActor->SetVisibility(anIsInitialized);
317 ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
318 vtkScalarBarActor* theScalarBarActor,
319 vtkLookupTable* theLookupTable)
321 bool anIsInitialized = theFunctor;
322 myExtractUnstructuredGrid->ClearRegisteredCells();
323 myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
324 myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
325 myVisualObj->UpdateFunctor(theFunctor);
327 using namespace SMESH::Controls;
328 if (anIsInitialized){
329 if (Length2D* aLength2D = dynamic_cast<Length2D*>(theFunctor.get())){
330 SMESH::Controls::Length2D::TValues aValues;
332 aLength2D->GetValues(aValues);
333 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
334 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
336 aDataSet->SetPoints(aGrid->GetPoints());
338 vtkIdType aNbCells = aValues.size();
340 vtkDoubleArray *aScalars = vtkDoubleArray::New();
341 aScalars->SetNumberOfComponents(1);
342 aScalars->SetNumberOfTuples(aNbCells);
344 vtkIdType aCellsSize = 3*aNbCells;
345 vtkCellArray* aConnectivity = vtkCellArray::New();
346 aConnectivity->Allocate( aCellsSize, 0 );
348 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
349 aCellTypesArray->SetNumberOfComponents( 1 );
350 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
352 vtkIdList *anIdList = vtkIdList::New();
353 anIdList->SetNumberOfIds(2);
355 Length2D::TValues::const_iterator anIter = aValues.begin();
356 for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
357 const Length2D::Value& aValue = *anIter;
359 myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
360 myVisualObj->GetNodeVTKId(aValue.myPntId[1])
362 if(aNode[0] >= 0 && aNode[1] >= 0){
363 anIdList->SetId( 0, aNode[0] );
364 anIdList->SetId( 1, aNode[1] );
365 aConnectivity->InsertNextCell( anIdList );
366 aCellTypesArray->InsertNextValue( VTK_LINE );
367 aScalars->SetValue(aVtkId,aValue.myLength);
371 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
372 aCellLocationsArray->SetNumberOfComponents( 1 );
373 aCellLocationsArray->SetNumberOfTuples( aNbCells );
375 aConnectivity->InitTraversal();
376 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
377 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
379 aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
380 SetUnstructuredGrid(aDataSet);
382 aDataSet->GetCellData()->SetScalars(aScalars);
385 theLookupTable->SetRange(aScalars->GetRange());
386 theLookupTable->Build();
388 myMergeFilter->SetScalars(aDataSet);
391 else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
392 SMESH::Controls::MultiConnection2D::MValues aValues;
394 aMultiConnection2D->GetValues(aValues);
395 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
396 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
397 aDataSet->SetPoints(aGrid->GetPoints());
399 vtkIdType aNbCells = aValues.size();
400 vtkDoubleArray *aScalars = vtkDoubleArray::New();
401 aScalars->SetNumberOfComponents(1);
402 aScalars->SetNumberOfTuples(aNbCells);
404 vtkIdType aCellsSize = 3*aNbCells;
405 vtkCellArray* aConnectivity = vtkCellArray::New();
406 aConnectivity->Allocate( aCellsSize, 0 );
408 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
409 aCellTypesArray->SetNumberOfComponents( 1 );
410 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
412 vtkIdList *anIdList = vtkIdList::New();
413 anIdList->SetNumberOfIds(2);
415 MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
416 for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
417 const MultiConnection2D::Value& aValue = (*anIter).first;
419 myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
420 myVisualObj->GetNodeVTKId(aValue.myPntId[1])
422 if(aNode[0] >= 0 && aNode[1] >= 0){
423 anIdList->SetId( 0, aNode[0] );
424 anIdList->SetId( 1, aNode[1] );
425 aConnectivity->InsertNextCell( anIdList );
426 aCellTypesArray->InsertNextValue( VTK_LINE );
427 aScalars->SetValue(aVtkId,(*anIter).second);
431 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
432 aCellLocationsArray->SetNumberOfComponents( 1 );
433 aCellLocationsArray->SetNumberOfTuples( aNbCells );
435 aConnectivity->InitTraversal();
436 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
437 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
439 aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
440 SetUnstructuredGrid(aDataSet);
442 aDataSet->GetCellData()->SetScalars(aScalars);
445 theLookupTable->SetRange(aScalars->GetRange());
446 theLookupTable->Build();
448 myMergeFilter->SetScalars(aDataSet);
452 GetMapper()->SetScalarVisibility(anIsInitialized);
453 theScalarBarActor->SetVisibility(anIsInitialized);
458 ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor)
460 myExtractUnstructuredGrid->ClearRegisteredCells();
461 myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
462 myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
463 myVisualObj->UpdateFunctor(theFunctor);
465 using namespace SMESH::Controls;
466 if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
467 myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
468 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
469 vtkIdType aNbCells = aGrid->GetNumberOfCells();
470 for( vtkIdType i = 0; i < aNbCells; i++ ){
471 vtkIdType anObjId = myVisualObj->GetElemObjId(i);
472 if(aFreeBorders->IsSatisfy(anObjId))
473 myExtractUnstructuredGrid->RegisterCell(i);
475 if(!myExtractUnstructuredGrid->IsCellsRegistered())
476 myExtractUnstructuredGrid->RegisterCell(-1);
477 SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
478 }else if(FreeEdges* aFreeEdges = dynamic_cast<FreeEdges*>(theFunctor.get())){
479 SMESH::Controls::FreeEdges::TBorders aBorders;
480 aFreeEdges->GetBoreders(aBorders);
481 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
482 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
483 aDataSet->SetPoints(aGrid->GetPoints());
485 vtkIdType aNbCells = aBorders.size();
486 vtkIdType aCellsSize = 3*aNbCells;
487 vtkCellArray* aConnectivity = vtkCellArray::New();
488 aConnectivity->Allocate( aCellsSize, 0 );
490 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
491 aCellTypesArray->SetNumberOfComponents( 1 );
492 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
494 vtkIdList *anIdList = vtkIdList::New();
495 anIdList->SetNumberOfIds(2);
497 FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
498 for(; anIter != aBorders.end(); anIter++){
499 const FreeEdges::Border& aBorder = *anIter;
501 myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
502 myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
504 //cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
505 if(aNode[0] >= 0 && aNode[1] >= 0){
506 anIdList->SetId( 0, aNode[0] );
507 anIdList->SetId( 1, aNode[1] );
508 aConnectivity->InsertNextCell( anIdList );
509 aCellTypesArray->InsertNextValue( VTK_LINE );
513 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
514 aCellLocationsArray->SetNumberOfComponents( 1 );
515 aCellLocationsArray->SetNumberOfTuples( aNbCells );
517 aConnectivity->InitTraversal();
518 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
519 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
521 aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
523 SetUnstructuredGrid(aDataSet);
535 unsigned long mTime = this->Superclass::GetMTime();
536 mTime = max(mTime,myExtractGeometry->GetMTime());
537 mTime = max(mTime,myExtractUnstructuredGrid->GetMTime());
538 mTime = max(mTime,myMergeFilter->GetMTime());
539 mTime = max(mTime,myGeomFilter->GetMTime());
540 mTime = max(mTime,myTransformFilter->GetMTime());
547 ::SetTransform(VTKViewer_Transform* theTransform)
549 myTransformFilter->SetTransform(theTransform);
557 if ( !myIsShrinkable ) return;
558 if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
560 myShrinkFilter->SetInput( aDataSet );
561 myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
570 if ( !myIsShrunk ) return;
571 if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
573 myPassFilter[ 1 ]->SetInput( aDataSet );
574 myPassFilter[ 1 ]->Modified();
583 ::SetRepresentation(EReperesent theMode)
587 myGeomFilter->SetInside(true);
588 myGeomFilter->SetWireframeMode(false);
589 GetProperty()->SetRepresentation(0);
592 myGeomFilter->SetInside(false);
593 myGeomFilter->SetWireframeMode(true);
594 GetProperty()->SetRepresentation(theMode);
597 myGeomFilter->SetInside(true);
598 myGeomFilter->SetWireframeMode(true);
599 GetProperty()->SetRepresentation(1);
602 myGeomFilter->SetInside(false);
603 myGeomFilter->SetWireframeMode(false);
604 GetProperty()->SetRepresentation(theMode);
606 myRepresentation = theMode;
607 GetProperty()->Modified();
608 myMapper->Modified();
615 ::SetVisibility(int theMode)
617 if(!myExtractUnstructuredGrid->GetInput() ||
618 GetUnstructuredGrid()->GetNumberOfCells())
620 vtkLODActor::SetVisibility(theMode);
622 vtkLODActor::SetVisibility(false);
631 if(!GetUnstructuredGrid()->GetNumberOfCells()){
632 vtkLODActor::SetVisibility(false);
634 return vtkLODActor::GetVisibility();
640 ::GetNodeObjId(int theVtkID)
642 vtkIdType anID = theVtkID;
644 if(IsImplicitFunctionUsed())
645 anID = myExtractGeometry->GetNodeObjId(theVtkID);
647 vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
648 if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
652 vtkFloatingPointType*
654 ::GetNodeCoord(int theObjID)
656 vtkDataSet* aDataSet = myMergeFilter->GetOutput();
657 vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
658 vtkFloatingPointType* aCoord = (anID >= 0) ? aDataSet->GetPoint(anID) : NULL;
659 if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
666 ::GetElemObjId(int theVtkID)
668 vtkIdType anId = myGeomFilter->GetElemObjId(theVtkID);
672 vtkIdType anId2 = anId;
673 if(IsImplicitFunctionUsed())
674 anId2 = myExtractGeometry->GetElemObjId(anId);
678 vtkIdType anId3 = myExtractUnstructuredGrid->GetInputId(anId2);
682 vtkIdType aRetID = myVisualObj->GetElemObjId(anId3);
684 MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID);
690 ::GetElemCell(int theObjID)
692 vtkDataSet* aDataSet = myVisualObj->GetUnstructuredGrid();
693 vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID);
694 vtkCell* aCell = (aGridID >= 0) ? aDataSet->GetCell(aGridID) : NULL;
696 MESSAGE("GetElemCell - theObjID = "<<theObjID<<"; aGridID = "<<aGridID);
705 return myShrinkFilter->GetShrinkFactor();
710 ::SetShrinkFactor(vtkFloatingPointType theValue)
712 theValue = theValue > 0.1? theValue: 0.8;
713 myShrinkFilter->SetShrinkFactor(theValue);
720 ::SetHighlited(bool theIsHighlited)
722 if ( myIsHighlited == theIsHighlited )
724 myIsHighlited = theIsHighlited;
730 ::Render(vtkRenderer *ren, vtkMapper* m)
732 int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
733 vtkFloatingPointType aStoredFactor, aStoredUnit;
734 vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
736 vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
737 vtkFloatingPointType aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
739 static vtkFloatingPointType EPS = .01;
742 vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnits);
743 vtkLODActor::Render(ren,m);
745 vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
746 vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
752 ::SetPolygonOffsetParameters(vtkFloatingPointType factor,
753 vtkFloatingPointType units)
755 myPolygonOffsetFactor = factor;
756 myPolygonOffsetUnits = units;