Salome HOME
Implementation of the issue 20984: EDF 1566 SMESH: Better visibility of the elements...
[modules/visu.git] / src / OBJECT / VISU_ScalarMapAct.cxx
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  VISU OBJECT : interactive object for VISU entities implementation
24 //  File   : VISU_MeshAct.hxx
25 //  Author : Laurent CORNABE with the help of Nicolas REJNERI
26 //  Module : VISU
27 //  $Header$
28 //
29 #include "VISU_ScalarMapAct.h"
30 #include "VISU_LookupTable.hxx"
31 #include "VISU_ScalarBarActor.hxx"
32 #include "VISU_PipeLine.hxx"
33
34 #include "VISU_OpenGLPointSpriteMapper.hxx"
35 #include "VISU_GaussPtsDeviceActor.h"
36 #include "VISU_DeformedShapePL.hxx"
37 #include "VISU_PipeLineUtils.hxx"
38
39
40 #include <SUIT_ResourceMgr.h>
41 #include <SUIT_Session.h>
42
43 #include <SALOME_ExtractGeometry.h>
44 #include <SALOME_ExtractPolyDataGeometry.h>
45
46 #include <vtkObjectFactory.h>
47 #include <vtkRenderer.h>
48 #include <vtkProperty.h>
49 #include <vtkMatrix4x4.h>
50 #include <vtkMapper.h>
51 #include <vtkDataSetMapper.h>
52
53 #include <vtkRenderWindowInteractor.h>
54 #include <vtkCallbackCommand.h>
55 #include <vtkRenderWindow.h>
56 #include <vtkImageData.h>
57
58
59 //============================================================================
60 class VISU_PointsDeviceActor: public VISU_GaussDeviceActorBase
61 {
62  public:
63   vtkTypeMacro(VISU_PointsDeviceActor, VISU_GaussDeviceActorBase);
64
65   static 
66   VISU_PointsDeviceActor* 
67   New();
68  
69
70   //----------------------------------------------------------------------------
71   virtual
72   void
73   SetInput(vtkDataSet* theDataSet)
74   {
75     myGeomFilter->SetInput( theDataSet );
76   }
77
78
79   //----------------------------------------------------------------------------
80   void
81   SetInteractor(vtkRenderWindowInteractor* theInteractor)
82   {
83     if(theInteractor == myInteractor)
84       return;
85
86     if(myInteractor)
87       myInteractor->RemoveObserver(myEventCallbackCommand);
88     
89     if(theInteractor)
90       theInteractor->AddObserver(vtkCommand::CharEvent, 
91                                  myEventCallbackCommand, 
92                                  0.0);
93
94     myInteractor = theInteractor;
95   }
96
97
98   //----------------------------------------------------------------------------
99   void
100   DoMapperShallowCopy( vtkMapper* theMapper,
101                        bool theIsCopyInput )
102   {
103     Superclass::DoMapperShallowCopy( theMapper, theIsCopyInput );
104
105     vtkDataSet* aDataSet = theMapper->GetInput();
106     vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
107
108     GetPointSpriteMapper()->SetAverageCellSize( aScaleFactor );
109   }
110
111
112   //----------------------------------------------------------------------------
113   void
114   DeepCopy( VISU_PointsDeviceActor *theActor )
115   {
116     VISU::CopyPointSpriteDataMapper( GetPointSpriteMapper(), theActor->GetPointSpriteMapper(), false );
117   }
118
119  protected:
120   //----------------------------------------------------------------------------
121   VISU_PointsDeviceActor():
122     myGeomFilter( VTKViewer_GeometryFilter::New() ),
123     myEventCallbackCommand( vtkCallbackCommand::New() ),
124     myInteractor( NULL )
125   {
126     myGeomFilter->SetInside(true);
127
128     VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New();
129     aMapper->SetInput( myGeomFilter->GetOutput() );
130
131     std::string aRootDir( getenv( "VISU_ROOT_DIR") );
132     std::string aMainTexture = aRootDir + "/share/salome/resources/visu/sprite_texture.bmp";
133     std::string anAlphaTexture = aRootDir + "/share/salome/resources/visu/sprite_alpha.bmp";
134     VISU::TTextureValue aTextureValue = VISU::GetTexture( aMainTexture, anAlphaTexture );
135     aMapper->SetImageData( aTextureValue.GetPointer() );
136
137     aMapper->SetUseLookupTableScalarRange(true);
138     aMapper->SetColorModeToMapScalars();
139     aMapper->SetScalarVisibility(true);
140
141     SetPointSpriteMapper( aMapper );
142
143     aMapper->Delete();
144
145     myEventCallbackCommand->SetClientData( this );
146     myEventCallbackCommand->SetCallback( VISU_PointsDeviceActor::ProcessEvents );
147   }
148
149
150   //----------------------------------------------------------------------------
151   ~VISU_PointsDeviceActor()
152   {
153     SetInteractor( NULL );
154     myGeomFilter->Delete();
155     myEventCallbackCommand->Delete();
156   }
157
158
159   //----------------------------------------------------------------------------
160   static
161   void
162   ProcessEvents(vtkObject* theObject, 
163                 unsigned long theEvent,
164                 void* theClientData, 
165                 void* theCallData)
166   {
167     if ( VISU_PointsDeviceActor* self = reinterpret_cast<VISU_PointsDeviceActor*>( theClientData ) )
168       self->OnInteractorEvent( theEvent );
169   }
170
171
172   //----------------------------------------------------------------------------
173   void
174   OnInteractorEvent(unsigned long theEvent)
175   {
176     switch ( theEvent ) {
177     case vtkCommand::CharEvent: {
178       switch( myInteractor->GetKeyCode() ) {
179       case 'M' :
180       case 'm' : {
181         if ( !GetVisibility() )
182           return;
183
184         static vtkFloatingPointType anIncrement = 2;
185         vtkFloatingPointType aMagnification = GetPointSpriteMapper()->GetPointSpriteMagnification();
186         vtkFloatingPointType coefficient = myInteractor->GetShiftKey() ? anIncrement : 1 / anIncrement;
187
188         GetPointSpriteMapper()->SetPointSpriteMagnification( aMagnification * coefficient );
189
190         myInteractor->CreateTimer(VTKI_TIMER_UPDATE);
191         break;
192       }
193       default:
194         return;
195       }
196       break;
197     }
198     default:
199       return;
200     }
201   }
202
203
204   //----------------------------------------------------------------------------
205   vtkCallbackCommand* myEventCallbackCommand;
206   vtkRenderWindowInteractor* myInteractor;
207   VTKViewer_GeometryFilter* myGeomFilter;
208
209  private:
210   VISU_PointsDeviceActor(const VISU_PointsDeviceActor&); // Not implemented
211   void operator=(const VISU_PointsDeviceActor&); // Not implemented
212 };
213
214 vtkStandardNewMacro(VISU_PointsDeviceActor);
215
216 //----------------------------------------------------------------------------
217 vtkStandardNewMacro(VISU_ScalarMapAct);
218 static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
219
220 //----------------------------------------------------------------------------
221 VISU_ScalarMapAct
222 ::VISU_ScalarMapAct()
223 {
224   myScalarBar = VISU_ScalarBarActor::New();
225
226   vtkProperty* aProperty = GetProperty();
227   aProperty->SetAmbient(1.0); 
228   aProperty->SetDiffuse(0.0);
229   aProperty->SetSpecular(0.0);
230   
231   myProperty->DeepCopy(aProperty);
232
233   vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
234
235   mySurfaceActor= SVTK_DeviceActor::New();
236   mySurfaceActor->SetRepresentation(SVTK::Representation::Surface);
237   mySurfaceActor->SetProperty(aProperty);
238   mySurfaceActor->SetUserMatrix(aMatrix);
239
240   myEdgeActor = SVTK_DeviceActor::New();
241   myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe);
242   myEdgeActor->SetUserMatrix(aMatrix);
243   myEdgeActor->GetProperty()->SetColor(255.,255.,255.);
244
245   myPointsActor = SVTK_DeviceActor::New();
246   myPointsActor->SetRepresentation(SVTK::Representation::Points);
247   myPointsActor->SetProperty(aProperty);
248   myPointsActor->SetUserMatrix(aMatrix);
249
250   myPointSpriteActor = VISU_PointsDeviceActor::New();
251   myPointSpriteActor->SetProperty(aProperty);
252   myPointSpriteActor->SetUserMatrix(aMatrix);
253
254   aMatrix->Delete();
255
256   myIsPointSpriteMode = false;
257
258   SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
259   //Quadratic 2D elements representation
260   if(aResourceMgr) {
261     //----------------------------------------------------------------------------
262     int aQuadraticAngle = aResourceMgr->integerValue( "VISU", "max_angle", 2);
263     mySurfaceActor->SetQuadraticArcAngle(aQuadraticAngle);
264     myEdgeActor->SetQuadraticArcAngle(aQuadraticAngle);
265
266     int anElem0DSize = aResourceMgr->integerValue( "VISU", "elem0d_size", 5);
267     mySurfaceActor->GetProperty()->SetPointSize(anElem0DSize);
268   }
269 }
270
271 //----------------------------------------------------------------------------
272 VISU_ScalarMapAct
273 ::~VISU_ScalarMapAct()
274 {
275   myScalarBar->Delete();
276
277   myPointsActor->Delete();
278   myPointSpriteActor->Delete();
279
280   mySurfaceActor->Delete();
281   myEdgeActor->Delete();
282 }
283
284 void
285 VISU_ScalarMapAct
286 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
287 {
288   VISU_DataSetActor::ShallowCopyPL( thePipeLine );
289
290   myEdgeActor->GetMapper()->ScalarVisibilityOff();
291
292   myPointSpriteActor->DoMapperShallowCopy( thePipeLine->GetMapper(), false );
293
294   VISU::CopyMapper( myPointsActor->GetMapper(), thePipeLine->GetMapper(), false );
295   VISU::CopyMapper( mySurfaceActor->GetMapper(), thePipeLine->GetMapper(), false );
296 }
297
298 //----------------------------------------------------------------------------
299 void
300 VISU_ScalarMapAct
301 ::SetMapperInput(vtkDataSet* theDataSet)
302 {
303   Superclass::SetMapperInput( theDataSet );
304
305 //    myPointsActor->SetInput( theDataSet );
306 //    mySurfaceActor->SetInput( theDataSet );
307 //    myEdgeActor->SetInput( theDataSet );
308
309   if (theDataSet->IsA("vtkPolyData")) {
310     myPointSpriteActor->SetInput( myPolyDataExtractor->GetOutput() );
311     myPointsActor->SetInput( myPolyDataExtractor->GetOutput() );
312     mySurfaceActor->SetInput( myPolyDataExtractor->GetOutput() );
313     myEdgeActor->SetInput( myPolyDataExtractor->GetOutput() );
314   } else {
315     myPointSpriteActor->SetInput( myExtractor->GetOutput() );
316     myPointsActor->SetInput( myExtractor->GetOutput() );
317     mySurfaceActor->SetInput( myExtractor->GetOutput() );
318     myEdgeActor->SetInput( myExtractor->GetOutput() );
319   }
320 }
321
322 //----------------------------------------------------------------------------
323 void
324 VISU_ScalarMapAct
325 ::SetTransform(VTKViewer_Transform* theTransform)
326 {
327   Superclass::SetTransform(theTransform);
328
329   myPointsActor->SetTransform(theTransform);
330   myPointSpriteActor->SetTransform(theTransform);
331
332   mySurfaceActor->SetTransform(theTransform);
333   myEdgeActor->SetTransform(theTransform);
334 }
335
336 //----------------------------------------------------------------------------
337 vtkProperty* 
338 VISU_ScalarMapAct
339 ::GetEdgeProperty()
340 {
341   return myEdgeActor->GetProperty();
342 }
343
344 //----------------------------------------------------------------------------
345 void
346 VISU_ScalarMapAct
347 ::SetShrinkable(bool theIsShrinkable)
348 {
349   Superclass::SetShrinkable(theIsShrinkable);
350
351   mySurfaceActor->SetShrinkable(theIsShrinkable);
352   myEdgeActor->SetShrinkable(theIsShrinkable);
353 }
354
355 void
356 VISU_ScalarMapAct
357 ::SetShrinkFactor(vtkFloatingPointType theValue)
358 {
359   Superclass::SetShrinkFactor(theValue);
360
361   mySurfaceActor->SetShrinkFactor(theValue);
362   myEdgeActor->SetShrinkFactor(theValue);
363 }
364
365 //----------------------------------------------------------------------------
366 void
367 VISU_ScalarMapAct
368 ::SetShrink()
369 {
370   if(myRepresentation == VTK_POINTS)
371     return;
372
373   Superclass::SetShrink();
374
375   mySurfaceActor->SetShrink();
376   myEdgeActor->SetShrink();
377 }
378
379 void
380 VISU_ScalarMapAct
381 ::UnShrink()
382 {
383   Superclass::UnShrink();
384
385   mySurfaceActor->UnShrink();
386   myEdgeActor->UnShrink();
387 }
388
389 //----------------------------------------------------------------------------
390 void
391 VISU_ScalarMapAct
392 ::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed)
393 {
394   Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
395
396   mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed);
397 }
398
399 void
400 VISU_ScalarMapAct
401 ::SetFeatureEdgesAngle(vtkFloatingPointType theValue)
402 {
403   Superclass::SetFeatureEdgesAngle(theValue);
404
405   mySurfaceActor->SetFeatureEdgesAngle(theValue);
406 }
407
408 void
409 VISU_ScalarMapAct
410 ::SetFeatureEdgesFlags(bool theIsFeatureEdges,
411                        bool theIsBoundaryEdges,
412                        bool theIsManifoldEdges,
413                        bool theIsNonManifoldEdges)
414 {
415   Superclass::SetFeatureEdgesFlags(theIsFeatureEdges,
416                                    theIsBoundaryEdges,
417                                    theIsManifoldEdges,
418                                    theIsNonManifoldEdges);
419
420   mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges,
421                                        theIsBoundaryEdges,
422                                        theIsManifoldEdges,
423                                        theIsNonManifoldEdges);
424 }
425
426 void
427 VISU_ScalarMapAct
428 ::SetFeatureEdgesColoring(bool theIsColoring)
429 {
430   Superclass::SetFeatureEdgesColoring(theIsColoring);
431
432   mySurfaceActor->SetFeatureEdgesColoring(theIsColoring);
433 }
434
435 //----------------------------------------------------------------------------
436 void
437 VISU_ScalarMapAct
438 ::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
439 {
440   if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS)
441     return;
442
443   Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
444
445   mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled);
446 }
447
448 //----------------------------------------------------------------------------
449 void
450 VISU_ScalarMapAct
451 ::SetOpacity(vtkFloatingPointType theValue)
452 {
453   mySurfaceActor->GetProperty()->SetOpacity(theValue);
454
455   vtkFloatingPointType aPointSpriteOpacity = theValue > 0.0 ? 1.0 : 0.0;
456   myPointSpriteActor->GetPointSpriteMapper()->SetPointSpriteOpacity(aPointSpriteOpacity);
457 }
458
459 vtkFloatingPointType
460 VISU_ScalarMapAct
461 ::GetOpacity()
462 {
463   return mySurfaceActor->GetProperty()->GetOpacity();
464 }
465
466 //----------------------------------------------------------------------------
467 void
468 VISU_ScalarMapAct
469 ::SetLineWidth(vtkFloatingPointType theLineWidth)
470 {
471   mySurfaceActor->GetProperty()->SetLineWidth(theLineWidth);
472 }
473
474 vtkFloatingPointType
475 VISU_ScalarMapAct::GetLineWidth()
476 {
477   return mySurfaceActor->GetProperty()->GetLineWidth();
478 }
479
480 //----------------------------------------------------------------------------
481 void
482 VISU_ScalarMapAct
483 ::DeepCopy(VISU_Actor *theActor)
484 {
485   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
486     Superclass::DeepCopy(theActor);
487     SetBarVisibility(anActor->GetBarVisibility());
488     myPointSpriteActor->DeepCopy( anActor->myPointSpriteActor );
489     SetShading(anActor->IsShading());
490   }
491 }
492
493
494 //----------------------------------------------------------------------------
495 void
496 VISU_ScalarMapAct
497 ::AddToRender(vtkRenderer* theRenderer)
498 {
499   Superclass::AddToRender(theRenderer);
500
501   myPointSpriteActor->SetInteractor( myInteractor );
502
503   if(myScalarBar)
504     theRenderer->AddActor2D(myScalarBar);
505 }
506
507 //----------------------------------------------------------------------------
508 void
509 VISU_ScalarMapAct
510 ::RemoveFromRender(vtkRenderer* theRenderer)
511 {
512   if(myScalarBar)
513     theRenderer->RemoveActor(myScalarBar);
514
515   if ( vtkWindow* aWindow = theRenderer->GetRenderWindow() ) {
516     myPointSpriteActor->ReleaseGraphicsResources( aWindow );
517     myPointsActor->ReleaseGraphicsResources( aWindow );
518     mySurfaceActor->ReleaseGraphicsResources( aWindow );
519     myEdgeActor->ReleaseGraphicsResources( aWindow );
520   }
521
522   Superclass::RemoveFromRender(theRenderer);
523 }
524
525 //----------------------------------------------------------------------------
526 void
527 VISU_ScalarMapAct
528 ::SetVisibility(int theMode)
529 {
530   Superclass::SetVisibility( theMode );
531
532   myPointSpriteActor->SetVisibility( theMode );
533   myPointsActor->SetVisibility( theMode );
534
535   if(myScalarBar) 
536     myScalarBar->SetVisibility(myBarVisibility && theMode);
537 }
538
539 //----------------------------------------------------------------------------
540 int 
541 VISU_ScalarMapAct
542 ::GetBarVisibility()
543 {
544   return myBarVisibility;
545 }
546
547 //----------------------------------------------------------------------------
548 VISU_ScalarBarActor*
549 VISU_ScalarMapAct
550 ::GetScalarBar()
551 {
552   return myScalarBar;
553 }
554
555 //----------------------------------------------------------------------------
556 void
557 VISU_ScalarMapAct
558 ::SetBarVisibility(bool theMode)
559 {
560   myBarVisibility = theMode;
561   if(myScalarBar) 
562     myScalarBar->SetVisibility(myBarVisibility && GetVisibility());
563 }
564
565
566 //----------------------------------------------------------------------------
567 void
568 VISU_ScalarMapAct
569 ::SetRepresentation(int theMode) 
570
571   bool anIsShanding = IsShading();
572
573   Superclass::SetRepresentation(theMode);
574
575   if(theMode == SVTK::Representation::Surfaceframe)
576     mySurfaceActor->SetRepresentation(SVTK::Representation::Surface);
577   else
578     mySurfaceActor->SetRepresentation(theMode);
579
580   myPointSpriteActor->SetProperty( mySurfaceActor->GetProperty() );
581   myPointsActor->SetProperty( mySurfaceActor->GetProperty() );
582
583   SetShading(anIsShanding);
584 }
585
586
587 //----------------------------------------------------------------------------
588 void
589 VISU_ScalarMapAct
590 ::SetShading(bool theOn)
591 {
592   vtkProperty* aProperty = mySurfaceActor->GetProperty();
593
594   if (theOn) {
595     aProperty->SetAmbient(0.0); 
596     aProperty->SetDiffuse(1.0);
597   } else {
598     aProperty->SetAmbient(1.0); 
599     aProperty->SetDiffuse(0.0);
600   }
601 }
602
603 //----------------------------------------------------------------------------
604 bool
605 VISU_ScalarMapAct
606 ::IsShading()
607 {
608   vtkProperty* aProperty = mySurfaceActor->GetProperty();
609   
610   return (fabs(aProperty->GetAmbient()) < EPS && fabs(aProperty->GetDiffuse() - 1.) < EPS);
611 }
612
613 int
614 VISU_ScalarMapAct
615 ::RenderOpaqueGeometry(vtkViewport *ren)
616 {
617   GetMatrix(myEdgeActor->GetUserMatrix());
618   GetMatrix(mySurfaceActor->GetUserMatrix());
619   GetMatrix(myPointsActor->GetUserMatrix());
620   GetMatrix(myPointSpriteActor->GetUserMatrix());
621
622   using namespace SVTK::Representation;
623   switch ( GetRepresentation() ) {
624
625   case Surfaceframe:
626     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
627     mySurfaceActor->RenderOpaqueGeometry(ren);
628
629     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
630     myEdgeActor->RenderOpaqueGeometry(ren);
631     break;
632
633   case Points:
634     if( myIsPointSpriteMode ) {
635       myPointSpriteActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
636       myPointSpriteActor->RenderOpaqueGeometry(ren);
637     } else {
638       myPointsActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
639       myPointsActor->RenderOpaqueGeometry(ren);
640     }
641     break;
642
643   default:
644     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
645     mySurfaceActor->RenderOpaqueGeometry(ren);
646   }
647
648   return 1;
649 }
650
651 int
652 VISU_ScalarMapAct
653 #if (VTK_XVERSION < 0x050100)
654 ::RenderTranslucentGeometry(vtkViewport *ren)
655 #else
656 ::RenderTranslucentPolygonalGeometry(vtkViewport *ren)
657 #endif
658 {
659   GetMatrix(myEdgeActor->GetUserMatrix());
660   GetMatrix(mySurfaceActor->GetUserMatrix());
661
662   using namespace SVTK::Representation;
663   switch ( GetRepresentation() ) {
664
665   case Surfaceframe:
666     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
667 #if (VTK_XVERSION < 0x050100)
668     mySurfaceActor->RenderTranslucentGeometry(ren);
669 #else
670     mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
671 #endif
672
673     myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren);
674 #if (VTK_XVERSION < 0x050100)
675     myEdgeActor->RenderTranslucentGeometry(ren);
676 #else
677     myEdgeActor->RenderTranslucentPolygonalGeometry(ren);
678 #endif
679     break;
680
681   case Points:
682     if( myIsPointSpriteMode ) {
683       myPointSpriteActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
684 #if (VTK_XVERSION < 0x050100)
685       myPointSpriteActor->RenderTranslucentGeometry(ren);
686 #else
687       myPointSpriteActor->RenderTranslucentPolygonalGeometry(ren);
688 #endif
689     } else {
690       myPointsActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
691 #if (VTK_XVERSION < 0x050100)
692       myPointsActor->RenderTranslucentGeometry(ren);
693 #else
694       myPointsActor->RenderTranslucentPolygonalGeometry(ren);
695 #endif
696     }
697     break;
698
699   default:
700     mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren);
701 #if (VTK_XVERSION < 0x050100)
702     mySurfaceActor->RenderTranslucentGeometry(ren);
703 #else
704     mySurfaceActor->RenderTranslucentPolygonalGeometry(ren);
705 #endif
706   }
707
708   return 1;
709 }
710
711 //----------------------------------------------------------------------------
712 #if (VTK_XVERSION >= 0x050100)
713 int
714 VISU_ScalarMapAct
715 ::HasTranslucentPolygonalGeometry()
716 {
717   int result = 0; 
718
719   using namespace SVTK::Representation;
720   switch ( GetRepresentation() ) {
721   case Surfaceframe:
722     result |= mySurfaceActor->HasTranslucentPolygonalGeometry();
723     result |= myEdgeActor->HasTranslucentPolygonalGeometry();
724     break;
725   case Points:
726     if( myIsPointSpriteMode )
727       result |= myPointSpriteActor->HasTranslucentPolygonalGeometry();
728     else
729       result |= myPointsActor->HasTranslucentPolygonalGeometry();
730     break;
731   default:
732     result |= mySurfaceActor->HasTranslucentPolygonalGeometry();
733   }
734
735   return result;
736 }
737 #endif
738
739 //----------------------------------------------------------------------------
740 unsigned long int
741 VISU_ScalarMapAct
742 ::GetMemorySize()
743 {
744   unsigned long int aSize = Superclass::GetMemorySize();
745
746   aSize += myPointSpriteActor->GetMemorySize();
747
748   return aSize;
749 }
750
751 //----------------------------------------------------------------------------
752
753 VISU_Actor::EQuadratic2DRepresentation 
754 VISU_ScalarMapAct
755 ::GetQuadratic2DRepresentation() const
756 {
757   bool mode = (mySurfaceActor->GetQuadraticArcMode() && myEdgeActor->GetQuadraticArcMode());
758   if(mode){
759     return VISU_Actor::eArcs;
760   }
761   else
762     return VISU_Actor::eLines;
763 }
764   
765 void VISU_ScalarMapAct::SetQuadratic2DRepresentation( VISU_Actor::EQuadratic2DRepresentation theMode )
766 {
767   Superclass::SetQuadratic2DRepresentation( theMode );
768   switch(theMode) {
769   case VISU_Actor::eArcs:
770     mySurfaceActor->SetQuadraticArcMode(true);
771     myEdgeActor->SetQuadraticArcMode(true);
772     break;
773   case VISU_Actor::eLines:
774     mySurfaceActor->SetQuadraticArcMode(false);
775     myEdgeActor->SetQuadraticArcMode(false);
776     break;
777   default:
778     break;
779   }
780 }
781
782 void VISU_ScalarMapAct::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
783 {
784   Superclass::SetMarkerStd( theMarkerType, theMarkerScale );
785   myPointsActor->SetMarkerStd( theMarkerType, theMarkerScale );
786
787   myIsPointSpriteMode = theMarkerType == VTK::MT_POINT_SPRITE;
788 }
789
790 void VISU_ScalarMapAct::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
791 {
792   Superclass::SetMarkerTexture( theMarkerId, theMarkerTexture );
793   myPointsActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
794
795   myIsPointSpriteMode = false;
796 }
797
798 /**
799  * Set size of the 0D elements.
800  */
801 void VISU_ScalarMapAct::Set0DElemSize(vtkFloatingPointType theValue) {
802   mySurfaceActor->GetProperty()->SetPointSize(theValue);
803 }
804
805 /**
806  * Get size of the 0D elements.
807  */
808 vtkFloatingPointType VISU_ScalarMapAct::Get0DElemSize() {
809   return mySurfaceActor->GetProperty()->GetPointSize();
810 }
811