]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Slider improvement
authorouv <ouv@opencascade.com>
Wed, 29 Nov 2006 12:04:58 +0000 (12:04 +0000)
committerouv <ouv@opencascade.com>
Wed, 29 Nov 2006 12:04:58 +0000 (12:04 +0000)
13 files changed:
idl/VISU_Gen.idl
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI_CacheDlg.cxx
src/VISUGUI/VisuGUI_CacheDlg.h
src/VISUGUI/VisuGUI_Slider.cxx
src/VISUGUI/VisuGUI_Slider.h
src/VISU_I/Makefile.in
src/VISU_I/SALOME_GenericObjPointer.cc [new file with mode: 0644]
src/VISU_I/SALOME_GenericObjPointer.hh [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3dCache_i.hh
src/VISU_I/VISU_ColoredPrs3dHolder_i.cc
src/VISU_I/VISU_ColoredPrs3dHolder_i.hh

index 1a9fde61f9ff8032acfa6ffec6113090a3774f67..a45623af77d55582a30870916d9c48bb206c1463 100644 (file)
@@ -576,6 +576,7 @@ module VISU {
 
   //-------------------------------------------------------
   interface View3D;
+  interface ColoredPrs3dCache;
 
   /*! \brief %ColoredPrs3dHolder interface.
    * Interface of 3d presentation's holder, which represents colored 3d presentations,
@@ -619,9 +620,14 @@ module VISU {
     ColoredPrs3d::TimeStampsRange GetTimeStampsRange();
 
     /*!
-     * Gats input parameters of the last visited presentation.
+     * Gets input parameters of the last visited presentation.
      */
     BasicInput GetBasicInput();
+
+    /*!
+     * Gets a %ColoredPrs3dCache, to which the holder belongs
+     */
+    ColoredPrs3dCache GetCache();
   };
 
 
index 539cb4b98020a92a3211aacf1fedfe012379e808..25ede96fd67d093d2ed4a8248b70d9dca49b57c1 100644 (file)
@@ -1624,6 +1624,12 @@ msgstr "Progressive"
 msgid "VisuGUI_Slider::MORE"
 msgstr "More..."
 
+msgid "VisuGUI_Slider::CACHE_MEMORY"
+msgstr "Cache:"
+
+msgid "VisuGUI_Slider::FREE_MEMORY"
+msgstr "Free:"
+
 msgid "VisuGUI_Slider::SPEED"
 msgstr "Speed:"
 
index a17535f2fdd7460111ebc7c17f9c2871847b1012..5e0be2c29faea800cf1e08e4a4ef2c4c5e22bfc5 100644 (file)
@@ -84,35 +84,6 @@ VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache,
 
   connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), myLimitedMemory, SLOT( setEnabled( bool ) ) );
 
-  // Current state
-  QGroupBox* aStateGroup = new QGroupBox( tr( "MEMORY STATE" ), this );
-  aStateGroup->setColumnLayout( 0, Qt::Vertical );
-  aStateGroup->layout()->setSpacing( 0 );
-  aStateGroup->layout()->setMargin( 0 );
-
-  QGridLayout* aStateLayout = new QGridLayout( aStateGroup->layout(), 2, 2 );
-  aStateLayout->setSpacing(6);
-  aStateLayout->setMargin(6);
-
-  QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroup );
-  myUsedMemory = new QLineEdit( aStateGroup );
-  myUsedMemory->setText( QString::number( (double)myCache->GetMemorySize() ) + " Mb" );
-  myUsedMemory->setReadOnly( true );
-  myUsedMemory->setEnabled( false );
-  myUsedMemory->setPaletteForegroundColor( Qt::black );
-
-  QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE" ), aStateGroup );
-  myFreeMemory = new QLineEdit( aStateGroup );
-  myFreeMemory->setText( QString::number( aLimitedMemoryMax ) + " Mb" );
-  myFreeMemory->setReadOnly( true );
-  myFreeMemory->setEnabled( false );
-  myFreeMemory->setPaletteForegroundColor( Qt::black );
-
-  aStateLayout->addWidget( aUsedMemoryLabel, 0, 0 );
-  aStateLayout->addWidget( myUsedMemory, 0, 1 );
-  aStateLayout->addWidget( aFreeMemoryLabel, 1, 0 );
-  aStateLayout->addWidget( myFreeMemory, 1, 1 );
-
   // Ok / Cancel
   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
   GroupButtons->setColumnLayout(0, Qt::Vertical );
