Salome HOME
Avoid including of SALOMEDS classes; fix pb with objects deletion
authorjfa <jfa@opencascade.com>
Thu, 18 Aug 2005 06:15:31 +0000 (06:15 +0000)
committerjfa <jfa@opencascade.com>
Thu, 18 Aug 2005 06:15:31 +0000 (06:15 +0000)
17 files changed:
src/GEOMBase/GEOMBase.cxx
src/GEOMBase/GEOMBase_Helper.cxx
src/GEOMBase/Makefile.in
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI.h
src/GEOMGUI/GeometryGUI_Swig.cxx
src/GEOMGUI/Makefile.in
src/GEOMToolsGUI/GEOMToolsGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI.h
src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_I/GEOM_Gen_i.hh
src/GEOM_I/GEOM_ICurvesOperations_i.cc
src/GEOM_I/GEOM_Object_i.hh
src/GEOM_I/Makefile.in

index d2aedf7279977cc4a783a9e087c3263cc3125c5f..194a81c96d63f86225d10d76414fb41d88f6d355 100644 (file)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 
 #include <vtkRenderer.h>
 #include <qvaluelist.h>
-#include <qstringlist.h> 
+#include <qstringlist.h>
 
 #include "GEOMImpl_Types.hxx"
 
 using namespace std;
 
 #include "SALOMEDSClient.hxx"
-#include "SALOMEDS_SObject.hxx"
-#include "SALOMEDS_Study.hxx"
 
 
 //=======================================================================
@@ -124,7 +122,7 @@ TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR)
   GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj );
   if (GeomObject->_is_nil())
     return result;
-  
+
   result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject);
   return result;
 }
@@ -162,7 +160,7 @@ bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& td
     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
     if ( !appStudy ) return false;
     _PTR(Study) aStudy = appStudy->studyDS();
-    
+
     _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) );
     _PTR(GenericAttribute) anAttr;
     if( obj ) {
@@ -176,7 +174,7 @@ bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& td
       }
     }
   }
-  
+
   return false;
 }
 
@@ -198,15 +196,15 @@ int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList,
            SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
            if ( !appStudy ) return nbSel;
            _PTR(Study) aStudy = appStudy->studyDS();
-           
+
            _PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) );
-           
+
            _PTR(GenericAttribute) anAttr;
-           
+
            if ( obj && obj->FindAttribute( anAttr, "AttributeName") )
              {
                _PTR(AttributeName) aNameAttr ( anAttr );
-               theName = aNameAttr->Value().c_str();        
+               theName = aNameAttr->Value().c_str();
              }
          }
        }
@@ -224,7 +222,7 @@ int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList,
       }
       else
        theName = QString( "%1_objects" ).arg( anObjs.length() );
-      
+
       return anObjs.length();
     }
 }
@@ -344,17 +342,17 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
   if ( !appStudy ) return resultShape;
   _PTR(Study) aStudy = appStudy->studyDS();
-  
+
   _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) );
   if ( !anObj )
     return resultShape;
-  
+
   QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
 
   for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it ) {
     if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) {
       Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
-      
+
       AIS_ListOfInteractive List;
       ic->DisplayedObjects(List);
       AIS_ListOfInteractive List1;
@@ -396,7 +394,7 @@ GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& t
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
   if ( !appStudy ) return GEOM_Actor::New();
   _PTR(Study) aStudy = appStudy->studyDS();
-  
+
   _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) );
   if ( !anObj )
     return GEOM_Actor::New();
@@ -448,7 +446,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO
     if (it.current()->getViewManager()->getType() != OCCViewer_Viewer::Type())
       continue;
     Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
-    
+
     AIS_ListOfInteractive aList;
     anIC->DisplayedObjects( aList );
     anIC->ObjectsInCollector( aList );
@@ -458,7 +456,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO
     {
       Handle(SALOME_InteractiveObject) anObj =
         Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() );
-      
+
       if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 )
       {
         if( isOnlyInActiveView )
@@ -471,7 +469,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO
       }
     }
   }
-        
+
   return Handle(AIS_InteractiveObject)();
 }
 
@@ -489,19 +487,19 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte
     testResult = false;
     return res;
   }
-  
+
   QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
 
   for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it ) {
     if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) {
       Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
-      
+
       AIS_ListOfInteractive List;
       ic->DisplayedObjects(List);
       AIS_ListOfInteractive List1;
       ic->ObjectsInCollector(List1);
       List.Append(List1);
-      
+
       AIS_ListIteratorOfListOfInteractive ite(List);
       while(ite.More())
       {
@@ -529,7 +527,7 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte
           }
         }
         ite.Next();
-      }  
+      }
     }
   }
   testResult = false;
@@ -545,7 +543,7 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interac
 {
   GEOM::GEOM_Object_var aShape;
   testResult = false;
-  
+
   /* case SObject */
   if(IO->hasEntry()) {
     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
@@ -570,32 +568,35 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interac
 
 //=======================================================================
 // function : ConvertListOfIOInListOfIOR()
-// purpose  : 
+// purpose  :
 //=======================================================================
 void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR)
 {
-  int nbSel = aList.Extent();  
+  int nbSel = aList.Extent();
   listIOR.length(nbSel);
   int j=0;
   SALOME_ListIteratorOfListIO It(aList);
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); 
-  if ( !appStudy ) return; 
-  _PTR(Study) aStudy = appStudy->studyDS(); 
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+    ( SUIT_Session::session()->activeApplication()->activeStudy() );
+  if ( !appStudy ) return;
+  _PTR(Study) aStudy = appStudy->studyDS();
 
-  for(int i=0; It.More(); It.Next(), i++) {
+  for (int i=0; It.More(); It.Next(), i++) {
     Handle(SALOME_InteractiveObject) IObject = It.Value();
-    if(IObject->hasEntry()) {
+    if (IObject->hasEntry()) {
       _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
       _PTR(GenericAttribute) anAttr;
-      if(obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
+      if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
        _PTR(AttributeIOR) anIOR (anAttr);
-        CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>(aStudy.get())->ConvertIORToObject(anIOR->Value());
-       if(theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) {
+        //CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>
+        //  (aStudy.get())->ConvertIORToObject(anIOR->Value());
+        CORBA::Object_var theObj = GeometryGUI::ClientSObjectToObject(obj);
+       if (!CORBA::is_nil(theObj) && theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) {
          listIOR[j] = CORBA::string_dup(anIOR->Value().c_str());
          j++;
        }
       }
-    } 
+    }
   }
   listIOR.length(j);
 }
@@ -603,26 +604,27 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::stri
 
 //=======================================================================
 // function : ConvertIOinGEOMObject()
-// purpose  : 
+// purpose  :
 //=======================================================================
-GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& theIO, 
+GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& theIO,
                                                       Standard_Boolean& theResult )
-{ 
+{
   theResult = Standard_False;
   GEOM::GEOM_Object_var aReturnObject;
   if ( !theIO.IsNull() )
   {
     const char* anEntry = theIO->getEntry();
 
-    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+      ( SUIT_Session::session()->activeApplication()->activeStudy() );
     if ( !appStudy ) return  GEOM::GEOM_Object::_nil();
     _PTR(Study) aStudy = appStudy->studyDS();
 
     _PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) );
-    
-    if ( aSObj  )
+
+    if (aSObj)
     {
-      aReturnObject = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject() );
+      aReturnObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
       theResult = !CORBA::is_nil( aReturnObject );
     }
   }
@@ -632,20 +634,20 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter
 
 //=======================================================================
 // function : ConvertListOfIOInListOfGO()
-// purpose  : 
+// purpose  :
 //=======================================================================
 void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
                                           GEOM::ListOfGO&      theListGO,
                                           const bool           theShapesOnly )
 {
-  int nbSel = theList.Extent();  
+  int nbSel = theList.Extent();
   theListGO.length( nbSel );
   SALOME_ListIteratorOfListIO anIter( theList );
 
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
   if ( !appStudy ) return;
   _PTR(Study) aStudy = appStudy->studyDS();
-  
+
   int j = 0;
   for ( int i=0; anIter.More(); anIter.Next(), i++ )
   {
@@ -654,13 +656,13 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
 
     if ( aSObj )
     {
-      GEOM::GEOM_Object_var aGeomObj = 
-       GEOM::GEOM_Object::_narrow(dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject());
+      GEOM::GEOM_Object_var aGeomObj =
+       GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
       if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) )
         theListGO[ j++ ] = aGeomObj;
     }
   }
-  
+
   theListGO.length( j );
 }
 
@@ -671,16 +673,16 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
 //=================================================================================
 bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone)
 {
-  if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() 
+  if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
      != OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE)
     return false;
-  
+
   OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort();
   Handle( V3d_View) view3d = vp3d->getView();
   Standard_Real Width, Height;
   view3d->Size(Width, Height);
   const Standard_Real aHeight = (Width + Height) / 50.0;
-  
+
   try {
     Standard_Real first, last;
     Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last);
@@ -693,11 +695,11 @@ bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& A
     curv->D1( param, middleParamPoint, V1);
     if(V1.Magnitude() < Precision::Confusion())
       return false;
-    
+
     /* Topology orientation not geom orientation */
     if(tds.Orientation() == TopAbs_REVERSED)
       V1 *= -1.0;
-    
+
     gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1));
     const Standard_Real radius1 = aHeight / 5.0;
     if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) {
@@ -707,7 +709,7 @@ bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& A
   }
   catch(Standard_Failure) {
     // OCC failures are hard to catch in GUI.
-    // This  because of the position for  #include <Standard_ErrorHandler.hxx> that is very critic to find 
+    // This  because of the position for  #include <Standard_ErrorHandler.hxx> that is very critic to find
     // in SALOME environment : compilation error !
   }
   return false;
@@ -729,7 +731,7 @@ bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P)
 
 //=================================================================================
 // function : GetBipointDxDyDz()
-// purpose  : 
+// purpose  :
 //=================================================================================
 void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz)
 {
@@ -777,14 +779,14 @@ bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S,  gp_Pnt& P1, gp_Pnt&
 //=======================================================================
 double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const char* aTitle1, const char* aTitle, const double bottom, const double top, const int decimals)
 {
-  GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(), 
+  GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(),
                                                               aTitle, TRUE, 0, bottom, top, decimals);
   int r = Dialog->exec();
   float X = 0.0;
   if(r == QDialog::Accepted) {
     res = Standard_True;
     X = Dialog->getValue();
-  } 
+  }
   else
     res = Standard_False;
   delete Dialog;
@@ -795,7 +797,7 @@ double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const cha
 //=======================================================================
 // function : SelectionByNameInDialogs()
 // purpose  : Called when user has entered a name of object in a LineEdit.
-//          : The selection is changed. Dialog box will receive the 
+//          : The selection is changed. Dialog box will receive the
 //          : corresponding signal to manage this event.
 //=======================================================================
 bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList)
@@ -804,10 +806,10 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
   if ( !appStudy ) return false;
   _PTR(Study) ST = appStudy->studyDS();
-  
+
   std::vector<_PTR(SObject)> listSO;
   listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM");
-  
+
   if(listSO.size() < 1) {
     const QString caption  = QObject::tr("GEOM_WRN_WARNING");
     const QString text = QObject::tr("GEOM_NAME_INCORRECT");
@@ -833,7 +835,7 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU
 
   /* Add as a selected object       */
   /* Clear any previous selection : */
-  /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */ 
+  /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */
   // Sel->ClearIObjects(); //mzn
   // Sel->AddIObject(SI); //mzn
   return true;
@@ -850,7 +852,7 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y)
   SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop();
   x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
   y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
-  return true;  
+  return true;
 }
 
 
@@ -868,13 +870,13 @@ QString GEOMBase::GetDefaultName(const QString& theOperation)
 
   int aNumber = 0;
   _PTR(SObject) obj;
-  do 
+  do
     {
       aName = theOperation+"_"+QString::number(++aNumber);
       obj = aStudy->FindObject(aName.latin1());
-    } 
+    }
   while (obj);
-  
+
   return aName;
 }
 
