Provide presentations update after SHAPER objects modification

This commit is contained in:
jfa 2021-01-12 13:03:48 +03:00
parent b21941faaf
commit 2c2917086a
2 changed files with 29 additions and 67 deletions

View File

@ -167,9 +167,10 @@ Standard_Boolean GEOM_Client::Find (const TopoDS_Shape& S, TCollection_AsciiStri
// function : Bind()
// purpose :
//=======================================================================
void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S )
void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S, int Tick )
{
myShapesMap[IOR] = S;
myTicksMap[IOR] = Tick;
}
//=======================================================================
@ -192,31 +193,31 @@ void GEOM_Client::ClearClientBuffer()
myShapesMap.clear();
}
//=======================================================================
// function : BufferLength()
// purpose :
//=======================================================================
unsigned int GEOM_Client::BufferLength()
{
return myShapesMap.size();
}
//=======================================================================
// function : GetShape()
// purpose :
//=======================================================================
TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape )
{
TopoDS_Shape S;
CORBA::String_var anIOR = geom->GetStringFromIOR(aShape);
TCollection_AsciiString IOR = anIOR.in();
int aShapeTick = aShape->GetTick();
std::map< TCollection_AsciiString , int >::iterator i2t = myTicksMap.find( IOR );
if ( i2t != myTicksMap.end() ) {
// The shape was modified, clean the stored one
if (i2t->second != aShapeTick)
RemoveShapeFromBuffer(IOR);
}
TopoDS_Shape S;
if ( Find( IOR, S ))
return S;
/******* in case of a MAIN GEOM::SHAPE ********/
if ( aShape->IsMainShape() ) {
S = Load(geom, aShape);
Bind(IOR, S);
Bind(IOR, S, aShapeTick);
return S;
}
@ -254,6 +255,6 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p
S = aCompound;
}
Bind(IOR, S);
Bind(IOR, S, aShapeTick);
return S;
}

View File

@ -29,28 +29,12 @@
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
#ifdef HAVE_FINITE
#undef HAVE_FINITE // E.A. fix a warning about redefinition of HAVE_FINITE in re-inclusion of Standard_values.h
#endif
#ifndef _TColStd_SequenceOfAsciiString_HeaderFile
#include <TColStd_SequenceOfAsciiString.hxx>
#endif
#ifndef _TopTools_SequenceOfShape_HeaderFile
#include <TopTools_SequenceOfShape.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#include <Standard_Boolean.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Shape.hxx>
class TCollection_AsciiString;
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#include <map>
#include <vector>
#ifdef WIN32
#if defined GEOMCLIENT_EXPORTS || defined GEOMClient_EXPORTS
@ -62,11 +46,6 @@ class TopoDS_Shape;
#define GEOMCLIENT_EXPORT
#endif
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Shape.hxx>
#include <map>
#include <vector>
/*
* if define SINGLE_CLIENT is not commented, the method get_client always returns the same GEOM_Client object (singleton object)
* and the SHAPE_READER macro can be used to define an object that is always this singleton object
@ -81,42 +60,17 @@ class TopoDS_Shape;
class GEOMCLIENT_EXPORT GEOM_Client {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
//Standard_EXPORT
GEOM_Client();
//Standard_EXPORT
GEOM_Client(Engines::Container_ptr client);
//Standard_EXPORT
GEOM_Client(const GEOM_Client& client);
//Standard_EXPORT
Standard_Boolean Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
//Standard_EXPORT
Standard_Boolean Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
//Standard_EXPORT
void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) ;
//Standard_EXPORT
TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape );
//Standard_EXPORT
Standard_Boolean Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
void RemoveShapeFromBuffer( const TCollection_AsciiString& IOR ) ;
//Standard_EXPORT
void ClearClientBuffer() ;
//Standard_EXPORT
unsigned int BufferLength() ;
TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
#ifdef SINGLE_CLIENT
static GEOM_Client& get_client();
#else
@ -124,10 +78,17 @@ class GEOMCLIENT_EXPORT GEOM_Client {
#endif
private:
// Methods PRIVATE
//
Standard_Boolean Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S, int Tick ) ;
TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
// Fields PRIVATE
//
std::map< TCollection_AsciiString , std::vector<TopoDS_Shape> > _mySubShapes;
std::map< TCollection_AsciiString , TopoDS_Shape > myShapesMap;
std::map< TCollection_AsciiString , int > myTicksMap;
long pid_client;
};