1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // VISU OBJECT : interactive object for VISU entities implementation
21 // File : VISU_Prs3dUtils.cc
22 // Author : Alexey PETROV
25 #include "VISU_Prs3dUtils.hh"
26 #include "VISU_Prs3d_i.hh"
27 #include "VISU_PointMap3d_i.hh"
28 #include "SalomeApp_Study.h"
29 #include "SALOME_Event.h"
34 //----------------------------------------------------------------------------
36 ::TSetModified(VISU::PrsObject_i* thePrsObject):
37 myPrsObject(thePrsObject)
43 //----------------------------------------------------------------------------
47 struct TEvent: public SALOME_Event
49 VISU::TSetModified* mySetModified;
50 TEvent(VISU::TSetModified* theSetModified):
51 mySetModified(theSetModified)
58 VISU::PrsObject_i* aPrsObject = mySetModified->myPrsObject;
62 VISU::Prs3d_i* aPrs3d;
63 VISU::PointMap3d_i* aPntMap;
64 SalomeApp_Study* aStudy;
65 unsigned long int time;
66 if( (aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aPrsObject)) && aPrs3d->GetActorEntry() != "" ) {
67 aStudy = aPrs3d->GetGUIStudy();
68 time = aPrs3d->GetMTime();
69 } else if ( aPntMap = dynamic_cast<VISU::PointMap3d_i*>(aPrsObject) ) {
70 aStudy = aPntMap->GetGUIStudy();
71 time = aPntMap->GetMTime();
75 if(time > mySetModified->GetMTime()){
82 ProcessVoidEvent(new TEvent(this));
85 //----------------------------------------------------------------------------
87 std::string ToFormat( const int thePrec )
91 sprintf( str, "%%-#.%dg", thePrec );
95 //----------------------------------------------------------------------------
97 int ToPrecision( const char* theFormat )
99 int N = strlen( theFormat );
103 for ( int i = 0; i < N; i++ )
105 if ( theFormat[ i ] == '.' )
107 else if ( theFormat[ i ] == 'g' )
114 str[ k++ ] = theFormat[ i ];