@@ -887,13 +889,13 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment
 {
   QString anErrorCode(theErrorCode);
   QString aComment(theComment);
-  
+
   QString aText = "";
   if (!anErrorCode.isEmpty())
     aText.append("\n" + QObject::tr(anErrorCode));
   if (!aComment.isEmpty())
     aText.append("\n" + QString(theComment));
-  
+
   SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ),
                           QObject::tr("GEOM_PRP_ABORT") + aText, "OK" );
 }
@@ -950,7 +952,7 @@ bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& t
 QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
 {
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-  
+
   if ( appStudy )
   {
     string anIOR = SalomeApp_Application::orb()->object_to_string( theObj );
@@ -959,16 +961,16 @@ QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
       _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( anIOR ) );
 
       _PTR(GenericAttribute) anAttr;
-      
+
       if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") )
       {
         _PTR(AttributeName) aNameAttr ( anAttr );
-       return QString( aNameAttr->Value().c_str() );        
+       return QString( aNameAttr->Value().c_str() );
       }
     }
   }
-  
-  return QString("");  
+
+  return QString("");
 }
 
 bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj )
index c1824caccd5349f563e7d0a43c2f66be7ff4801e..7c2707cab2e42924564d415708edd2224c9888b0 100755 (executable)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2004  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 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 
-// 
-//  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
 //
 //
 //
 using namespace std;
 
 #include <SALOMEDSClient.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDS_Study.hxx>
-
-
 
 
 //================================================================
@@ -74,7 +70,7 @@ static SUIT_ViewWindow* getActiveView()
   SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
   if ( activeStudy )
     return SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-  
+
   return 0;
 }
 
@@ -92,14 +88,14 @@ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine()
 // Function : GEOMBase_Helper
 // Purpose  :
 //================================================================
-GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop ) 
+GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop )
   : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false )
 {
 }
 
 //================================================================
 // Function : ~GEOMBase_Helper
-// Purpose  : 
+// Purpose  :
 //================================================================
 GEOMBase_Helper::~GEOMBase_Helper()
 {
@@ -118,7 +114,7 @@ GEOMBase_Helper::~GEOMBase_Helper()
 
 //================================================================
 // Function : display
-// Purpose  : 
+// Purpose  :
 //================================================================
 void GEOMBase_Helper::display( const ObjectList& objList, const bool updateView )
 {
@@ -151,7 +147,7 @@ void GEOMBase_Helper::display( GEOM::GEOM_Object_ptr object, const bool updateVi
 
 //================================================================
 // Function : erase
-// Purpose  : 
+// Purpose  :
 //================================================================
 void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView )
 {
@@ -165,7 +161,7 @@ void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView )
 
 //================================================================
 // Function : erase
-// Purpose  : 
+// Purpose  :
 //================================================================
 void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView )
 {
@@ -178,9 +174,9 @@ void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView
 
 //================================================================
 // Function : redisplay
-// Purpose  : 
+// Purpose  :
 //================================================================
-void GEOMBase_Helper::redisplay( const ObjectList& objList, 
+void GEOMBase_Helper::redisplay( const ObjectList& objList,
                                 const bool withChildren,
                                 const bool updateView )
 {
@@ -194,9 +190,9 @@ void GEOMBase_Helper::redisplay( const ObjectList& objList,
 
 //================================================================
 // Function : redisplay
-// Purpose  : 
+// Purpose  :
 //================================================================
-void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, 
+void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
                                 const bool withChildren,
                                 const bool updateView )
 {
@@ -205,23 +201,25 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
     // Default color will be used
     getDisplayer()->UnsetColor();
     getDisplayer()->UnsetWidth();
-    
+
     // Enable activisation of selection
     getDisplayer()->SetToActivate( true );
-    
+
     string entry = getEntry( object );
-    getDisplayer()->Redisplay( new SALOME_InteractiveObject( entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ) ) ), false );
+    getDisplayer()->Redisplay(new SALOME_InteractiveObject
+                              (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object))), false);
   }
-  
+
   if ( withChildren ) {
     SalomeApp_Study* aDoc = getStudy();
     if ( aDoc && aDoc->studyDS() ) {
       _PTR(Study) aStudy = aDoc->studyDS();
-      _PTR(SObject) aSObj ( aStudy->FindObjectIOR( SalomeApp_Application::orb()->object_to_string( object ) ) );
+      _PTR(SObject) aSObj (aStudy->FindObjectIOR(SalomeApp_Application::orb()->object_to_string(object)));
       if ( aSObj  ) {
        _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
        for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
-         GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(anIt->Value().get())->GetObject() );
+         GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow
+            (GeometryGUI::ClientSObjectToObject(anIt->Value()));
          if ( !CORBA::is_nil( aChild ) ) {
            if ( !aChild->_is_nil() ) {
              string entry = getEntry( aChild );
@@ -230,10 +228,10 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
            }
          }
        }
-      }    
+      }
     }
   }
-  
+
   if ( updateView )
     getDisplayer()->UpdateViewer();
 }
@@ -247,12 +245,12 @@ void GEOMBase_Helper::displayPreview( const bool   activate,
                                       const bool   toRemoveFromEngine,
                                       const double lineWidth )
 {
-  isPreview = true; 
+  isPreview = true;
   QString msg;
   if ( !isValid( msg ) )
   {
     erasePreview( update );
-    isPreview = false; 
+    isPreview = false;
     return;
   }
 
@@ -289,7 +287,7 @@ void GEOMBase_Helper::displayPreview( const bool   activate,
 //================================================================
 void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
                                       const bool            append,
-                                      const bool            activate, 
+                                      const bool            activate,
                                       const bool            update,
                                       const double          lineWidth )
 {
@@ -304,7 +302,7 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
 
   // Make a reference to GEOM_Object
   getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) );
-  
+
   // Build prs
   SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
   if ( aPrs == 0 || aPrs->IsNull() )
@@ -345,8 +343,8 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs,
       SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
       if (aView)
        aView->Display( prs );
-    } 
-  
+    }
+
   // Add prs to the preview list
   myPreview.push_back( (SALOME_Prs*)prs );
 
@@ -357,7 +355,7 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs,
 
 //================================================================
 // Function : erasePreview
-// Purpose  : 
+// Purpose  :
 //================================================================
 void GEOMBase_Helper::erasePreview( const bool update )
 {
@@ -375,7 +373,7 @@ void GEOMBase_Helper::erasePreview( const bool update )
             SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
             if (aView)
               aView->Erase( *anIter, true );
-          } 
+          }
       }
     delete *anIter;
   }
@@ -409,7 +407,8 @@ void GEOMBase_Helper::activate( const int theType )
       _PTR(SObject) aRefSO;
       if ( !aSO->ReferencedObject( aRefSO ) )
       {
-        GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(aSO.get())->GetObject() );
+        GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow
+          (GeometryGUI::ClientSObjectToObject(aSO));
         if ( !anObj->_is_nil() && anObj->GetType() == theType )
           aList.Append( new SALOME_InteractiveObject( aSO->GetID().c_str(), "GEOM", aSO->GetName().c_str()) );
       }
@@ -427,7 +426,7 @@ void GEOMBase_Helper::activate( const int theType )
 void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode )
 {
   SALOME_ListIO aListOfIO;
-  
+
   ObjectList::const_iterator anIter = theObjs.begin();
   for ( ; anIter != theObjs.end(); ++anIter )
   {
@@ -498,7 +497,8 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN
 
   GEOM::GEOM_Object_ptr aFatherObj = getFather( theObj );
 
-  getGeomEngine()->AddInStudy( dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy(), theObj, theName, aFatherObj );
+  getGeomEngine()->AddInStudy(GeometryGUI::ClientStudyToStudy(aStudy),
+                              theObj, theName, aFatherObj);
 }
 
 //================================================================
@@ -540,7 +540,7 @@ int GEOMBase_Helper::getStudyId() const
 
 //================================================================
 // Function : getStudy
-// Purpose  : Returns the active study. It is recommended to use 
+// Purpose  : Returns the active study. It is recommended to use
 //            this method instead of direct desktop->getActiveStudy() calls
 //================================================================
 SalomeApp_Study* GEOMBase_Helper::getStudy() const
@@ -548,14 +548,14 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const
   SUIT_Desktop* aDesktop = getDesktop();
   if (!aDesktop)
     return 0;
-  
-  QPtrList<SUIT_Application> anAppList = SUIT_Session::session()->applications(); 
-  
+
+  QPtrList<SUIT_Application> anAppList = SUIT_Session::session()->applications();
+
   SUIT_Application* anApp = 0;
   for ( QPtrListIterator<SUIT_Application> it( anAppList ); it.current() ; ++it )
     {
       anApp = it.current();
-      if ( anApp->desktop() == aDesktop ) 
+      if ( anApp->desktop() == aDesktop )
        break;
     }
 
@@ -564,7 +564,7 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const
 
 //================================================================
 // Function : getEntry
-// Purpose  : 
+// Purpose  :
 //================================================================
 char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const
 {
@@ -583,7 +583,7 @@ char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const
 
 //================================================================
 // Function : getDisplayer
-// Purpose  : 
+// Purpose  :
 //================================================================
 GEOM_Displayer* GEOMBase_Helper::getDisplayer()
 {
@@ -594,7 +594,7 @@ GEOM_Displayer* GEOMBase_Helper::getDisplayer()
 
 //================================================================
 // Function : clearShapeBuffer
-// Purpose  : 
+// Purpose  :
 //================================================================
 void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
 {
@@ -619,34 +619,34 @@ void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
     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 );
     }
   }
 }
 
 //================================================================
 // Function : openCommand
-// Purpose  : 
+// Purpose  :
 //================================================================
-bool GEOMBase_Helper::openCommand() 
+bool GEOMBase_Helper::openCommand()
 {
   bool res = false;
   if ( !getStudy() || hasCommand() )
     return res;
-  
+
   GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() );
   if ( !anOp->_is_nil() ) {
     myCommand = new GEOM_Operation( SUIT_Session::session()->activeApplication(), anOp.in() );
     myCommand->start();
     res = true;
   }
+
   return res;
 }
 
 //================================================================
 // Function : abortCommand
-// Purpose  : 
+// Purpose  :
 //================================================================
 bool GEOMBase_Helper::abortCommand()
 {
@@ -655,13 +655,13 @@ bool GEOMBase_Helper::abortCommand()
 
   myCommand->abort();
   myCommand = 0;
-  return true;  
+
+  return true;
 }
 
 //================================================================
 // Function : commitCommand
-// Purpose  : 
+// Purpose  :
 //================================================================
 bool GEOMBase_Helper::commitCommand( const char* )
 {
@@ -671,12 +671,12 @@ bool GEOMBase_Helper::commitCommand( const char* )
   myCommand->commit();
   myCommand = 0;
 
-  return true;  
+  return true;
 }
 
 //================================================================
 // Function : hasCommand
-// Purpose  : 
+// Purpose  :
 //================================================================
 bool GEOMBase_Helper::hasCommand() const
 {
@@ -685,7 +685,7 @@ bool GEOMBase_Helper::hasCommand() const
 
 //================================================================
 // Function : getOperation
-// Purpose  : 
+// Purpose  :
 //================================================================
 GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation()
 {
@@ -699,13 +699,13 @@ GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation()
 
 //================================================================
 // Function : checkViewWindow
-// Purpose  : 
+// Purpose  :
 //================================================================
 bool GEOMBase_Helper::checkViewWindow()
 {
   if ( myViewWindow ){
     QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
-    for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it ) 
+    for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it )
       {
        if ( myViewWindow == it.current() )
          return true;
@@ -718,7 +718,7 @@ bool GEOMBase_Helper::checkViewWindow()
 //================================================================
 // Function : onAccept
 // Purpose  : This method should be called from dialog's slots onOk() and onApply()
-//            It perfroms user input validation, then it 
+//            It perfroms user input validation, then it
 //            performs a proper operation and manages transactions, etc.
 //================================================================
 bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
@@ -726,12 +726,12 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
   if ( !appStudy ) return false;
   _PTR(Study) aStudy = appStudy->studyDS();
-  
+
   bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked();
   if ( aLocked ) {
     MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
     SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(),
-                          QObject::tr("WRN_WARNING"), 
+                          QObject::tr("WRN_WARNING"),
                           QObject::tr("WRN_STUDY_LOCKED"),
                           QObject::tr("BUT_OK") );
     return false;
@@ -773,7 +773,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
            withChildren = false;
            display( *it, false );
          }
-         else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client 
+         else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client
                 // before redisplay
            clearShapeBuffer( *it );
            withChildren = true;
@@ -816,8 +816,8 @@ void GEOMBase_Helper::showError()
     msg = QObject::tr( "GEOM_PRP_ABORT" );
 
   SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(),
-                          QObject::tr( "GEOM_ERROR_STATUS" ), 
-                          msg, 
+                          QObject::tr( "GEOM_ERROR_STATUS" ),
+                          msg,
                           QObject::tr( "BUT_OK" ) );
 }
 