index 71693e76b8bea213cb52973fdf21af524cf511e6..f60521f84659bcbc3d803643badb3a85e2c683cf 100644 (file)
@@ -63,9 +63,6 @@ private:
   QRadioButton*   myMimimalMemoryButton;
   QRadioButton*   myLimitedMemoryButton;
   QtxDblSpinBox*  myLimitedMemory;
-
-  QLineEdit*      myUsedMemory;
-  QLineEdit*      myFreeMemory;
 };
 
 #endif
index b3da409f6ddf0af831cdde373c81ed5edf5e28fc..32e1f3e8fe60a2879d15075873fc898dada915d7 100644 (file)
@@ -37,6 +37,8 @@
 
 #include "SALOME_ListIteratorOfListIO.hxx"
 
+#include "VISU_PipeLine.hxx"
+
 #include "VISU_Actor.h"
 
 #include "VVTK_MainWindow.h"
@@ -58,6 +60,7 @@
 #include <qlabel.h>
 #include <qlayout.h>
 #include <qhbox.h>
+#include <qhbuttongroup.h>
 #include <qpushbutton.h>
 #include <qtoolbutton.h>
 #include <qslider.h>
@@ -91,7 +94,7 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
   QVBoxLayout* aBasicLayout = new QVBoxLayout( aWidget, 11, 6 );
 
   // Slider and time stamps
-  QHBoxLayout* aSliderLayout = new QHBoxLayout( 0, 0, 6); 
+  QHBoxLayout* aSliderLayout = new QHBoxLayout( 0, 0, 6 );
 
   myFirstTimeStamp = new QLabel( aWidget );
   myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
@@ -101,7 +104,6 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
   mySlider = new QSlider( aWidget );
   mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   mySlider->setOrientation( QSlider::Horizontal );
-  //mySlider->setTickmarks( QSlider::Below );
   mySlider->setTracking( false );
   aSliderLayout->addWidget( mySlider );
 
@@ -125,7 +127,7 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
   aBasicLayout->addLayout( aSliderLayout );
 
   // Buttons
-  QHBoxLayout* aButtonsLayout = new QHBoxLayout( 0, 0, 6); 
+  QHBoxLayout* aButtonsLayout = new QHBoxLayout( 0, 0, 6 );
 
   myMoreButton = new QPushButton( tr( "MORE" ), aWidget );
   myMoreButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
@@ -137,32 +139,47 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
 
   myFirstButton = new QToolButton( aWidget );
   myFirstButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
-  //myFirstButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   aButtonsLayout->addWidget( myFirstButton );
 
   myPreviousButton = new QToolButton( aWidget );
   myPreviousButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
-  //myPreviousButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   aButtonsLayout->addWidget( myPreviousButton );
 
   myPlayButton = new QToolButton( aWidget );
   myPlayButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
-  //myPlayButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   myPlayButton->setToggleButton( true );
   aButtonsLayout->addWidget( myPlayButton );
 
   myNextButton = new QToolButton( aWidget );
   myNextButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
-  //myNextButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   aButtonsLayout->addWidget( myNextButton );
 
   myLastButton = new QToolButton( aWidget );
   myLastButton->setIconSet( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
-  //myLastButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   aButtonsLayout->addWidget( myLastButton );
 
   aButtonsLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
 
+  // Memory state
+  QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget );
+  aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aButtonsLayout->addWidget( aCacheMemoryLabel );
+
+  myCacheMemory = new QLabel( aWidget );
+  myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aButtonsLayout->addWidget( myCacheMemory );
+
+  QLabel* aFreeMemoryLabel = new QLabel( tr( "FREE_MEMORY" ), aWidget );
+  aFreeMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aButtonsLayout->addWidget( aFreeMemoryLabel );
+
+  myFreeMemory = new QLabel( aWidget );
+  myFreeMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+  aButtonsLayout->addWidget( myFreeMemory );
+
+  aButtonsLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+
+  // Speed
   QLabel* aSpeedLabel = new QLabel( tr( "SPEED" ), aWidget );
   aSpeedLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   aButtonsLayout->addWidget( aSpeedLabel );
@@ -172,6 +189,7 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
   mySpeedBox->setValue( 50 );
   aButtonsLayout->addWidget( mySpeedBox );
 
+  // AVI
   myAVIBox = new QCheckBox( tr( "AVI" ), aWidget );
   myAVIBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
   myAVIBox->setEnabled( false );
@@ -250,6 +268,7 @@ void VisuGUI_Slider::enableControls( bool on )
       if( aNumber == aTimeStampNumber )
        a_current_index = an_index;
     }
+    // work around - to update controls' sizes
     myTimeStampStrings->setFont(myTimeStampStrings->font());
     myTimeStampStrings->updateGeometry();
     
