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);
84 myIsShrinkable = false;
85 myRepresentation = eSurface;
87 myProperty = vtkProperty::New();
88 myMapper = vtkPolyDataMapper::New();
90 vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
91 myPolygonOffsetUnits);
93 myMapper->UseLookupTableScalarRangeOn();
94 myMapper->SetColorModeToMapScalars();
96 myShrinkFilter = vtkShrinkFilter::New();
98 myStoreClippingMapping = false;
100 myExtractGeometry = SMESH_ExtractGeometry::New();
101 myExtractGeometry->SetReleaseDataFlag(true);
102 myIsImplicitFunctionUsed = false;
104 myExtractUnstructuredGrid = VTKViewer_ExtractUnstructuredGrid::New();
106 myMergeFilter = vtkMergeFilter::New();
108 myGeomFilter = VTKViewer_GeometryFilter::New();
110 myTransformFilter = VTKViewer_TransformFilter::New();
112 for(int i = 0; i < 6; i++)
113 myPassFilter.push_back(vtkPassThroughFilter::New());
118 ::~SMESH_DeviceActor()
120 if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
122 myProperty->Delete();
126 myShrinkFilter->Delete();
128 myExtractUnstructuredGrid->Delete();
130 myMergeFilter->Delete();
132 myGeomFilter->Delete();
134 myExtractGeometry->Delete();
136 myTransformFilter->Delete();
138 for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
139 myPassFilter[i]->Delete();
146 ::SetStoreGemetryMapping(bool theStoreMapping)
148 myGeomFilter->SetStoreMapping(theStoreMapping);
149 SetStoreClippingMapping(theStoreMapping);
155 ::SetStoreClippingMapping(bool theStoreMapping)
157 myStoreClippingMapping = theStoreMapping;
158 myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
159 SetStoreIDMapping(theStoreMapping);
165 ::SetStoreIDMapping(bool theStoreMapping)
167 myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping);
173 ::Init(TVisualObjPtr theVisualObj,
174 vtkImplicitBoolean* theImplicitBoolean)
176 myVisualObj = theVisualObj;
177 myExtractGeometry->SetImplicitFunction(theImplicitBoolean);
178 SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
184 ::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
187 if(theIsImplicitFunctionUsed)
188 myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
190 myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
192 myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
193 SetStoreClippingMapping(myStoreClippingMapping);
199 ::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid)
202 //myIsShrinkable = theGrid->GetNumberOfCells() > 10;
203 myIsShrinkable = true;
205 myExtractUnstructuredGrid->SetInput(theGrid);
207 myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
209 myExtractGeometry->SetInput(myMergeFilter->GetOutput());
212 SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
213 myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
216 myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
219 myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() );
220 myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
223 myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
224 myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
227 myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
228 myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
229 myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
230 myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
233 myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
234 myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
236 vtkLODActor::SetMapper( myMapper );
242 VTKViewer_ExtractUnstructuredGrid*
244 ::GetExtractUnstructuredGrid()
246 return myExtractUnstructuredGrid;
252 ::GetUnstructuredGrid()
254 myExtractUnstructuredGrid->Update();
255 return myExtractUnstructuredGrid->GetOutput();
261 ::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
262 vtkScalarBarActor* theScalarBarActor,
263 vtkLookupTable* theLookupTable)
265 bool anIsInitialized = theFunctor;
267 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
269 SetStoreIDMapping(true);
270 myExtractUnstructuredGrid->Update();
271 vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
273 aDataSet->ShallowCopy(aGrid);
275 vtkDoubleArray *aScalars = vtkDoubleArray::New();
276 vtkIdType aNbCells = aGrid->GetNumberOfCells();
277 aScalars->SetNumberOfComponents(1);
278 aScalars->SetNumberOfTuples(aNbCells);
280 myVisualObj->UpdateFunctor(theFunctor);
282 using namespace SMESH::Controls;
283 if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
284 for(vtkIdType i = 0; i < aNbCells; i++){
285 vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
286 vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
287 double aValue = aNumericalFunctor->GetValue(anObjId);
288 aScalars->SetValue(i,aValue);
290 }else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
291 for(vtkIdType i = 0; i < aNbCells; i++){
292 vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
293 vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
294 bool aValue = aPredicate->IsSatisfy(anObjId);
295 aScalars->SetValue(i,aValue);
299 aDataSet->GetCellData()->SetScalars(aScalars);
302 theLookupTable->SetRange(aScalars->GetRange());
303 theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
304 theLookupTable->Build();
306 myMergeFilter->SetScalars(aDataSet);
309 GetMapper()->SetScalarVisibility(anIsInitialized);
310 theScalarBarActor->SetVisibility(anIsInitialized);
315 ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
316 vtkScalarBarActor* theScalarBarActor,
317 vtkLookupTable* theLookupTable)
319 bool anIsInitialized = theFunctor;
320 myExtractUnstructuredGrid->ClearRegisteredCells();
321 myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
322 myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
323 myVisualObj->UpdateFunctor(theFunctor);
325 using namespace SMESH::Controls;
326 if (anIsInitialized){
327 if (Length2D* aLength2D = dynamic_cast<Length2D*>(theFunctor.get())){
328 SMESH::Controls::Length2D::TValues aValues;
330 aLength2D->GetValues(aValues);
331 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
332 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
334 aDataSet->SetPoints(aGrid->GetPoints());
336 vtkIdType aNbCells = aValues.size();
338 vtkDoubleArray *aScalars = vtkDoubleArray::New();
339 aScalars->SetNumberOfComponents(1);
340 aScalars->SetNumberOfTuples(aNbCells);
342 vtkIdType aCellsSize = 3*aNbCells;
343 vtkCellArray* aConnectivity = vtkCellArray::New();
344 aConnectivity->Allocate( aCellsSize, 0 );
346 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
347 aCellTypesArray->SetNumberOfComponents( 1 );
348 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
350 vtkIdList *anIdList = vtkIdList::New();
351 anIdList->SetNumberOfIds(2);
353 Length2D::TValues::const_iterator anIter = aValues.begin();
354 for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
355 const Length2D::Value& aValue = *anIter;
357 myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
358 myVisualObj->GetNodeVTKId(aValue.myPntId[1])
360 if(aNode[0] >= 0 && aNode[1] >= 0){
361 anIdList->SetId( 0, aNode[0] );
362 anIdList->SetId( 1, aNode[1] );
363 aConnectivity->InsertNextCell( anIdList );
364 aCellTypesArray->InsertNextValue( VTK_LINE );
365 aScalars->SetValue(aVtkId,aValue.myLength);
369 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
370 aCellLocationsArray->SetNumberOfComponents( 1 );
371 aCellLocationsArray->SetNumberOfTuples( aNbCells );
373 aConnectivity->InitTraversal();
374 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
375 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
377 aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
378 SetUnstructuredGrid(aDataSet);
380 aDataSet->GetCellData()->SetScalars(aScalars);
383 theLookupTable->SetRange(aScalars->GetRange());
384 theLookupTable->Build();
386 myMergeFilter->SetScalars(aDataSet);
389 else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
390 SMESH::Controls::MultiConnection2D::MValues aValues;
392 aMultiConnection2D->GetValues(aValues);
393 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
394 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
395 aDataSet->SetPoints(aGrid->GetPoints());
397 vtkIdType aNbCells = aValues.size();
398 vtkDoubleArray *aScalars = vtkDoubleArray::New();
399 aScalars->SetNumberOfComponents(1);
400 aScalars->SetNumberOfTuples(aNbCells);
402 vtkIdType aCellsSize = 3*aNbCells;
403 vtkCellArray* aConnectivity = vtkCellArray::New();
404 aConnectivity->Allocate( aCellsSize, 0 );
406 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
407 aCellTypesArray->SetNumberOfComponents( 1 );
408 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
410 vtkIdList *anIdList = vtkIdList::New();
411 anIdList->SetNumberOfIds(2);
413 MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
414 for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
415 const MultiConnection2D::Value& aValue = (*anIter).first;
417 myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
418 myVisualObj->GetNodeVTKId(aValue.myPntId[1])
420 if(aNode[0] >= 0 && aNode[1] >= 0){
421 anIdList->SetId( 0, aNode[0] );
422 anIdList->SetId( 1, aNode[1] );
423 aConnectivity->InsertNextCell( anIdList );
424 aCellTypesArray->InsertNextValue( VTK_LINE );
425 aScalars->SetValue(aVtkId,(*anIter).second);
429 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
430 aCellLocationsArray->SetNumberOfComponents( 1 );
431 aCellLocationsArray->SetNumberOfTuples( aNbCells );
433 aConnectivity->InitTraversal();
434 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
435 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
437 aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
438 SetUnstructuredGrid(aDataSet);
440 aDataSet->GetCellData()->SetScalars(aScalars);
443 theLookupTable->SetRange(aScalars->GetRange());
444 theLookupTable->Build();
446 myMergeFilter->SetScalars(aDataSet);
450 GetMapper()->SetScalarVisibility(anIsInitialized);
451 theScalarBarActor->SetVisibility(anIsInitialized);
456 ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor)
458 myExtractUnstructuredGrid->ClearRegisteredCells();
459 myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
460 myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
461 myVisualObj->UpdateFunctor(theFunctor);
463 using namespace SMESH::Controls;
464 if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
465 myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
466 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
467 vtkIdType aNbCells = aGrid->GetNumberOfCells();
468 for( vtkIdType i = 0; i < aNbCells; i++ ){
469 vtkIdType anObjId = myVisualObj->GetElemObjId(i);
470 if(aFreeBorders->IsSatisfy(anObjId))
471 myExtractUnstructuredGrid->RegisterCell(i);
473 if(!myExtractUnstructuredGrid->IsCellsRegistered())
474 myExtractUnstructuredGrid->RegisterCell(-1);
475 SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
476 }else if(FreeEdges* aFreeEdges = dynamic_cast<FreeEdges*>(theFunctor.get())){
477 SMESH::Controls::FreeEdges::TBorders aBorders;
478 aFreeEdges->GetBoreders(aBorders);
479 vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
480 vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
481 aDataSet->SetPoints(aGrid->GetPoints());
483 vtkIdType aNbCells = aBorders.size();
484 vtkIdType aCellsSize = 3*aNbCells;
485 vtkCellArray* aConnectivity = vtkCellArray::New();
486 aConnectivity->Allocate( aCellsSize, 0 );
488 vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
489 aCellTypesArray->SetNumberOfComponents( 1 );
490 aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
492 vtkIdList *anIdList = vtkIdList::New();
493 anIdList->SetNumberOfIds(2);
495 FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
496 for(; anIter != aBorders.end(); anIter++){
497 const FreeEdges::Border& aBorder = *anIter;
499 myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
500 myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
502 //cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
503 if(aNode[0] >= 0 && aNode[1] >= 0){
504 anIdList->SetId( 0, aNode[0] );
505 anIdList->SetId( 1, aNode[1] );
506 aConnectivity->InsertNextCell( anIdList );
507 aCellTypesArray->InsertNextValue( VTK_LINE );
511 VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
512 aCellLocationsArray->SetNumberOfComponents( 1 );
513 aCellLocationsArray->SetNumberOfTuples( aNbCells );
515 aConnectivity->InitTraversal();
516 for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
517 aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
519 aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
521 SetUnstructuredGrid(aDataSet);
533 unsigned long mTime = this->Superclass::GetMTime();
534 mTime = max(mTime,myExtractGeometry->GetMTime());
535 mTime = max(mTime,myExtractUnstructuredGrid->GetMTime());
536 mTime = max(mTime,myMergeFilter->GetMTime());
537 mTime = max(mTime,myGeomFilter->GetMTime());
538 mTime = max(mTime,myTransformFilter->GetMTime());
545 ::SetTransform(VTKViewer_Transform* theTransform)
547 myTransformFilter->SetTransform(theTransform);
555 if ( !myIsShrinkable ) return;
556 if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
558 myShrinkFilter->SetInput( aDataSet );
559 myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
568 if ( !myIsShrunk ) return;
569 if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() )
571 myPassFilter[ 1 ]->SetInput( aDataSet );
572 myPassFilter[ 1 ]->Modified();
581 ::SetRepresentation(EReperesent theMode)
585 myGeomFilter->SetInside(true);
586 myGeomFilter->SetWireframeMode(false);
587 GetProperty()->SetRepresentation(0);
590 myGeomFilter->SetInside(false);
591 myGeomFilter->SetWireframeMode(true);
592 GetProperty()->SetRepresentation(theMode);
595 myGeomFilter->SetInside(true);
596 myGeomFilter->SetWireframeMode(true);
597 GetProperty()->SetRepresentation(1);
600 myGeomFilter->SetInside(false);
601 myGeomFilter->SetWireframeMode(false);
602 GetProperty()->SetRepresentation(theMode);
604 myRepresentation = theMode;
605 GetProperty()->Modified();
606 myMapper->Modified();
613 ::SetVisibility(int theMode)
615 if(!myExtractUnstructuredGrid->GetInput() ||
616 GetUnstructuredGrid()->GetNumberOfCells())
618 vtkLODActor::SetVisibility(theMode);
620 vtkLODActor::SetVisibility(false);
629 if(!GetUnstructuredGrid()->GetNumberOfCells()){
630 vtkLODActor::SetVisibility(false);
632 return vtkLODActor::GetVisibility();
638 ::GetNodeObjId(int theVtkID)
640 vtkIdType anID = theVtkID;
642 if(IsImplicitFunctionUsed())
643 anID = myExtractGeometry->GetNodeObjId(theVtkID);
645 vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
646 if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
650 vtkFloatingPointType*
652 ::GetNodeCoord(int theObjID)
654 vtkDataSet* aDataSet = myMergeFilter->GetOutput();
655 vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID);
656 vtkFloatingPointType* aCoord = aDataSet->GetPoint(anID);
657 if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<<theObjID<<"; anID = "<<anID);
664 ::GetElemObjId(int theVtkID)
666 vtkIdType anId = myGeomFilter->GetElemObjId(theVtkID);
670 vtkIdType anId2 = anId;
671 if(IsImplicitFunctionUsed())
672 anId2 = myExtractGeometry->GetElemObjId(anId);
676 vtkIdType anId3 = myExtractUnstructuredGrid->GetInputId(anId2);
680 vtkIdType aRetID = myVisualObj->GetElemObjId(anId3);
682 MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID);
688 ::GetElemCell(int theObjID)
690 vtkDataSet* aDataSet = myVisualObj->GetUnstructuredGrid();
691 vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID);
692 vtkCell* aCell = aDataSet->GetCell(aGridID);
694 MESSAGE("GetElemCell - theObjID = "<<theObjID<<"; aGridID = "<<aGridID);
703 return myShrinkFilter->GetShrinkFactor();
708 ::SetShrinkFactor(vtkFloatingPointType theValue)
710 theValue = theValue > 0.1? theValue: 0.8;
711 myShrinkFilter->SetShrinkFactor(theValue);
718 ::SetHighlited(bool theIsHighlited)
720 if ( myIsHighlited == theIsHighlited )
722 myIsHighlited = theIsHighlited;
728 ::Render(vtkRenderer *ren, vtkMapper* m)
730 int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
731 vtkFloatingPointType aStoredFactor, aStoredUnit;
732 vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
734 vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
735 vtkFloatingPointType aFactor = myPolygonOffsetFactor, aUnits = myPolygonOffsetUnits;
737 static vtkFloatingPointType EPS = .01;
740 vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnits);
741 vtkLODActor::Render(ren,m);
743 vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aStoredFactor,aStoredUnit);
744 vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology);
750 ::SetPolygonOffsetParameters(vtkFloatingPointType factor,
751 vtkFloatingPointType units)
753 myPolygonOffsetFactor = factor;
754 myPolygonOffsetUnits = units;