-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#ifdef WIN32
#pragma warning( disable:4786 )
#include <TColStd_HArray1OfInteger.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
+#include <TopTools_SequenceOfShape.hxx>
#include <OSD.hxx>
#include <SALOMEDS_Tool.hxx>
{
//work around PAL12004, PAL12628
//OSD::SetSignal( true );
- bool raiseFPE;
-#ifdef _DEBUG_
- raiseFPE = true;
- char* envDisableFPE = getenv("DISABLE_FPE");
- if (envDisableFPE && atoi(envDisableFPE))
- raiseFPE = false;
-#else
- raiseFPE = false;
+ bool raiseFPE = false;
+#if defined(_DEBUG_) | defined(_DEBUG) //the Last for WIN32 default settings
+ char* envEnableFPE = getenv("ENABLE_FPE");
+ if (envEnableFPE && atoi(envEnableFPE))
+ raiseFPE = true;
#endif
OSD::SetSignal( raiseFPE );
}
aResultSO->SetAttrString("AttributeIOR",aGeomObjIOR);
TCollection_AsciiString anObjectName, aNamePrefix("Shape_");
+ CORBA::Long mytype=aBaseObj->GetType();
// BEGIN: try to find existed name for current shape
- if ( !aShape->_is_nil() )
+ if ( !aShape->_is_nil() && mytype != GEOM_GROUP)
{
// recieve current TopoDS shape
CORBA::String_var entry = aShape->GetEntry();
}
// END: try to find existed name for current shape
- CORBA::Long mytype=aBaseObj->GetType();
if ( mytype == GEOM_GROUP ) {
GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() );
switch ( (TopAbs_ShapeEnum)anOp->GetType( aShape )) {
return aResult._retn();
}
+//=======================================================================
+// function :
+// purpose :
+//=======================================================================
+SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
+ const GEOM::string_array& theObjectIORs ) {
+ // fill in the tree structure
+ GEOMUtils::TreeModel tree;
+
+ // foreach( QString ior, theObjectIORs ) {
+ std::string ior;
+ for ( int i = 0; i < theObjectIORs.length(); i++ ) {
+ ior = theObjectIORs[i].in();
+ GEOM::GEOM_Object_ptr anObj = GetIORFromString( ior.c_str() );
+ GEOMUtils::LevelsList upLevelList;
+ getUpwardDependency( anObj, upLevelList );
+ GEOMUtils::LevelsList downLevelList;
+ getDownwardDependency( theStudy, anObj, downLevelList );
+ tree.insert( std::pair<std::string, std::pair<GEOMUtils::LevelsList,GEOMUtils::LevelsList> >(ior, std::pair<GEOMUtils::LevelsList,GEOMUtils::LevelsList>( upLevelList, downLevelList ) ) );
+ }
+
+ // translation the tree into string
+ std::string treeStr;
+ GEOMUtils::ConvertTreeToString( tree, treeStr );
+
+ char* aBuffer = (char*)CORBA::string_dup(treeStr.c_str());
+ int aBufferSize = strlen((char*)aBuffer);
+
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+
+ SALOMEDS::TMPFile_var aStream = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+
+ return aStream._retn();
+}
+
+//=======================================================================
+// function :
+// purpose :
+//=======================================================================
+void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &upLevelList,
+ int level ) {
+ std::string aGboIOR = GetStringFromIOR(GEOM::GEOM_Object::_narrow(gbo));
+ GEOM::ListOfGBO_var depList = gbo->GetDependency();
+ for( int j = 0; j < depList->length(); j++ ) {
+ if ( level > 0 ) {
+ GEOMUtils::NodeLinks anIORs;
+ GEOMUtils::LevelInfo aLevelMap;
+ if ( level-1 >= upLevelList.size() ) {
+ upLevelList.push_back( aLevelMap );
+ } else {
+ aLevelMap = upLevelList.at(level-1);
+ if ( aLevelMap.count( aGboIOR ) > 0 )
+ anIORs = aLevelMap[ aGboIOR ];
+ }
+ anIORs.push_back( GetStringFromIOR(GEOM::GEOM_Object::_narrow(depList[j])) );
+ aLevelMap.insert( std::pair<std::string, GEOMUtils::NodeLinks>(aGboIOR, anIORs) );
+ }
+ getUpwardDependency(depList[j], upLevelList, level++);
+ }
+}
+
+//=======================================================================
+// function :
+// purpose :
+//=======================================================================
+void GEOM_Gen_i::getDownwardDependency( SALOMEDS::Study_ptr theStudy,
+ GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &downLevelList,
+ int level ) {
+ SALOMEDS::SComponent_var comp = theStudy->FindComponent("GEOM");
+ if ( !comp )
+ return;
+
+ SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator( comp );
+ for ( it->InitEx( true ); it->More(); it->Next() ) {
+ SALOMEDS::SObject_var child = it->Value();
+ CORBA::Object_var corbaObj = child->GetObject();
+ GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
+ if( CORBA::is_nil( geomObj ) )
+ continue;
+
+ GEOM::ListOfGBO_var depList = geomObj->GetDependency();
+ if( depList->length() == 0 )
+ continue;
+ std::string aGoIOR = GetStringFromIOR( geomObj );
+
+ for( int i = 0; i < depList->length(); i++ ) {
+ if ( depList[i]->IsSame( gbo ) ) {
+ GEOMUtils::NodeLinks anIORs;
+ GEOMUtils::LevelInfo aLevelMap;
+ if ( level >= downLevelList.size() ) {
+ aLevelMap = GEOMUtils::LevelInfo();
+ downLevelList.push_back( aLevelMap );
+ } else {
+ aLevelMap = downLevelList.at(level);
+ if ( aLevelMap.count( aGoIOR ) > 0 )
+ anIORs = aLevelMap[ aGoIOR ];
+ }
+ anIORs.push_back( GetStringFromIOR(GEOM::GEOM_Object::_narrow(depList[i])));
+ aLevelMap.insert( std::pair<std::string, GEOMUtils::NodeLinks>(aGoIOR, anIORs) );
+ }
+ }
+ getDownwardDependency(theStudy, geomObj, downLevelList, level++);
+ }
+}
+
//=====================================================================================
// EXPORTED METHODS
//=====================================================================================