@@ -267,6 +286,22 @@ void VisuGUI_Slider::enableControls( bool on )
 
 }
 
+void VisuGUI_Slider::updateMemoryState()
+{
+  if( myHolderList.empty() )
+    return;
+
+  VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
+
+  VISU::ColoredPrs3dCache_var aCache = aHolder->GetCache();
+  CORBA::Float aCacheMemory = aCache->GetMemorySize();
+  myCacheMemory->setText( QString::number( aCacheMemory ) + " Mb" );
+
+  long aMb = 1024 * 1024;
+  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+  myFreeMemory->setText( QString::number( aFreeMemory ) + " Mb" );
+}
+
 void VisuGUI_Slider::onSelectionChanged()
 {
   //cout << "VisuGUI_Slider::onSelectionChanged()" << endl;
@@ -303,6 +338,7 @@ void VisuGUI_Slider::onSelectionChanged()
   }
 
   enableControls( !myHolderList.empty() );
+  updateMemoryState();
 }
 
 void VisuGUI_Slider::onTimeStampActivated( int value )
@@ -393,6 +429,8 @@ void VisuGUI_Slider::onValueChanged( int value )
 
   myTimeStampStrings->setCurrentItem( value );
   myTimeStampIndices->setCurrentItem( value );
+
+  updateMemoryState();
 }
 
 void VisuGUI_Slider::onSpeedChanged( int value )
index d76ecf69b06f8f0998925a1436f66f84c9723e50..a15037c11bb853e9d1ec123aa1683f6b56ac8efd 100644 (file)
@@ -64,10 +64,6 @@ public:
                  LightApp_SelectionMgr* theSelectionMgr );
   virtual ~VisuGUI_Slider();
 
-public:
-
-  virtual void     enableControls( bool );
-
 public slots:
   virtual void     onSelectionChanged();
 
@@ -86,6 +82,10 @@ public slots:
 
   virtual void     onTimeout();
 
+protected:
+  virtual void     enableControls( bool );
+  virtual void     updateMemoryState();
+
 private:
   VisuGUI_Module*  myModule;
   VVTK_MainWindow* myMainWindow;
@@ -107,6 +107,9 @@ private:
   QToolButton*     myNextButton;
   QToolButton*     myLastButton;
 
+  QLabel*          myCacheMemory;
+  QLabel*          myFreeMemory;
+
   QSpinBox*        mySpeedBox;
   QCheckBox*       myAVIBox;
 
index bfdc2a50cc7b274d2530912ec3bbef03a33ff426..5c427a1c3eab60c932d905771ead813946648346 100644 (file)
@@ -59,7 +59,7 @@ LIB_SRC = \
        VISU_Gen_i.cc \
        VISU_CorbaMedConvertor.cxx \
        VISU_DumpPython.cc \
-       SALOME_GenericObjPtr.cc
+       SALOME_GenericObjPointer.cc
 
 LIB_MOC = \
        VISU_TimeAnimation.h
@@ -108,7 +108,7 @@ EXPORT_HEADERS = \
        VISU_ColoredPrs3dCache_i.hh \
        VISU_ColoredPrs3dHolder_i.hh \
        VISU_ColoredPrs3dFactory.hh \
-       SALOME_GenericObjPtr.hh
+       SALOME_GenericObjPointer.hh
 
 # additionnal information to compil and link file
 CPPFLAGS += \
