Salome HOME
Issue 0020336: [CEA 339] specifying a cut line with 2 points
[modules/visu.git] / src / VISU_I / VISU_PointMap3d_i.cc
1 //  Copyright (C) 2007-2008  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 //  VISU OBJECT : interactive object for VISU entities implementation
23 //  File   : VISU_PointMap3d_i.cc
24 //  Author : Dmitry Matveitchev
25 //  Module : VISU
26 //
27 #include "VISU_PointMap3d_i.hh"
28
29 #include "VISU_CutLinesBase_i.hh"
30 #include "VISU_Result_i.hh"
31 #include "VISU_ViewManager_i.hh"
32 #include "VISU_ScalarBarActor.hxx"
33 #include "SUIT_ResourceMgr.h"
34
35 #include "SALOME_Event.h"
36 #include "VISU_Prs3dUtils.hh"
37 #include "SPlot2d_Curve.h"
38 #include "VISU_PipeLineUtils.hxx"
39
40 #include "VISU_TableReader.hxx"
41 #include "VISU_ConvertorUtils.hxx"
42 #include "VISU_DeformedGridPL.hxx"
43
44 #include "SALOME_InteractiveObject.hxx"
45 #include "VISU_Gen_i.hh"
46
47 #include <vtkTextProperty.h>
48 #include <vtkActorCollection.h>
49
50 #include <boost/bind.hpp>
51
52 #ifdef _DEBUG_
53 static int MYDEBUG = 0;
54 #else
55 static int MYDEBUG = 0;
56 #endif
57
58 using namespace std;
59
60 //----------------------------------------------------------------
61 //                      PointMap3d Object
62 //----------------------------------------------------------------
63 int VISU::PointMap3d_i::myNbPresent = 0;
64 const string VISU::PointMap3d_i::myComment  = "POINTMAP3D";
65 /*!
66   Generate unique name
67 */
68 QString VISU::PointMap3d_i::GenerateName()
69 {
70   return VISU::GenerateName( "Table3D - ", ++myNbPresent );
71 }
72 /*!
73   Gets comment string
74 */
75 const char* VISU::PointMap3d_i::GetComment() const
76 {
77   return myComment.c_str();
78 }
79 /*!
80   Constructor
81 */
82 VISU::PointMap3d_i::PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
83   : Table_i(theStudy, theObjectEntry),
84   myActorCollection(vtkActorCollection::New()),
85   myIsActiveState(true)
86 {
87   if(MYDEBUG) MESSAGE("PointMap3d_i::PointMap3d_i - this = "<<this);
88   SetStudyDocument(theStudy);
89   mySObj = theStudy->FindObjectID(theObjectEntry);
90   myOffset[0] = myOffset[1] = myOffset[2] = 0;
91   myActorCollection->Delete();
92 }
93 /*!
94   Destructor
95 */
96 VISU::PointMap3d_i::~PointMap3d_i()
97 {
98   if(MYDEBUG) MESSAGE("PointMap3d_i::~PointMap3d_i - this = "<<this);
99 }
100
101 //----------------------------------------------------------------------------
102 namespace VISU
103 {
104   struct TInvokeSignalEvent: public SALOME_Event
105   {
106     typedef boost::signal0<void> TSignal;
107     const TSignal& mySignal;
108     
109     TInvokeSignalEvent(const TSignal& theSignal):
110       mySignal(theSignal)
111     {}
112     
113     virtual
114     void
115     Execute()
116     {
117       mySignal();
118     }
119   };
120 }
121
122 //----------------------------------------------------------------------------
123 void
124 VISU::PointMap3d_i
125 ::SetTitle( const char* theTitle )
126 {
127   SetName( theTitle, true );
128 }
129
130 //----------------------------------------------------------------------------
131 char*
132 VISU::PointMap3d_i
133 ::GetTitle()
134 {
135   return CORBA::string_dup( GetName().c_str() );
136 }
137
138 //----------------------------------------------------------------------------
139 SALOMEDS::SObject_var
140 VISU::PointMap3d_i
141 ::GetSObject() const
142 {
143   return mySObj;
144 }
145
146 //----------------------------------------------------------------------------
147 std::string
148 VISU::PointMap3d_i
149 ::GetObjectEntry() 
150 {
151   CORBA::String_var anEntry = mySObj->GetID();
152   return anEntry.in(); 
153 }
154
155 //----------------------------------------------------------------------------
156 Handle(SALOME_InteractiveObject)
157 VISU::PointMap3d_i
158 ::GetIO()
159 {
160   if( myIO.IsNull() )
161     myIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str());
162
163   return myIO;
164 }
165
166 //----------------------------------------------------------------------------
167 /*!
168   Creates table3d object
169 */
170 VISU::Storable* VISU::PointMap3d_i::Create()
171 {
172   // generate name ...
173   SetName(GetTableTitle().toLatin1().constData(), false);
174
175   if ( GetName() == "" ) {
176     if ( !mySObj->_is_nil() ) {
177       CutLinesBase_i* pCutLines = NULL;
178       CORBA::Object_var anObj = SObjectToObject(mySObj);
179       if(!CORBA::is_nil(anObj)){
180         VISU::CutLinesBase_var aCutLines = VISU::CutLinesBase::_narrow(anObj);
181         if(!aCutLines->_is_nil())
182           pCutLines = dynamic_cast<CutLinesBase_i*>(GetServant(aCutLines).in());
183       }
184       if (!pCutLines)
185         if (mySObj->GetName()) SetName(mySObj->GetName(), false);
186     }
187   }
188
189   if ( GetName() == "" )
190     SetName(GenerateName().toLatin1().constData(), false);
191
192   // Create Pipeline
193   myTablePL = VISU_DeformedGridPL::New();
194   myTablePL->SetPolyDataIDMapper(GetTableIDMapper());
195   myTablePL->Update();
196
197   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
198
199   bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
200   SetUnitsVisible(isUnits);
201
202   SetSourceRange();
203
204   if( aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false) )
205     SetScaling(VISU::LOGARITHMIC);
206   else
207     SetScaling(VISU::LINEAR);
208
209   int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
210   SetNbColors(aNumberOfColors);
211
212   int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
213   UseFixedRange(aRangeType == 1);
214   if(aRangeType == 1){
215     float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
216     float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
217     SetRange(aMin, aMax);
218   }
219
220   int lp = aResourceMgr->integerValue( "VISU", "scalar_bar_label_precision", 3 );
221   SetLabelsFormat( VISU::ToFormat( lp ).c_str() );
222
223   // Orientation
224   int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
225   if(anOrientation == 1)
226     SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL);
227   else
228     SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL);
229
230   // Scalar Bar origin
231   QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
232
233   vtkFloatingPointType aXorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2;
234   aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
235   myPosition[0] = aXorigin;
236
237   vtkFloatingPointType aYorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012;
238   aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
239   myPosition[1] = aYorigin;
240
241   // Scalar Bar size
242   myWidth = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6;
243   myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
244
245   myHeight = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12;
246   myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
247
248   myTitleSize = aResourceMgr->doubleValue("VISU", propertyName + "title_size", 0);
249   myLabelSize = aResourceMgr->doubleValue("VISU", propertyName + "label_size", 0);
250   myBarWidth = aResourceMgr->doubleValue("VISU", propertyName + "bar_width", 0);
251   myBarHeight = aResourceMgr->doubleValue("VISU", propertyName + "bar_height", 0);
252
253   // Nb of Labels
254   myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
255
256   // Fonts properties definition
257   myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
258   myTitFontType = VTK_ARIAL;
259
260   if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
261     QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
262     if ( f.family() == "Arial" )
263       myTitFontType = VTK_ARIAL;
264     else if ( f.family() == "Courier" )
265       myTitFontType = VTK_COURIER;
266     else if ( f.family() == "Times" )
267       myTitFontType = VTK_TIMES;
268     
269     myIsBoldTitle   = f.bold();
270     myIsItalicTitle = f.italic();
271     myIsShadowTitle =  f.overline();
272   }
273
274   QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
275
276   myTitleColor[0] = aTextColor.red()   / 255;
277   myTitleColor[1] = aTextColor.green() / 255;
278   myTitleColor[2] = aTextColor.blue()  / 255;
279
280   myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
281   myLblFontType = VTK_ARIAL;
282
283   if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
284     QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
285     if ( f.family() == "Arial" )
286       myLblFontType = VTK_ARIAL;
287     else if ( f.family() == "Courier" )
288       myLblFontType = VTK_COURIER;
289     else if ( f.family() == "Times" )
290       myLblFontType = VTK_TIMES;
291     
292     myIsBoldLabel   = f.bold();
293     myIsItalicLabel = f.italic();
294     myIsShadowLabel =  f.overline();
295   }
296
297   QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
298
299   myLabelColor[0] = aLabelColor.red()   / 255;
300   myLabelColor[1] = aLabelColor.green() / 255;
301   myLabelColor[2] = aLabelColor.blue()  / 255;
302
303   // scalar bar default position
304   bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
305   int aPlace = 1;
306   if (anIsArrangeBar){
307     aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
308   }
309   if(myBarOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){
310     myPosition[1] += myHeight*(aPlace-1);
311   } else {
312     myPosition[0] += myWidth*(aPlace-1);
313   }
314
315   return Build( false );
316 }
317
318 /*
319   GetIDMapper
320 */
321
322 VISU::PTableIDMapper
323 VISU::PointMap3d_i
324 ::GetTableIDMapper()
325 {
326   //Initialisate table mapper
327   SALOMEDS::GenericAttribute_var anAttr;
328   mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
329   SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
330
331   PTableIDMapper aTableIDMapper( new TTableIDMapper() );
332   TTable2D& aTable2D = *aTableIDMapper;
333
334   aTable2D.myTitle = aTableOfReal->GetTitle();
335
336   SALOMEDS::StringSeq_var aColStrList = aTableOfReal->GetColumnTitles();
337   SALOMEDS::StringSeq_var aRowStrList = aTableOfReal->GetRowTitles();
338
339   for ( int i = 0; i < aRowStrList->length(); i++ ) {
340     aTable2D.myColumnTitles.push_back( aRowStrList[ i ].in() );
341   }
342
343   int aCols = aTableOfReal->GetNbColumns();
344   int aRows = aTableOfReal->GetNbRows();
345
346   for (int i=1; i<=aCols; i++) {
347     TTable2D::TRow aRow;
348     aRow.myTitle = aColStrList[ i-1 ].in();
349     for (int j=1; j<=aRows; j++) {
350       double aVal = aTableOfReal->GetValue(j, i);
351       QString aValStr = QString::number(aVal);
352       aRow.myValues.push_back( aValStr.toLatin1().constData() );
353     }
354     if( aRow.myValues.size() > 0 )
355       aTable2D.myRows.push_back( aRow );
356   }
357
358   return aTableIDMapper;
359 }
360
361 /*
362   Create Actor
363 */
364 VISU_PointMap3dActor* VISU::PointMap3d_i::CreateActor()
365 {
366   VISU_PointMap3dActor* anActor = VISU_PointMap3dActor::New();
367   anActor->SetPipeLine(myTablePL);
368   anActor->SetFactory(this);
369
370   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
371   int  aDispMode = aResourceMgr->integerValue("VISU", "point_map_represent", 2);
372   bool toShrink  = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false);
373   anActor->SetRepresentation(aDispMode);
374   if (toShrink) anActor->SetShrink();
375
376   Handle (SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str());
377   anActor->setIO(anIO);
378
379   myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,anActor));
380   //  myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,anActor));
381
382   myActorCollection->AddItem(anActor);
383
384   UpdateActor( anActor );
385
386   return anActor;
387 }
388
389 /*
390   Update Actor
391 */
392 void VISU::PointMap3d_i::UpdateActor(VISU_ActorBase* theActor)
393 {
394   if(VISU_PointMap3dActor* anActor = dynamic_cast<VISU_PointMap3dActor*>(theActor)){
395     Update();
396     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
397     aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
398     aScalarBar->SetTitle(GetTitle());
399     aScalarBar->SetOrientation(GetBarOrientation());
400     aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
401     aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());
402     aScalarBar->SetWidth(GetWidth());
403     aScalarBar->SetHeight(GetHeight());
404     aScalarBar->SetNumberOfLabels(GetLabels());
405     aScalarBar->SetRatios(myTitleSize, myLabelSize, 
406                           myBarWidth, myBarHeight);
407     aScalarBar->SetNumberOfLabels(GetLabels());
408     aScalarBar->SetLabelFormat(GetLabelsFormat());
409
410     vtkFloatingPointType anRGB[3];
411
412     vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
413     aTitleProp->SetFontFamily(GetTitFontType());
414
415     GetTitleColor(anRGB[0],anRGB[1],anRGB[2]);
416     aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
417
418     IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
419     IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
420     IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
421
422     vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
423     aLabelProp->SetFontFamily(GetLblFontType());
424
425     GetLabelColor(anRGB[0],anRGB[1],anRGB[2]);
426     aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
427
428     IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
429     IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
430     IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
431
432     aScalarBar->Modified();
433   }
434   theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
435 }
436
437 void
438 VISU::PointMap3d_i
439 ::UpdateActors()
440 {
441   if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "<<this);
442   ProcessVoidEvent(new TVoidMemFunEvent<VISU_PipeLine>
443                    (GetSpecificPL(), &VISU_PipeLine::Update));
444
445   ProcessVoidEvent(new VISU::TInvokeSignalEvent(myUpdateActorsSignal));
446 }
447
448 //----------------------------------------------------------------------------
449 void
450 VISU::PointMap3d_i
451 ::Update()
452 {
453   if(GetMTime() < myUpdateTime.GetMTime())
454     return;
455
456   if(MYDEBUG) MESSAGE("PointMap3d_i::Update - this = "<<this);
457
458   try{
459     ProcessVoidEvent(new TVoidMemFunEvent<VISU_PipeLine>
460                      (GetSpecificPL(), &VISU_PipeLine::Update));
461     myUpdateTime.Modified();
462   }catch(std::exception&){
463     throw;
464   }catch(...){
465     throw std::runtime_error("PointMap3d_i::Update >> unexpected exception was caught!!!");
466   }
467 }
468
469 //----------------------------------------------------------------------------
470 unsigned long int 
471 VISU::PointMap3d_i
472 ::GetMTime()
473 {
474   unsigned long int aTime = myParamsTime.GetMTime();
475   if( GetSpecificPL() )
476     aTime = std::max(aTime, GetSpecificPL()->GetMTime());
477   return aTime;
478 }
479
480 /*!
481   Builds presentation of table
482 */
483 VISU::Storable* VISU::PointMap3d_i::Build( int theRestoring )
484 {
485
486   // look for reference SObject with table attribute
487   SALOMEDS::SObject_var SO = mySObj;
488
489   if ( !SO->_is_nil() ) {
490     CutLinesBase_i* pCutLines = NULL;
491     CORBA::Object_var anObj = SObjectToObject(SO);
492     if(!CORBA::is_nil(anObj)){
493       VISU::CutLinesBase_var aCutLines = VISU::CutLinesBase::_narrow(anObj);
494       if(!aCutLines->_is_nil())
495         pCutLines = dynamic_cast<CutLinesBase_i*>(GetServant(aCutLines).in());
496     }
497     SALOMEDS::Study_var aStudy = GetStudyDocument();
498     SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
499     SALOMEDS::GenericAttribute_var anAttr;
500     // look for component
501     if ( !theRestoring ) {
502         SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
503         // create SObject and set attributes
504         QString aComment;
505         if(pCutLines)
506           aComment.sprintf("myComment=%s;mySourceId=CutLines",GetComment());
507         else{
508           aComment.sprintf("myComment=%s;mySourceId=TableAttr",GetComment());
509           SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
510           if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){
511             SALOMEDS::AttributeString_var aCommentAttr =
512               SALOMEDS::AttributeString::_narrow(anAttr);
513             CORBA::String_var aValue = aCommentAttr->Value();
514             Storable::TRestoringMap aMap;
515             Storable::StringToMap(aValue.in(),aMap);
516             bool anIsExist;
517             QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
518             if(anIsExist){
519               if(aMethodName == "ImportTables"){
520                 aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment());
521               }
522             }
523           }
524         }
525
526         string anEntry = CreateAttributes( GetStudyDocument(),
527                                           SO->GetID(),//SComponent->GetID(),
528                                           "ICON_TREE_TABLE",
529                                           GetID(),
530                                           GetName(),
531                                           "",
532                                           aComment.toLatin1().constData(),
533                                           pCutLines );
534         // create SObject referenced to real table object
535         mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID( anEntry.c_str() ));
536         if(pCutLines) {
537           pCutLines->BuildTableOfReal(mySObj);
538         }
539         // mpv (PAL5357): reference attributes are unnecessary now
540         //SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj );
541         //Builder->Addreference( refSO, SO );
542     }
543
544     return this;
545   }
546   return NULL;
547 }
548 /*!
549   Restores table object from stream
550 */
551 VISU::Storable* VISU::PointMap3d_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
552 {
553   if(MYDEBUG) MESSAGE(GetComment());
554   SetName(VISU::Storable::FindValue(theMap,"myName").toLatin1().constData(), false);
555   myTitle = VISU::Storable::FindValue(theMap,"myTitle").toLatin1().constData();
556   myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
557   mySObj = SALOMEDS::SObject::_duplicate(SO);
558
559   //Create PipeLine
560   myTablePL = VISU_DeformedGridPL::New();
561   myTablePL->SetPolyDataIDMapper(GetTableIDMapper());
562   myTablePL->Update();
563
564   //Restore Other Values
565   
566   float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
567   float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
568   SetRange(aMin, aMax);
569
570   UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
571
572   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
573   SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
574   SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g").toLatin1().constData());
575   SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myBarOrientation").toInt());
576
577   SetTitle(VISU::Storable::FindValue(theMap,"myTitle").toLatin1().constData());
578   myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
579   myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
580   myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
581   myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
582   myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
583   myTitleSize = VISU::Storable::FindValue(theMap,"myTitleSize").toInt();
584   myLabelSize = VISU::Storable::FindValue(theMap,"myLabelSize").toInt();
585   myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
586   myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
587
588   myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
589   myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
590   myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
591   myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
592   myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
593   myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
594   myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
595
596   myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
597   myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
598   myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
599   myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
600   myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
601   myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
602   myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
603
604   myParamsTime.Modified();
605   return Build( true );
606 }
607 /*!
608   Flushes table data into stream
609 */
610 void VISU::PointMap3d_i::ToStream( std::ostringstream& theStr )
611 {
612   Storable::DataToStream( theStr, "myName",        GetName().c_str() );
613   Storable::DataToStream( theStr, "myTitle",       myTitle.c_str() );
614   Storable::DataToStream( theStr, "myOrientation", myOrientation );
615
616   Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
617   Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
618   Storable::DataToStream( theStr, "myIsFixedRange",   IsRangeFixed() );
619
620   Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
621   Storable::DataToStream( theStr, "myBarOrientation", myBarOrientation );
622
623   Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
624   Storable::DataToStream( theStr, "myUnitsVisible",   myIsUnits );
625   Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
626   Storable::DataToStream( theStr, "myLabelsFormat",   myLabelsFormat.c_str() );
627   Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
628   Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
629   Storable::DataToStream( theStr, "myWidth",          myWidth );
630   Storable::DataToStream( theStr, "myHeight",         myHeight );
631   Storable::DataToStream( theStr, "myTitleSize",      myTitleSize );
632   Storable::DataToStream( theStr, "myLabelSize",     myLabelSize );
633   Storable::DataToStream( theStr, "myBarWidth",       myBarWidth );
634   Storable::DataToStream( theStr, "myBarHeight",      myBarHeight );
635
636   Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
637   Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
638   Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
639   Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
640   Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
641   Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
642   Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
643
644   Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
645   Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
646   Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
647   Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
648   Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
649   Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
650   Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
651 }
652 /*!
653   Called from engine to restore table from the file
654 */
655 VISU::Storable* VISU::PointMap3d_i::StorableEngine(SALOMEDS::SObject_ptr theSObject,
656                                                    const Storable::TRestoringMap& theMap,
657                                                    const std::string& thePrefix,
658                                                    CORBA::Boolean theIsMultiFile)
659 {
660   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
661   VISU::PointMap3d_i* pResent = new VISU::PointMap3d_i( aStudy, "" );
662   return pResent->Restore( theMap, theSObject);
663 }
664 /*!
665   Gets title for the original table object
666 */
667 QString VISU::PointMap3d_i::GetTableTitle()
668 {
669   SALOMEDS::SObject_var SO = mySObj;
670   SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
671   SALOMEDS::GenericAttribute_var        anAttr;
672   SALOMEDS::AttributeTableOfInteger_var anInt;
673   SALOMEDS::AttributeTableOfReal_var    aReal;
674   if ( !SO->_is_nil() ) {
675     if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
676       anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
677       CORBA::String_var aString = anInt->GetTitle();
678       return aString.in();
679     }
680     else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
681       aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
682       CORBA::String_var aString = aReal->GetTitle();
683       return aString.in();
684     }
685   }
686   return "";
687 }
688
689 //---------------------------------------------------------------
690 void VISU::PointMap3d_i::RemoveFromStudy()
691 {
692   struct TRemoveFromStudy: public SALOME_Event
693   {
694     VISU::PointMap3d_i* myRemovable;
695     TRemoveFromStudy(VISU::PointMap3d_i* theRemovable):
696       myRemovable(theRemovable)
697     {}
698     
699     virtual
700     void
701     Execute()
702     {
703       VISU::RemoveFromStudy(myRemovable->GetSObject(),false);
704     }
705   };
706
707   // Remove the table with all curves
708   ProcessVoidEvent(new TRemoveFromStudy(this));
709 }
710
711 //----------------------------------------------------------------
712 void VISU::PointMap3d_i::SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz)
713 {
714   myOffset[0] = theDx;
715   myOffset[1] = theDy;
716   myOffset[2] = theDz;
717   myParamsTime.Modified();
718 }
719
720 void VISU::PointMap3d_i::GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz)
721 {
722   theDx = myOffset[0];
723   theDy = myOffset[1];
724   theDz = myOffset[2];
725 }
726
727 CORBA::Float VISU::PointMap3d_i::GetMemorySize()
728 {
729   CORBA::Float aSize = GetSpecificPL()->GetMemorySize();
730
731   int anEnd = myActorCollection->GetNumberOfItems();
732   for(int anId = 0; anId < anEnd; anId++)
733     if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId))
734       if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anObject)){
735         aSize += anActor->GetMemorySize();
736         //cout<<"Prs3d_i::GetMemorySize - "<<this<<"; anActor = "<<aSize / (1024.0 * 1024.0)<<endl;
737       }
738
739   // Convert to mega bytes
740   return aSize / (1024.0 * 1024.0);
741 }
742
743 //------------------ ColoredPrs3dBase Methods --------------------
744 CORBA::Double VISU::PointMap3d_i::GetMin()
745 {
746   return myTablePL->GetScalarRange()[0];
747 }
748
749 CORBA::Double VISU::PointMap3d_i::GetMinTableValue()
750 {
751   SALOMEDS::GenericAttribute_var anAttr;
752   mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
753   SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
754   double aMin = aTableOfReal->GetValue(1, 1);
755   
756   for (int i=1; i<=aTableOfReal->GetNbColumns(); i++)
757     for (int j=1; j<=aTableOfReal->GetNbRows(); j++) {
758       double aVal = aTableOfReal->GetValue(j, i);
759       if (aVal < aMin)
760         aMin = aVal;
761     }
762   
763   return aMin;
764 }
765
766 CORBA::Double VISU::PointMap3d_i::GetMaxTableValue()
767 {
768   SALOMEDS::GenericAttribute_var anAttr;
769   mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
770   SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
771   double aMax = aTableOfReal->GetValue(1, 1);
772
773   for (int i=1; i<=aTableOfReal->GetNbColumns(); i++)
774     for (int j=1; j<=aTableOfReal->GetNbRows(); j++) {
775       double aVal = aTableOfReal->GetValue(j, i);
776       if (aVal > aMax)
777         aMax = aVal;
778     }
779
780   return aMax;
781 }
782
783 CORBA::Double VISU::PointMap3d_i::GetMax()
784 {
785   return myTablePL->GetScalarRange()[1];
786 }
787
788 void VISU::PointMap3d_i::SetRange(CORBA::Double theMin, CORBA::Double theMax)
789 {
790   vtkFloatingPointType aScalarRange[2] = {theMin, theMax};
791   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, vtkFloatingPointType*>
792                    (GetSpecificPL(), &VISU_DeformedGridPL::SetScalarRange, aScalarRange));
793
794   UseFixedRange(true);
795 }
796
797 CORBA::Double VISU::PointMap3d_i::GetSourceMin()
798 {
799   vtkFloatingPointType aRange[2];
800   GetSpecificPL()->GetSourceRange(aRange);
801   return aRange[0];
802 }
803
804 CORBA::Double VISU::PointMap3d_i::GetSourceMax()
805 {
806   vtkFloatingPointType aRange[2];
807   GetSpecificPL()->GetSourceRange(aRange);
808   return aRange[1];
809 }
810
811 void VISU::PointMap3d_i::SetSourceRange()
812 {
813   GetSpecificPL()->SetSourceRange();
814   ProcessVoidEvent(new TVoidMemFunEvent<VISU_DeformedGridPL>
815                    (GetSpecificPL(), &VISU_DeformedGridPL::SetSourceRange));
816
817   UseFixedRange(false);
818 }
819
820 CORBA::Boolean VISU::PointMap3d_i::IsRangeFixed()
821 {
822   return myIsFixedRange; 
823 }
824
825 void VISU::PointMap3d_i::UseFixedRange(bool theRange)
826 {
827   if(myIsFixedRange == theRange)
828     return;
829
830   myIsFixedRange = theRange;
831 }
832
833 void VISU::PointMap3d_i::SetPosition(CORBA::Double theX, CORBA::Double theY)
834 {
835   bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX);
836   anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY);
837   if(anIsSameValue)
838     return;
839
840   myPosition[0] = theX; 
841   myPosition[1] = theY;
842 }
843
844 CORBA::Double VISU::PointMap3d_i::GetPosX()
845 {
846   return myPosition[0];
847 }
848
849 CORBA::Double VISU::PointMap3d_i::GetPosY()
850 {
851   return myPosition[1];
852 }
853
854 void VISU::PointMap3d_i::SetSize(CORBA::Double theWidth, CORBA::Double theHeight)
855 {
856   bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth);
857   anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight);
858   if(anIsSameValue)
859     return;
860
861   myWidth = theWidth; 
862   myHeight = theHeight;
863 }
864
865 CORBA::Double VISU::PointMap3d_i::GetHeight()
866 {
867   return myHeight;
868 }
869
870 CORBA::Double VISU::PointMap3d_i::GetWidth()
871 {
872   return myWidth;
873 }
874
875 void VISU::PointMap3d_i::SetNbColors(CORBA::Long theNbColors)
876 {
877   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
878                    (GetSpecificPL(), &VISU_DeformedGridPL::SetNbColors, theNbColors));
879 }
880
881 CORBA::Long VISU::PointMap3d_i::GetNbColors()
882 {
883   return GetSpecificPL()->GetNbColors();
884 }
885
886 void VISU::PointMap3d_i::SetLabels(CORBA::Long theNbLabels)
887 {
888   if(myNumberOfLabels == theNbLabels)
889     return;
890
891   myNumberOfLabels = theNbLabels;
892 }
893
894 CORBA::Long VISU::PointMap3d_i::GetLabels()
895 {
896   return myNumberOfLabels;
897 }
898
899 void VISU::PointMap3d_i::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theBarOrientation)
900 {
901   if(myBarOrientation == theBarOrientation)
902     return;
903
904   myBarOrientation = theBarOrientation;
905 }
906
907 VISU::ColoredPrs3dBase::Orientation VISU::PointMap3d_i::GetBarOrientation()
908 {
909   return myBarOrientation;
910 }
911
912 //------------------- ScaledPrs3d Methods -----------------------
913
914 void VISU::PointMap3d_i::SetScaling(VISU::Scaling theScaling)
915 {
916   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
917                    (GetSpecificPL(), &VISU_DeformedGridPL::SetScaling, theScaling));
918 }
919
920 VISU::Scaling VISU::PointMap3d_i::GetScaling()
921 {
922   return VISU::Scaling(GetSpecificPL()->GetScaling());
923 }
924
925 //------------------- Check Table on Positive Values ------------
926 bool VISU::PointMap3d_i::IsPositiveTable()
927 {
928   SALOMEDS::GenericAttribute_var anAttr;
929   mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
930   SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
931
932   for (int i=1; i<=aTableOfReal->GetNbColumns(); i++)
933     for (int j=1; j<=aTableOfReal->GetNbRows(); j++) {
934       double aVal = aTableOfReal->GetValue(j, i);
935       if (aVal < 0)
936         return false;
937     }
938
939   return true;
940 }
941
942 //------------------- Plot3dBase Methods ------------------------
943
944 void VISU::PointMap3d_i::SetScaleFactor (CORBA::Double theScaleFactor)
945 {
946   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, vtkFloatingPointType>
947                    (GetSpecificPL(), &VISU_DeformedGridPL::SetScaleFactor, theScaleFactor));
948 }
949
950 CORBA::Double VISU::PointMap3d_i::GetScaleFactor ()
951 {
952   return myTablePL->GetScaleFactor();
953 }
954
955 void VISU::PointMap3d_i::SetContourPrs (CORBA::Boolean theIsContourPrs )
956 {
957   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, bool>
958                    (GetSpecificPL(), &VISU_DeformedGridPL::SetContourPrs, theIsContourPrs));
959 }
960
961 CORBA::Boolean VISU::PointMap3d_i::GetIsContourPrs()
962 {
963   return myTablePL->GetIsContourPrs();
964 }
965
966 void VISU::PointMap3d_i::SetNbOfContours (CORBA::Long theNb)
967 {
968   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_DeformedGridPL, int>
969                    (GetSpecificPL(), &VISU_DeformedGridPL::SetNumberOfContours, theNb));
970 }
971
972 CORBA::Long VISU::PointMap3d_i::GetNbOfContours ()
973 {
974   return myTablePL->GetNumberOfContours();
975 }
976
977 //-------------------- Actor Factory Methods --------------------
978
979 bool VISU::PointMap3d_i::GetActiveState ()
980 {
981   return myIsActiveState;
982 }
983
984 void VISU::PointMap3d_i::SetActiveState ( bool theState )
985 {
986   myIsActiveState = theState;
987 }
988
989 void VISU::PointMap3d_i::RemoveActor (VISU_ActorBase* theActor)
990 {
991   myActorCollection->RemoveItem(theActor);
992 }
993
994 void VISU::PointMap3d_i::RemoveActors ()
995 {
996   ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal));
997   myActorCollection->RemoveAllItems();
998 }
999
1000
1001 //-----------------------Text Properties & Label Properties------------------
1002 bool VISU::PointMap3d_i::IsBoldTitle() 
1003
1004   return myIsBoldTitle;
1005 }
1006
1007 //----------------------------------------------------------------------------
1008 void VISU::PointMap3d_i::SetBoldTitle(bool theIsBoldTitle)
1009 {
1010   if(myIsBoldTitle == theIsBoldTitle)
1011     return;
1012
1013   myIsBoldTitle = theIsBoldTitle;
1014   myParamsTime.Modified();
1015 }
1016
1017 //----------------------------------------------------------------------------
1018 bool VISU::PointMap3d_i::IsItalicTitle() 
1019
1020   return myIsItalicTitle;
1021 }
1022
1023 //----------------------------------------------------------------------------
1024 void VISU::PointMap3d_i::SetItalicTitle(bool theIsItalicTitle)
1025
1026   if(myIsItalicTitle == theIsItalicTitle)
1027     return;
1028
1029   myIsItalicTitle = theIsItalicTitle;
1030   myParamsTime.Modified();
1031 }
1032
1033 //----------------------------------------------------------------------------
1034 bool VISU::PointMap3d_i::IsShadowTitle() 
1035
1036   return myIsShadowTitle;
1037 }
1038
1039 //----------------------------------------------------------------------------
1040 void VISU::PointMap3d_i::SetShadowTitle(bool theIsShadowTitle)
1041
1042   if(myIsShadowTitle == theIsShadowTitle)
1043     return;
1044
1045   myIsShadowTitle = theIsShadowTitle;
1046   myParamsTime.Modified();
1047 }
1048
1049 //----------------------------------------------------------------------------
1050 int VISU::PointMap3d_i::GetTitFontType()
1051 {
1052   return myTitFontType;
1053 }
1054
1055 //----------------------------------------------------------------------------
1056 void VISU::PointMap3d_i::SetTitFontType(int theTitFontType)
1057 {
1058   if(myTitFontType == theTitFontType)
1059     return;
1060
1061   myTitFontType = theTitFontType;
1062   myParamsTime.Modified();
1063 }
1064
1065 //----------------------------------------------------------------------------
1066 void VISU::PointMap3d_i::GetTitleColor(vtkFloatingPointType& theR, 
1067                                          vtkFloatingPointType& theG, 
1068                                          vtkFloatingPointType& theB)
1069 {
1070   theR = myTitleColor[0]; 
1071   theG = myTitleColor[1]; 
1072   theB = myTitleColor[2];
1073 }
1074
1075 //----------------------------------------------------------------------------
1076 void VISU::PointMap3d_i::SetTitleColor(vtkFloatingPointType theR, 
1077                                          vtkFloatingPointType theG, 
1078                                          vtkFloatingPointType theB)
1079 {
1080   bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR);
1081   anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG);
1082   anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB);
1083   if(anIsSameValue)
1084     return;
1085
1086   myTitleColor[0] = theR; 
1087   myTitleColor[1] = theG; 
1088   myTitleColor[2] = theB; 
1089   myParamsTime.Modified();
1090 }
1091
1092 //----------------------------------------------------------------------------
1093 bool VISU::PointMap3d_i::IsBoldLabel()
1094 {
1095   return myIsBoldLabel;
1096 }
1097
1098 //----------------------------------------------------------------------------
1099 void VISU::PointMap3d_i::SetBoldLabel(bool theIsBoldLabel) 
1100 {
1101   if(myIsBoldLabel == theIsBoldLabel)
1102     return;
1103
1104   myIsBoldLabel = theIsBoldLabel;
1105   myParamsTime.Modified();
1106 }
1107
1108 //----------------------------------------------------------------------------
1109 bool VISU::PointMap3d_i::IsItalicLabel() 
1110 {
1111   return myIsItalicLabel;
1112 }
1113
1114 //----------------------------------------------------------------------------
1115 void VISU::PointMap3d_i::SetItalicLabel(bool theIsItalicLabel)
1116 {
1117   if(myIsItalicLabel == theIsItalicLabel)
1118     return;
1119
1120   myIsItalicLabel = theIsItalicLabel;
1121   myParamsTime.Modified();
1122 }
1123
1124 //----------------------------------------------------------------------------
1125 bool VISU::PointMap3d_i::IsShadowLabel() 
1126 {
1127   return myIsShadowLabel;
1128 }
1129
1130 //----------------------------------------------------------------------------
1131 void VISU::PointMap3d_i::SetShadowLabel(bool theIsShadowLabel)
1132 {
1133   if(myIsShadowLabel == theIsShadowLabel)
1134     return;
1135
1136   myIsShadowLabel = theIsShadowLabel;
1137   myParamsTime.Modified();
1138 }
1139
1140 //----------------------------------------------------------------------------
1141 int VISU::PointMap3d_i::GetLblFontType()
1142 {
1143   return myLblFontType;
1144 }
1145
1146 //----------------------------------------------------------------------------
1147 void VISU::PointMap3d_i::SetLblFontType(int theLblFontType)
1148 {
1149   if(myLblFontType == theLblFontType)
1150     return;
1151
1152   myLblFontType = theLblFontType;
1153   myParamsTime.Modified();
1154 }
1155
1156 //----------------------------------------------------------------------------
1157 void VISU::PointMap3d_i::GetLabelColor(vtkFloatingPointType& theR, 
1158                                   vtkFloatingPointType& theG, 
1159                                   vtkFloatingPointType& theB)
1160 {
1161   theR = myLabelColor[0]; 
1162   theG = myLabelColor[1]; 
1163   theB = myLabelColor[2];
1164 }
1165
1166 //----------------------------------------------------------------------------
1167 void VISU::PointMap3d_i::SetLabelColor(vtkFloatingPointType theR, 
1168                                   vtkFloatingPointType theG, 
1169                                   vtkFloatingPointType theB)
1170 {
1171   bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR);
1172   anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG);
1173   anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB);
1174   if(anIsSameValue)
1175     return;
1176
1177   myLabelColor[0] = theR; 
1178   myLabelColor[1] = theG; 
1179   myLabelColor[2] = theB; 
1180   myParamsTime.Modified();
1181 }
1182
1183 //----------------------------------------------------------------------------
1184 CORBA::Long VISU::PointMap3d_i::GetTitleSize() 
1185 {
1186   return myTitleSize;
1187 }
1188
1189 //----------------------------------------------------------------------------
1190 CORBA::Long VISU::PointMap3d_i::GetLabelSize() 
1191 {
1192   return myLabelSize;
1193 }
1194
1195 //----------------------------------------------------------------------------
1196 CORBA::Long VISU::PointMap3d_i::GetBarWidth() 
1197 {
1198   return myBarWidth;
1199 }
1200
1201 //----------------------------------------------------------------------------
1202 CORBA::Long VISU::PointMap3d_i::GetBarHeight() 
1203
1204   return myBarHeight;
1205 }
1206
1207 //----------------------------------------------------------------------------
1208 void
1209 VISU::PointMap3d_i::SetLabelsFormat(const char* theFormat)
1210 {
1211   if( myLabelsFormat != theFormat ){
1212     myLabelsFormat = theFormat;
1213     myParamsTime.Modified();
1214   }
1215 }
1216
1217 //----------------------------------------------------------------------------
1218 char* VISU::PointMap3d_i::GetLabelsFormat() 
1219
1220   return CORBA::string_dup(myLabelsFormat.c_str());
1221 }
1222
1223 //----------------------------------------------------------------------------
1224 void VISU::PointMap3d_i::SetUnitsVisible(CORBA::Boolean isVisible)
1225 {
1226   if( myIsUnits != isVisible ){
1227     myIsUnits = isVisible;
1228     myParamsTime.Modified();
1229   }
1230 }
1231
1232 //----------------------------------------------------------------------------
1233 CORBA::Boolean VISU::PointMap3d_i::IsUnitsVisible()
1234 {
1235   return myIsUnits;
1236 }
1237
1238 //----------------------------------------------------------------------------
1239 void VISU::PointMap3d_i::SetRatios(CORBA::Long theTitleSize, 
1240                               CORBA::Long theLabelSize, 
1241                               CORBA::Long theBarWidth, CORBA::Long theBarHeight) 
1242 {
1243   bool anIsSameValue = VISU::CheckIsSameValue(myTitleSize, theTitleSize);
1244   anIsSameValue &= VISU::CheckIsSameValue(myLabelSize, theLabelSize);
1245   anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
1246   anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
1247   if(anIsSameValue)
1248     return;
1249
1250   myTitleSize = theTitleSize; 
1251   myLabelSize = theLabelSize; 
1252   myBarWidth = theBarWidth; 
1253   myBarHeight = theBarHeight;
1254   myParamsTime.Modified();
1255 }