continue;
if (geomObj->GetType() == GEOM_MARKER) {
ComboBox1->addItem(geomObj->GetName());
- TopoDS_Shape aShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
+ //TopoDS_Shape aShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
+ TopoDS_Shape aShape = GEOM_Client::ShapeReader.GetShape(GeometryGUI::GetGeomGen(), geomObj);
gp_Ax3 aLCS;
aLCS.Transform(aShape.Location().Transformation());
//=============================================================================
GEOM_Object::~GEOM_Object()
{
- MESSAGE("GEOM_Object::~GEOM_Object()");
+ //MESSAGE("GEOM_Object::~GEOM_Object()");
}
//=============================================================================
if (GeomObject->_is_nil())
return result;
- result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject);
+ //result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject);
+ result = GEOM_Client::ShapeReader.GetShape(GeometryGUI::GetGeomGen(), GeomObject);
return result;
}
{
if ( !CORBA::is_nil( theObject ) )
{
- TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObject );
+ //TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObject );
+ TopoDS_Shape aTopoDSShape = GEOM_Client::ShapeReader.GetShape( GeometryGUI::GetGeomGen(), theObject );
if ( !aTopoDSShape.IsNull() && ( theType == TopAbs_SHAPE || theType == aTopoDSShape.ShapeType() ) )
{
theShape = aTopoDSShape;
#include <TColStd_MapOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
+#include <sys/time.h>
+static long tcount=0;
+static long cumul;
+#define START_TIMING long tt0; timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
+#define END_TIMING(NUMBER) \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
+
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
TCollection_AsciiString asciiIOR( (char *)IOR.in() );
- GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
+ //GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
+ GEOM_Client::ShapeReader.RemoveShapeFromBuffer( asciiIOR );
if ( !getStudy() || !getStudy()->studyDS() )
return;
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
_PTR(AttributeIOR) anIOR ( anAttr );
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
- GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
+ //GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
+ GEOM_Client::ShapeReader.RemoveShapeFromBuffer( asciiIOR );
}
}
}
return false;
}
+ START_TIMING;
erasePreview( false );
bool result = false;
}
updateViewer();
+ END_TIMING(1);
return result;
}
#define HST_CLIENT_LEN 256
+#include <vector>
+
+#include <sys/time.h>
+static long tcount=0;
+static long cumul;
+#define START_TIMING long tt0; timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
+#define END_TIMING(NUMBER) \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
+
+GEOM_Client GEOM_Client::ShapeReader;
//=======================================================================
// function : Load()
//=======================================================================
Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S )
{
+ //CCAR
+#if 1
+ if(_myIndexes.count(IOR)==0)
+ {
+ return 0;
+ }
+ else
+ {
+ Standard_Integer i =_myIndexes[IOR];
+ S = myShapes.Value(i);
+ return i;
+ }
+#else
for ( Standard_Integer i = 1; i<= myIORs.Length(); i++ ) {
if (myIORs.Value(i).IsEqual(IOR)) {
S = myShapes.Value(i);
}
}
return 0;
+#endif
}
//=======================================================================
{
myIORs.Append(IOR);
myShapes.Append(S);
+ _myIndexes[IOR]=myIORs.Length();
}
//=======================================================================
if( anIndex != 0 ) {
myIORs.Remove(anIndex);
myShapes.Remove(anIndex);
+ _myIndexes.erase(IOR);
+ _mySubShapes.erase(IOR);
}
return;
}
return;
myIORs.Clear();
myShapes.Clear();
+ _myIndexes.clear();
+ _mySubShapes.clear();
return;
}
TCollection_AsciiString IOR = (char*)anIOR.in();
Standard_Integer anIndex = Find(IOR, S);
- if (anIndex != 0) return S;
+ if (anIndex != 0)
+ {
+ return S;
+ }
/******* in case of a MAIN GEOM::SHAPE ********/
if (aShape->IsMainShape()) {
TopoDS_Shape aMainShape = GetShape (geom, aShape->GetMainShape());
GEOM::ListOfLong_var list = aShape->GetSubShapeIndices();
+ START_TIMING;
+
TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(aMainShape, anIndices);
+ anIOR = geom->GetStringFromIOR(aShape->GetMainShape());
+ IOR = (char*)anIOR.in();
+
+ //find subshapes only one time
+ if(_mySubShapes.count(IOR)==0)
+ {
+ std::cerr << "find sub shapes " << std::endl;
+ TopExp::MapShapes(aMainShape, anIndices);
+ Standard_Integer ii = 1, nbSubSh = anIndices.Extent();
+ for (; ii <= nbSubSh; ii++)
+ {
+ _mySubShapes[IOR].push_back(anIndices.FindKey(ii));
+ }
+ }
/* Case of only one subshape */
if (list->length() == 1 && list[0] > 0) {
- S = anIndices.FindKey(list[0]);
+ //S = anIndices.FindKey(list[0]);
+ S = _mySubShapes[IOR][list[0]-1];
}
else {
BRep_Builder B;
B.MakeCompound(aCompound);
for (int i = 0; i < list->length(); i++) {
if (0 < list[i] && list[i] <= anIndices.Extent()) {
- TopoDS_Shape aSubShape = anIndices.FindKey(list[i]);
+ TopoDS_Shape aSubShape = _mySubShapes[IOR][list[i]-1];
+ //TopoDS_Shape aSubShape = anIndices.FindKey(list[i]);
B.Add(aCompound, aSubShape);
}
}
S = aCompound;
}
Bind(IOR, S);
+ END_TIMING(100);
return S;
}
#define GEOMCLIENT_EXPORT
#endif
+#include <TCollection_AsciiString.hxx>
+#include <map>
+#include <vector>
+
//=====================================================================
// GEOM_Client : class definition
//=====================================================================
//Standard_EXPORT
unsigned int BufferLength() ;
TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
+ static GEOM_Client ShapeReader;
private:
// Fields PRIVATE
//
TColStd_SequenceOfAsciiString myIORs ;
TopTools_SequenceOfShape myShapes ;
+ std::map< TCollection_AsciiString , int > _myIndexes;
+ std::map< TCollection_AsciiString , std::vector<TopoDS_Shape> > _mySubShapes;
long pid_client;
};
}
if ( !CORBA::is_nil( geomGen ) )
{
- TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject );
+ //TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject );
+ TopoDS_Shape aTopoDSShape = GEOM_Client::ShapeReader.GetShape( geomGen, theObject );
if ( !aTopoDSShape.IsNull() )
{
#include <GEOMImpl_Types.hxx>
#include <Graphic3d_HArray1OfBytes.hxx>
+#include <sys/time.h>
+static long tcount=0;
+static long cumul;
+#define START_TIMING long tt0; timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
+#define END_TIMING(NUMBER) \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
+
//================================================================
// Function : getActiveStudy
if ( prs )
{
+ START_TIMING;
vf->BeforeDisplay( this );
vf->Display( prs );
vf->AfterDisplay( this );
+ END_TIMING(100);
if ( updateViewer )
vf->Repaint();
return 0;
internalReset();
- setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) );
+ setShape( GEOM_Client::ShapeReader.GetShape( GeometryGUI::GetGeomGen(), theObj ) );
+ //setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) );
myType = theObj->GetType();
// Update presentation
if ( !GeomObject->_is_nil() )
{
// finally set shape
- setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
+ setShape( GEOM_Client::ShapeReader.GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
+ //setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
myType = GeomObject->GetType();
}
}
}
}
UpdatePrs( prs ); // Update presentation by using of the double dispatch
+ myViewFrame->updateViewer( prs );
}
}
return prs;
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
- GEOM_Client& GetShapeReader() { return myShapeReader; }
+ GEOM_Client& GetShapeReader() { return GEOM_Client::ShapeReader; }
+ //GEOM_Client& GetShapeReader() { return myShapeReader; }
// Get active dialog box
QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
#include <vtkRenderer.h>
+#include <sys/time.h>
+static long tcount=0;
+static long cumul;
+#define START_TIMING long tt0; timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
+#define END_TIMING(NUMBER) \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
+
static GEOM_Client ShapeReader;
inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){
std::string anIORValue = anIOR->Value();
GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str());
- TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
+ TopoDS_Shape Shape = GEOM_Client::ShapeReader.GetShape(Geom,aShape);
if (!Shape.IsNull()) {
if (obj->FindAttribute(anAttr, "AttributeName")) {
_PTR(AttributeName) aName (anAttr);
aStudyBuilder->Addreference(newObj1, obj);
// commit transaction
op->commit();*/
+ START_TIMING;
Handle(GEOM_InteractiveObject) anIO =
new GEOM_InteractiveObject (const_cast<char*>(anIORValue.c_str()),
const_cast<char*>(aFatherIOR.c_str()),
const_cast<char*>( obj->GetID().c_str()));
GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer);
+ END_TIMING(100);
/*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
SVTK_View* aView = aViewWindow->getView();
int aMode = aView->GetDisplayMode();
#include "SALOMEDS_Tool.hxx"
+#include <sys/time.h>
+static long tt0;
+static long tcount=0;
+static long cumul;
+static timeval tv;
+#define START_TIMING gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
+#define END_TIMING(NUMBER) \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
+
+
//============================================================================
// function : GEOM_Gen_i()
// purpose : constructor to be called for servant creation.
{
SALOMEDS::SObject_var aResultSO;
if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
+ //START_TIMING;
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
CORBA::String_var IOR;
aSubSO->Destroy();
}
+ //END_TIMING(100);
return aResultSO._retn();
}
GEOM_Object_i::~GEOM_Object_i()
{
- MESSAGE("GEOM_Object_i::~GEOM_Object_i");
+ //MESSAGE("GEOM_Object_i::~GEOM_Object_i");
GEOM_Engine::GetEngine()->RemoveObject(_impl);
}
if (GEOMBase::GetShape(aGeomObj, aShape)) {
if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
TopTools_IndexedMapOfShape aMainMap;
- TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ TopoDS_Shape aMainShape = GEOM_Client::ShapeReader.GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ //TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
TopExp::MapShapes(aMainShape, aMainMap);
TopExp_Explorer anExp (aShape, getShapeType());
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
if (aView == 0) return;
- TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ TopoDS_Shape aMainShape = GEOM_Client::ShapeReader.GetShape(GeometryGUI::GetGeomGen(), myMainObj);
+ //TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
TopoDS_Shape aRestrictionShape;
if (subSelectionWay() == ALL_SUBSHAPES)
aRestrictionShape = aMainShape;
else if (!myInPlaceObj->_is_nil())
- aRestrictionShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myInPlaceObj);
+ aRestrictionShape = GEOM_Client::ShapeReader.GetShape(GeometryGUI::GetGeomGen(), myInPlaceObj);
+ //aRestrictionShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myInPlaceObj);
else ;
TopTools_IndexedMapOfShape aSubShapesMap;
_PTR(Study) aStudy = appStudy->studyDS();
TopTools_IndexedMapOfShape aMainMap;
- TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myObject);
+ TopoDS_Shape aMainShape = GEOM_Client::ShapeReader.GetShape(GeometryGUI::GetGeomGen(), myObject);
+ //TopoDS_Shape aMainShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), myObject);
TopExp::MapShapes(aMainShape, aMainMap);
SALOME_ListIteratorOfListIO anIter (aSelList);