diff --git a/src/VISU_I/SALOME_GenericObjPointer.cc b/src/VISU_I/SALOME_GenericObjPointer.cc
new file mode 100644 (file)
index 0000000..6b19648
--- /dev/null
@@ -0,0 +1,126 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : SALOME_GenericObjPtr.cc
+//  Author : Oleg UVAROV
+//  Module : SALOME
+
+#include "SALOME_GenericObjPtr.hh"
+
+using namespace SALOME;
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase
+::GenericObjPtrBase() :
+  Object(0)
+{
+  // Add a reference to the object.
+  this->Register();
+}
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase
+::GenericObjPtrBase(GenericObj_i* r):
+  Object(r)
+{
+  // Add a reference to the object.
+  this->Register();
+}
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase
+::GenericObjPtrBase(const GenericObjPtrBase& r):
+  Object(r.Object)
+{
+  // Add a reference to the object.
+  this->Register();
+}
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase
+::GenericObjPtrBase(GenericObj_i* r, const GenericObjPtrBase::NoReference&):
+  Object(r)
+{
+  // Do not add a reference to the object because we received the
+  // NoReference argument.
+}
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase
+::~GenericObjPtrBase()
+{
+  // The main pointer must be set to NULL before calling UnRegister,
+  // so use a local variable to save the pointer.  This is because the
+  // garbage collection reference graph traversal may make it back to
+  // this smart pointer, and we do not want to include this reference.
+  if(GenericObj_i* object = this->Object)
+  {
+    this->Object = 0;
+    object->Destroy();
+  }
+}
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase&
+GenericObjPtrBase
+::operator=(GenericObj_i* r)
+{
+  // This is an exception-safe assignment idiom that also gives the
+  // correct order of register/unregister calls to all objects
+  // involved.  A temporary is constructed that references the new
+  // object.  Then the main pointer and temporary are swapped and the
+  // temporary's destructor unreferences the old object.
+  GenericObjPtrBase(r).Swap(*this);
+  return *this;
+}
+
+//----------------------------------------------------------------------------
+GenericObjPtrBase&
+GenericObjPtrBase
+::operator=(const GenericObjPtrBase& r)
+{
+  // This is an exception-safe assignment idiom that also gives the
+  // correct order of register/unregister calls to all objects
+  // involved.  A temporary is constructed that references the new
+  // object.  Then the main pointer and temporary are swapped and the
+  // temporary's destructor unreferences the old object.
+  GenericObjPtrBase(r).Swap(*this);
+  return *this;
+}
+
+//----------------------------------------------------------------------------
+void GenericObjPtrBase
+::Swap(GenericObjPtrBase& r)
+{
+  // Just swap the pointers.  This is used internally by the
+  // assignment operator.
+  GenericObj_i* temp = r.Object;
+  r.Object = this->Object;
+  this->Object = temp;
+}
+
+//----------------------------------------------------------------------------
+void GenericObjPtrBase
+::Register()
+{
+  // Add a reference only if the object is not NULL.
+  if(this->Object)
+    this->Object->Register();
+}
diff --git a/src/VISU_I/SALOME_GenericObjPointer.hh b/src/VISU_I/SALOME_GenericObjPointer.hh
new file mode 100644 (file)
index 0000000..4e1bf06
--- /dev/null
@@ -0,0 +1,156 @@
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//  File   : SALOME_GenericObjPtr.hh
+//  Author : Oleg UVAROV
+//  Module : SALOME
+
+#ifndef SALOME_GenericObjPointer_HH
+#define SALOME_GenericObjPointer_HH
+
+#include "SALOME_GenericObj_i.hh"
+
+namespace SALOME
+{
+  class GenericObjPtrBase
+  {
+  public:
+    // Description:
+    // Initialize smart pointer to NULL.
+    GenericObjPtrBase();
+
+    // Description:
+    // Initialize smart pointer to given object.
+    GenericObjPtrBase( GenericObj_i* );
+
+    // Description:
+    // Initialize smart pointer with a new reference to the same object
+    // referenced by given smart pointer.
+    GenericObjPtrBase( const GenericObjPtrBase& );
+
+    // Description:
+    // Destroy smart pointer and remove the reference to its object.
+    ~GenericObjPtrBase();
+
+    // Description:
+    // Assign object to reference.  This removes any reference to an old object.
+    GenericObjPtrBase& operator=( GenericObj_i* );
+    GenericObjPtrBase& operator=( const GenericObjPtrBase& );
+
+    // Description:
+    // Get the contained pointer.
+    GenericObj_i* GetPointer() const
+    {
+      return this->Object;
+    }
+
+  protected:
+    // Initialize smart pointer to given object, but do not increment
+    // reference count.  The destructor will still decrement the count.
+    // This effectively makes it an auto-ptr.
+    class NoReference {};
+    GenericObjPtrBase(GenericObj_i* r, const NoReference&);
+
+    // Pointer to the actual object.
+    GenericObj_i* Object;
+
+  private:
+    // Internal utility methods.
+    void Swap( GenericObjPtrBase& );
+    void Register();
+  };
+
+  template <class T>
+  class GenericObjPtr: public GenericObjPtrBase
+  {
+  public:
+    // Description:
+    // Initialize smart pointer to NULL.
+    GenericObjPtr() {}
+
+    // Description:
+    // Initialize smart pointer to given object.
+    GenericObjPtr(T* r): GenericObjPtrBase(r) {}
+
+    // Description:
+    // Initialize smart pointer with a new reference to the same object
+    // referenced by given smart pointer.
+    GenericObjPtr(const GenericObjPtrBase& r): GenericObjPtrBase(r) {}
+
+    // Description:
+    // Assign object to reference.  This removes any reference to an old
+    // object.
+    GenericObjPtr& operator=(T* r)
+    {
+      this->GenericObjPtrBase::operator=(r);
+      return *this;
+    }
+
+    // Description:
+    // Assign object to reference.  This removes any reference to an old
+    // object.
+    GenericObjPtr& operator=(const GenericObjPtrBase& r)
+    {
+      this->GenericObjPtrBase::operator=(r);
+      return *this;
+    }
+
+    // Description:
+    // Get the contained pointer.
+    T* GetPointer() const
+    {
+      return dynamic_cast<T*>(this->Object);
+    }
+
+    // Description:
+    // Get the contained pointer.
+    operator T* () const
+    {
+      return dynamic_cast<T*>(this->Object);
+    }
+
+    // Description:
+    // Dereference the pointer and return a reference to the contained
+    // object.
+    T& operator*() const
+    {
+      return *dynamic_cast<T*>(this->Object);
+    }
+
+    // Description:
+    // Provides normal pointer target member access using operator ->.
+    T* operator->() const
+    {
+      return dynamic_cast<T*>(this->Object);
+    }
+
+    // Description:
+    // Create an instance of an object.
+    static GenericObjPtr<T> New()
+    {
+      return GenericObjPtr<T>(T::New(), NoReference());
+    }
+
+  protected:
+    GenericObjPtr(T* r, const NoReference& n): GenericObjPtrBase(r, n) {}
+  };
+}
+
+#endif
index 47d7f4770b6fb261c3cc5f15c7c357482a6c8bf9..122aaa33b13ed64bb42703fcc63cbba082d70403 100644 (file)
@@ -190,6 +190,14 @@ void
 VISU::ColoredPrs3dCache_i
 ::SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode)
 {
+  VISU::ColoredPrs3dCache::MemoryMode aCurrentMode = GetMemoryMode();
+
+  if( aCurrentMode == VISU::ColoredPrs3dCache::LIMITED &&
+      theMode == VISU::ColoredPrs3dCache::MINIMAL )
+  {
+    ClearCache();
+  }
+
   myMemoryMode = theMode;
 }
 
