-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
+// 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.
+// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File: SalomeApp_DataModel.cxx
// Created: 10/25/2004 10:36:06 AM
// Author: Sergey LITONIN
-//
+
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_DataObject.h"
*/
bool SalomeApp_DataModelSync::isCorrect( const kerPtr& so ) const
{
+#ifdef WITH_SALOMEDS_OBSERVER
+ // with GUI observers this function is not needed anymore
+ return true;
+#endif
kerPtr refObj;
QString name = so->GetName().c_str();
_PTR( GenericAttribute ) anAttr;
\param prepend - SUIT object must be added to start of children list
*/
suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so,
- const suitPtr& parent,
- const suitPtr& after ) const
+ const suitPtr& parent,
+ const suitPtr& after ) const
{
if( !isCorrect( so ) )
return 0;
_PTR(SComponent) aSComp( so );
suitPtr nitem = aSComp ? new SalomeApp_ModuleObject( aSComp, 0 ) :
new SalomeApp_DataObject( so, 0 );
+
if( parent ) {
int pos = after ? parent->childPos( after ) : 0;
parent->insertChild( nitem, pos+1 );
_PTR( SComponent ) aComp( p );
bool res = ( !p && !q ) ||
( lobj && !sobj && aComp ) ||
- ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() );
+ ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() );
return res;
}
{
QList<kerPtr> ch;
- _PTR(ChildIterator) it ( myStudy->NewChildIterator( obj ) );
- for( ; it->More(); it->Next() )
- ch.append( it->Value() );
+ _PTR( GenericAttribute ) anAttr;
+ bool expandable = true;
+ if ( obj && obj->FindAttribute( anAttr, "AttributeExpandable" ) ) {
+ _PTR(AttributeExpandable) aAttrExp = anAttr;
+ expandable = aAttrExp->IsExpandable();
+ }
+
+ if ( expandable ) {
+ // tmp??
+ _PTR(UseCaseBuilder) aUseCaseBuilder = myStudy->GetUseCaseBuilder();
+ if (aUseCaseBuilder->HasChildren(obj)) {
+ _PTR(UseCaseIterator) it ( aUseCaseBuilder->GetUseCaseIterator( obj ) );
+ for ( ; it->More(); it->Next() )
+ ch.append( it->Value() );
+ }
+ else {
+ _PTR(ChildIterator) it ( myStudy->NewChildIterator( obj ) );
+ for ( ; it->More(); it->Next() )
+ ch.append( it->Value() );
+ }
+ }
+
return ch;
}
{
QString marg; marg.fill( ' ', 3*it.depth() );
QString nnn = "%1 '%2'";
- qDebug( nnn.arg( marg ).arg( it.current()->name() ).toLatin1() );
+ qDebug( nnn.arg( marg ).arg( it.current()->name() ).toUtf8() );
}
}
if ( anId.isEmpty() )
return true; // Probably nothing to load
- _PTR(Study) aStudy ( aDoc->studyDS() ); // shared_ptr cannot be used here
- _PTR(SComponent) aSComp ( aStudy->FindComponentID( std::string( anId.toLatin1() ) ) );
+ _PTR(SComponent) aSComp ( SalomeApp_Application::getStudy()->FindComponentID( std::string( anId.toUtf8() ) ) );
if ( aSComp )
updateTree( aSComp, aDoc );
studyRoot = dynamic_cast<LightApp_RootObject*>( aSStudy->root() );
QString anId = getRootEntry( aSStudy );
if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing
- _PTR(Study) aStudy ( aSStudy->studyDS() );
- sobj = aStudy->FindComponentID( std::string( anId.toLatin1() ) );
+ sobj = SalomeApp_Application::getStudy()->FindComponentID( std::string( anId.toUtf8() ) );
}
}
}
if ( studyRoot ) {
aSStudy = dynamic_cast<SalomeApp_Study*>( studyRoot->study() ); // <study> value should not change here theoretically, but just to make sure
if ( aSStudy ) {
- _PTR(Study) aStudy ( aSStudy->studyDS() );
// modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon
- sobj = aStudy->FindComponentID( std::string( modelRoot->entry().toLatin1() ) );
+ sobj = SalomeApp_Application::getStudy()->FindComponentID( std::string( modelRoot->entry().toUtf8() ) );
}
}
}
}
}
+#ifdef WITH_SALOMEDS_OBSERVER
+ SalomeApp_RootObject* root=dynamic_cast<SalomeApp_RootObject*>(study->root());
+ if(!(root->toSynchronize()))
+ return suitObj;
+#endif
+
SalomeApp_DataModelSync sync( study->studyDS(), study->root() );
if( !suitObj || dynamic_cast<SalomeApp_DataObject*>( suitObj ) )
- return ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, suitObj, sync );
+ suitObj= ::synchronize<kerPtr,suitPtr,SalomeApp_DataModelSync>( sobj, suitObj, sync );
else
- return 0;
+ suitObj= 0;
+
+ return suitObj;
}
/*!