@@ -858,8 +858,8 @@ bool GEOMBase_Helper::isValid( QString& )
 
 //================================================================
 // Function : execute
-// Purpose  : This method is called by onAccept(). 
-//            It should perform the required operation and put all new or modified objects into 
+// Purpose  : This method is called by onAccept().
+//            It should perform the required operation and put all new or modified objects into
 //            <objects> argument.Should return <false> if some error occurs during its execution.
 //================================================================
 bool GEOMBase_Helper::execute( ObjectList& objects )
@@ -899,9 +899,9 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const
   TopoDS_Shape aShape;
   if ( !GEOMBase::GetShape( theObj, aShape ) )
     return "";
-  
+
   long aType = aShape.ShapeType();
-  
+
   switch ( aType )
   {
     case TopAbs_VERTEX   : return QObject::tr( "GEOM_VERTEX" );
@@ -923,14 +923,14 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const
 const SALOME_ListIO& GEOMBase_Helper::selectedIO()
 {
   mySelected.Clear();
-  
+
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   if ( app ) {
     SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr();
     if ( aSelMgr )
       aSelMgr->selectedObjects( mySelected );
   }
-  
+
   return mySelected;
 }
 
index 871e7f452365f2ddb652ae72765dff9f9cd1a030..c80cb2cee047751136b7e25530409e237f41a061 100644 (file)
@@ -66,6 +66,6 @@ LIB_SERVER_IDL =
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
 CXXFLAGS += $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
 
-LDFLAGS += -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome $(CAS_LDPATH) -lDlgRef -lGEOM -lsuit -lOCCViewer -lVTKViewer -lSalomeDS -lTKPrim
+LDFLAGS += -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome $(CAS_LDPATH) -lDlgRef -lGEOM -lsuit -lOCCViewer -lVTKViewer -lTKPrim
 
 @CONCLUDE@
index 1d1111eeef7f33e41fe2e94e7d8ddd6b8b614b86..c7494b8c7acab93438a976a6d4b956442ef72f68 100644 (file)
@@ -1,12 +1,13 @@
-#include <OCCViewer_ViewModel.h>
-
 #include "GEOMGUI_Selection.h"
+
+#include "GeometryGUI.h"
 #include "GEOM_Displayer.h"
-#include "GEOMImpl_Types.hxx"
 
 #include <SalomeApp_DataOwner.h>
 #include <SalomeApp_Study.h>
 
+#include <OCCViewer_ViewModel.h>
+
 #include <SUIT_Session.h>
 #include <SUIT_ViewWindow.h>
 #include <SUIT_ViewManager.h>
 
 #include <SALOMEDSClient_SObject.hxx>
 #include <SALOMEDSClient_Study.hxx>
-#include <SALOMEDS_SObject.hxx>
+
 #include <SALOME_Prs.h>
 #include <SALOME_InteractiveObject.hxx>
 
 #include <SOCC_Prs.h>
 #include <SVTK_Prs.h>
 #include <SALOME_Actor.h>
-#include <vtkActorCollection.h>
 
 #include <OCCViewer_ViewModel.h>
 #include <VTKViewer_ViewModel.h>
 
+#include "GEOMImpl_Types.hxx"
+
+// OCCT Includes
 #include <AIS.hxx>
 #include <AIS_InteractiveObject.hxx>
 #include <AIS_ListOfInteractive.hxx>
 
+// VTK Includes
+#include <vtkActorCollection.h>
+
 GEOMGUI_Selection::GEOMGUI_Selection()
 {
 }
@@ -41,7 +47,7 @@ GEOMGUI_Selection::~GEOMGUI_Selection()
 QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const
 {
   if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() );
+
   return SalomeApp_Selection::globalParam( p );
 }
 
@@ -111,7 +117,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
            }
          }
        }
-      } 
+      }
       else if ( viewType == VTKViewer_Viewer::Type() ) { // assuming VTK
        SVTK_Prs* vtkPrs = (SVTK_Prs*) prs;
        vtkActorCollection* lst = vtkPrs->GetObjects();
@@ -124,7 +130,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
              int dm = salActor->getDisplayMode();
              if ( dm == 0 )
                return "Wireframe";
-             else if ( dm == 1 ) 
+             else if ( dm == 1 )
                return "Shading";
            } // if ( salome actor )
          } // if ( actor )
@@ -144,9 +150,9 @@ bool GEOMGUI_Selection::isComponent( const int index ) const
     _PTR(Study) study = appStudy->studyDS();
     QString anEntry = entry( index );
 
-    if ( study && !anEntry.isNull() ) { 
+    if ( study && !anEntry.isNull() ) {
       _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
-      if ( aSO && aSO->GetFatherComponent() ) 
+      if ( aSO && aSO->GetFatherComponent() )
        return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
     }
   }
@@ -158,18 +164,17 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
     (SUIT_Session::session()->activeApplication()->activeStudy());
 
-  if ( appStudy && index >= 0 && index < count() )  {
+  if (appStudy && index >= 0 && index < count()) {
     _PTR(Study) study = appStudy->studyDS();
-    QString anEntry = entry( index );
+    QString anEntry = entry(index);
 
-    if ( study && !anEntry.isNull() ) { 
-      _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
-      if ( aSO ) {
-       SALOMEDS_SObject* aDSObj = dynamic_cast<SALOMEDS_SObject*>( aSO.get() );
-       return GEOM::GEOM_Object::_narrow( aDSObj->GetObject() );
+    if (study && !anEntry.isNull()) {
+      _PTR(SObject) aSO (study->FindObjectID(anEntry.latin1()));
+      if (aSO) {
+        CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSO);
+       return GEOM::GEOM_Object::_narrow(anObj);
       }
     }
   }
   return GEOM::GEOM_Object::_nil();
 }
-
index 5caaf1b392c26f5daf4c382e328851c44490b6ee..26313ac05ddaae7bb1b201fb10ce5f0c2e920b33 100644 (file)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  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 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 
+//  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  Module : GEOM
 //  $Header$
 
-#include <SOCC_ViewModel.h>
-
 #include "GEOM_Displayer.h"
-#include "GEOMImpl_Types.hxx"
+
+#include "GeometryGUI.h"
 
 #include "GEOM_TypeFilter.h"
 #include "GEOM_EdgeFilter.h"
@@ -38,8 +37,9 @@
 #include "GEOM_LogicalFilter.h"
 #include "GEOM_OCCFilter.h"
 
-#include "GEOM_AssemblyBuilder.h"
 #include "GEOM_Actor.h"
+#include "GEOM_AssemblyBuilder.h"
+#include "GEOM_AISShape.hxx"
 #include "GEOM_AISTrihedron.hxx"
 #include "GEOM_VTKTrihedron.hxx"
 
 #include <SalomeApp_Tools.h>
 
 #include <SALOME_ListIteratorOfListIO.hxx>
-#include <SALOMEDSClient.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDSClient_SObject.hxx>
 
 #include <SOCC_Prs.h>
+#include <SOCC_ViewModel.h>
 
 #include <SVTK_Prs.h>
 #include <SVTK_ViewModel.h>
 
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-
-#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDSClient_SObject.hxx>
 
-#include <GeometryGUI.h>
-#include <GEOM_AISShape.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
+// OCCT Includes
 #include <AIS_Drawer.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <Prs3d_PointAspect.hxx>
 #include <Graphic3d_AspectMarker3d.hxx>
-#include <Geom_Plane.hxx>
+#include <StdSelect_TypeOfEdge.hxx>
+#include <StdSelect_TypeOfFace.hxx>
 #include <TopoDS_Face.hxx>
 #include <BRep_Tool.hxx>
-#include <gp_Pln.hxx>
+#include <Geom_Plane.hxx>
 #include <Geom_Axis2Placement.hxx>
-#include <StdSelect_TypeOfEdge.hxx>
-#include <StdSelect_TypeOfFace.hxx>
+#include <gp_Pln.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
+// VTK Includes
 #include <vtkActorCollection.h>
 
+// STL Includes
 #include <cstring>
 
+// CORBA Headers
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+#include "GEOMImpl_Types.hxx"
+
 using namespace std;
 
 //================================================================
@@ -130,7 +135,7 @@ static inline int getTopAbsMode( const int implType )
 SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
 {
   SUIT_SelectionFilter* aFilter;
-  
+
   int aTopAbsMode = getTopAbsMode( theMode );
   if ( aTopAbsMode != -1 )
     aFilter = new GEOM_TypeFilter( getStudy(), aTopAbsMode, true ); //@ aFilter = new GEOM_TypeFilter( ( TopAbs_ShapeEnum )aTopAbsMode );
@@ -139,22 +144,22 @@ SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
       {
       case GEOM_LINE      : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Line ); break;
       case GEOM_CIRCLE    : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Circle ); break;
-       
+
       case GEOM_PLANE     : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Plane ); break;
       case GEOM_CYLINDER  : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cylinder ); break;
       case GEOM_SPHERE    : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Sphere ); break;
       case GEOM_TORUS     : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Torus ); break;
       case GEOM_REVOLUTION: aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Revol ); break;
       case GEOM_CONE      : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cone ); break;
-       
+
       case GEOM_PREVIEW   : aFilter = new GEOM_PreviewFilter( getStudy() ); break;
-       
+
       case GEOM_ALLSHAPES : aFilter = new GEOM_SelectionFilter(getStudy(), true ); break;
       case GEOM_ALLGEOM   : aFilter = new SalomeApp_TypeFilter( getStudy(), "GEOM" ); break;
-       
+
       default             : aFilter = new GEOM_TypeFilter( getStudy(), theMode ); break;
       }
-  
+
   return aFilter;
 }
 
@@ -166,10 +171,10 @@ static char* getEntry( GEOM::GEOM_Object_ptr object )
 {
   SUIT_Session* session = SUIT_Session::session();
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
-  if ( app ) 
+  if ( app )
   {
     string IOR = app->orb()->object_to_string( object );
-    if ( IOR != "" ) 
+    if ( IOR != "" )
     {
       SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
       _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
@@ -188,10 +193,10 @@ static const char* getName( GEOM::GEOM_Object_ptr object )
 {
   SUIT_Session* session = SUIT_Session::session();
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
-  if ( app ) 
+  if ( app )
   {
     string IOR = app->orb()->object_to_string( object );
-    if ( IOR != "" ) 
+    if ( IOR != "" )
     {
       SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
       _PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( IOR ) );
@@ -218,7 +223,7 @@ static const char* getName( GEOM::GEOM_Object_ptr object )
 GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* study )
 {
   myStudy = study;
-  
+
   /* Shading Color */
   SUIT_Session* session = SUIT_Session::session();
   SUIT_ResourceMgr* resMgr = session->resourceMgr();
@@ -277,7 +282,7 @@ SALOME_View* GEOM_Displayer::GetActiveView()
  *  Display interactive object in the current viewer
  */
 //=================================================================
-void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, 
+void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
                             const bool updateViewer,
                             SALOME_View* theViewFrame )
 {
@@ -285,7 +290,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
   if ( vf )
   {
     SALOME_Prs* prs = buildPresentation( theIO, vf );
-    
+
     if ( prs )
     {
       vf->BeforeDisplay( this );
@@ -294,7 +299,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
 
       if ( updateViewer )
         vf->Repaint();
-      
+
       delete prs;  // delete presentation because displayer is its owner
     }
   }
@@ -334,7 +339,7 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO,
     return;
 
   SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
-  
+
   if ( vf ) {
     SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() );
     if ( prs ) {
@@ -375,7 +380,7 @@ void GEOM_Displayer::EraseAll ( const bool forced,
                                SALOME_View* theViewFrame )
 {
   SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
-  
+
   if ( vf ) {
     vf->EraseAll( forced );
     if ( updateViewer )
@@ -515,7 +520,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
       {
         aTrh = new GEOM_AISTrihedron( aPlc );
 
-        if ( HasColor() )  
+        if ( HasColor() )
           aTrh->SetColor( (Quantity_NameOfColor)GetColor() );
 
         if ( HasWidth() )
@@ -540,7 +545,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
           if ( !aTrh.IsNull() )
           {
             aTrh->SetComponent( aPlc );
-            aTrh->SetToUpdate();            
+            aTrh->SetToUpdate();
           }
         }
       }
@@ -562,7 +567,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
         // Setup shape properties here ..., e.g. display mode, color, transparency, etc
        AISShape->SetDisplayMode( myDisplayMode );
         AISShape->SetShadingColor( myShadingColor );
-       
+
         if ( HasColor() )
         {
          AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
@@ -645,12 +650,12 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
     return;
 
   vtkActorCollection* theActors = 0;
-  
+
   if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE )
   {
     myToActivate = false;
     GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
-    
+
     if ( HasColor() )
     {
       Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
@@ -669,25 +674,25 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
 //      aTrh->SetSize( 0.5 * vf->GetTrihedronSize() );
 
     vtkPrs->AddObject( aTrh );
-      
+
     theActors = vtkActorCollection::New();
     theActors->AddItem( aTrh );
   }
   else
     theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True );
-    
+
   theActors->InitTraversal();
-  
+
   vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
 
   vtkProperty* aProp = 0;
-  
+
   if ( HasColor() || HasWidth() )
   {
     aProp = vtkProperty::New();
     aProp->SetRepresentationToWireframe();
   }
-  
+
   if ( HasColor() )
   {
     Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
@@ -702,7 +707,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
   while ( anActor != NULL )
   {
     SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor );
-    
+
     GActor->setIO( myIO );
 
     if ( aProp )
@@ -722,9 +727,9 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
       GActor->PickableOn();
     else
       GActor->PickableOff();
-      
+
     vtkPrs->AddObject( GActor );
-    
+
     anActor = (vtkActor*)theActors->GetNextActor();
   }
 
@@ -748,17 +753,17 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
   myViewFrame = GetActiveView();
   if ( myViewFrame == 0 )
     return 0;
-  
+
   SALOME_Prs* aPrs = myViewFrame->CreatePrs();
   if ( aPrs == 0 )
     return 0;
 
-  internalReset();  
+  internalReset();
   setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) );
   myType = theObj->GetType();
 
   // Update presentation
-  UpdatePrs( aPrs );  
+  UpdatePrs( aPrs );
 
   return aPrs;
 }
@@ -793,44 +798,44 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
  *  GEOM_Displayer::buildPresentation
  *  Builds/finds object's presentation for the current viewer
  *  Calls corresponding Update() method by means of double dispatch
- *  [ internal ]      
+ *  [ internal ]
  */
 //=================================================================
-SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO, 
+SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
                                               SALOME_View* theViewFrame )
 {
   SALOME_Prs* prs = 0;
   internalReset();
 
   myViewFrame = theViewFrame ? theViewFrame : GetActiveView();
-  
-  if ( myViewFrame ) 
+
+  if ( myViewFrame )
   {
     prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 );
-    if ( prs ) 
+    if ( prs )
     {
-      if ( !theIO.IsNull() ) 
+      if ( !theIO.IsNull() )
       {
        // set interactive object
        setIO( theIO );
        //  Find SOBject (because shape should be published previously)
        SUIT_Session* session = SUIT_Session::session();
        SUIT_Application* app = session->activeApplication();
-       if ( app ) 
+       if ( app )
        {
          SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
          if ( study )
          {
            _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) );
-           if ( SO ) 
+           if ( SO )
            {
              // get CORBA reference to data object
-             CORBA::Object_var object = dynamic_cast<SALOMEDS_SObject*>(SO.get())->GetObject();
-             if ( !CORBA::is_nil( object ) ) 
+             CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
+             if ( !CORBA::is_nil( object ) )
              {
                // downcast to GEOM object
                GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object );
-               if ( !GeomObject->_is_nil() ) 
+               if ( !GeomObject->_is_nil() )
                {
                  // finally set shape
                  setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
@@ -875,7 +880,7 @@ void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& the
     return;
 
   SalomeApp_SelectionMgr* sm = app->selectionMgr();
+
   // remove all filters from selection
   sm->clearFilters();
 
@@ -885,7 +890,7 @@ void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& the
       SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() );
       vf->LocalSelection( prs, theMode );
       delete prs;  // delete presentation because displayer is its owner
-    }  
+    }
 }
 
 //=================================================================
@@ -916,11 +921,11 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
   if ( !app )
     return;
-  
+
   SALOME_View* vf = GetActiveView();
   if ( vf == 0 )
     return;
-  
+
   // Close local context
   vf->GlobalSelection( update );
 
@@ -934,9 +939,9 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
     clearTemporary( sm );
 
   //@ aSel->ClearIndex();
-    
+
   sm->clearFilters();
+
   // Remove filters from AIS_InteractiveContext
   Handle(AIS_InteractiveContext) ic;
   SOCC_Viewer* viewer = dynamic_cast<SOCC_Viewer*>( vf );
@@ -946,7 +951,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
       if ( !ic.IsNull() )
        ic->RemoveFilters();
     }
-  
+
   if ( theModes.Contains( GEOM_ALLOBJECTS ) )
     return;
 
@@ -967,7 +972,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
          if ( aFilter )
            aListOfFilters.append( aFilter );
        }
-      
+
       aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR );
     }
   else
@@ -994,7 +999,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
 void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
 {
   SALOME_ListIteratorOfListIO Iter( theIOList );
-  for ( ; Iter.More(); Iter.Next() ) 
+  for ( ; Iter.More(); Iter.Next() )
     LocalSelection( Iter.Value(), theMode );
 }
 
@@ -1095,20 +1100,20 @@ bool GEOM_Displayer::ToActivate() const
 //=================================================================
 /*!
  *  GEOM_Displayer::clearTemporary
- *  Removes from selection temporary objects 
+ *  Removes from selection temporary objects
  */
 //=================================================================
 void GEOM_Displayer::clearTemporary( SalomeApp_SelectionMgr* theSelMgr )
 {
   SALOME_ListIO selected, toSelect;
   theSelMgr->selectedObjects( selected );
-  
+
   for (  SALOME_ListIteratorOfListIO it( selected ) ; it.More(); it.Next() ) {
     Handle(SALOME_InteractiveObject) io = it.Value();
-    if ( !io.IsNull() && io->hasEntry() && strncmp( io->getEntry(), "TEMP_", 5 ) != 0 ) 
+    if ( !io.IsNull() && io->hasEntry() && strncmp( io->getEntry(), "TEMP_", 5 ) != 0 )
       toSelect.Append( it.Value() );
   }
-  
+
   theSelMgr->setSelectedObjects( toSelect, true );
 }
 
index cabc16ab130f54d8ded1bc32238e11ff50c4407b..2e1b295e8546761198e652c33dca561e778c2a63 100644 (file)
@@ -82,6 +82,40 @@ bool GeometryGUI::InitGeomGen()
   return true; 
 }                         
 
+//=======================================================================
+// function : ClientSObjectToObject
+// purpose  : 
+//=======================================================================
+CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
+{
+  _PTR(GenericAttribute) anAttr;
+  CORBA::Object_var anObj;
+  try {
+    std::string aValue = theSObject->GetIOR();
+    if (strcmp(aValue.c_str(), "") != 0) {
+      CORBA::ORB_ptr anORB = SalomeApp_Application::orb();
+      anObj = anORB->string_to_object(aValue.c_str());
+    }
+  } catch(...) {
+    INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
+  }
+  return anObj._retn();
+}
+
+//=======================================================================
+// function : ClientStudyToStudy
+// purpose  : 
+//=======================================================================
+SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
+{
+  SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
+  CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
+  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
+  int aStudyID = theStudy->StudyId();
+  SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(aStudyID);
+  return aDSStudy._retn();
+}
+
 //=================================================================================
 // class   : CustomItem
 // purpose : Set Font to a text.
index 2f56a0029bc5a9c4fb175162163007a01ae1e85f..860cd795caee3826cbb4169a2cfc78d353104806 100644 (file)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 #include "GEOMGUI.h"
 #include "GEOM_Client.hxx"
 #include "SALOME_InteractiveObject.hxx"
+
+#include "SALOMEDSClient.hxx"
+
+// QT Includes
 #include <qmap.h>
 
-#include "gp_Ax3.hxx"
+// OCCT Includes
+#include <gp_Ax3.hxx>
+
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS)
 
 #ifdef WNT
 #include <SALOME_WNT.hxx>
@@ -63,7 +72,7 @@ class SALOME_WNT_EXPORT GeometryGUI : public SalomeApp_Module
 
 public:
   // Constructor
-  GeometryGUI(); 
+  GeometryGUI();
 
   // Destructor
   ~GeometryGUI();
@@ -71,15 +80,18 @@ public:
   virtual void                initialize( CAM_Application* );
   virtual QString             engineIOR() const;
 
-  static bool                 InitGeomGen();   //BugID IPAL9186: SRN: To be called by Python scripts 
+  static bool                 InitGeomGen();   //BugID IPAL9186: SRN: To be called by Python scripts
 
   static GEOM::GEOM_Gen_var   GetGeomGen()        { return myComponentGeom; }
-  
+
+  static CORBA::Object_var    ClientSObjectToObject (_PTR(SObject) theSObject);
+  static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
+
   GEOM_Client&                GetShapeReader()    { return myShapeReader; }
   Standard_CString&           GetFatherior()      { return myFatherior; }
   //void                        SetState( const int state ) { myState = state; }
   //int                         GetState() const    { return myState; }
-  
+
   // Get active dialog box
   QDialog*                    GetActiveDialogBox(){ return myActiveDialogBox; }
   // Set active dialog box
@@ -91,7 +103,7 @@ public:
   void                        EmitSignalDefaultStepValueChanged( double newVal );
 
   void                        OnGUIEvent( int id );
-  
+
   virtual bool                OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
   virtual bool                OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
   virtual bool                OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
@@ -137,10 +149,13 @@ protected:
 
 private:
   GEOMGUI*                    getLibrary( const QString& libraryName );
-  void                        createGeomAction( const int id, const QString& po_id, const QString& icon_id = QString(""), const int key = 0, const bool toggle = false );
-  void                        createPopupItem( const int, const QString& clients, const QString& types, 
-                                              const bool isSingle = false, const int isVisible = -1, 
-                                              const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 );
+  void                        createGeomAction( const int id, const QString& po_id,
+                                               const QString& icon_id = QString(""),
+                                               const int key = 0, const bool toggle = false );
+  void                        createPopupItem( const int, const QString& clients, const QString& types,
+                                              const bool isSingle = false, const int isVisible = -1,
+                                              const bool isExpandAll = false, const bool isOCC = false,
+                                              const int parentId = -1 );
 
 private:
   static GEOM::GEOM_Gen_var   myComponentGeom;   // GEOM engine
@@ -158,4 +173,3 @@ private:
 };
 
 #endif
-
index a99523bb3a0196e1953273a2b9580c4019fcf525..1dc5ac24e9f1363b077dbff1c929f8cf190bf362 100644 (file)
@@ -59,8 +59,6 @@
 #include "utilities.h"
 
 #include "SALOMEDSClient.hxx"
-#include "SALOMEDS_SObject.hxx"
-#include "SALOMEDS_Study.hxx"
 
 // OCCT Includes
 #include <TopExp_Explorer.hxx>
index 1322b3582597e019fb3499af4f85f4e7ebc77e02..a14ea4cb1f2e776a11355a94f50cbca0071ec81f 100644 (file)
@@ -73,6 +73,6 @@ LIB_SERVER_IDL =
 CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(GUI_ROOT_DIR)/include/salome
 CXXFLAGS += $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(GUI_ROOT_DIR)/include/salome
 
-LDFLAGS += -lGEOMFiltersSelection -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome -lOCCViewer -lVTKViewer -lSalomeApp -lCAM -lGEOMClient -lSOCC -lSVTK -lGEOMObject -lToolsGUI -lSalomeDS -lEvent
+LDFLAGS += -lGEOMFiltersSelection -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome -lOCCViewer -lVTKViewer -lSalomeApp -lCAM -lGEOMClient -lSOCC -lSVTK -lGEOMObject -lToolsGUI -lEvent
 
 @CONCLUDE@
index 5bbaa653cc7819dc79d85e37145d03e0c85b9c26..473ccd7ecfb625fc7d3a1b735d4b804ba396cfc9 100644 (file)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -27,6 +27,7 @@
 //  $Header$
 
 #include "GEOMToolsGUI.h"
+
 #include "GeometryGUI.h"
 #include "GEOM_Actor.h"
 #include "GEOMBase.h"
 #include <SALOME_ListIteratorOfListIO.hxx>
 #include <SALOME_Prs.h>
 
+#include "utilities.h"
+
+// QT Includes
 #include <qapplication.h>
 #include <qmap.h>
 
-#include "utilities.h"
+// OCCT Includes
+#include <TCollection_AsciiString.hxx>
 
 using namespace std;
 
 typedef QMap<QString, QString> FilterMap;
 
-#include <SALOMEDS_SObject.hxx>
-
-
-
-
 //=======================================================================
 // function : getFileName
-// purpose  : Selection of a file name for Import/Export. Returns also 
+// purpose  : Selection of a file name for Import/Export. Returns also
 //            the selected file type code through <filter> argument.
 //=======================================================================
-static QString getFileName( QWidget*           parent, 
-                           const QString&     initial, 
-                           const FilterMap&   filterMap, 
+static QString getFileName( QWidget*           parent,
+                           const QString&     initial,
+                           const FilterMap&   filterMap,
                            const QString&     caption,
                            bool               open,
                            QString&           format )
@@ -80,7 +80,7 @@ static QString getFileName( QWidget*           parent,
   for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it )
     filters.push_back( it.key() );
 
-  SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true );    
+  SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true );
   if ( !caption.isEmpty() )
     fd->setCaption( caption );
 
@@ -105,7 +105,7 @@ static QString getFileName( QWidget*           parent,
 // function : GEOMToolsGUI()
 // purpose  : Constructor
 //=======================================================================
-GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent ) 
+GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
 : GEOMGUI( parent )
 {
 }
@@ -122,7 +122,7 @@ GEOMToolsGUI::~GEOMToolsGUI()
 
 //=======================================================================
 // function : OnGUIEvent()
-// purpose  : 
+// purpose  :
 //=======================================================================
 bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
 {
@@ -239,12 +239,12 @@ void GEOMToolsGUI::OnEditDelete()
        bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
        if ( aLocked ) {
          SUIT_MessageBox::warn1 ( app->desktop(),
-                                  QObject::tr("WRN_WARNING"), 
+                                  QObject::tr("WRN_WARNING"),
                                   QObject::tr("WRN_STUDY_LOCKED"),
                                   QObject::tr("BUT_OK") );
          return;
        }
-  
+
        // VSR 17/11/04: check if all objects selected belong to GEOM component --> start
        // modifications of ASV 01.06.05
        QString parentComp = getParentComponent( aStudy, selected );
@@ -253,14 +253,14 @@ void GEOMToolsGUI::OnEditDelete()
 
        if ( parentComp != geomComp )  {
          SUIT_MessageBox::warn1 ( app->desktop(),
-                                 QObject::tr("ERR_ERROR"), 
+                                 QObject::tr("ERR_ERROR"),
                                  QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ),
                                  QObject::tr("BUT_OK") );
          return;
        }
        // VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish
 
-       if ( SUIT_MessageBox::warn2( app->desktop(), 
+       if ( SUIT_MessageBox::warn2( app->desktop(),
                                     QObject::tr( "GEOM_WRN_WARNING" ),
                                     QObject::tr( "GEOM_REALLY_DELETE" ),
                                     QObject::tr( "GEOM_BUT_YES" ),
@@ -269,7 +269,7 @@ void GEOMToolsGUI::OnEditDelete()
 
        //      QAD_Operation* op = new SALOMEGUI_ImportOperation(.....);
        //      op->start();
-       
+
        // prepare list of SALOME_Views
        QPtrList<SALOME_View> views;
        SALOME_View* view;
@@ -282,7 +282,7 @@ void GEOMToolsGUI::OnEditDelete()
          if ( view )
            views.append( view );
        }
-       
+
        _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
        _PTR(GenericAttribute) anAttr;
        GEOM_Displayer* disp = new GEOM_Displayer( appStudy );
@@ -300,59 +300,60 @@ void GEOMToolsGUI::OnEditDelete()
          if ( !strcmp( obj->GetIOR().c_str(), geomIOR ) )
            continue;
 
-         // iterate through all childres of obj, find IOR attributes on children and remove shapes that 
-         // correspond to these IORs
-         for ( _PTR(ChildIterator) it ( aStudy->NewChildIterator( obj ) ); it->More();it->Next() ) {
-           _PTR(SObject) child ( it->Value() );
-           if ( child->FindAttribute( anAttr, "AttributeIOR" ) ) {
-             _PTR(AttributeIOR) anIOR( anAttr );
+         // iterate through all children of obj, find IOR attributes on children
+         // and remove shapes that correspond to these IORs
+         for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
+           _PTR(SObject) child (it->Value());
+           if (child->FindAttribute(anAttr, "AttributeIOR")) {
+             _PTR(AttributeIOR) anIOR (anAttr);
 
              // Delete child( s ) shape in Client :
-             const TCollection_AsciiString ASCior( (char*)anIOR->Value().c_str() ) ;
-             getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCior );
-
-             for ( view = views.first(); view; view = views.next() ) { 
-               CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(child.get()))->GetObject();
-               GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
-               if ( !CORBA::is_nil( geomObj ) )
-                 disp->Erase( geomObj, true, view );
-             }
+             const TCollection_AsciiString ASCior ((char*)anIOR->Value().c_str());
+             getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCior);
+
+              CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(child);
+              GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow(corbaObj);
+              if (!CORBA::is_nil(geomObj)) {
+                for (view = views.first(); view; view = views.next()) {
+                 disp->Erase(geomObj, true, view);
+                }
+              }
            }
-         } // for ( childres of obj )
+         } // for ( children of obj )
 
          // Erase main graphical object
-         for ( view = views.first(); view; view = views.next() ) 
+         for ( view = views.first(); view; view = views.next() )
            disp->Erase( io, true, view );
 
          // Delete main shape in Client :
          if ( obj->FindAttribute( anAttr, "AttributeIOR" ) ) {
            _PTR(AttributeIOR) anIOR( anAttr );
-           const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() ) ;
+           const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() );
            getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCIor );
          }
 
-         // Remove objects from Study
-         aStudyBuilder->RemoveObject( obj );
-
-         CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(obj.get()))->GetObject();
+          CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
          GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
          if ( !CORBA::is_nil( geomObj ) )
            GeometryGUI::GetGeomGen()->RemoveObject( geomObj );
-      
+
+         // Remove objects from Study
+         aStudyBuilder->RemoveObject( obj );
+
          //deleted = true;
        } // MAIN LOOP of selected
-       
+
        selected.Clear();
        aSelMgr->setSelectedObjects( selected );
        getGeometryGUI()->updateObjBrowser();
       } // if ( selected not empty )
     } // if ( selMgr && appStudy )
+
     app->updateActions(); //SRN: BugID IPAL9377, case 1 for GEOM module
-    
+
   } // if ( app )
 
+
   //  if ( deleted )
   //    op->finish();
   //  else
@@ -365,8 +366,8 @@ void GEOMToolsGUI::OnEditDelete()
 // purpose  :
 //==============================================================================
 void GEOMToolsGUI::OnEditCopy()
-{  
-/* 
+{
+/*
  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
   GEOM::string_array_var listIOR = new GEOM::string_array;
 
@@ -377,20 +378,20 @@ void GEOMToolsGUI::OnEditCopy()
   Sel->ClearIObjects();
 
   SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  int aStudyID = aStudy->StudyId();    
+  int aStudyID = aStudy->StudyId();
 
   for (unsigned int ind = 0; ind < listIOR->length();ind++) {
     GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]);
     try {
       GEOM::GEOM_IInsertOperations_var IOp =  myGeom->GetIInsertOperations(aStudyID);
-      GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit) ;
+      GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit);
       myGeomBase->Display(result);
     }
     catch  (const SALOME::SALOME_Exception& S_ex) {
       QtCatchCorbaException(S_ex);
     }
   }
-  
+
   QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY"));
 */
 }
@@ -404,7 +405,7 @@ bool GEOMToolsGUI::Import()
 {
   SUIT_Application* app = getGeometryGUI()->getApp();
   if (! app) return false;
+
   SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
   if ( !stud ) {
     cout << "FAILED to cast active study to SalomeApp_Study" << endl;
@@ -415,7 +416,7 @@ bool GEOMToolsGUI::Import()
   bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
   if ( aLocked ) {
     SUIT_MessageBox::warn1 ( app->desktop(),
-                           QObject::tr("WRN_WARNING"), 
+                           QObject::tr("WRN_WARNING"),
                            QObject::tr("WRN_STUDY_LOCKED"),
                            QObject::tr("BUT_OK") );
     return false;
@@ -423,9 +424,9 @@ bool GEOMToolsGUI::Import()
 
   GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
   if ( CORBA::is_nil( eng ) ) {
-    SUIT_MessageBox::error1( app->desktop(), 
+    SUIT_MessageBox::error1( app->desktop(),
                            QObject::tr("WRN_WARNING"),
-                           QObject::tr( "GEOM Engine is not started" ), 
+                           QObject::tr( "GEOM Engine is not started" ),
                            QObject::tr("BUT_OK") );
       return false;
     }
@@ -433,7 +434,7 @@ bool GEOMToolsGUI::Import()
   GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
   if ( aInsOp->_is_nil() )
     return false;
-  
+
   GEOM::GEOM_Object_var anObj;
 
   // Obtain a list of available import formats
@@ -441,15 +442,15 @@ bool GEOMToolsGUI::Import()
   GEOM::string_array_var aFormats, aPatterns;
   aInsOp->ImportTranslators( aFormats, aPatterns );
 
-  for ( int i = 0, n = aFormats->length(); i < n; i++ ) 
+  for ( int i = 0, n = aFormats->length(); i < n; i++ )
     aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
 
   QString fileType;
 
   QString file = getFileName(app->desktop(), "", aMap, tr("GEOM_MEN_IMPORT"), true, fileType );
-  if( file.isEmpty() || fileType.isEmpty() ) 
+  if( file.isEmpty() || fileType.isEmpty() )
     return false;
-  
+
   GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
   try {
     SUIT_OverrideCursor wc;
@@ -458,29 +459,31 @@ bool GEOMToolsGUI::Import()
 
     anOp->start();
 
-    anObj = aInsOp->Import( file.latin1(), fileType.latin1() );  
+    anObj = aInsOp->Import( file.latin1(), fileType.latin1() );
 
     if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
       anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() );
       QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true ));
-      GeometryGUI::GetGeomGen()->PublishInStudy(dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy(), 
-                                               SALOMEDS::SObject::_nil(), 
-                                               anObj, 
-                                               aPublishObjName );
+
+      SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy(aStudy);
+      GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy,
+                                               SALOMEDS::SObject::_nil(),
+                                               anObj,
+                                               aPublishObjName);
 
       GEOM_Displayer( stud ).Display( anObj.in() );
 
       // update data model and object browser
       getGeometryGUI()->updateObjBrowser( true );
-      
-      anOp->commit();      
+
+      anOp->commit();
     }
     else {
       anOp->abort();
       wc.suspend();
-      SUIT_MessageBox::error1( app->desktop(), 
+      SUIT_MessageBox::error1( app->desktop(),
                              QObject::tr( "GEOM_ERROR" ),
-                             QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), 
+                             QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
                              QObject::tr("BUT_OK") );
     }
   }
@@ -502,23 +505,23 @@ bool GEOMToolsGUI::Export()
 {
   SalomeApp_Application* app = getGeometryGUI()->getApp();
   if (!app) return false;
-  
+
   SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
   if ( !stud ) {
     cout << "FAILED to cast active study to SalomeApp_Study" << endl;
     return false;
   }
   _PTR(Study) aStudy = stud->studyDS();
-  
+
   GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
   if ( CORBA::is_nil( eng ) ) {
-    SUIT_MessageBox::error1( app->desktop(), 
+    SUIT_MessageBox::error1( app->desktop(),
                             QObject::tr("WRN_WARNING"),
-                            QObject::tr( "GEOM Engine is not started" ), 
+                            QObject::tr( "GEOM Engine is not started" ),
                             QObject::tr("BUT_OK") );
     return false;
   }
-  
+
   GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
   if ( aInsOp->_is_nil() )
     return false;
@@ -527,7 +530,7 @@ bool GEOMToolsGUI::Export()
   FilterMap aMap;
   GEOM::string_array_var aFormats, aPatterns;
   aInsOp->ExportTranslators( aFormats, aPatterns );
-  for ( int i = 0, n = aFormats->length(); i < n; i++ ) 
+  for ( int i = 0, n = aFormats->length(); i < n; i++ )
     aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
 
   // Get selected objects
@@ -546,21 +549,21 @@ bool GEOMToolsGUI::Export()
 
     if ( !found || anObj->_is_nil() )
       continue;
-    
+
     QString fileType;
-    QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap, 
+    QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap,
                               tr("GEOM_MEN_EXPORT"), false, fileType);
-    
+
     // User has pressed "Cancel" --> stop the operation
     if ( file.isEmpty() || fileType.isEmpty() )
       return false;
-    
+
     GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
     try {
       SUIT_OverrideCursor wc;
-      
+
       app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( file, /*withExten=*/true )) );
-      
+
       anOp->start();
 
 
@@ -572,21 +575,21 @@ bool GEOMToolsGUI::Export()
        {
          anOp->abort();
          wc.suspend();
-         SUIT_MessageBox::error1( app->desktop(), 
+         SUIT_MessageBox::error1( app->desktop(),
                                   QObject::tr( "GEOM_ERROR" ),
-                                  QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), 
+                                  QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
                                   QObject::tr("BUT_OK") );
          return false;
        }
-    }  
+    }
     catch (const SALOME::SALOME_Exception& S_ex) {
       //QtCatchCorbaException(S_ex);
       anOp->abort();
       return false;
     }
   }
-  
-  return true; 
+
+  return true;
 }
 
 
@@ -597,7 +600,7 @@ QString GEOMToolsGUI::getParentComponent( _PTR( Study ) study, const SALOME_List
   for ( SALOME_ListIteratorOfListIO it( iobjs ); it.More(); it.Next() ) {
 
     Handle(SALOME_InteractiveObject) io = it.Value();
-    if ( !io->hasEntry() ) 
+    if ( !io->hasEntry() )
       continue;
 
     QString compName = getParentComponent( study->FindObjectID( io->getEntry() ) );
index d85bdd0f84908c49ae84b6d0c72f6633c989bfc0..6d239c3300bdcdd45f8e6f2618e4edd88b89623a 100644 (file)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -32,9 +32,9 @@
 #include "GEOMGUI.h"
 
 #include <SALOMEDSClient.hxx>
-#include <SALOMEDS_Study.hxx>
 #include <SALOME_ListIO.hxx>
 
+#include <CORBA.h>
 
 //=================================================================================
 // class    : GEOMToolsGUI
@@ -51,8 +51,8 @@ public :
 private:
   // Import and export topology methods
   bool Import();
-  bool Export(); 
-  
+  bool Export();
+
   void OnEditCopy();
   void OnEditDelete();
 
@@ -69,7 +69,7 @@ private:
   void OnOpen();
 
   // returns name of Module (Component) of given objects (usually selected objects)
-  // if objects belong to different Components, a NULL string is returned. 
+  // if objects belong to different Components, a NULL string is returned.
   QString getParentComponent( _PTR( Study ), const SALOME_ListIO& );
   QString getParentComponent( _PTR(SObject) );
 };
index 2c05e34575eae8e9253d2f07617dc58ea9db93d7..5f317478c4d7cc7cd18d7edae40d080812345a60 100644 (file)
@@ -1,25 +1,25 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2004  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 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 
-// 
-//  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
 //
-//            
 //
 //  File   : GEOMToolsGUI_1.cxx
 //  Author : Sergey ANIKIN
 #include <PythonConsole_PyConsole.h>
 
 #include "GEOMToolsGUI.h"
+
 #include "GeometryGUI.h"
-#include "GEOM_Actor.h"
-#include "GEOMBase.h"
 #include "GEOMToolsGUI_TransparencyDlg.h"
 #include "GEOMToolsGUI_NbIsosDlg.h"        // Method ISOS adjustement
 #include "GEOMToolsGUI_NameDlg.h"
 
+#include "GEOM_Actor.h"
+#include "GEOMBase.h"
+
 #include <SALOME_ListIO.hxx>
 #include <SALOME_ListIteratorOfListIO.hxx>
 
 #include <SalomeApp_Study.h>
 #include <SalomeApp_Module.h>
 
+#include "SALOMEDSClient.hxx"
+
+#include "utilities.h"
+
+// OCCT Includes
 #include <AIS_Drawer.hxx>
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <Prs3d_IsoAspect.hxx>
 
+// VTK Includes
 #include <vtkBMPReader.h>
 #include <vtkTexture.h>
 #include <vtkTextureMapToPlane.h>
 #include <vtkDataSetMapper.h>
 #include <vtkRenderer.h>
 
+// QT Includes
 #include <qfileinfo.h>
 #include <qcolordialog.h>
 #include <qspinbox.h>
 #include <qapplication.h>
 
-#include "utilities.h"
-
 using namespace std;
 
-#include "SALOMEDSClient.hxx"
-#include "SALOMEDS_Study.hxx"
-
-
 
 void GEOMToolsGUI::OnSettingsColor()
 {
@@ -92,14 +95,14 @@ void GEOMToolsGUI::OnSettingsColor()
   SUIT_Desktop* desk = sess->activeApplication()->desktop();
 
   QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) );
-  
+
   QColor aDialogColor = QColorDialog::getColor(anInitColor, desk );
-  if( aDialogColor.isValid() ) 
+  if( aDialogColor.isValid() )
   {
     QString type = desk->activeWindow()->getViewManager()->getType();
     if( type != OCCViewer_Viewer::Type() && type != VTKViewer_Viewer::Type() )
       MESSAGE("Settings Color is not supported for current Viewer");
-    
+
     resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor );
   }
 }
@@ -116,25 +119,25 @@ void GEOMToolsGUI::OnSettingsIsos()
 
   if ( type != OCCViewer_Viewer::Type() )
     return;
-  
+
   OCCViewer_Viewer* vm = (OCCViewer_Viewer*)vman->getViewModel();
   Handle (AIS_InteractiveContext) ic = vm->getAISContext();
-  
+
   int IsoU = resMgr->integerValue( "Geometry:SettingsIsoU", 1 );
   int IsoV = resMgr->integerValue( "Geometry:SettingsIsoV", 1 );
-  
+
   ic->DefaultDrawer()->UIsoAspect()->SetNumber( IsoU );
   ic->DefaultDrawer()->VIsoAspect()->SetNumber( IsoV );
-  
-  GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(desk, tr("GEOM_MEN_ISOS"), TRUE);     
-  
+
+  GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(desk, tr("GEOM_MEN_ISOS"), TRUE);
+
   NbIsosDlg->SpinBoxU->setValue(IsoU);
   NbIsosDlg->SpinBoxV->setValue(IsoV);
-  
+
   if(NbIsosDlg->exec()) {
     IsoU = NbIsosDlg->SpinBoxU->text().toInt();
     IsoV = NbIsosDlg->SpinBoxV->text().toInt();
-    
+
     ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso);
     ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso);
     resMgr->setValue("Geometry:SettingsIsoU", isoU);
@@ -154,7 +157,7 @@ void GEOMToolsGUI::OnSettingsStep()
   double dd = GEOMBase::Parameter( res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3);
   if(res) {
     resMgr->setValue( "Geometry", "SettingsGeomStep", dd );
-    
+
     /* Emit signal to GeometryGUI_SpinBoxes */
     getGeometryGUI()->EmitSignalDefaultStepValueChanged( dd );
   }
@@ -177,21 +180,21 @@ void GEOMToolsGUI::OnRename()
        bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
        if ( aLocked ) {
          SUIT_MessageBox::warn1 ( app->desktop(),
-                                  QObject::tr("WRN_WARNING"), 
+                                  QObject::tr("WRN_WARNING"),
                                   QObject::tr("WRN_STUDY_LOCKED"),
                                   QObject::tr("BUT_OK") );
          return;
        }
-  
+
        for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
          Handle(SALOME_InteractiveObject) IObject = It.Value();
-    
+
          _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
          _PTR(GenericAttribute) anAttr;
          if ( obj ) {
            if( obj->FindAttribute(anAttr, "AttributeName") ) {
              _PTR(AttributeName) aName (anAttr);
-       
+
              QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() );
              if ( !newName.isEmpty() ) {
                aName->SetValue( newName.latin1() ); // rename the SObject
@@ -210,7 +213,7 @@ void GEOMToolsGUI::OnCheckGeometry()
 {
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   PythonConsole* pyConsole = app->pythonConsole();
-  
+
   if(pyConsole)
     pyConsole->exec("from GEOM_usinggeom import *");
 }
@@ -282,36 +285,36 @@ void GEOMToolsGUI::OnNbIsos()
 
   if ( !isOCC )
     return;
-  
+
   OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
   Handle (AIS_InteractiveContext) ic = vm->getAISContext();
-  
+
   ic->InitCurrent();
   if ( ic->MoreCurrent() ) {
     Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
     Handle(AIS_Drawer)    CurDrawer = CurObject->Attributes();
-    
+
     int UIso = CurDrawer->UIsoAspect()->Number();
     int VIso = CurDrawer->VIsoAspect()->Number();
-    
+
     GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
       new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
-    
+
     NbIsosDlg->setU( UIso );
     NbIsosDlg->setV( VIso );
-    
+
     if ( NbIsosDlg->exec() ) {
       SUIT_OverrideCursor();
       for(; ic->MoreCurrent(); ic->NextCurrent()) {
         CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
        Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-       
+
        int nbUIso = NbIsosDlg->getU();
        int nbVIso = NbIsosDlg->getV();
-       
+
        CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) );
        CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
-       
+
        ic->SetLocalAttributes(CurObject, CurDrawer);
        ic->Redisplay(CurObject);
       }
@@ -343,12 +346,12 @@ void GEOMToolsGUI::OnOpen()
          useSubItems = true;
          obj =  subobj;
        }
-       else 
+       else
          anIter->Next();
       }
       obj->FindAttribute(anAttr, "AttributePersistentRef");
-             
-      while(useSubItems?anIter->More():!anAttr->_is_nil()) { 
+
+      while(useSubItems?anIter->More():!anAttr->_is_nil()) {
        if(!obj->FindAttribute(anAttr, "AttributeIOR") &&
           obj->FindAttribute(anAttr, "AttributePersistentRef")) {
          _PTR(SComponent) FComp ( obj->GetFatherComponent() );
@@ -376,7 +379,7 @@ void GEOMToolsGUI::OnOpen()
                  } else {
                    return;
                  }
-               } 
+               }
                else {
                  MESSAGE("loadComponentData(): Driver is null");
                  return;
@@ -394,7 +397,7 @@ void GEOMToolsGUI::OnOpen()
                //                SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
                //                if (!CORBA::is_nil(SC))
                //                  aStudyBuilder->LoadWith(SC,driver);
-           } 
+           }
          }
          else {
            MESSAGE("Component is null");
@@ -403,8 +406,8 @@ void GEOMToolsGUI::OnOpen()
        if(useSubItems) {
          anIter->Next();
          obj.reset( anIter->Value() );
-       } 
-       else 
+       }
+       else
          anAttr = NULL;
       }
     }
index bb5a92348790d7e19887f155905b893c3c1ad9a6..44d4c23b6735b13a899c79524f2a8503296d2cca 100644 (file)
@@ -7,7 +7,7 @@
 #include "GEOM_Gen_i.hh"
 #include "GEOM_Object_i.hh"
 
-#include <strstream> 
+#include <strstream>
 
 #include "Utils_CorbaException.hxx"
 #include "OpUtil.hxx"
 
 //============================================================================
 // function : GEOM_Gen_i()
-// purpose  : constructor to be called for servant creation. 
+// purpose  : constructor to be called for servant creation.
 //============================================================================
 GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
                       PortableServer::POA_ptr poa,
-                      PortableServer::ObjectId * contId, 
-                      const char *instanceName, 
+                      PortableServer::ObjectId * contId,
+                      const char *instanceName,
                       const char *interfaceName) :
   Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
 {
-  _thisObj = this ;
+  _thisObj = this;
   _id = _poa->activate_object(_thisObj);
   name_service = new SALOME_NamingService(_orb);
 
@@ -88,13 +88,13 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
 char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
                                         const char* aLocalPersistentID,
                                         CORBA::Boolean isMultiFile,
-                                        CORBA::Boolean isASCII) 
-{ 
+                                        CORBA::Boolean isASCII)
+{
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
 
   Handle(GEOM_Object) anObject = _impl->GetObject(aStudy->StudyId(), const_cast<char*>(aLocalPersistentID));
-  TCollection_AsciiString anEntry;  
-  TDF_Tool::Entry(anObject->GetEntry(), anEntry);  
+  TCollection_AsciiString anEntry;
+  TDF_Tool::Entry(anObject->GetEntry(), anEntry);
   GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString());
 
   CORBA::String_var aPersRefString = _orb->object_to_string(obj);
@@ -103,7 +103,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
 
 //============================================================================
 // function : CanPublishInStudy
-// purpose  : 
+// purpose  :
 //============================================================================
 bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
 {
@@ -114,7 +114,7 @@ bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
 
 //============================================================================
 // function : PublishInStudy
-// purpose  : 
+// purpose  :
 //============================================================================
 SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
                                                 SALOMEDS::SObject_ptr theSObject,
@@ -129,9 +129,9 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
   if(aShape->_is_nil()) return aResultSO;
 
   SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::StudyBuilder_var     aStudyBuilder = theStudy->NewBuilder(); 
+  SALOMEDS::StudyBuilder_var     aStudyBuilder = theStudy->NewBuilder();
 
-  SALOMEDS::SComponent_var       aFather = theStudy->FindComponent("GEOM"); 
+  SALOMEDS::SComponent_var       aFather = theStudy->FindComponent("GEOM");
   if (aFather->_is_nil()) {
     aFather = aStudyBuilder->NewComponent("GEOM");
     anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
@@ -142,11 +142,11 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
     aStudyBuilder->DefineComponentInstance(aFather, GEOM_Gen::_this());
   }
   if (aFather->_is_nil()) return aResultSO;
-  
+
   if (CORBA::is_nil(theSObject)) {
     aResultSO = aStudyBuilder->NewObject(aFather);
   } else {
-    if (!theSObject->ReferencedObject(aResultSO)) 
+    if (!theSObject->ReferencedObject(aResultSO))
       aResultSO = SALOMEDS::SObject::_duplicate(theSObject); //SRN: Added Aug 24,2004 : for  the method AddInStudy with theFather argumenet != NULL
       //THROW_SALOME_CORBA_EXCEPTION("Publish in study supervision graph error",SALOME::BAD_PARAM);
   }
@@ -157,7 +157,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
 
   anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap");
   SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
-  TCollection_AsciiString aShapeName("Shape_");  
+  TCollection_AsciiString aShapeName("Shape_");
 
   if ( aShape->GetType() == GEOM_GROUP ) {
     GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() );
@@ -206,7 +206,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
   } else if ( aShape->GetShapeType() == GEOM::VERTEX ) {
     aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
     aShapeName = "Vertex_";
-  }                                          
+  }
   //if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
   //else aShapeName = TCollection_AsciiString(strdup(theName));
 
@@ -221,7 +221,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
     do {
       aNewShapeName = aShapeName + TCollection_AsciiString(++i);
       obj = theStudy->FindObject( aNewShapeName.ToCString() );
-    } 
+    }
     while ( !obj->_is_nil() );
     aShapeName = aNewShapeName;
   }
@@ -239,7 +239,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
   return aResultSO._retn();
 }
 
+
 //============================================================================
 // function : Save()
 // purpose  : save OCAF/Geom document
@@ -276,7 +276,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
 //============================================================================
 // function : SaveASCII()
 // purpose  :
-//============================================================================ 
+//============================================================================
 SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
                                         const char* theURL,
                                         bool isMultiFile) {
@@ -288,7 +288,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
 //============================================================================
 // function : Load()
 // purpose  :
-//============================================================================ 
+//============================================================================
 CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
                                const SALOMEDS::TMPFile& theStream,
                                const char* theURL,
@@ -327,7 +327,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
 //============================================================================
 // function : LoadASCII()
 // purpose  :
-//============================================================================ 
+//============================================================================
 CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
                                     const SALOMEDS::TMPFile& theStream,
                                     const char* theURL,
@@ -377,7 +377,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::
   if (anObject->_is_nil()) return aStreamFile._retn();
 
   aStreamFile = anObject->GetShapeStream();
-  
+
   // Assign an ID  the type of  GEOM_Object
   theObjectID = anObject->GetType();
 
@@ -416,21 +416,21 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
   } catch (Standard_Failure) {
     return false;
   }
-  
+
   // SObject of the created shape is theObject or new Child of Component if theObject == geom component
   SALOMEDS::SObject_var aNewSO;
   if (strcmp(theObject->GetFatherComponent()->GetID(),theObject->GetID()) == 0) {
     aNewSO = aStudyBuilder->NewObject(theObject);
   } else aNewSO = SALOMEDS::SObject::_duplicate(theObject);
 
-  
-  //Create a new GEOM_Object 
-  Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);  
-  Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);  
+
+  //Create a new GEOM_Object
+  Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
+  Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
   aFunction->SetValue(aTopology);
 
-  TCollection_AsciiString anEntry;  
-  TDF_Tool::Entry(anObj->GetEntry(), anEntry);  
+  TCollection_AsciiString anEntry;
+  TDF_Tool::Entry(anObj->GetEntry(), anEntry);
   GEOM::GEOM_Object_var obj = GetObject(anObj->GetDocID(), anEntry.ToCString());
 
   // Add IORAttribute to the Study and set IOR of the created GEOM_Object to it
@@ -459,26 +459,26 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
 {
   SALOMEDS::SObject_var aResultSO;
   if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
-    
-  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); 
+
+  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
   char* IOR;
 
   if(!theFather->_is_nil()) {
-    IOR = _orb->object_to_string(theFather); 
+    IOR = _orb->object_to_string(theFather);
     SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR);
     if(aFatherSO->_is_nil()) return aResultSO._retn();
     aResultSO = aStudyBuilder->NewObject(aFatherSO);
     //aStudyBuilder->Addreference(aResultSO, aResultSO);
-  }   
+  }
 
   aResultSO = PublishInStudy(theStudy, aResultSO, theObject, theName);
   if(aResultSO->_is_nil()) return aResultSO._retn();
 
   GEOM::ListOfGO_var aList = theObject->GetDependency();
-  Standard_Integer aLength = aList->length(); 
+  Standard_Integer aLength = aList->length();
   if(aLength < 1) return aResultSO._retn();
 
-  //Publish the arguments  
+  //Publish the arguments
   for(Standard_Integer i = 0; i< aLength; i++) {
     GEOM::GEOM_Object_var anObject = aList[i];
     if(anObject->_is_nil()) continue;
@@ -488,18 +488,18 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
     SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
     aStudyBuilder->Addreference(aSubSO, aSO);
   }
-  
+
   return aResultSO._retn();
 }
 
 //============================================================================
-// function : register() 
+// function : register()
 // purpose  : register 'name' in 'name_service'
 //============================================================================
 void GEOM_Gen_i::register_name(char * name)
 {
   GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this());
-  name_service->Register(g, strdup(name)); 
+  name_service->Register(g, strdup(name));
 }
 
 //============================================================================
@@ -522,7 +522,7 @@ void GEOM_Gen_i::Redo(CORBA::Long theStudyID)
 
 //============================================================================
 // function : GetIBasicOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -530,19 +530,19 @@ GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theS
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIBasicOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IBasicOperations_i* aServant =
     new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IBasicOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetITransformOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -550,19 +550,19 @@ GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::L
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetITransformOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_ITransformOperations_i* aServant =
     new GEOM_ITransformOperations_i(_poa, engine, _impl->GetITransformOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_ITransformOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetI3DPrimOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -570,19 +570,19 @@ GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long th
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetI3DPrimOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_I3DPrimOperations_i* aServant =
     new GEOM_I3DPrimOperations_i(_poa, engine, _impl->GetI3DPrimOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_I3DPrimOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIShapesOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -590,19 +590,19 @@ GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long th
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIShapesOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IShapesOperations_i* aServant =
     new GEOM_IShapesOperations_i(_poa, engine, _impl->GetIShapesOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IShapesOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIBlocksOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -610,19 +610,19 @@ GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long th
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIBlocksOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IBlocksOperations_i* aServant =
     new GEOM_IBlocksOperations_i(_poa, engine, _impl->GetIBlocksOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IBlocksOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIBooleanOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -630,19 +630,19 @@ GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIBooleanOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IBooleanOperations_i* aServant =
     new GEOM_IBooleanOperations_i(_poa, engine, _impl->GetIBooleanOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IBooleanOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetICurvesOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -650,19 +650,19 @@ GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long th
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetICurvesOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_ICurvesOperations_i* aServant =
     new GEOM_ICurvesOperations_i(_poa, engine, _impl->GetICurvesOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_ICurvesOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetILocalOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -670,19 +670,19 @@ GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theS
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetILocalOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_ILocalOperations_i* aServant =
     new GEOM_ILocalOperations_i(_poa, engine, _impl->GetILocalOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_ILocalOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIHealingOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -690,19 +690,19 @@ GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::IHealingOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IHealingOperations_i* aServant =
     new GEOM_IHealingOperations_i(_poa, engine, _impl->GetIHealingOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IHealingOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIInsertOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -710,19 +710,19 @@ GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long th
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIInsertOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IInsertOperations_i* aServant =
     new GEOM_IInsertOperations_i(_poa, engine, _impl->GetIInsertOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IInsertOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIMeasureOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -730,19 +730,19 @@ GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIMeasureOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IMeasureOperations_i* aServant =
     new GEOM_IMeasureOperations_i(_poa, engine, _impl->GetIMeasureOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IMeasureOperations_var operations = aServant->_this();
   return operations._retn();
 }
 
 //============================================================================
 // function : GetIGroupOperations
-// purpose  : 
+// purpose  :
 //============================================================================
 GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theStudyID)
      throw ( SALOME::SALOME_Exception )
@@ -750,12 +750,12 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS
   Unexpect aCatch(SALOME_SalomeException);
   MESSAGE( "GEOM_Gen_i::GetIGroupOperations" );
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
+  GEOM::GEOM_Gen_ptr engine = _this();
 
   GEOM_IGroupOperations_i* aServant =
     new GEOM_IGroupOperations_i(_poa, engine, _impl->GetIGroupOperations(theStudyID));
 
-  // activate the CORBA servant 
+  // activate the CORBA servant
   GEOM::GEOM_IGroupOperations_var operations = aServant->_this();
   return operations._retn();
 }
@@ -771,7 +771,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShap
   if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil();
   Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry());
   if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil();
-  
+
   Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length());
   for(Standard_Integer i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
 
@@ -788,13 +788,13 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShap
  *  RemoveObject
  */
 //=============================================================================
-void GEOM_Gen_i::RemoveObject(GEOM::GEOM_Object_ptr theObject)         
+void GEOM_Gen_i::RemoveObject(GEOM::GEOM_Object_ptr theObject)
 {
   Handle(GEOM_Object) anObject = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
   if (anObject.IsNull()) return;
   _impl->RemoveObject(anObject);
-  return; 
-}  
+  return;
+}
 
 
 //=================================================================================
@@ -815,34 +815,35 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) {
   if(strcmp(stringIOR,"") != 0){
     CORBA::Object_var anObject = _orb->string_to_object(stringIOR);
     if(!CORBA::is_nil(anObject))
-      aGeomObject =  GEOM::GEOM_Object::_narrow(anObject.in()) ;
+      aGeomObject =  GEOM::GEOM_Object::_narrow(anObject.in());
   }
-  return aGeomObject._retn() ;
+  return aGeomObject._retn();
 }
 
 //=================================================================================
 // function : GetObject()
-// purpose  : 
+// purpose  :
 //=================================================================================
-GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject(CORBA::Long theStudyID, const char* theEntry)
+GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* theEntry)
 {
   GEOM::GEOM_Object_var obj;
   Handle(GEOM_Object) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
-  if(handle_object.IsNull()) return NULL;
+  if (handle_object.IsNull()) return NULL;
+
   TCollection_AsciiString stringIOR = handle_object->GetIOR();
-  if(stringIOR.Length() > 1) {
+  if (stringIOR.Length() > 1) {
     CORBA::Object_var corba_object = _orb->string_to_object(stringIOR.ToCString());
-    if(!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object);
-    return obj._retn();  
-   }
+    if (!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object);
+    return obj._retn();
+  }
+
+  GEOM::GEOM_Gen_ptr engine = _this();
+  GEOM_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object);
 
-  GEOM::GEOM_Gen_ptr engine = _this(); 
-  GEOM_Object_i* servant = new GEOM_Object_i(_poa, engine, handle_object);
-  
   obj = servant->_this();
-  stringIOR =  _orb->object_to_string(obj);
+  stringIOR = _orb->object_to_string(obj);
   handle_object->SetIOR(stringIOR);
-  return obj._retn(); 
+  return obj._retn();
 }
 
 
@@ -852,14 +853,13 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject(CORBA::Long theStudyID, const char*
 extern "C"
 {
   PortableServer::ObjectId * GEOMEngine_factory(CORBA::ORB_ptr orb,
-                                               PortableServer::POA_ptr poa, 
+                                               PortableServer::POA_ptr poa,
                                                PortableServer::ObjectId * contId,
-                                               const char *instanceName, 
+                                               const char *instanceName,
                                                const char * interfaceName)
   {
    GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
-   myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example 
-   return myGEOM_Gen_i->getId() ;
+   myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
+   return myGEOM_Gen_i->getId();
   }
 }
-
index e0b09d6b9e83453b5f3ad8e6198a12405288427e..1111c11ba06c5eb84e4db4fd8a51fd67496cf3d9 100644 (file)
@@ -6,16 +6,14 @@
 // IDL headers
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
 
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
-#include "SALOME_Component_i.hxx"
 
+#include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
 
-//#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
 #include "GEOM_IBasicOperations_i.hh"
 #include "GEOM_ITransformOperations_i.hh"
 #include "GEOM_I3DPrimOperations_i.hh"
@@ -29,6 +27,8 @@
 #include "GEOM_IMeasureOperations_i.hh"
 #include "GEOM_IGroupOperations_i.hh"
 
+//#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
 
 //=====================================================================
 // GEOM_Gen_i : class definition
@@ -40,12 +40,13 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
   //-----------------------------------------------------------------------//
   // Constructor / Destructor                                              //
   //-----------------------------------------------------------------------//
-  // constructor to be called for servant creation. 
+
+  // constructor to be called for servant creation.
   GEOM_Gen_i();
   GEOM_Gen_i(CORBA::ORB_ptr orb,
             PortableServer::POA_ptr poa,
-            PortableServer::ObjectId * contId, 
-            const char *instanceName, 
+            PortableServer::ObjectId * contId,
+            const char *instanceName,
             const char *interfaceName);
 
   // destructor, doing nothing (for now)
@@ -57,7 +58,7 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
 
   //-----------------------------------------------------------------------//
   // Inherited methods from SALOMEDS::Driver                               //
-  //-----------------------------------------------------------------------//    
+  //-----------------------------------------------------------------------//
 
   SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
                          const char* theURL,
@@ -66,7 +67,7 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
   SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
                               const char* theURL,
                               bool isMultiFile);
-  
+
   CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
                      const SALOMEDS::TMPFile& theStream,
                      const char* theURL,
@@ -103,13 +104,18 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
                                  CORBA::Long theObjectID,
                                  SALOMEDS::SObject_ptr theObject);
 
-  //Adds theObject in the study with a name = theName, if theFather is not null the object is placed under theFather
-  SALOMEDS::SObject_ptr AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM::GEOM_Object_ptr theObject, const char* theName, GEOM::GEOM_Object_ptr theFather);
+  /*! \brief Adds theObject in the study with a name = theName, if
+   *         theFather is not null the object is placed under theFather
+   */
+  SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
+                                   GEOM::GEOM_Object_ptr theObject,
+                                   const char* theName,
+                                   GEOM::GEOM_Object_ptr theFather);
 
   //-----------------------------------------------------------------------//
-  // Transaction methods                                                    //
-  //-----------------------------------------------------------------------// 
+  // Transaction methods                                                   //
+  //-----------------------------------------------------------------------//
+
   //Undos one transaction in the document associated with theStudyID
   virtual void Undo(CORBA::Long theStudyID);
 
@@ -118,12 +124,12 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
 
   //-----------------------------------------------------------------------//
   // Operations methods                                                    //
-  //-----------------------------------------------------------------------// 
+  //-----------------------------------------------------------------------//
 
   //Returns a pointer to BasicOperations interface
   virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
     throw (SALOME::SALOME_Exception);
-  
+
   //Returns a pointer to TransformOperations interface
   virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
     throw (SALOME::SALOME_Exception);
@@ -169,7 +175,8 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
     throw (SALOME::SALOME_Exception);
 
   //Adds a new sub shape
-  virtual GEOM::GEOM_Object_ptr AddSubShape(GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfLong& theIndices);
+  virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
+                                            const GEOM::ListOfLong& theIndices);
 
   virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
 
@@ -177,25 +184,25 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
 
   virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
 
-  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, 
-                                      CORBA::Boolean isPublished, 
+  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+                                      CORBA::Boolean isPublished,
                                       CORBA::Boolean& isValidScript);
 
   char* GetDumpName (const char* theStudyEntry);
 
   GEOM::string_array* GetAllDumpNames();
 
-  //********************************************************************************************************//
-  //     Internal methods
-  //********************************************************************************************************//
+  //-----------------------------------------------------------------------//
+  // Internal methods                                                      //
+  //-----------------------------------------------------------------------//
+
   virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
 
  private:
+
    ::GEOMImpl_Gen* _impl;
    SALOME_NamingService * name_service;
-   char * _name; 
-
+   char * _name;
 };
 
-#endif 
+#endif
index d8f185eceac594f9e0ee57a2935d2feba505b222..6ae20ca137811c827be42c15e2f61e782358ce92 100644 (file)
@@ -36,7 +36,7 @@ GEOM_ICurvesOperations_i::~GEOM_ICurvesOperations_i()
 /*!
  *  MakeCirclePntVecR
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
                       CORBA::Double theR)
@@ -69,7 +69,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR
 /*!
  *  MakeCircleThreePnt
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt
                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
                       GEOM::GEOM_Object_ptr thePnt3)
@@ -104,7 +104,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt
 /*!
  *  MakeEllipse
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
                       CORBA::Double theRMajor, double theRMinor)
@@ -137,7 +137,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
 /*!
  *  MakeArc
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc
                                                 (GEOM::GEOM_Object_ptr thePnt1,
                                                 GEOM::GEOM_Object_ptr thePnt2,
@@ -173,7 +173,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc
 /*!
  *  MakePolyline
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline
                                     (const GEOM::ListOfGO& thePoints)
 {
@@ -209,7 +209,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline
 /*!
  *  MakeSplineBezier
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier
                                               (const GEOM::ListOfGO& thePoints)
 {
@@ -245,7 +245,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier
 /*!
  *  MakeSplineInterpolation
  */
-//============================================================================= 
+//=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
                                               (const GEOM::ListOfGO& thePoints)
 {
@@ -281,10 +281,11 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
 /*!
  *  MakeSketcher
  */
-//============================================================================= 
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane)
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
+            (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane)
 {
-  GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_nil();
 
   //Set a not done flag
   GetOperations()->SetNotDone();
@@ -297,9 +298,10 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCom
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-      GetOperations()->MakeSketcher(theCommand, aWorkingPlane);
+    GetOperations()->MakeSketcher(strdup(theCommand), aWorkingPlane);
   if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();
+    //return aGEOMObject._retn();
+    return GEOM::GEOM_Object::_nil();
 
   return GetObject(anObject);
 }
@@ -309,10 +311,11 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCom
 /*!
  *  MakeSketcherOnPlane
  */
-//============================================================================= 
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
+                (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
 {
-  GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_nil();
 
   //Set a not done flag
   GetOperations()->SetNotDone();
@@ -322,7 +325,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane (const char*
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-      GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
+      GetOperations()->MakeSketcherOnPlane(strdup(theCommand), aWorkingPlane);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
index 06bea0b09615fec8f0e8c635599d2e00c779141b..3191df9adcde9e5eabbc1edfc5ca7a1eae0b49cd 100644 (file)
@@ -4,12 +4,13 @@
 
 
 #include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(GEOM_Gen)
 
 #include "SALOME_GenericObj_i.hh"
+
 #include "GEOM_Object.hxx"
+
 #include <TopoDS_Shape.hxx>
 
 class GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOME::GenericObj_i
@@ -17,22 +18,22 @@ class GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOM
  public:
    GEOM_Object_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, Handle(GEOM_Object) theImpl);
    ~GEOM_Object_i();
-  
+
   virtual char* GetEntry();
-  
+
   virtual CORBA::Long GetStudyID();
-  
+
   virtual CORBA::Long GetType();
 
-  virtual GEOM::shape_type GetShapeType(); 
+  virtual GEOM::shape_type GetShapeType();
 
   virtual void SetName(const char* theName);
 
-  virtual char* GetName();    
+  virtual char* GetName();
 
   virtual void SetStudyEntry(const char* theEntry);
 
-  virtual char* GetStudyEntry();    
+  virtual char* GetStudyEntry();
 
   virtual GEOM::ListOfGO* GetDependency();
 
@@ -44,18 +45,18 @@ class GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOM
 
   virtual bool IsMainShape() { return _impl->IsMainShape(); }
 
-  virtual GEOM::ListOfLong* GetSubShapeIndices(); 
+  virtual GEOM::ListOfLong* GetSubShapeIndices();
+
   virtual GEOM::GEOM_Object_ptr GetMainShape();
 
-  virtual bool IsShape();   
+  virtual bool IsShape();
 
   Handle(GEOM_Object) GetImpl() { return _impl; }
 
  private:
 
-  GEOM::GEOM_Gen_ptr _engine; 
-  Handle(GEOM_Object) _impl;     
+  GEOM::GEOM_Gen_ptr _engine;
+  Handle(GEOM_Object) _impl;
   TopoDS_Shape _geom;
 };
 
index ec731fbd29c9da4a248b36a871973d3aba47b6e4..ec0ab37e5936ff500026625e5de96ee389bf4cd2 100644 (file)
@@ -54,9 +54,11 @@ LIB_SRC = \
        GEOM_Gen_i.cc \
        GEOM_DumpPython.cc
 
+# SALOME_Component.idl
+LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl #\
+                 #SALOME_Exception.idl SALOME_GenericObj.idl
 
-LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl \
-                GEOM_Gen.idl SALOME_GenericObj.idl
+LIB_SERVER_IDL = GEOM_Gen.idl
 
 # Executables targets
 BIN = 
@@ -84,7 +86,9 @@ EXPORT_HEADERS = GEOM_Object_i.hh \
 # additionnal information to compil and link file
 CPPFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
 CXXFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS  += -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMArchimede -lGEOMbasic -lGEOMimpl $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj 
+LDFLAGS  += -lGEOMArchimede -lGEOMbasic -lGEOMimpl -lGEOMSketcher \
+            $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset \
+            -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeNS -lSalomeContainer -lSalomeGenericObj 
 
 # additional file to be cleaned
 MOSTLYCLEAN =
@@ -92,4 +96,3 @@ CLEAN =
 DISTCLEAN =
 
 @CONCLUDE@
-