@@ -406,3 +414,25 @@ VISU::ColoredPrs3dCache_i
 
   return false;
 }
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3dCache_i
+::ClearCache()
+{
+  TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin();
+  TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end();
+  for(; aHolderIter != aHolderIterEnd; aHolderIter++){
+    const TLastVisitedPrsList& aPrsList = aHolderIter->second;
+    TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin();
+    TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end();
+    for(; aPrsIter != aPrsIterEnd; aPrsIter++){
+      if(TPrs3dPtr aPrs3d = *aPrsIter)
+      {
+      }
+    }
+  }
+
+
+}
index 7737184a71945be3f8838ba9b4ece67d14419917..2f6f00559086c964074c5d68f5a3f1659a27bf5a 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "VISU_ColoredPrs3dFactory.hh"
 
-#include "SALOME_GenericObjPtr.hh"
+#include "SALOME_GenericObjPointer.hh"
 
 namespace VISU
 {
@@ -160,6 +160,9 @@ namespace VISU
                         const VISU::ColoredPrs3dHolder::BasicInput& theInput,
                         VISU::View3D_ptr theView3D);
 
+    void
+    ClearCache();
+
     //----------------------------------------------------------------------------
     virtual int
     IsPossible(VISU::VISUType theType,
index 5825e08bb5899c6fa41ddb8f54f5d0b21936b519..136a7e371e82806f521201ccd6d11ec71cd5e210 100644 (file)
@@ -148,6 +148,15 @@ VISU::ColoredPrs3dHolder_i
 }
 
 
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_ptr
+VISU::ColoredPrs3dHolder_i
+::GetCache()
+{
+  return myCache._this();
+}
+
+
 //----------------------------------------------------------------------------
 VISU::VISUType
 VISU::ColoredPrs3dHolder_i
index 3947d48c0700c542b34345efdbf1a7a3d3b92024..78dbb6e759e4f1fb88f98bc41ecd6005b7c8412e 100644 (file)
@@ -84,10 +84,15 @@ namespace VISU
     VISU::ColoredPrs3d::TimeStampsRange*
     GetTimeStampsRange();
 
-    //! Gats input parameters of the last visited presentation.
+    //! Gets input parameters of the last visited presentation.
     VISU::ColoredPrs3dHolder::BasicInput*
     GetBasicInput();
 
+    //----------------------------------------------------------------------------
+    //! Gets a ColoredPrs3dCache, to which the holder belongs
+    VISU::ColoredPrs3dCache_ptr
+    GetCache();
+
     //----------------------------------------------------------------------------
     virtual 
     VISU::VISUType