* This interface is responsible for memory management of 3d presentations.
* One cache corresponds to one study.
*/
- interface ColoredPrs3dCache : SALOME::GenericObj
+ interface ColoredPrs3dCache : PrsObject, SALOME::GenericObj
{
/*!
* Creates %ColoredPrs3dHolder.
CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
if (!CORBA::is_nil(anObject)) {
+ // is it Holder ?
+ VISU::ColoredPrs3dHolder_i* aHolder =
+ dynamic_cast<VISU::ColoredPrs3dHolder_i*>(VISU::GetServant(anObject).in());
+ if (aHolder) {
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Holder object");
+ //UpdateViewer( this, aHolder );
+ if (vw) {
+ displayer()->Display(anIO->getEntry());
+ vw->highlight(anIO, 1);
+ }
+ continue;
+ }
+
// is it Prs3d object ?
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if (aPrsObject) {
// Rules
QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
- "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'");
+ "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+ "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TCOLOREDPRS3DHOLDER'");
// VISU root commands
QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
#include "VisuGUI_Tools.h"
#include "VISU_ViewManager_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
#include "VISU_Actor.h"
#include "VVTK_ViewModel.h"
dynamic_cast<SVTK_ViewWindow*>( vtk_viewer->getViewManager()->getActiveView() );
if( wnd )
{
- VISU::Prs3d_i* thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant( anObj ).in() );
+ VISU::Prs3d_i* thePrs;
+ VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObj).in());
+ if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER)
+ {
+ VISU::ColoredPrs3dHolder_i* aHolder = dynamic_cast<VISU::ColoredPrs3dHolder_i*>( aBase );
+ thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant(aHolder->GetDevice()).in() );
+ }
+ else
+ thePrs = dynamic_cast<VISU::Prs3d_i*>( aBase );
+
if( thePrs )
{
buildPrs3d( wnd, thePrs );
- prs = LightApp_Displayer::buildPresentation( entry, aViewFrame );
+ prs = LightApp_Displayer::buildPresentation( thePrs->GetEntry(), aViewFrame );
}
}
}
if( viewer_type==SVTK_Viewer::Type() || viewer_type==VVTK_Viewer::Type())
{
- VISU::Prs3d_i* thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant( anObj ).in() );
- return thePrs;
+ VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObj).in());
+ if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER)
+ return dynamic_cast<VISU::ColoredPrs3dHolder_i*>(aBase);
+
+ return dynamic_cast<VISU::Prs3d_i*>(aBase);
}
else if( viewer_type==SPlot2d_Viewer::Type() )
{
false ); // in edition mode
QApplication::restoreOverrideCursor();
}
- RestoreSelection(theModule, thePrs3d);
+ RestoreSelection(theModule, NULL/*thePrs3d*/);
delete aDlg;
}
}
#include "VISU_Table_i.hh"
#include "VISU_Mesh_i.hh"
#include "VISU_ViewManager_i.hh"
+#include "VISU_ColoredPrs3dCache_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
#include "VISU_Actor.h"
#include "VISU_ScalarMapAct.h"
if (!aServant.in())
return NULL;
- return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+ VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(aServant.in());
+ if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER)
+ {
+ VISU::ColoredPrs3dHolder_i* aHolder = dynamic_cast<VISU::ColoredPrs3dHolder_i*>(aBase);
+ return dynamic_cast<VISU::ColoredPrs3d_i*>(VISU::GetServant(aHolder->GetDevice()).in());
+ }
+
+ return dynamic_cast<VISU::Prs3d_i*>(aBase);
}
void
#include "VISU_ColoredPrs3dCache_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_ColoredPrs3dHolder_i.hh"
#include "VISU_Gen_i.hh"
+#include "VISU_Result_i.hh"
#include "VISU_View_i.hh"
#include "VISU_ViewManager_i.hh"
-#include "VISU_ColoredPrs3d_i.hh"
-#include "VISU_ColoredPrs3dHolder_i.hh"
+
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_ScalarMapOnDeformedShape_i.hh"
+#include "VISU_GaussPoints_i.hh"
+#include "VISU_Plot3D_i.hh"
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutLines_i.hh"
+#include "VISU_Vectors_i.hh"
+#include "VISU_StreamLines_i.hh"
#include "VVTK_ViewWindow.h"
//----------------------------------------------------------------------------
VISU::ColoredPrs3dCache_i::
ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy):
- myStudy(SALOMEDS::Study::_duplicate(theStudy))
+ PrsObject_i(theStudy)
{
if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::ColoredPrs3dCache_i - this = "<<this);
+
+ QString aComment;
+ myName = GetFolderName();
+ CORBA::String_var anIOR = GetID();
+ SALOMEDS::SComponent_var aSComponent = VISU::FindOrCreateVisuComponent(theStudy);
+ CORBA::String_var aFatherEntry = aSComponent->GetID();
+ CreateAttributes(GetStudyDocument(), aFatherEntry.in(), "", anIOR.in(), myName, "", "", true);
}
}
-//---------------------------------------------------------------
-const SALOMEDS::Study_var&
-VISU::ColoredPrs3dCache_i::
-GetStudyDocument() const
-{
- return myStudy;
-}
-
-
//----------------------------------------------------------------------------
-bool
+int
VISU::ColoredPrs3dCache_i::
-IsPossibleToCreate(VISU::VISUType theType,
- const VISU::ColoredPrs3dHolder::BasicInput& theInput)
+IsPossible(VISU::VISUType theType,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput)
{
- return true;
+ //cout << "VISU::ColoredPrs3dCache_i::IsPossible " << endl;
+ VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant(theInput.myResult).in() );
+ std::string aMeshName = theInput.myMeshName.in();
+ VISU::Entity anEntity = theInput.myEntity;
+ std::string aFieldName = theInput.myFieldName.in();
+ long aTimeStampNumber = theInput.myTimeStampNumber;
+
+ bool ok = 0;
+ switch( theType ){
+ case TSCALARMAP: ok = VISU::ScalarMap_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TISOSURFACE: ok = VISU::IsoSurfaces_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TDEFORMEDSHAPE: ok = VISU::DeformedShape_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TSCALARMAPONDEFORMEDSHAPE: ok = VISU::ScalarMapOnDeformedShape_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TGAUSSPOINTS: ok = VISU::GaussPoints_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TPLOT3D: ok = VISU::Plot3D_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TCUTPLANES: ok = VISU::CutPlanes_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TCUTLINES: ok = VISU::CutLines_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TVECTORS: ok = VISU::Vectors_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ case TSTREAMLINES: ok = VISU::StreamLines_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber);
+ break;
+ default: break;
+ }
+
+ //cout << "returned " << ok << endl;
+ return ok;
}
CreateHolder(VISU::VISUType theType,
const VISU::ColoredPrs3dHolder::BasicInput& theInput)
{
- if(IsPossibleToCreate(theType, theInput))
+ if(IsPossible(theType, theInput))
{
VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(theType, theInput, *this);
CreatePrs(theType, theInput, aHolder);
VISU::ColoredPrs3dHolder::BasicInput theInput,
VISU::ColoredPrs3dHolder_i* theHolder)
{
- VISU::ColoredPrs3d_i* aPrs3d = Base_i::GetVisuGenImpl()->CreatePrs3d_i(theType, myStudy);
+ VISU::ColoredPrs3d_i* aPrs3d = Base_i::GetVisuGenImpl()->CreatePrs3d_i(theType, GetStudyDocument());
aPrs3d->SetResultObject( theInput.myResult );
aPrs3d->SetMeshName( theInput.myMeshName );
aPrs3d->SetEntity( theInput.myEntity );
{
aLastVisitedPrsList.pop_front();
}
- else if(IsPossibleToCreate(theHolder->GetPrsType(), theInput))
+ else if(IsPossible(theHolder->GetPrsType(), theInput))
{
aPrs3d = CreatePrs(theHolder->GetPrsType(), theInput, theHolder);
//cout << "Created " << aPrs3d->GetName() << endl;
#ifndef VISU_ColoredPrs3dCache_i_HeaderFile
#define VISU_ColoredPrs3dCache_i_HeaderFile
-#include "VISUConfig.hh"
+#include "VISU_PrsObject_i.hh"
#include "SALOME_GenericObj_i.hh"
* One cache corresponds to one study.
*/
class ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache,
- public virtual SALOME::GenericObj_i
+ public virtual SALOME::GenericObj_i,
+ public virtual PrsObject_i
{
ColoredPrs3dCache_i();
ColoredPrs3dCache_i(const ColoredPrs3dCache_i&);
const VISU::ColoredPrs3dHolder::BasicInput& theInput);
//----------------------------------------------------------------------------
+ virtual
+ VISU::VISUType
+ GetType() { return VISU::TCOLOREDPRS3DCACHE; }
+
+ virtual
+ void
+ RemoveFromStudy() {}
+
+ virtual
+ void
+ ToStream(std::ostringstream&) {}
+
+ virtual
+ const char*
+ GetComment() const { return NULL; }
+
+ static
+ const std::string
+ GetFolderName() { return "Cache"; }
+
VISU::ColoredPrs3d_i*
CreatePrs(VISU::VISUType theType,
VISU::ColoredPrs3dHolder::BasicInput theInput,
VISU::View3D_ptr theView3D);
//----------------------------------------------------------------------------
+ virtual int
+ IsPossible(VISU::VISUType theType,
+ const VISU::ColoredPrs3dHolder::BasicInput& theInput);
+
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;
};
}
QString aComment;
myName = GenerateName().latin1();
CORBA::String_var anIOR = GetID();
- std::string aFatherEntry = VISU::FindOrCreate3DPresentationsFolder(GetStudyDocument());
+ std::string aFatherEntry = theCache.GetEntry();
aComment = QString("myComment=") + aType;
- CreateAttributes(GetStudyDocument(),
- aFatherEntry,
- "",
- anIOR.in(),
- myName,
- "",
- aComment,
- true);
+ CreateAttributes(GetStudyDocument(), aFatherEntry, "", anIOR.in(), myName, "", aComment, true);
}
return aResultSO._retn();
}
+ VISU::ColoredPrs3d_i*
+ VISU_Gen_i::
+ CreateHolder(VISU::VISUType theType,
+ Result_i* theResult,
+ const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Double theIteration)
+ {
+ VISU::ColoredPrs3dHolder::BasicInput anInput;
+ anInput.myResult = theResult->_this();
+ anInput.myMeshName = theMeshName.c_str();
+ anInput.myEntity = theEntity;
+ anInput.myFieldName = theFieldName.c_str();
+ anInput.myTimeStampNumber = theIteration;
+
+ SALOMEDS::Study_var aStudy = GetCurrentStudy();
+ VISU::ColoredPrs3dCache_ptr aCache = GetColoredPrs3dCache(aStudy);
+ VISU::ColoredPrs3dHolder_ptr aHolder = aCache->CreateHolder(theType,anInput);
+
+ VISU::ColoredPrs3d_ptr aPrs3d = aHolder->GetDevice();
+ VISU::ColoredPrs3d_i* aPrs3d_i = dynamic_cast<VISU::ColoredPrs3d_i*>(GetServant(aPrs3d).in());
+
+ return aPrs3d_i;
+ }
+
VISU::ColoredPrs3dCache_ptr
VISU_Gen_i::
GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
{
- VISU::ColoredPrs3dCache_i* aCache = new VISU::ColoredPrs3dCache_i(theStudy);
- return aCache->_this();
+ SALOMEDS::SObject_var aSObject = theStudy->FindObject(VISU::ColoredPrs3dCache_i::GetFolderName().c_str());
+ if(!CORBA::is_nil(aSObject))
+ {
+ CORBA::Object_var anObject = aSObject->GetObject();
+ VISU::ColoredPrs3dCache_var aCache = VISU::ColoredPrs3dCache::_narrow(anObject);
+ if(!CORBA::is_nil(aCache))
+ return aCache._retn();
+ }
+
+ return (new VISU::ColoredPrs3dCache_i(theStudy))->_this();
}
}
class Result_i;
class ColoredPrs3d_i;
class ColoredPrs3dCache_i;
+ class ColoredPrs3dHolder_i;
bool
CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
CreatePrs3d(VISUType theType,
SALOMEDS::Study_ptr theStudy);
+ ColoredPrs3d_i*
+ CreateHolder(VISU::VISUType theType,
+ Result_i* theResult,
+ const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Double theIteration);
+
//Create 3D collored Presentation Of Different Types
template<typename TPrs3d_i> TPrs3d_i*
CreatePrs3d(Result_ptr theResult,
if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){
TPrs3d_i* aPresent = new TPrs3d_i(aResult,thePublishInStudyMode);
+
+ if( thePublishInStudyMode != ColoredPrs3d_i::EPublishUnderTimeStamp )
+ {
+ ColoredPrs3d_i* aPrs3d =
+ CreateHolder(aPresent->GetType(),aResult,theMeshName,theEntity,theFieldName,theIteration);
+
+ return dynamic_cast<TPrs3d_i*>(aPrs3d);
+ }
+
if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration))
return aPresent;
aPresent->_remove_ref();
aCache = myVisu.GetColoredPrs3dCache(myVisu.GetCurrentStudy())
aHolder = aCache.CreateHolder(theVISUType, theInput)
+
+ if not aHolder:
+ print "It is impossible to create such kind of holder (%s) with the given parameters" % theVISUType
+ print "\ttheMeshName = '%s'" % theInput.myMeshName
+ print "\ttheEntity = %s" % theInput.myEntity
+ print "\ttheFieldName = '%s'" % theInput.myFieldName
+ print "\ttheTimeStampNumber = %s" % theInput.myTimeStampNumber
+ return
+
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 "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType
print "\ttheMeshName = '%s'" % theInput.myMeshName
print "\ttheEntity = %s" % theInput.myEntity
print "\ttheFieldName = '%s'" % theInput.myFieldName
#---------------------------------------------------------------
PRS3D_TYPE_LIST = []
-#PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
+PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
PRS3D_TYPE_LIST.append(VISU.TISOSURFACE)
PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)