Back to index

salome-gui  6.5.0
CAM_DataModel.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include "CAM_DataModel.h"
00024 
00025 #include "CAM_Module.h"
00026 #include "CAM_DataObject.h"
00027 
00041 CAM_DataModel::CAM_DataModel( CAM_Module* module )
00042 : myRoot( 0 ),
00043   myModule( module )
00044 {
00045 }
00046 
00052 CAM_DataModel::~CAM_DataModel()
00053 {
00054 }
00055 
00063 void CAM_DataModel::initialize()
00064 {
00065 }
00066 
00072 CAM_DataObject* CAM_DataModel::root() const
00073 {
00074   return myRoot;
00075 }
00076 
00091 void CAM_DataModel::setRoot( const CAM_DataObject* newRoot )
00092 {
00093   if ( myRoot == newRoot )
00094     return;
00095 
00096   if ( myRoot )
00097     myRoot->disconnect( SIGNAL( destroyed( SUIT_DataObject* ) ), 
00098                         this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
00099 
00100   myRoot = (CAM_DataObject*)newRoot;
00101 
00102   if ( myRoot )
00103     myRoot->connect( SIGNAL( destroyed( SUIT_DataObject* ) ), 
00104                      this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
00105 
00106   emit rootChanged( this );
00107 }
00108 
00113 CAM_Module* CAM_DataModel::module() const
00114 {
00115   return myModule;
00116 }
00117 
00125 void CAM_DataModel::onDestroyed( SUIT_DataObject* obj )
00126 {
00127   if ( myRoot == obj )
00128     myRoot = 0;
00129 }
00130 
00142 bool CAM_DataModel::open( const QString& /*name*/, 
00143                           CAM_Study*     /*study*/, 
00144                           QStringList    /*files*/ )
00145 {
00146   return true;
00147 }
00148 
00158 bool CAM_DataModel::save( QStringList& )
00159 { 
00160   return true; 
00161 }
00162 
00174 bool CAM_DataModel::saveAs( const QString& /*name*/,
00175                             CAM_Study*     /*study*/,
00176                             QStringList&   /*files*/ )
00177 {
00178   return true;
00179 }
00180 
00189 bool CAM_DataModel::close()
00190 { 
00191   return true; 
00192 }
00193 
00202 bool CAM_DataModel::create( CAM_Study* )
00203 { 
00204   return true; 
00205 }
00206