Added interfaces for VISU_ColoredPrs3dCache and VISU_ColoredPrs3dHolder.
TFIELD, /*!< Field represents the results of calculations (it can be scalar or vector values), grouped together under one physical concept. */
TTIMESTAMP, /*!<Time stamp represents a subfield: the results of calculations are taken in one definite moment. */
TANIMATION, /*!< Represents Animation object. */
+ TCOLOREDPRS3DHOLDER, /*!< Colored 3D presentation holder */
+ TCOLOREDPRS3DCACHE, /*!< Colored 3D presentation cache */
TALL
};
* Gets the title of the scalar bar.
*/
string GetTitle();
+
+ /*!
+ * Gets an expended memory size for the presentation.
+ */
+ long GetMemorySize();
+ };
+
+
+ //-------------------------------------------------------
+ interface View3D;
+
+ /*! \brief %ColoredPrs3dHolder interface.
+ * Interface of 3d presentation's holder, which represents colored 3d presentations,
+ * created on fields. It is publishing in the object browser in a separate folder
+ * and can be controled by viewer's slider.
+ */
+ interface ColoredPrs3dHolder : PrsObject, SALOME::GenericObj
+ {
+ /*!
+ * Presentation input parameters.
+ */
+ struct BasicInput
+ {
+ Result myResult;
+ string myMeshName;
+ Entity myEntity;
+ string myFieldName;
+ long myTimeStampNumber;
+ };
+
+ /*!
+ * Apply input parameters to last visited presentation in the cache.
+ */
+ boolean Apply(in ColoredPrs3d thePrs3d,
+ in BasicInput theInput,
+ in View3D theView3D);
+
+ /*!
+ * Gets the last visited presentation in the cache.
+ */
+ ColoredPrs3d GetDevice();
+
+ /*!
+ * Gets TimeStampsRange information from the last visited presentation.
+ */
+ ColoredPrs3d::TimeStampsRange GetTimeStampsRange();
+
+ /*!
+ * Gats input parameters of the last visited presentation.
+ */
+ BasicInput GetBasicInput();
+ };
+
+
+ //-------------------------------------------------------
+ /*! \brief %ColoredPrs3dCache interface.
+ * This interface is responsible for memory management of 3d presentations.
+ * One cache corresponds to one study.
+ */
+ interface ColoredPrs3dCache : SALOME::GenericObj
+ {
+ /*!
+ * Creates %ColoredPrs3dHolder.
+ */
+ ColoredPrs3dHolder CreateHolder(in VISUType theType,
+ in ColoredPrs3dHolder::BasicInput theInput);
};
//-------------------------------------------------------
interface ViewManager;
- interface View3D;
/*! \brief %VISU_Gen interface
*
void DeleteResult(in Result theResult);
void DeletePrs3d(in Prs3d thePrs3d);
+
+ /*!
+ * Get or create %ColoredPrs3dCache object.
+ */
+ ColoredPrs3dCache GetColoredPrs3dCache(in SALOMEDS::Study theStudy);
};
/*! \brief %View interface
return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);
}
+ VISU::ColoredPrs3dCache_ptr
+ VISU_Gen_i::
+ GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
+ {
+ return myVisuGen->GetColoredPrs3dCache(theStudy);
+ }
};
virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean theIsPublished,
CORBA::Boolean& theIsValidScript);
+
+ virtual
+ VISU::ColoredPrs3dCache_ptr
+ GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
};
};
VISU_TimeAnimation.cxx \
VISU_CorbaMedConvertor.cxx \
VISU_DumpPython.cc \
- VISU_ScalarMapOnDeformedShape_i.cc
+ VISU_ScalarMapOnDeformedShape_i.cc \
+ VISU_ColoredPrs3dHolder_i.cc \
+ VISU_ColoredPrs3dCache_i.cc
LIB_MOC = \
VISU_TimeAnimation.h
VISU_ViewManager_i.hh \
VISU_View_i.hh \
VISU_TimeAnimation.h \
- VISU_ScalarMapOnDeformedShape_i.hh
+ VISU_ScalarMapOnDeformedShape_i.hh \
+ VISU_ColoredPrs3dHolder_i.hh \
+ VISU_ColoredPrs3dCache_i.hh
# additionnal information to compil and link file
CPPFLAGS += \
// STL headers
#include <map>
+#include <deque>
#include <string>
#include <sstream>
#include <iostream>
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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 : VISU_ColoredPrs3dCache_i.cc
+// Author : Oleg UVAROV
+// Module : VISU
+
+#include "VISU_ColoredPrs3dCache_i.hh"
+
+#include "VISU_Gen_i.hh"
+#include "VISU_View_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
+
+#include "VVTK_ViewWindow.h"
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_i::
+ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy):
+ myStudy(SALOMEDS::Study::_duplicate(theStudy))
+{
+ if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::ColoredPrs3dCache_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dCache_i::
+~ColoredPrs3dCache_i()
+{
+ if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::~ColoredPrs3dCache_i - this = "<<this);
+}
+
+
+//---------------------------------------------------------------
+const SALOMEDS::Study_var&
+VISU::ColoredPrs3dCache_i::
+GetStudyDocument() const
+{
+ return myStudy;
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU::ColoredPrs3dCache_i::
+IsPossibleToCreate(VISU::VISUType theType,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput)
+{
+ return true;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder_ptr
+VISU::ColoredPrs3dCache_i::
+CreateHolder(VISU::VISUType theType,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput)
+{
+ if(IsPossibleToCreate(theType, theInput))
+ {
+ VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(theType, theInput, *this);
+ CreatePrs(theType, theInput, aHolder);
+ return aHolder->_this();
+ }
+ return VISU::ColoredPrs3dHolder::_nil();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dCache_i::
+CreatePrs(VISU::VISUType theType,
+ VISU::ColoredPrs3dHolder::BasicInput theInput,
+ VISU::ColoredPrs3dHolder_i* theHolder)
+{
+ VISU::ColoredPrs3d_i* aPrs3d = Base_i::GetVisuGenImpl()->CreatePrs3d_i(theType, myStudy);
+ aPrs3d->SetResultObject( theInput.myResult );
+ aPrs3d->SetMeshName( theInput.myMeshName );
+ aPrs3d->SetEntity( theInput.myEntity );
+ aPrs3d->SetFieldName( theInput.myFieldName );
+ aPrs3d->SetTimeStampNumber( theInput.myTimeStampNumber );
+ aPrs3d->Apply();
+
+ GetLastVisitedPrsList(theHolder).push_back(aPrs3d);
+
+ return aPrs3d;
+}
+
+
+//----------------------------------------------------------------------------
+TLastVisitedPrsList&
+VISU::ColoredPrs3dCache_i::
+GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder)
+{
+ //cout << "VISU::ColoredPrs3dCache_i::GetLastVisitedPrsList(";
+ //cout << theHolder->GetEntry().latin1() << ")" << endl;
+ return myHolderMap[theHolder->GetEntry()];
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dCache_i::
+GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder)
+{
+ TLastVisitedPrsList aList = GetLastVisitedPrsList(theHolder);
+ if( !aList.empty() )
+ return aList.front();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_i*
+VISU::ColoredPrs3dCache_i::
+FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput)
+{
+ //cout << "VISU::ColoredPrs3dCache_i::FindPrsByInput() ";
+ VISU::ColoredPrs3d_i* aPrs3d = NULL;
+ VISU::ColoredPrs3dHolder::BasicInput_var anInput;
+ TLastVisitedPrsList::iterator it = theLastVisitedPrsList.begin();
+ TLastVisitedPrsList::iterator itEnd = theLastVisitedPrsList.end();
+ for(; it != itEnd; ++it)
+ {
+ aPrs3d = *it;
+ anInput = aPrs3d->GetBasicInput();
+
+ if(anInput->myResult->_is_equivalent(theInput.myResult) &&
+ !strcmp(anInput->myMeshName.in(), theInput.myMeshName.in()) &&
+ anInput->myEntity == theInput.myEntity &&
+ !strcmp(anInput->myFieldName.in(), theInput.myFieldName.in()) &&
+ anInput->myTimeStampNumber == theInput.myTimeStampNumber )
+ {
+ //cout << "returns " << aPrs3d->GetName() << endl;
+ return aPrs3d;
+ }
+ }
+
+ //cout << "returns NULL" << endl;
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU::ColoredPrs3dCache_i::
+UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder,
+ VISU::ColoredPrs3d_i* thePrs,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+ VISU::View3D_ptr theView3D)
+{
+ //cout << "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" << endl;
+ VISU::ColoredPrs3d_i* aPrs3d = NULL;
+ TLastVisitedPrsList& aLastVisitedPrsList = GetLastVisitedPrsList(theHolder);
+
+ if(aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput))
+ {
+ aLastVisitedPrsList.pop_front();
+ }
+ else if(IsPossibleToCreate(theHolder->GetPrsType(), theInput))
+ {
+ aPrs3d = CreatePrs(theHolder->GetPrsType(), theInput, theHolder);
+ //cout << "Created " << aPrs3d->GetName() << endl;
+ }
+ else
+ {
+ //cout << "Move only" << endl;
+ aPrs3d = aLastVisitedPrsList.front();
+ aLastVisitedPrsList.pop_front();
+ }
+ aLastVisitedPrsList.push_back(aPrs3d);
+
+ //aPrs3d->SameAs(thePrs);
+
+ if(aPrs3d && !CORBA::is_nil(theView3D))
+ {
+ //cout << "Display " << aPrs3d->GetName() << endl;
+ VISU::ColoredPrs3d_var aColoredPrs3d = aPrs3d->_this();
+ theView3D->DisplayOnly(aColoredPrs3d);
+ return true;
+ }
+
+ return false;
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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 : VISU_ColoredPrs3dCache_i.hxx
+// Author : Oleg UVAROV
+// Module : VISU
+
+#ifndef VISU_ColoredPrs3dCache_i_HeaderFile
+#define VISU_ColoredPrs3dCache_i_HeaderFile
+
+#include "VISUConfig.hh"
+
+#include "SALOME_GenericObj_i.hh"
+
+namespace VISU
+{
+ class ColoredPrs3d_i;
+ class ColoredPrs3dHolder_i;
+
+ typedef std::string THolderEntry;
+ typedef std::deque<VISU::ColoredPrs3d_i*> TLastVisitedPrsList;
+ typedef std::map<THolderEntry,TLastVisitedPrsList> TColoredPrs3dHolderMap;
+
+ /*!
+ * This interface is responsible for memory management of 3d presentations.
+ * One cache corresponds to one study.
+ */
+ class ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache,
+ public virtual SALOME::GenericObj_i
+ {
+ ColoredPrs3dCache_i();
+ ColoredPrs3dCache_i(const ColoredPrs3dCache_i&);
+ public:
+ //----------------------------------------------------------------------------
+ //! A constructor to create an instance of the class
+ explicit
+ ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy);
+
+ virtual
+ ~ColoredPrs3dCache_i();
+
+ //----------------------------------------------------------------------------
+ /*!
+ * Creates ColoredPrs3dHolder.
+ */
+ VISU::ColoredPrs3dHolder_ptr
+ CreateHolder(VISU::VISUType theType,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput);
+
+ //----------------------------------------------------------------------------
+ VISU::ColoredPrs3d_i*
+ CreatePrs(VISU::VISUType theType,
+ VISU::ColoredPrs3dHolder::BasicInput theInput,
+ VISU::ColoredPrs3dHolder_i* theHolder);
+
+ TLastVisitedPrsList&
+ GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder);
+
+ VISU::ColoredPrs3d_i*
+ GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder);
+
+ bool
+ UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder,
+ VISU::ColoredPrs3d_i* thePrs,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+ VISU::View3D_ptr theView3D);
+
+ //----------------------------------------------------------------------------
+ VISU::ColoredPrs3d_i*
+ FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput);
+
+ bool
+ IsPossibleToCreate(VISU::VISUType theType,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput);
+
+ const SALOMEDS::Study_var&
+ GetStudyDocument() const;
+
+ private:
+ SALOMEDS::Study_var myStudy;
+ TColoredPrs3dHolderMap myHolderMap;
+ };
+}
+
+#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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 : VISU_ColoredPrs3dHolder_i.cc
+// Author : Oleg UVAROV
+// Module : VISU
+
+#include "VISU_ColoredPrs3dHolder_i.hh"
+
+#include "VISU_ColoredPrs3dCache_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//---------------------------------------------------------------
+int VISU::ColoredPrs3dHolder_i::myNbHolders = 0;
+
+//---------------------------------------------------------------
+QString
+VISU::ColoredPrs3dHolder_i::
+GenerateName()
+{
+ return VISU::GenerateName("Holder",myNbHolders++);
+}
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder_i::
+ColoredPrs3dHolder_i(VISU::VISUType theType,
+ VISU::ColoredPrs3dHolder::BasicInput theInput,
+ VISU::ColoredPrs3dCache_i& theCache) :
+ PrsObject_i(theCache.GetStudyDocument()),
+ myPrsType(theType),
+ myCache(theCache)
+{
+ if(MYDEBUG) MESSAGE("ColoredPrs3dHolder_i::ColoredPrs3dHolder_i - this = "<<this);
+
+ QString aType;
+ switch( theType ){
+ case TSCALARMAP: aType = "SCALARMAP"; break;
+ case TISOSURFACE: aType = "ISOSURFACES"; break;
+ case TDEFORMEDSHAPE: aType = "DEFORMEDSHAPE"; break;
+ case TSCALARMAPONDEFORMEDSHAPE: aType = "SCALARMAPONDEFORMEDSHAPE"; break;
+ case TGAUSSPOINTS: aType = "GAUSSPOINTS"; break;
+ case TPLOT3D: aType = "PLOT3D"; break;
+ case TCUTPLANES: aType = "CUTPLANES"; break;
+ case TCUTLINES: aType = "CUTLINES"; break;
+ case TVECTORS: aType = "VECTORS"; break;
+ case TSTREAMLINES: aType = "STREAMLINES"; break;
+ default: break;
+ }
+
+ QString aComment;
+ myName = GenerateName().latin1();
+ CORBA::String_var anIOR = GetID();
+ std::string aFatherEntry = VISU::FindOrCreate3DPresentationsFolder(GetStudyDocument());
+ aComment = QString("myComment=") + aType;
+ CreateAttributes(GetStudyDocument(),
+ aFatherEntry,
+ "",
+ anIOR.in(),
+ myName,
+ "",
+ aComment,
+ true);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder_i::
+~ColoredPrs3dHolder_i()
+{
+ if(MYDEBUG) MESSAGE("ColoredPrs3dHolder_i::~ColoredPrs3dHolder_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Boolean
+VISU::ColoredPrs3dHolder_i::
+Apply(VISU::ColoredPrs3d_ptr thePrs3d,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+ VISU::View3D_ptr theView3D)
+{
+ VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>( VISU::GetServant(thePrs3d).in() );
+ return myCache.UpdateLastVisitedPrs(this, aPrs3d, theInput, theView3D);
+}
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d_ptr
+VISU::ColoredPrs3dHolder_i::
+GetDevice()
+{
+ if(VISU::ColoredPrs3d_i* aPrs3d = myCache.GetLastVisitedPrs(this))
+ return aPrs3d->_this();
+
+ return VISU::ColoredPrs3d::_nil();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3d::TimeStampsRange*
+VISU::ColoredPrs3dHolder_i::
+GetTimeStampsRange()
+{
+ if( VISU::ColoredPrs3d_ptr aDevice = GetDevice() )
+ return aDevice->GetTimeStampsRange();
+
+ return NULL;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::ColoredPrs3dHolder::BasicInput*
+VISU::ColoredPrs3dHolder_i::
+GetBasicInput()
+{
+ if( VISU::ColoredPrs3d_ptr aDevice = GetDevice() )
+ {
+ VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>( VISU::GetServant(aDevice).in() );
+ if( aPrs3d )
+ return aPrs3d->GetBasicInput();
+ }
+
+ return NULL;
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// 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 : VISU_ColoredPrs3dHolder_i.hxx
+// Author : Oleg UVAROV
+// Module : VISU
+
+#ifndef VISU_ColoredPrs3dHolder_i_HeaderFile
+#define VISU_ColoredPrs3dHolder_i_HeaderFile
+
+#include "VISU_PrsObject_i.hh"
+
+#include "SALOME_GenericObj_i.hh"
+
+namespace VISU
+{
+ class ColoredPrs3d_i;
+ class ColoredPrs3dCache_i;
+
+ /*!
+ * Interface of 3d presentation's holder, which represents colored 3d presentations,
+ * created on fields. It is publishing in the object browser in a separate folder
+ * and can be controled by viewer's slider.
+ */
+ class ColoredPrs3dHolder_i : public virtual POA_VISU::ColoredPrs3dHolder,
+ public virtual SALOME::GenericObj_i,
+ public virtual PrsObject_i
+ {
+ ColoredPrs3dHolder_i();
+ ColoredPrs3dHolder_i(const ColoredPrs3dHolder_i&);
+ public:
+ //----------------------------------------------------------------------------
+ //! A constructor to create an instance of the class
+ explicit
+ ColoredPrs3dHolder_i(VISU::VISUType theType,
+ VISU::ColoredPrs3dHolder::BasicInput theInput,
+ VISU::ColoredPrs3dCache_i& theCache);
+
+ virtual
+ ~ColoredPrs3dHolder_i();
+
+ //----------------------------------------------------------------------------
+ /*! Apply input parameters to last visited presentation in the cache.
+ */
+ virtual
+ CORBA::Boolean
+ Apply(VISU::ColoredPrs3d_ptr thePrs3d,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput,
+ VISU::View3D_ptr theView3D);
+
+ /*! Gets the last visited presentation in the cache.
+ */
+ virtual
+ VISU::ColoredPrs3d_ptr
+ GetDevice();
+
+ /*! Gets TimeStampsRange information from the last visited presentation.
+ */
+ virtual
+ VISU::ColoredPrs3d::TimeStampsRange*
+ GetTimeStampsRange();
+
+ /*! Gats input parameters of the last visited presentation.
+ */
+ VISU::ColoredPrs3dHolder::BasicInput*
+ GetBasicInput();
+
+ //----------------------------------------------------------------------------
+ virtual
+ VISU::VISUType
+ GetType() { return VISU::TCOLOREDPRS3DHOLDER; }
+
+ virtual
+ void
+ RemoveFromStudy() {}
+
+ virtual
+ void
+ ToStream(std::ostringstream&) {}
+
+ virtual
+ QString
+ GenerateName();
+
+ virtual
+ const char*
+ GetComment() const { return NULL; }
+
+ //----------------------------------------------------------------------------
+ VISU::VISUType
+ GetPrsType() const { return myPrsType; }
+
+ private:
+ VISU::VISUType myPrsType;
+
+ VISU::ColoredPrs3dCache_i& myCache;
+
+ static int myNbHolders;
+ };
+}
+
+#endif
return aTimeStampsRange._retn();
}
+VISU::ColoredPrs3dHolder::BasicInput*
+VISU::ColoredPrs3d_i
+::GetBasicInput()
+{
+ VISU::ColoredPrs3dHolder::BasicInput* aBasicInput = new VISU::ColoredPrs3dHolder::BasicInput();
+ aBasicInput->myResult = GetResultObject();
+ aBasicInput->myMeshName = GetMeshName();
+ aBasicInput->myEntity = GetEntity();
+ aBasicInput->myFieldName = GetFieldName();
+ aBasicInput->myTimeStampNumber = GetTimeStampNumber();
+
+ return aBasicInput;
+}
+
//----------------------------------------------------------------------------
CORBA::Boolean
VISU::ColoredPrs3d_i
//----------------------------------------------------------------------------
std::string
-FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy)
+VISU::FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy)
{
static char aFolderName[] = "3D Presentations";
CORBA::String_var anEntry;
}else if(myPublishInStudyMode == EPublishIndependently){
myName = GenerateName().latin1();
CORBA::String_var anIOR = GetID();
- std::string aFatherEntry = FindOrCreate3DPresentationsFolder(GetStudyDocument());
+ std::string aFatherEntry = VISU::FindOrCreate3DPresentationsFolder(GetStudyDocument());
aComment.sprintf("myComment=%s",
GetComment());
CreateAttributes(GetStudyDocument(),
namespace VISU
{
+ std::string
+ FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy);
+
//============================================================================
class ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d,
public virtual Prs3d_i
std::string
GetCTitle();
+ virtual
+ CORBA::Long
+ GetMemorySize() { return 0; }
+
+ //! Returns presentation input
+ VISU::ColoredPrs3dHolder::BasicInput*
+ GetBasicInput();
+
//----------------------------------------------------------------------------
public:
/*!
#include "VISU_TimeAnimation.h"
#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_ColoredPrs3dCache_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
+
#include "VISU_Actor.h"
#include "HDFascii.hxx"
}
- template<typename TPrs3d_i>
- Prs3d_ptr
- CreatePrs3d(SALOMEDS::Study_ptr theStudy)
- {
- if(!theStudy->GetProperties()->IsLocked()){
- typedef typename TPrs3d_i::TInterface TPrs3d;
- typename TPrs3d::_var_type aPrs3d;
- if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,ColoredPrs3d_i::EPublishIndependently)){
- return aPresent->_this();
- }
- }
- return Prs3d::_nil();
- }
-
-
- Prs3d_ptr
+ ColoredPrs3d_i*
VISU_Gen_i::
- CreatePrs3d(VISUType theType,
- SALOMEDS::Study_ptr theStudy)
+ CreatePrs3d_i(VISUType theType,
+ SALOMEDS::Study_ptr theStudy)
{
switch(theType){
case TSCALARMAP:
- return VISU::CreatePrs3d<ScalarMap_i>(theStudy);
+ return VISU::CreatePrs3d_i<ScalarMap_i>(theStudy);
case TGAUSSPOINTS:
- return VISU::CreatePrs3d<GaussPoints_i>(theStudy);
+ return VISU::CreatePrs3d_i<GaussPoints_i>(theStudy);
case TDEFORMEDSHAPE:
- return VISU::CreatePrs3d<DeformedShape_i>(theStudy);
+ return VISU::CreatePrs3d_i<DeformedShape_i>(theStudy);
case TSCALARMAPONDEFORMEDSHAPE:
- return VISU::CreatePrs3d<ScalarMapOnDeformedShape_i>(theStudy);
+ return VISU::CreatePrs3d_i<ScalarMapOnDeformedShape_i>(theStudy);
case TISOSURFACE:
- return VISU::CreatePrs3d<IsoSurfaces_i>(theStudy);
+ return VISU::CreatePrs3d_i<IsoSurfaces_i>(theStudy);
case TSTREAMLINES:
- return VISU::CreatePrs3d<StreamLines_i>(theStudy);
+ return VISU::CreatePrs3d_i<StreamLines_i>(theStudy);
case TPLOT3D:
- return VISU::CreatePrs3d<Plot3D_i>(theStudy);
+ return VISU::CreatePrs3d_i<Plot3D_i>(theStudy);
case TCUTPLANES:
- return VISU::CreatePrs3d<CutPlanes_i>(theStudy);
+ return VISU::CreatePrs3d_i<CutPlanes_i>(theStudy);
case TCUTLINES:
- return VISU::CreatePrs3d<CutLines_i>(theStudy);
+ return VISU::CreatePrs3d_i<CutLines_i>(theStudy);
case TVECTORS:
- return VISU::CreatePrs3d<Vectors_i>(theStudy);
+ return VISU::CreatePrs3d_i<Vectors_i>(theStudy);
}
+ return NULL;
+ }
+
+
+ Prs3d_ptr
+ VISU_Gen_i::
+ CreatePrs3d(VISUType theType,
+ SALOMEDS::Study_ptr theStudy)
+ {
+ if(ColoredPrs3d_i* aPrs3d = CreatePrs3d_i(theType, theStudy))
+ return aPrs3d->_this();
return Prs3d::_nil();
}
anIOR->SetValue(anIORValue);
return aResultSO._retn();
}
+
+ VISU::ColoredPrs3dCache_ptr
+ VISU_Gen_i::
+ GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
+ {
+ VISU::ColoredPrs3dCache_i* aCache = new VISU::ColoredPrs3dCache_i(theStudy);
+ return aCache->_this();
+ }
}
{
class Result_i;
class ColoredPrs3d_i;
+ class ColoredPrs3dCache_i;
bool
CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
const std::string& theFieldName,
CORBA::Double theIteration);
+ template<typename TPrs3d_i>
+ ColoredPrs3d_i*
+ CreatePrs3d_i(SALOMEDS::Study_ptr theStudy)
+ {
+ if(!theStudy->GetProperties()->IsLocked()){
+ typedef typename TPrs3d_i::TInterface TPrs3d;
+ if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,ColoredPrs3d_i::EPublishIndependently)){
+ return aPresent;
+ }
+ }
+ return NULL;
+ }
+
class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
public virtual ::Engines_Component_i,
public virtual Base_i
const char* theMeshName,
const char* theGroupName);
+ ColoredPrs3d_i*
+ CreatePrs3d_i(VISUType theType,
+ SALOMEDS::Study_ptr theStudy);
+
Prs3d_ptr
CreatePrs3d(VISUType theType,
SALOMEDS::Study_ptr theStudy);
PasteInto(const SALOMEDS::TMPFile& theStream,
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject);
+
+ virtual
+ VISU::ColoredPrs3dCache_ptr
+ GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
};
}
EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \
visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py \
visu_table.py visu_big_table.py visu_view.py visu_delete.py \
- visu_swig_test.py visu_split_views.py visu_change_input.py \
+ visu_swig_test.py visu_split_views.py visu_change_input.py visu_cache.py \
VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \
VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py
EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py
--- /dev/null
+import os
+import time
+import VISU
+import SALOMEDS
+from batchmode_visu import *
+
+#---------------------------------------------------------------
+def WalkTroughTimeStamps(theVISUType,
+ theInput,
+ theViewManager):
+ aView = theViewManager.Create3DView();
+ aView.SetTitle("To test presentation of %s type" % theVISUType)
+
+ aCache = myVisu.GetColoredPrs3dCache(myVisu.GetCurrentStudy())
+ aHolder = aCache.CreateHolder(theVISUType, theInput)
+ aPrs3d = aHolder.GetDevice()
+
+ #aPrs3d = myVisu.CreatePrs3d(theVISUType, myVisu.GetCurrentStudy())
+ if not aHolder.Apply(aPrs3d, theInput, aView):
+ print "It is impossible to create such kind of presentation (%s) with the given parameters"
+ print "\ttheMeshName = '%s'" % theInput.myMeshName
+ print "\ttheEntity = %s" % theInput.myEntity
+ print "\ttheFieldName = '%s'" % theInput.myFieldName
+ print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
+ return
+
+ aView.FitAll()
+
+ aDelay = 0.0
+ aRange = aHolder.GetTimeStampsRange()
+ for anInfo in aRange:
+ print "%d (%s); " % (anInfo.myNumber, anInfo.myTime)
+ theInput.myTimeStampNumber = anInfo.myNumber
+ aHolder.Apply(aPrs3d, theInput, aView)
+ time.sleep(aDelay)
+ pass
+ pass
+
+#---------------------------------------------------------------
+PRS3D_TYPE_LIST = []
+#PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
+PRS3D_TYPE_LIST.append(VISU.TISOSURFACE)
+PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
+PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
+PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
+PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
+PRS3D_TYPE_LIST.append(VISU.TVECTORS)
+PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
+
+
+#---------------------------------------------------------------
+aMedFile = "TimeStamps.med"
+aMedFile = "ResOK_0000.med"
+aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile
+aResult = myVisu.ImportFile(aMedFile)
+
+aMeshName ="dom"
+anEntity = VISU.NODE
+aFieldName = "vitesse";
+aTimeStampNumber = 1
+
+anInput = VISU.ColoredPrs3dHolder.BasicInput(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+
+aViewManager = myVisu.GetViewManager();
+
+WalkTroughTimeStamps(VISU.TSCALARMAP, anInput, aViewManager)
+
+for aVISUType in PRS3D_TYPE_LIST:
+ WalkTroughTimeStamps(aVISUType, anInput, aViewManager)
+ pass
+
+anInput.myEntity = VISU.CELL;
+anInput.myFieldName = "pression";
+WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager)