Avoid including of SALOMEDS classes; fix pb with objects deletion

This commit is contained in:
jfa 2005-08-18 06:15:31 +00:00
parent 4fbd5fabf5
commit 131a4abe50
17 changed files with 735 additions and 657 deletions

View File

@ -1,23 +1,23 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -80,15 +80,13 @@
#include <vtkRenderer.h> #include <vtkRenderer.h>
#include <qvaluelist.h> #include <qvaluelist.h>
#include <qstringlist.h> #include <qstringlist.h>
#include "GEOMImpl_Types.hxx" #include "GEOMImpl_Types.hxx"
using namespace std; using namespace std;
#include "SALOMEDSClient.hxx" #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 ); GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj );
if (GeomObject->_is_nil()) if (GeomObject->_is_nil())
return result; return result;
result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject); result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject);
return result; 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() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return false; if ( !appStudy ) return false;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) );
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
if( obj ) { if( obj ) {
@ -176,7 +174,7 @@ bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& td
} }
} }
} }
return false; 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() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return nbSel; if ( !appStudy ) return nbSel;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) ); _PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) );
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
if ( obj && obj->FindAttribute( anAttr, "AttributeName") ) if ( obj && obj->FindAttribute( anAttr, "AttributeName") )
{ {
_PTR(AttributeName) aNameAttr ( anAttr ); _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 else
theName = QString( "%1_objects" ).arg( anObjs.length() ); theName = QString( "%1_objects" ).arg( anObjs.length() );
return 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() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return resultShape; if ( !appStudy ) return resultShape;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) );
if ( !anObj ) if ( !anObj )
return resultShape; return resultShape;
QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); 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 (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) {
Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
AIS_ListOfInteractive List; AIS_ListOfInteractive List;
ic->DisplayedObjects(List); ic->DisplayedObjects(List);
AIS_ListOfInteractive List1; 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() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return GEOM_Actor::New(); if ( !appStudy ) return GEOM_Actor::New();
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) );
if ( !anObj ) if ( !anObj )
return GEOM_Actor::New(); 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()) if (it.current()->getViewManager()->getType() != OCCViewer_Viewer::Type())
continue; continue;
Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
AIS_ListOfInteractive aList; AIS_ListOfInteractive aList;
anIC->DisplayedObjects( aList ); anIC->DisplayedObjects( aList );
anIC->ObjectsInCollector( aList ); anIC->ObjectsInCollector( aList );
@ -458,7 +456,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO
{ {
Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject) anObj =
Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() ); Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() );
if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 ) if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 )
{ {
if( isOnlyInActiveView ) if( isOnlyInActiveView )
@ -471,7 +469,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO
} }
} }
} }
return Handle(AIS_InteractiveObject)(); return Handle(AIS_InteractiveObject)();
} }
@ -489,19 +487,19 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte
testResult = false; testResult = false;
return res; return res;
} }
QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); 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 (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) {
Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
AIS_ListOfInteractive List; AIS_ListOfInteractive List;
ic->DisplayedObjects(List); ic->DisplayedObjects(List);
AIS_ListOfInteractive List1; AIS_ListOfInteractive List1;
ic->ObjectsInCollector(List1); ic->ObjectsInCollector(List1);
List.Append(List1); List.Append(List1);
AIS_ListIteratorOfListOfInteractive ite(List); AIS_ListIteratorOfListOfInteractive ite(List);
while(ite.More()) while(ite.More())
{ {
@ -529,7 +527,7 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte
} }
} }
ite.Next(); ite.Next();
} }
} }
} }
testResult = false; testResult = false;
@ -545,7 +543,7 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interac
{ {
GEOM::GEOM_Object_var aShape; GEOM::GEOM_Object_var aShape;
testResult = false; testResult = false;
/* case SObject */ /* case SObject */
if(IO->hasEntry()) { if(IO->hasEntry()) {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); 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() // function : ConvertListOfIOInListOfIOR()
// purpose : // purpose :
//======================================================================= //=======================================================================
void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR) void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR)
{ {
int nbSel = aList.Extent(); int nbSel = aList.Extent();
listIOR.length(nbSel); listIOR.length(nbSel);
int j=0; int j=0;
SALOME_ListIteratorOfListIO It(aList); SALOME_ListIteratorOfListIO It(aList);
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
if ( !appStudy ) return; ( SUIT_Session::session()->activeApplication()->activeStudy() );
_PTR(Study) aStudy = appStudy->studyDS(); 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(); Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()) { if (IObject->hasEntry()) {
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
if(obj && obj->FindAttribute(anAttr, "AttributeIOR")) { if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
_PTR(AttributeIOR) anIOR (anAttr); _PTR(AttributeIOR) anIOR (anAttr);
CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>(aStudy.get())->ConvertIORToObject(anIOR->Value()); //CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>
if(theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) { // (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()); listIOR[j] = CORBA::string_dup(anIOR->Value().c_str());
j++; j++;
} }
} }
} }
} }
listIOR.length(j); listIOR.length(j);
} }
@ -603,26 +604,27 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::stri
//======================================================================= //=======================================================================
// function : ConvertIOinGEOMObject() // 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 ) Standard_Boolean& theResult )
{ {
theResult = Standard_False; theResult = Standard_False;
GEOM::GEOM_Object_var aReturnObject; GEOM::GEOM_Object_var aReturnObject;
if ( !theIO.IsNull() ) if ( !theIO.IsNull() )
{ {
const char* anEntry = theIO->getEntry(); 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(); if ( !appStudy ) return GEOM::GEOM_Object::_nil();
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) ); _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 ); theResult = !CORBA::is_nil( aReturnObject );
} }
} }
@ -632,20 +634,20 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter
//======================================================================= //=======================================================================
// function : ConvertListOfIOInListOfGO() // function : ConvertListOfIOInListOfGO()
// purpose : // purpose :
//======================================================================= //=======================================================================
void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList, void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
GEOM::ListOfGO& theListGO, GEOM::ListOfGO& theListGO,
const bool theShapesOnly ) const bool theShapesOnly )
{ {
int nbSel = theList.Extent(); int nbSel = theList.Extent();
theListGO.length( nbSel ); theListGO.length( nbSel );
SALOME_ListIteratorOfListIO anIter( theList ); SALOME_ListIteratorOfListIO anIter( theList );
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; if ( !appStudy ) return;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
int j = 0; int j = 0;
for ( int i=0; anIter.More(); anIter.Next(), i++ ) for ( int i=0; anIter.More(); anIter.Next(), i++ )
{ {
@ -654,13 +656,13 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
if ( aSObj ) if ( aSObj )
{ {
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object_var aGeomObj =
GEOM::GEOM_Object::_narrow(dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject()); GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) ) if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) )
theListGO[ j++ ] = aGeomObj; theListGO[ j++ ] = aGeomObj;
} }
} }
theListGO.length( j ); theListGO.length( j );
} }
@ -671,16 +673,16 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
//================================================================================= //=================================================================================
bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) 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) != OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE)
return false; return false;
OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort(); OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort();
Handle( V3d_View) view3d = vp3d->getView(); Handle( V3d_View) view3d = vp3d->getView();
Standard_Real Width, Height; Standard_Real Width, Height;
view3d->Size(Width, Height); view3d->Size(Width, Height);
const Standard_Real aHeight = (Width + Height) / 50.0; const Standard_Real aHeight = (Width + Height) / 50.0;
try { try {
Standard_Real first, last; Standard_Real first, last;
Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), 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); curv->D1( param, middleParamPoint, V1);
if(V1.Magnitude() < Precision::Confusion()) if(V1.Magnitude() < Precision::Confusion())
return false; return false;
/* Topology orientation not geom orientation */ /* Topology orientation not geom orientation */
if(tds.Orientation() == TopAbs_REVERSED) if(tds.Orientation() == TopAbs_REVERSED)
V1 *= -1.0; V1 *= -1.0;
gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1)); gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1));
const Standard_Real radius1 = aHeight / 5.0; const Standard_Real radius1 = aHeight / 5.0;
if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) { 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) { catch(Standard_Failure) {
// OCC failures are hard to catch in GUI. // 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 ! // in SALOME environment : compilation error !
} }
return false; return false;
@ -729,7 +731,7 @@ bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P)
//================================================================================= //=================================================================================
// function : GetBipointDxDyDz() // function : GetBipointDxDyDz()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) 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) 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); aTitle, TRUE, 0, bottom, top, decimals);
int r = Dialog->exec(); int r = Dialog->exec();
float X = 0.0; float X = 0.0;
if(r == QDialog::Accepted) { if(r == QDialog::Accepted) {
res = Standard_True; res = Standard_True;
X = Dialog->getValue(); X = Dialog->getValue();
} }
else else
res = Standard_False; res = Standard_False;
delete Dialog; delete Dialog;
@ -795,7 +797,7 @@ double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const cha
//======================================================================= //=======================================================================
// function : SelectionByNameInDialogs() // function : SelectionByNameInDialogs()
// purpose : Called when user has entered a name of object in a LineEdit. // 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. // : corresponding signal to manage this event.
//======================================================================= //=======================================================================
bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList) 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() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return false; if ( !appStudy ) return false;
_PTR(Study) ST = appStudy->studyDS(); _PTR(Study) ST = appStudy->studyDS();
std::vector<_PTR(SObject)> listSO; std::vector<_PTR(SObject)> listSO;
listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM"); listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM");
if(listSO.size() < 1) { if(listSO.size() < 1) {
const QString caption = QObject::tr("GEOM_WRN_WARNING"); const QString caption = QObject::tr("GEOM_WRN_WARNING");
const QString text = QObject::tr("GEOM_NAME_INCORRECT"); 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 */ /* Add as a selected object */
/* Clear any previous selection : */ /* 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->ClearIObjects(); //mzn
// Sel->AddIObject(SI); //mzn // Sel->AddIObject(SI); //mzn
return true; return true;
@ -850,7 +852,7 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y)
SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop(); SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop();
x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 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; int aNumber = 0;
_PTR(SObject) obj; _PTR(SObject) obj;
do do
{ {
aName = theOperation+"_"+QString::number(++aNumber); aName = theOperation+"_"+QString::number(++aNumber);
obj = aStudy->FindObject(aName.latin1()); obj = aStudy->FindObject(aName.latin1());
} }
while (obj); while (obj);
return aName; return aName;
} }
@ -887,13 +889,13 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment
{ {
QString anErrorCode(theErrorCode); QString anErrorCode(theErrorCode);
QString aComment(theComment); QString aComment(theComment);
QString aText = ""; QString aText = "";
if (!anErrorCode.isEmpty()) if (!anErrorCode.isEmpty())
aText.append("\n" + QObject::tr(anErrorCode)); aText.append("\n" + QObject::tr(anErrorCode));
if (!aComment.isEmpty()) if (!aComment.isEmpty())
aText.append("\n" + QString(theComment)); aText.append("\n" + QString(theComment));
SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ),
QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); 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 ) QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
{ {
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 ) if ( appStudy )
{ {
string anIOR = SalomeApp_Application::orb()->object_to_string( theObj ); 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(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( anIOR ) );
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") )
{ {
_PTR(AttributeName) aNameAttr ( anAttr ); _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 ) bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj )

View File

@ -1,23 +1,23 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org // See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -59,10 +59,6 @@
using namespace std; using namespace std;
#include <SALOMEDSClient.hxx> #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(); SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
if ( activeStudy ) if ( activeStudy )
return SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); return SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
return 0; return 0;
} }
@ -92,14 +88,14 @@ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine()
// Function : GEOMBase_Helper // Function : GEOMBase_Helper
// Purpose : // 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 ) : myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false )
{ {
} }
//================================================================ //================================================================
// Function : ~GEOMBase_Helper // Function : ~GEOMBase_Helper
// Purpose : // Purpose :
//================================================================ //================================================================
GEOMBase_Helper::~GEOMBase_Helper() GEOMBase_Helper::~GEOMBase_Helper()
{ {
@ -118,7 +114,7 @@ GEOMBase_Helper::~GEOMBase_Helper()
//================================================================ //================================================================
// Function : display // Function : display
// Purpose : // Purpose :
//================================================================ //================================================================
void GEOMBase_Helper::display( const ObjectList& objList, const bool updateView ) 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 // Function : erase
// Purpose : // Purpose :
//================================================================ //================================================================
void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView ) 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 // Function : erase
// Purpose : // Purpose :
//================================================================ //================================================================
void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView ) 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 // Function : redisplay
// Purpose : // Purpose :
//================================================================ //================================================================
void GEOMBase_Helper::redisplay( const ObjectList& objList, void GEOMBase_Helper::redisplay( const ObjectList& objList,
const bool withChildren, const bool withChildren,
const bool updateView ) const bool updateView )
{ {
@ -194,9 +190,9 @@ void GEOMBase_Helper::redisplay( const ObjectList& objList,
//================================================================ //================================================================
// Function : redisplay // 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 withChildren,
const bool updateView ) const bool updateView )
{ {
@ -205,23 +201,25 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
// Default color will be used // Default color will be used
getDisplayer()->UnsetColor(); getDisplayer()->UnsetColor();
getDisplayer()->UnsetWidth(); getDisplayer()->UnsetWidth();
// Enable activisation of selection // Enable activisation of selection
getDisplayer()->SetToActivate( true ); getDisplayer()->SetToActivate( true );
string entry = getEntry( object ); 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 ) { if ( withChildren ) {
SalomeApp_Study* aDoc = getStudy(); SalomeApp_Study* aDoc = getStudy();
if ( aDoc && aDoc->studyDS() ) { if ( aDoc && aDoc->studyDS() ) {
_PTR(Study) aStudy = 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 ) { if ( aSObj ) {
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { 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 ( !CORBA::is_nil( aChild ) ) {
if ( !aChild->_is_nil() ) { if ( !aChild->_is_nil() ) {
string entry = getEntry( aChild ); string entry = getEntry( aChild );
@ -230,10 +228,10 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
} }
} }
} }
} }
} }
} }
if ( updateView ) if ( updateView )
getDisplayer()->UpdateViewer(); getDisplayer()->UpdateViewer();
} }
@ -247,12 +245,12 @@ void GEOMBase_Helper::displayPreview( const bool activate,
const bool toRemoveFromEngine, const bool toRemoveFromEngine,
const double lineWidth ) const double lineWidth )
{ {
isPreview = true; isPreview = true;
QString msg; QString msg;
if ( !isValid( msg ) ) if ( !isValid( msg ) )
{ {
erasePreview( update ); erasePreview( update );
isPreview = false; isPreview = false;
return; return;
} }
@ -289,7 +287,7 @@ void GEOMBase_Helper::displayPreview( const bool activate,
//================================================================ //================================================================
void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
const bool append, const bool append,
const bool activate, const bool activate,
const bool update, const bool update,
const double lineWidth ) const double lineWidth )
{ {
@ -304,7 +302,7 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
// Make a reference to GEOM_Object // Make a reference to GEOM_Object
getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) ); getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) );
// Build prs // Build prs
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object ); SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
if ( aPrs == 0 || aPrs->IsNull() ) 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); SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
if (aView) if (aView)
aView->Display( prs ); aView->Display( prs );
} }
// Add prs to the preview list // Add prs to the preview list
myPreview.push_back( (SALOME_Prs*)prs ); myPreview.push_back( (SALOME_Prs*)prs );
@ -357,7 +355,7 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs,
//================================================================ //================================================================
// Function : erasePreview // Function : erasePreview
// Purpose : // Purpose :
//================================================================ //================================================================
void GEOMBase_Helper::erasePreview( const bool update ) 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); SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
if (aView) if (aView)
aView->Erase( *anIter, true ); aView->Erase( *anIter, true );
} }
} }
delete *anIter; delete *anIter;
} }
@ -409,7 +407,8 @@ void GEOMBase_Helper::activate( const int theType )
_PTR(SObject) aRefSO; _PTR(SObject) aRefSO;
if ( !aSO->ReferencedObject( 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 ) if ( !anObj->_is_nil() && anObj->GetType() == theType )
aList.Append( new SALOME_InteractiveObject( aSO->GetID().c_str(), "GEOM", aSO->GetName().c_str()) ); 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 ) void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode )
{ {
SALOME_ListIO aListOfIO; SALOME_ListIO aListOfIO;
ObjectList::const_iterator anIter = theObjs.begin(); ObjectList::const_iterator anIter = theObjs.begin();
for ( ; anIter != theObjs.end(); ++anIter ) 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 ); 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 // 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 // this method instead of direct desktop->getActiveStudy() calls
//================================================================ //================================================================
SalomeApp_Study* GEOMBase_Helper::getStudy() const SalomeApp_Study* GEOMBase_Helper::getStudy() const
@ -548,14 +548,14 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const
SUIT_Desktop* aDesktop = getDesktop(); SUIT_Desktop* aDesktop = getDesktop();
if (!aDesktop) if (!aDesktop)
return 0; return 0;
QPtrList<SUIT_Application> anAppList = SUIT_Session::session()->applications(); QPtrList<SUIT_Application> anAppList = SUIT_Session::session()->applications();
SUIT_Application* anApp = 0; SUIT_Application* anApp = 0;
for ( QPtrListIterator<SUIT_Application> it( anAppList ); it.current() ; ++it ) for ( QPtrListIterator<SUIT_Application> it( anAppList ); it.current() ; ++it )
{ {
anApp = it.current(); anApp = it.current();
if ( anApp->desktop() == aDesktop ) if ( anApp->desktop() == aDesktop )
break; break;
} }
@ -564,7 +564,7 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const
//================================================================ //================================================================
// Function : getEntry // Function : getEntry
// Purpose : // Purpose :
//================================================================ //================================================================
char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const 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 // Function : getDisplayer
// Purpose : // Purpose :
//================================================================ //================================================================
GEOM_Displayer* GEOMBase_Helper::getDisplayer() GEOM_Displayer* GEOMBase_Helper::getDisplayer()
{ {
@ -594,7 +594,7 @@ GEOM_Displayer* GEOMBase_Helper::getDisplayer()
//================================================================ //================================================================
// Function : clearShapeBuffer // Function : clearShapeBuffer
// Purpose : // Purpose :
//================================================================ //================================================================
void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) 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") ) { if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
_PTR(AttributeIOR) anIOR ( anAttr ); _PTR(AttributeIOR) anIOR ( anAttr );
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
} }
} }
} }
//================================================================ //================================================================
// Function : openCommand // Function : openCommand
// Purpose : // Purpose :
//================================================================ //================================================================
bool GEOMBase_Helper::openCommand() bool GEOMBase_Helper::openCommand()
{ {
bool res = false; bool res = false;
if ( !getStudy() || hasCommand() ) if ( !getStudy() || hasCommand() )
return res; return res;
GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() ); GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() );
if ( !anOp->_is_nil() ) { if ( !anOp->_is_nil() ) {
myCommand = new GEOM_Operation( SUIT_Session::session()->activeApplication(), anOp.in() ); myCommand = new GEOM_Operation( SUIT_Session::session()->activeApplication(), anOp.in() );
myCommand->start(); myCommand->start();
res = true; res = true;
} }
return res; return res;
} }
//================================================================ //================================================================
// Function : abortCommand // Function : abortCommand
// Purpose : // Purpose :
//================================================================ //================================================================
bool GEOMBase_Helper::abortCommand() bool GEOMBase_Helper::abortCommand()
{ {
@ -655,13 +655,13 @@ bool GEOMBase_Helper::abortCommand()
myCommand->abort(); myCommand->abort();
myCommand = 0; myCommand = 0;
return true; return true;
} }
//================================================================ //================================================================
// Function : commitCommand // Function : commitCommand
// Purpose : // Purpose :
//================================================================ //================================================================
bool GEOMBase_Helper::commitCommand( const char* ) bool GEOMBase_Helper::commitCommand( const char* )
{ {
@ -671,12 +671,12 @@ bool GEOMBase_Helper::commitCommand( const char* )
myCommand->commit(); myCommand->commit();
myCommand = 0; myCommand = 0;
return true; return true;
} }
//================================================================ //================================================================
// Function : hasCommand // Function : hasCommand
// Purpose : // Purpose :
//================================================================ //================================================================
bool GEOMBase_Helper::hasCommand() const bool GEOMBase_Helper::hasCommand() const
{ {
@ -685,7 +685,7 @@ bool GEOMBase_Helper::hasCommand() const
//================================================================ //================================================================
// Function : getOperation // Function : getOperation
// Purpose : // Purpose :
//================================================================ //================================================================
GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation() GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation()
{ {
@ -699,13 +699,13 @@ GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation()
//================================================================ //================================================================
// Function : checkViewWindow // Function : checkViewWindow
// Purpose : // Purpose :
//================================================================ //================================================================
bool GEOMBase_Helper::checkViewWindow() bool GEOMBase_Helper::checkViewWindow()
{ {
if ( myViewWindow ){ if ( myViewWindow ){
QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); 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() ) if ( myViewWindow == it.current() )
return true; return true;
@ -718,7 +718,7 @@ bool GEOMBase_Helper::checkViewWindow()
//================================================================ //================================================================
// Function : onAccept // Function : onAccept
// Purpose : This method should be called from dialog's slots onOk() and onApply() // 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. // performs a proper operation and manages transactions, etc.
//================================================================ //================================================================
bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) 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() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return false; if ( !appStudy ) return false;
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
@ -773,7 +773,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
withChildren = false; withChildren = false;
display( *it, 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 // before redisplay
clearShapeBuffer( *it ); clearShapeBuffer( *it );
withChildren = true; withChildren = true;
@ -816,8 +816,8 @@ void GEOMBase_Helper::showError()
msg = QObject::tr( "GEOM_PRP_ABORT" ); msg = QObject::tr( "GEOM_PRP_ABORT" );
SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(),
QObject::tr( "GEOM_ERROR_STATUS" ), QObject::tr( "GEOM_ERROR_STATUS" ),
msg, msg,
QObject::tr( "BUT_OK" ) ); QObject::tr( "BUT_OK" ) );
} }
@ -858,8 +858,8 @@ bool GEOMBase_Helper::isValid( QString& )
//================================================================ //================================================================
// Function : execute // Function : execute
// Purpose : This method is called by onAccept(). // Purpose : This method is called by onAccept().
// It should perform the required operation and put all new or modified objects into // 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. // <objects> argument.Should return <false> if some error occurs during its execution.
//================================================================ //================================================================
bool GEOMBase_Helper::execute( ObjectList& objects ) bool GEOMBase_Helper::execute( ObjectList& objects )
@ -899,9 +899,9 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( !GEOMBase::GetShape( theObj, aShape ) ) if ( !GEOMBase::GetShape( theObj, aShape ) )
return ""; return "";
long aType = aShape.ShapeType(); long aType = aShape.ShapeType();
switch ( aType ) switch ( aType )
{ {
case TopAbs_VERTEX : return QObject::tr( "GEOM_VERTEX" ); 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() const SALOME_ListIO& GEOMBase_Helper::selectedIO()
{ {
mySelected.Clear(); mySelected.Clear();
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( app ) { if ( app ) {
SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr();
if ( aSelMgr ) if ( aSelMgr )
aSelMgr->selectedObjects( mySelected ); aSelMgr->selectedObjects( mySelected );
} }
return mySelected; return mySelected;
} }

View 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 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 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@ @CONCLUDE@

View File

@ -1,12 +1,13 @@
#include <OCCViewer_ViewModel.h>
#include "GEOMGUI_Selection.h" #include "GEOMGUI_Selection.h"
#include "GeometryGUI.h"
#include "GEOM_Displayer.h" #include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx"
#include <SalomeApp_DataOwner.h> #include <SalomeApp_DataOwner.h>
#include <SalomeApp_Study.h> #include <SalomeApp_Study.h>
#include <OCCViewer_ViewModel.h>
#include <SUIT_Session.h> #include <SUIT_Session.h>
#include <SUIT_ViewWindow.h> #include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h> #include <SUIT_ViewManager.h>
@ -14,22 +15,27 @@
#include <SALOMEDSClient_SObject.hxx> #include <SALOMEDSClient_SObject.hxx>
#include <SALOMEDSClient_Study.hxx> #include <SALOMEDSClient_Study.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOME_Prs.h> #include <SALOME_Prs.h>
#include <SALOME_InteractiveObject.hxx> #include <SALOME_InteractiveObject.hxx>
#include <SOCC_Prs.h> #include <SOCC_Prs.h>
#include <SVTK_Prs.h> #include <SVTK_Prs.h>
#include <SALOME_Actor.h> #include <SALOME_Actor.h>
#include <vtkActorCollection.h>
#include <OCCViewer_ViewModel.h> #include <OCCViewer_ViewModel.h>
#include <VTKViewer_ViewModel.h> #include <VTKViewer_ViewModel.h>
#include "GEOMImpl_Types.hxx"
// OCCT Includes
#include <AIS.hxx> #include <AIS.hxx>
#include <AIS_InteractiveObject.hxx> #include <AIS_InteractiveObject.hxx>
#include <AIS_ListOfInteractive.hxx> #include <AIS_ListOfInteractive.hxx>
// VTK Includes
#include <vtkActorCollection.h>
GEOMGUI_Selection::GEOMGUI_Selection() GEOMGUI_Selection::GEOMGUI_Selection()
{ {
} }
@ -41,7 +47,7 @@ GEOMGUI_Selection::~GEOMGUI_Selection()
QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const
{ {
if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() ); if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() );
return SalomeApp_Selection::globalParam( p ); 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 else if ( viewType == VTKViewer_Viewer::Type() ) { // assuming VTK
SVTK_Prs* vtkPrs = (SVTK_Prs*) prs; SVTK_Prs* vtkPrs = (SVTK_Prs*) prs;
vtkActorCollection* lst = vtkPrs->GetObjects(); vtkActorCollection* lst = vtkPrs->GetObjects();
@ -124,7 +130,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
int dm = salActor->getDisplayMode(); int dm = salActor->getDisplayMode();
if ( dm == 0 ) if ( dm == 0 )
return "Wireframe"; return "Wireframe";
else if ( dm == 1 ) else if ( dm == 1 )
return "Shading"; return "Shading";
} // if ( salome actor ) } // if ( salome actor )
} // if ( actor ) } // if ( actor )
@ -144,9 +150,9 @@ bool GEOMGUI_Selection::isComponent( const int index ) const
_PTR(Study) study = appStudy->studyDS(); _PTR(Study) study = appStudy->studyDS();
QString anEntry = entry( index ); QString anEntry = entry( index );
if ( study && !anEntry.isNull() ) { if ( study && !anEntry.isNull() ) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) ); _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
if ( aSO && aSO->GetFatherComponent() ) if ( aSO && aSO->GetFatherComponent() )
return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR(); 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*> SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
(SUIT_Session::session()->activeApplication()->activeStudy()); (SUIT_Session::session()->activeApplication()->activeStudy());
if ( appStudy && index >= 0 && index < count() ) { if (appStudy && index >= 0 && index < count()) {
_PTR(Study) study = appStudy->studyDS(); _PTR(Study) study = appStudy->studyDS();
QString anEntry = entry( index ); QString anEntry = entry(index);
if ( study && !anEntry.isNull() ) { if (study && !anEntry.isNull()) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) ); _PTR(SObject) aSO (study->FindObjectID(anEntry.latin1()));
if ( aSO ) { if (aSO) {
SALOMEDS_SObject* aDSObj = dynamic_cast<SALOMEDS_SObject*>( aSO.get() ); CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSO);
return GEOM::GEOM_Object::_narrow( aDSObj->GetObject() ); return GEOM::GEOM_Object::_narrow(anObj);
} }
} }
} }
return GEOM::GEOM_Object::_nil(); return GEOM::GEOM_Object::_nil();
} }

View File

@ -1,23 +1,23 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -26,10 +26,9 @@
// Module : GEOM // Module : GEOM
// $Header$ // $Header$
#include <SOCC_ViewModel.h>
#include "GEOM_Displayer.h" #include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx"
#include "GeometryGUI.h"
#include "GEOM_TypeFilter.h" #include "GEOM_TypeFilter.h"
#include "GEOM_EdgeFilter.h" #include "GEOM_EdgeFilter.h"
@ -38,8 +37,9 @@
#include "GEOM_LogicalFilter.h" #include "GEOM_LogicalFilter.h"
#include "GEOM_OCCFilter.h" #include "GEOM_OCCFilter.h"
#include "GEOM_AssemblyBuilder.h"
#include "GEOM_Actor.h" #include "GEOM_Actor.h"
#include "GEOM_AssemblyBuilder.h"
#include "GEOM_AISShape.hxx"
#include "GEOM_AISTrihedron.hxx" #include "GEOM_AISTrihedron.hxx"
#include "GEOM_VTKTrihedron.hxx" #include "GEOM_VTKTrihedron.hxx"
@ -56,37 +56,42 @@
#include <SalomeApp_Tools.h> #include <SalomeApp_Tools.h>
#include <SALOME_ListIteratorOfListIO.hxx> #include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOMEDSClient.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDSClient_SObject.hxx>
#include <SOCC_Prs.h> #include <SOCC_Prs.h>
#include <SOCC_ViewModel.h>
#include <SVTK_Prs.h> #include <SVTK_Prs.h>
#include <SVTK_ViewModel.h> #include <SVTK_ViewModel.h>
#include <SALOMEDSClient.hxx>
#include <SALOMEDSClient_SObject.hxx>
// OCCT Includes
#include <AIS_Drawer.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <StdSelect_TypeOfEdge.hxx>
#include <StdSelect_TypeOfFace.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Axis2Placement.hxx>
#include <gp_Pln.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) // VTK Includes
#include <GeometryGUI.h>
#include <GEOM_AISShape.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_Drawer.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Geom_Plane.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pln.hxx>
#include <Geom_Axis2Placement.hxx>
#include <StdSelect_TypeOfEdge.hxx>
#include <StdSelect_TypeOfFace.hxx>
#include <vtkActorCollection.h> #include <vtkActorCollection.h>
// STL Includes
#include <cstring> #include <cstring>
// CORBA Headers
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include "GEOMImpl_Types.hxx"
using namespace std; using namespace std;
//================================================================ //================================================================
@ -130,7 +135,7 @@ static inline int getTopAbsMode( const int implType )
SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode ) SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
{ {
SUIT_SelectionFilter* aFilter; SUIT_SelectionFilter* aFilter;
int aTopAbsMode = getTopAbsMode( theMode ); int aTopAbsMode = getTopAbsMode( theMode );
if ( aTopAbsMode != -1 ) if ( aTopAbsMode != -1 )
aFilter = new GEOM_TypeFilter( getStudy(), aTopAbsMode, true ); //@ aFilter = new GEOM_TypeFilter( ( TopAbs_ShapeEnum )aTopAbsMode ); 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_LINE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Line ); break;
case GEOM_CIRCLE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Circle ); 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_PLANE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Plane ); break;
case GEOM_CYLINDER : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cylinder ); 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_SPHERE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Sphere ); break;
case GEOM_TORUS : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Torus ); 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_REVOLUTION: aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Revol ); break;
case GEOM_CONE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cone ); break; case GEOM_CONE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cone ); break;
case GEOM_PREVIEW : aFilter = new GEOM_PreviewFilter( getStudy() ); break; case GEOM_PREVIEW : aFilter = new GEOM_PreviewFilter( getStudy() ); break;
case GEOM_ALLSHAPES : aFilter = new GEOM_SelectionFilter(getStudy(), true ); break; case GEOM_ALLSHAPES : aFilter = new GEOM_SelectionFilter(getStudy(), true ); break;
case GEOM_ALLGEOM : aFilter = new SalomeApp_TypeFilter( getStudy(), "GEOM" ); break; case GEOM_ALLGEOM : aFilter = new SalomeApp_TypeFilter( getStudy(), "GEOM" ); break;
default : aFilter = new GEOM_TypeFilter( getStudy(), theMode ); break; default : aFilter = new GEOM_TypeFilter( getStudy(), theMode ); break;
} }
return aFilter; return aFilter;
} }
@ -166,10 +171,10 @@ static char* getEntry( GEOM::GEOM_Object_ptr object )
{ {
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( app ) if ( app )
{ {
string IOR = app->orb()->object_to_string( object ); string IOR = app->orb()->object_to_string( object );
if ( IOR != "" ) if ( IOR != "" )
{ {
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); _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(); SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( app ) if ( app )
{ {
string IOR = app->orb()->object_to_string( object ); string IOR = app->orb()->object_to_string( object );
if ( IOR != "" ) if ( IOR != "" )
{ {
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( IOR ) ); _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 ) GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* study )
{ {
myStudy = study; myStudy = study;
/* Shading Color */ /* Shading Color */
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
SUIT_ResourceMgr* resMgr = session->resourceMgr(); SUIT_ResourceMgr* resMgr = session->resourceMgr();
@ -277,7 +282,7 @@ SALOME_View* GEOM_Displayer::GetActiveView()
* Display interactive object in the current viewer * 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, const bool updateViewer,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
@ -285,7 +290,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
if ( vf ) if ( vf )
{ {
SALOME_Prs* prs = buildPresentation( theIO, vf ); SALOME_Prs* prs = buildPresentation( theIO, vf );
if ( prs ) if ( prs )
{ {
vf->BeforeDisplay( this ); vf->BeforeDisplay( this );
@ -294,7 +299,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
if ( updateViewer ) if ( updateViewer )
vf->Repaint(); vf->Repaint();
delete prs; // delete presentation because displayer is its owner delete prs; // delete presentation because displayer is its owner
} }
} }
@ -334,7 +339,7 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO,
return; return;
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( vf ) { if ( vf ) {
SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() ); SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() );
if ( prs ) { if ( prs ) {
@ -375,7 +380,7 @@ void GEOM_Displayer::EraseAll ( const bool forced,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( vf ) { if ( vf ) {
vf->EraseAll( forced ); vf->EraseAll( forced );
if ( updateViewer ) if ( updateViewer )
@ -515,7 +520,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
{ {
aTrh = new GEOM_AISTrihedron( aPlc ); aTrh = new GEOM_AISTrihedron( aPlc );
if ( HasColor() ) if ( HasColor() )
aTrh->SetColor( (Quantity_NameOfColor)GetColor() ); aTrh->SetColor( (Quantity_NameOfColor)GetColor() );
if ( HasWidth() ) if ( HasWidth() )
@ -540,7 +545,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
if ( !aTrh.IsNull() ) if ( !aTrh.IsNull() )
{ {
aTrh->SetComponent( aPlc ); 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 // Setup shape properties here ..., e.g. display mode, color, transparency, etc
AISShape->SetDisplayMode( myDisplayMode ); AISShape->SetDisplayMode( myDisplayMode );
AISShape->SetShadingColor( myShadingColor ); AISShape->SetShadingColor( myShadingColor );
if ( HasColor() ) if ( HasColor() )
{ {
AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
@ -645,12 +650,12 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
return; return;
vtkActorCollection* theActors = 0; vtkActorCollection* theActors = 0;
if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE ) if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE )
{ {
myToActivate = false; myToActivate = false;
GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New(); GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
if ( HasColor() ) if ( HasColor() )
{ {
Quantity_Color aColor( (Quantity_NameOfColor)GetColor() ); Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
@ -669,25 +674,25 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
// aTrh->SetSize( 0.5 * vf->GetTrihedronSize() ); // aTrh->SetSize( 0.5 * vf->GetTrihedronSize() );
vtkPrs->AddObject( aTrh ); vtkPrs->AddObject( aTrh );
theActors = vtkActorCollection::New(); theActors = vtkActorCollection::New();
theActors->AddItem( aTrh ); theActors->AddItem( aTrh );
} }
else else
theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True ); theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True );
theActors->InitTraversal(); theActors->InitTraversal();
vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
vtkProperty* aProp = 0; vtkProperty* aProp = 0;
if ( HasColor() || HasWidth() ) if ( HasColor() || HasWidth() )
{ {
aProp = vtkProperty::New(); aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe(); aProp->SetRepresentationToWireframe();
} }
if ( HasColor() ) if ( HasColor() )
{ {
Quantity_Color aColor( (Quantity_NameOfColor)GetColor() ); Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
@ -702,7 +707,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
while ( anActor != NULL ) while ( anActor != NULL )
{ {
SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor ); SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor );
GActor->setIO( myIO ); GActor->setIO( myIO );
if ( aProp ) if ( aProp )
@ -722,9 +727,9 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
GActor->PickableOn(); GActor->PickableOn();
else else
GActor->PickableOff(); GActor->PickableOff();
vtkPrs->AddObject( GActor ); vtkPrs->AddObject( GActor );
anActor = (vtkActor*)theActors->GetNextActor(); anActor = (vtkActor*)theActors->GetNextActor();
} }
@ -748,17 +753,17 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
myViewFrame = GetActiveView(); myViewFrame = GetActiveView();
if ( myViewFrame == 0 ) if ( myViewFrame == 0 )
return 0; return 0;
SALOME_Prs* aPrs = myViewFrame->CreatePrs(); SALOME_Prs* aPrs = myViewFrame->CreatePrs();
if ( aPrs == 0 ) if ( aPrs == 0 )
return 0; return 0;
internalReset(); internalReset();
setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) ); setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) );
myType = theObj->GetType(); myType = theObj->GetType();
// Update presentation // Update presentation
UpdatePrs( aPrs ); UpdatePrs( aPrs );
return aPrs; return aPrs;
} }
@ -793,44 +798,44 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
* GEOM_Displayer::buildPresentation * GEOM_Displayer::buildPresentation
* Builds/finds object's presentation for the current viewer * Builds/finds object's presentation for the current viewer
* Calls corresponding Update() method by means of double dispatch * 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_View* theViewFrame )
{ {
SALOME_Prs* prs = 0; SALOME_Prs* prs = 0;
internalReset(); internalReset();
myViewFrame = theViewFrame ? theViewFrame : GetActiveView(); myViewFrame = theViewFrame ? theViewFrame : GetActiveView();
if ( myViewFrame ) if ( myViewFrame )
{ {
prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 ); prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 );
if ( prs ) if ( prs )
{ {
if ( !theIO.IsNull() ) if ( !theIO.IsNull() )
{ {
// set interactive object // set interactive object
setIO( theIO ); setIO( theIO );
// Find SOBject (because shape should be published previously) // Find SOBject (because shape should be published previously)
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
SUIT_Application* app = session->activeApplication(); SUIT_Application* app = session->activeApplication();
if ( app ) if ( app )
{ {
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ); SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( study ) if ( study )
{ {
_PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) ); _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) );
if ( SO ) if ( SO )
{ {
// get CORBA reference to data object // get CORBA reference to data object
CORBA::Object_var object = dynamic_cast<SALOMEDS_SObject*>(SO.get())->GetObject(); CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
if ( !CORBA::is_nil( object ) ) if ( !CORBA::is_nil( object ) )
{ {
// downcast to GEOM object // downcast to GEOM object
GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object ); GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object );
if ( !GeomObject->_is_nil() ) if ( !GeomObject->_is_nil() )
{ {
// finally set shape // finally set shape
setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) ); setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
@ -875,7 +880,7 @@ void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& the
return; return;
SalomeApp_SelectionMgr* sm = app->selectionMgr(); SalomeApp_SelectionMgr* sm = app->selectionMgr();
// remove all filters from selection // remove all filters from selection
sm->clearFilters(); 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() ); SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() );
vf->LocalSelection( prs, theMode ); vf->LocalSelection( prs, theMode );
delete prs; // delete presentation because displayer is its owner 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() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !app ) if ( !app )
return; return;
SALOME_View* vf = GetActiveView(); SALOME_View* vf = GetActiveView();
if ( vf == 0 ) if ( vf == 0 )
return; return;
// Close local context // Close local context
vf->GlobalSelection( update ); vf->GlobalSelection( update );
@ -934,9 +939,9 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
clearTemporary( sm ); clearTemporary( sm );
//@ aSel->ClearIndex(); //@ aSel->ClearIndex();
sm->clearFilters(); sm->clearFilters();
// Remove filters from AIS_InteractiveContext // Remove filters from AIS_InteractiveContext
Handle(AIS_InteractiveContext) ic; Handle(AIS_InteractiveContext) ic;
SOCC_Viewer* viewer = dynamic_cast<SOCC_Viewer*>( vf ); SOCC_Viewer* viewer = dynamic_cast<SOCC_Viewer*>( vf );
@ -946,7 +951,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
if ( !ic.IsNull() ) if ( !ic.IsNull() )
ic->RemoveFilters(); ic->RemoveFilters();
} }
if ( theModes.Contains( GEOM_ALLOBJECTS ) ) if ( theModes.Contains( GEOM_ALLOBJECTS ) )
return; return;
@ -967,7 +972,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
if ( aFilter ) if ( aFilter )
aListOfFilters.append( aFilter ); aListOfFilters.append( aFilter );
} }
aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR );
} }
else else
@ -994,7 +999,7 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode ) void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
{ {
SALOME_ListIteratorOfListIO Iter( theIOList ); SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() ) for ( ; Iter.More(); Iter.Next() )
LocalSelection( Iter.Value(), theMode ); LocalSelection( Iter.Value(), theMode );
} }
@ -1095,20 +1100,20 @@ bool GEOM_Displayer::ToActivate() const
//================================================================= //=================================================================
/*! /*!
* GEOM_Displayer::clearTemporary * GEOM_Displayer::clearTemporary
* Removes from selection temporary objects * Removes from selection temporary objects
*/ */
//================================================================= //=================================================================
void GEOM_Displayer::clearTemporary( SalomeApp_SelectionMgr* theSelMgr ) void GEOM_Displayer::clearTemporary( SalomeApp_SelectionMgr* theSelMgr )
{ {
SALOME_ListIO selected, toSelect; SALOME_ListIO selected, toSelect;
theSelMgr->selectedObjects( selected ); theSelMgr->selectedObjects( selected );
for ( SALOME_ListIteratorOfListIO it( selected ) ; it.More(); it.Next() ) { for ( SALOME_ListIteratorOfListIO it( selected ) ; it.More(); it.Next() ) {
Handle(SALOME_InteractiveObject) io = it.Value(); 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() ); toSelect.Append( it.Value() );
} }
theSelMgr->setSelectedObjects( toSelect, true ); theSelMgr->setSelectedObjects( toSelect, true );
} }

View File

@ -82,6 +82,40 @@ bool GeometryGUI::InitGeomGen()
return true; 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 // class : CustomItem
// purpose : Set Font to a text. // purpose : Set Font to a text.

View File

@ -1,23 +1,23 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -34,9 +34,18 @@
#include "GEOMGUI.h" #include "GEOMGUI.h"
#include "GEOM_Client.hxx" #include "GEOM_Client.hxx"
#include "SALOME_InteractiveObject.hxx" #include "SALOME_InteractiveObject.hxx"
#include "SALOMEDSClient.hxx"
// QT Includes
#include <qmap.h> #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 #ifdef WNT
#include <SALOME_WNT.hxx> #include <SALOME_WNT.hxx>
@ -63,7 +72,7 @@ class SALOME_WNT_EXPORT GeometryGUI : public SalomeApp_Module
public: public:
// Constructor // Constructor
GeometryGUI(); GeometryGUI();
// Destructor // Destructor
~GeometryGUI(); ~GeometryGUI();
@ -71,15 +80,18 @@ public:
virtual void initialize( CAM_Application* ); virtual void initialize( CAM_Application* );
virtual QString engineIOR() const; 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 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; } GEOM_Client& GetShapeReader() { return myShapeReader; }
Standard_CString& GetFatherior() { return myFatherior; } Standard_CString& GetFatherior() { return myFatherior; }
//void SetState( const int state ) { myState = state; } //void SetState( const int state ) { myState = state; }
//int GetState() const { return myState; } //int GetState() const { return myState; }
// Get active dialog box // Get active dialog box
QDialog* GetActiveDialogBox(){ return myActiveDialogBox; } QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
// Set active dialog box // Set active dialog box
@ -91,7 +103,7 @@ public:
void EmitSignalDefaultStepValueChanged( double newVal ); void EmitSignalDefaultStepValueChanged( double newVal );
void OnGUIEvent( int id ); void OnGUIEvent( int id );
virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* ); virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* ); virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* ); virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
@ -137,10 +149,13 @@ protected:
private: private:
GEOMGUI* getLibrary( const QString& libraryName ); 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 createGeomAction( const int id, const QString& po_id,
void createPopupItem( const int, const QString& clients, const QString& types, const QString& icon_id = QString(""),
const bool isSingle = false, const int isVisible = -1, const int key = 0, const bool toggle = false );
const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 ); 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: private:
static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine
@ -158,4 +173,3 @@ private:
}; };
#endif #endif

View File

@ -59,8 +59,6 @@
#include "utilities.h" #include "utilities.h"
#include "SALOMEDSClient.hxx" #include "SALOMEDSClient.hxx"
#include "SALOMEDS_SObject.hxx"
#include "SALOMEDS_Study.hxx"
// OCCT Includes // OCCT Includes
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>

View 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 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 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@ @CONCLUDE@

View File

@ -1,23 +1,23 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -27,6 +27,7 @@
// $Header$ // $Header$
#include "GEOMToolsGUI.h" #include "GEOMToolsGUI.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "GEOM_Actor.h" #include "GEOM_Actor.h"
#include "GEOMBase.h" #include "GEOMBase.h"
@ -49,28 +50,27 @@
#include <SALOME_ListIteratorOfListIO.hxx> #include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_Prs.h> #include <SALOME_Prs.h>
#include "utilities.h"
// QT Includes
#include <qapplication.h> #include <qapplication.h>
#include <qmap.h> #include <qmap.h>
#include "utilities.h" // OCCT Includes
#include <TCollection_AsciiString.hxx>
using namespace std; using namespace std;
typedef QMap<QString, QString> FilterMap; typedef QMap<QString, QString> FilterMap;
#include <SALOMEDS_SObject.hxx>
//======================================================================= //=======================================================================
// function : getFileName // 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. // the selected file type code through <filter> argument.
//======================================================================= //=======================================================================
static QString getFileName( QWidget* parent, static QString getFileName( QWidget* parent,
const QString& initial, const QString& initial,
const FilterMap& filterMap, const FilterMap& filterMap,
const QString& caption, const QString& caption,
bool open, bool open,
QString& format ) QString& format )
@ -80,7 +80,7 @@ static QString getFileName( QWidget* parent,
for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it )
filters.push_back( it.key() ); 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() ) if ( !caption.isEmpty() )
fd->setCaption( caption ); fd->setCaption( caption );
@ -105,7 +105,7 @@ static QString getFileName( QWidget* parent,
// function : GEOMToolsGUI() // function : GEOMToolsGUI()
// purpose : Constructor // purpose : Constructor
//======================================================================= //=======================================================================
GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent ) GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
: GEOMGUI( parent ) : GEOMGUI( parent )
{ {
} }
@ -122,7 +122,7 @@ GEOMToolsGUI::~GEOMToolsGUI()
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{ {
@ -239,12 +239,12 @@ void GEOMToolsGUI::OnEditDelete()
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warn1 ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return; return;
} }
// VSR 17/11/04: check if all objects selected belong to GEOM component --> start // VSR 17/11/04: check if all objects selected belong to GEOM component --> start
// modifications of ASV 01.06.05 // modifications of ASV 01.06.05
QString parentComp = getParentComponent( aStudy, selected ); QString parentComp = getParentComponent( aStudy, selected );
@ -253,14 +253,14 @@ void GEOMToolsGUI::OnEditDelete()
if ( parentComp != geomComp ) { if ( parentComp != geomComp ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warn1 ( app->desktop(),
QObject::tr("ERR_ERROR"), QObject::tr("ERR_ERROR"),
QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ), QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return; return;
} }
// VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish // 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_WRN_WARNING" ),
QObject::tr( "GEOM_REALLY_DELETE" ), QObject::tr( "GEOM_REALLY_DELETE" ),
QObject::tr( "GEOM_BUT_YES" ), QObject::tr( "GEOM_BUT_YES" ),
@ -269,7 +269,7 @@ void GEOMToolsGUI::OnEditDelete()
// QAD_Operation* op = new SALOMEGUI_ImportOperation(.....); // QAD_Operation* op = new SALOMEGUI_ImportOperation(.....);
// op->start(); // op->start();
// prepare list of SALOME_Views // prepare list of SALOME_Views
QPtrList<SALOME_View> views; QPtrList<SALOME_View> views;
SALOME_View* view; SALOME_View* view;
@ -282,7 +282,7 @@ void GEOMToolsGUI::OnEditDelete()
if ( view ) if ( view )
views.append( view ); views.append( view );
} }
_PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder()); _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
GEOM_Displayer* disp = new GEOM_Displayer( appStudy ); GEOM_Displayer* disp = new GEOM_Displayer( appStudy );
@ -300,59 +300,60 @@ void GEOMToolsGUI::OnEditDelete()
if ( !strcmp( obj->GetIOR().c_str(), geomIOR ) ) if ( !strcmp( obj->GetIOR().c_str(), geomIOR ) )
continue; continue;
// iterate through all childres of obj, find IOR attributes on children and remove shapes that // iterate through all children of obj, find IOR attributes on children
// correspond to these IORs // and remove shapes that correspond to these IORs
for ( _PTR(ChildIterator) it ( aStudy->NewChildIterator( obj ) ); it->More();it->Next() ) { for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
_PTR(SObject) child ( it->Value() ); _PTR(SObject) child (it->Value());
if ( child->FindAttribute( anAttr, "AttributeIOR" ) ) { if (child->FindAttribute(anAttr, "AttributeIOR")) {
_PTR(AttributeIOR) anIOR( anAttr ); _PTR(AttributeIOR) anIOR (anAttr);
// Delete child( s ) shape in Client : // Delete child( s ) shape in Client :
const TCollection_AsciiString ASCior( (char*)anIOR->Value().c_str() ) ; const TCollection_AsciiString ASCior ((char*)anIOR->Value().c_str());
getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCior ); getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCior);
for ( view = views.first(); view; view = views.next() ) { CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(child);
CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(child.get()))->GetObject(); GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow(corbaObj);
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); if (!CORBA::is_nil(geomObj)) {
if ( !CORBA::is_nil( geomObj ) ) for (view = views.first(); view; view = views.next()) {
disp->Erase( geomObj, true, view ); disp->Erase(geomObj, true, view);
} }
}
} }
} // for ( childres of obj ) } // for ( children of obj )
// Erase main graphical object // 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 ); disp->Erase( io, true, view );
// Delete main shape in Client : // Delete main shape in Client :
if ( obj->FindAttribute( anAttr, "AttributeIOR" ) ) { if ( obj->FindAttribute( anAttr, "AttributeIOR" ) ) {
_PTR(AttributeIOR) anIOR( anAttr ); _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 ); getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCIor );
} }
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 // Remove objects from Study
aStudyBuilder->RemoveObject( obj ); aStudyBuilder->RemoveObject( obj );
CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(obj.get()))->GetObject();
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if ( !CORBA::is_nil( geomObj ) )
GeometryGUI::GetGeomGen()->RemoveObject( geomObj );
//deleted = true; //deleted = true;
} // MAIN LOOP of selected } // MAIN LOOP of selected
selected.Clear(); selected.Clear();
aSelMgr->setSelectedObjects( selected ); aSelMgr->setSelectedObjects( selected );
getGeometryGUI()->updateObjBrowser(); getGeometryGUI()->updateObjBrowser();
} // if ( selected not empty ) } // if ( selected not empty )
} // if ( selMgr && appStudy ) } // if ( selMgr && appStudy )
app->updateActions(); //SRN: BugID IPAL9377, case 1 for GEOM module app->updateActions(); //SRN: BugID IPAL9377, case 1 for GEOM module
} // if ( app ) } // if ( app )
// if ( deleted ) // if ( deleted )
// op->finish(); // op->finish();
// else // else
@ -365,8 +366,8 @@ void GEOMToolsGUI::OnEditDelete()
// purpose : // purpose :
//============================================================================== //==============================================================================
void GEOMToolsGUI::OnEditCopy() void GEOMToolsGUI::OnEditCopy()
{ {
/* /*
SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
GEOM::string_array_var listIOR = new GEOM::string_array; GEOM::string_array_var listIOR = new GEOM::string_array;
@ -377,20 +378,20 @@ void GEOMToolsGUI::OnEditCopy()
Sel->ClearIObjects(); Sel->ClearIObjects();
SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); 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++) { for (unsigned int ind = 0; ind < listIOR->length();ind++) {
GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]); GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]);
try { try {
GEOM::GEOM_IInsertOperations_var IOp = myGeom->GetIInsertOperations(aStudyID); 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); myGeomBase->Display(result);
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch (const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex); QtCatchCorbaException(S_ex);
} }
} }
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY"));
*/ */
} }
@ -404,7 +405,7 @@ bool GEOMToolsGUI::Import()
{ {
SUIT_Application* app = getGeometryGUI()->getApp(); SUIT_Application* app = getGeometryGUI()->getApp();
if (! app) return false; if (! app) return false;
SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() ); SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
if ( !stud ) { if ( !stud ) {
cout << "FAILED to cast active study to SalomeApp_Study" << endl; cout << "FAILED to cast active study to SalomeApp_Study" << endl;
@ -415,7 +416,7 @@ bool GEOMToolsGUI::Import()
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warn1 ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
@ -423,9 +424,9 @@ bool GEOMToolsGUI::Import()
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) { if ( CORBA::is_nil( eng ) ) {
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::error1( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr( "GEOM Engine is not started" ), QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
} }
@ -433,7 +434,7 @@ bool GEOMToolsGUI::Import()
GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() ); GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
if ( aInsOp->_is_nil() ) if ( aInsOp->_is_nil() )
return false; return false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
// Obtain a list of available import formats // Obtain a list of available import formats
@ -441,15 +442,15 @@ bool GEOMToolsGUI::Import()
GEOM::string_array_var aFormats, aPatterns; GEOM::string_array_var aFormats, aPatterns;
aInsOp->ImportTranslators( 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] ); aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
QString fileType; QString fileType;
QString file = getFileName(app->desktop(), "", aMap, tr("GEOM_MEN_IMPORT"), true, 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; return false;
GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() ); GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
try { try {
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
@ -458,29 +459,31 @@ bool GEOMToolsGUI::Import()
anOp->start(); anOp->start();
anObj = aInsOp->Import( file.latin1(), fileType.latin1() ); anObj = aInsOp->Import( file.latin1(), fileType.latin1() );
if ( !anObj->_is_nil() && aInsOp->IsDone() ) { if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() ); anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() );
QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true )); QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true ));
GeometryGUI::GetGeomGen()->PublishInStudy(dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy(),
SALOMEDS::SObject::_nil(), SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy(aStudy);
anObj, GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy,
aPublishObjName ); SALOMEDS::SObject::_nil(),
anObj,
aPublishObjName);
GEOM_Displayer( stud ).Display( anObj.in() ); GEOM_Displayer( stud ).Display( anObj.in() );
// update data model and object browser // update data model and object browser
getGeometryGUI()->updateObjBrowser( true ); getGeometryGUI()->updateObjBrowser( true );
anOp->commit(); anOp->commit();
} }
else { else {
anOp->abort(); anOp->abort();
wc.suspend(); wc.suspend();
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::error1( app->desktop(),
QObject::tr( "GEOM_ERROR" ), 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") ); QObject::tr("BUT_OK") );
} }
} }
@ -502,23 +505,23 @@ bool GEOMToolsGUI::Export()
{ {
SalomeApp_Application* app = getGeometryGUI()->getApp(); SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false; if (!app) return false;
SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() ); SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
if ( !stud ) { if ( !stud ) {
cout << "FAILED to cast active study to SalomeApp_Study" << endl; cout << "FAILED to cast active study to SalomeApp_Study" << endl;
return false; return false;
} }
_PTR(Study) aStudy = stud->studyDS(); _PTR(Study) aStudy = stud->studyDS();
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) { if ( CORBA::is_nil( eng ) ) {
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::error1( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr( "GEOM Engine is not started" ), QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return false; return false;
} }
GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() ); GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
if ( aInsOp->_is_nil() ) if ( aInsOp->_is_nil() )
return false; return false;
@ -527,7 +530,7 @@ bool GEOMToolsGUI::Export()
FilterMap aMap; FilterMap aMap;
GEOM::string_array_var aFormats, aPatterns; GEOM::string_array_var aFormats, aPatterns;
aInsOp->ExportTranslators( 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] ); aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
// Get selected objects // Get selected objects
@ -546,21 +549,21 @@ bool GEOMToolsGUI::Export()
if ( !found || anObj->_is_nil() ) if ( !found || anObj->_is_nil() )
continue; continue;
QString fileType; 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); tr("GEOM_MEN_EXPORT"), false, fileType);
// User has pressed "Cancel" --> stop the operation // User has pressed "Cancel" --> stop the operation
if ( file.isEmpty() || fileType.isEmpty() ) if ( file.isEmpty() || fileType.isEmpty() )
return false; return false;
GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() ); GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
try { try {
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( file, /*withExten=*/true )) ); app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( file, /*withExten=*/true )) );
anOp->start(); anOp->start();
@ -572,21 +575,21 @@ bool GEOMToolsGUI::Export()
{ {
anOp->abort(); anOp->abort();
wc.suspend(); wc.suspend();
SUIT_MessageBox::error1( app->desktop(), SUIT_MessageBox::error1( app->desktop(),
QObject::tr( "GEOM_ERROR" ), 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") ); QObject::tr("BUT_OK") );
return false; return false;
} }
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch (const SALOME::SALOME_Exception& S_ex) {
//QtCatchCorbaException(S_ex); //QtCatchCorbaException(S_ex);
anOp->abort(); anOp->abort();
return false; 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() ) { for ( SALOME_ListIteratorOfListIO it( iobjs ); it.More(); it.Next() ) {
Handle(SALOME_InteractiveObject) io = it.Value(); Handle(SALOME_InteractiveObject) io = it.Value();
if ( !io->hasEntry() ) if ( !io->hasEntry() )
continue; continue;
QString compName = getParentComponent( study->FindObjectID( io->getEntry() ) ); QString compName = getParentComponent( study->FindObjectID( io->getEntry() ) );

View File

@ -1,23 +1,23 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -32,9 +32,9 @@
#include "GEOMGUI.h" #include "GEOMGUI.h"
#include <SALOMEDSClient.hxx> #include <SALOMEDSClient.hxx>
#include <SALOMEDS_Study.hxx>
#include <SALOME_ListIO.hxx> #include <SALOME_ListIO.hxx>
#include <CORBA.h>
//================================================================================= //=================================================================================
// class : GEOMToolsGUI // class : GEOMToolsGUI
@ -51,8 +51,8 @@ public :
private: private:
// Import and export topology methods // Import and export topology methods
bool Import(); bool Import();
bool Export(); bool Export();
void OnEditCopy(); void OnEditCopy();
void OnEditDelete(); void OnEditDelete();
@ -69,7 +69,7 @@ private:
void OnOpen(); void OnOpen();
// returns name of Module (Component) of given objects (usually selected objects) // 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( Study ), const SALOME_ListIO& );
QString getParentComponent( _PTR(SObject) ); QString getParentComponent( _PTR(SObject) );
}; };

View File

@ -1,25 +1,25 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org // See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
//
// //
//
// //
// File : GEOMToolsGUI_1.cxx // File : GEOMToolsGUI_1.cxx
// Author : Sergey ANIKIN // Author : Sergey ANIKIN
@ -29,13 +29,15 @@
#include <PythonConsole_PyConsole.h> #include <PythonConsole_PyConsole.h>
#include "GEOMToolsGUI.h" #include "GEOMToolsGUI.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
#include "GEOMToolsGUI_TransparencyDlg.h" #include "GEOMToolsGUI_TransparencyDlg.h"
#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement #include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement
#include "GEOMToolsGUI_NameDlg.h" #include "GEOMToolsGUI_NameDlg.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
#include <SALOME_ListIO.hxx> #include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx> #include <SALOME_ListIteratorOfListIO.hxx>
@ -59,11 +61,17 @@
#include <SalomeApp_Study.h> #include <SalomeApp_Study.h>
#include <SalomeApp_Module.h> #include <SalomeApp_Module.h>
#include "SALOMEDSClient.hxx"
#include "utilities.h"
// OCCT Includes
#include <AIS_Drawer.hxx> #include <AIS_Drawer.hxx>
#include <AIS_ListOfInteractive.hxx> #include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx> #include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_IsoAspect.hxx> #include <Prs3d_IsoAspect.hxx>
// VTK Includes
#include <vtkBMPReader.h> #include <vtkBMPReader.h>
#include <vtkTexture.h> #include <vtkTexture.h>
#include <vtkTextureMapToPlane.h> #include <vtkTextureMapToPlane.h>
@ -71,19 +79,14 @@
#include <vtkDataSetMapper.h> #include <vtkDataSetMapper.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
// QT Includes
#include <qfileinfo.h> #include <qfileinfo.h>
#include <qcolordialog.h> #include <qcolordialog.h>
#include <qspinbox.h> #include <qspinbox.h>
#include <qapplication.h> #include <qapplication.h>
#include "utilities.h"
using namespace std; using namespace std;
#include "SALOMEDSClient.hxx"
#include "SALOMEDS_Study.hxx"
void GEOMToolsGUI::OnSettingsColor() void GEOMToolsGUI::OnSettingsColor()
{ {
@ -92,14 +95,14 @@ void GEOMToolsGUI::OnSettingsColor()
SUIT_Desktop* desk = sess->activeApplication()->desktop(); SUIT_Desktop* desk = sess->activeApplication()->desktop();
QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) ); QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) );
QColor aDialogColor = QColorDialog::getColor(anInitColor, desk ); QColor aDialogColor = QColorDialog::getColor(anInitColor, desk );
if( aDialogColor.isValid() ) if( aDialogColor.isValid() )
{ {
QString type = desk->activeWindow()->getViewManager()->getType(); QString type = desk->activeWindow()->getViewManager()->getType();
if( type != OCCViewer_Viewer::Type() && type != VTKViewer_Viewer::Type() ) if( type != OCCViewer_Viewer::Type() && type != VTKViewer_Viewer::Type() )
MESSAGE("Settings Color is not supported for current Viewer"); MESSAGE("Settings Color is not supported for current Viewer");
resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor ); resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor );
} }
} }
@ -116,25 +119,25 @@ void GEOMToolsGUI::OnSettingsIsos()
if ( type != OCCViewer_Viewer::Type() ) if ( type != OCCViewer_Viewer::Type() )
return; return;
OCCViewer_Viewer* vm = (OCCViewer_Viewer*)vman->getViewModel(); OCCViewer_Viewer* vm = (OCCViewer_Viewer*)vman->getViewModel();
Handle (AIS_InteractiveContext) ic = vm->getAISContext(); Handle (AIS_InteractiveContext) ic = vm->getAISContext();
int IsoU = resMgr->integerValue( "Geometry:SettingsIsoU", 1 ); int IsoU = resMgr->integerValue( "Geometry:SettingsIsoU", 1 );
int IsoV = resMgr->integerValue( "Geometry:SettingsIsoV", 1 ); int IsoV = resMgr->integerValue( "Geometry:SettingsIsoV", 1 );
ic->DefaultDrawer()->UIsoAspect()->SetNumber( IsoU ); ic->DefaultDrawer()->UIsoAspect()->SetNumber( IsoU );
ic->DefaultDrawer()->VIsoAspect()->SetNumber( IsoV ); 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->SpinBoxU->setValue(IsoU);
NbIsosDlg->SpinBoxV->setValue(IsoV); NbIsosDlg->SpinBoxV->setValue(IsoV);
if(NbIsosDlg->exec()) { if(NbIsosDlg->exec()) {
IsoU = NbIsosDlg->SpinBoxU->text().toInt(); IsoU = NbIsosDlg->SpinBoxU->text().toInt();
IsoV = NbIsosDlg->SpinBoxV->text().toInt(); IsoV = NbIsosDlg->SpinBoxV->text().toInt();
ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso); ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso);
ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso); ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso);
resMgr->setValue("Geometry:SettingsIsoU", isoU); 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); 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) { if(res) {
resMgr->setValue( "Geometry", "SettingsGeomStep", dd ); resMgr->setValue( "Geometry", "SettingsGeomStep", dd );
/* Emit signal to GeometryGUI_SpinBoxes */ /* Emit signal to GeometryGUI_SpinBoxes */
getGeometryGUI()->EmitSignalDefaultStepValueChanged( dd ); getGeometryGUI()->EmitSignalDefaultStepValueChanged( dd );
} }
@ -177,21 +180,21 @@ void GEOMToolsGUI::OnRename()
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(), SUIT_MessageBox::warn1 ( app->desktop(),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") ); QObject::tr("BUT_OK") );
return; return;
} }
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr; _PTR(GenericAttribute) anAttr;
if ( obj ) { if ( obj ) {
if( obj->FindAttribute(anAttr, "AttributeName") ) { if( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName (anAttr); _PTR(AttributeName) aName (anAttr);
QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() ); QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if ( !newName.isEmpty() ) { if ( !newName.isEmpty() ) {
aName->SetValue( newName.latin1() ); // rename the SObject 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() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
PythonConsole* pyConsole = app->pythonConsole(); PythonConsole* pyConsole = app->pythonConsole();
if(pyConsole) if(pyConsole)
pyConsole->exec("from GEOM_usinggeom import *"); pyConsole->exec("from GEOM_usinggeom import *");
} }
@ -282,36 +285,36 @@ void GEOMToolsGUI::OnNbIsos()
if ( !isOCC ) if ( !isOCC )
return; return;
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() ); OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext(); Handle (AIS_InteractiveContext) ic = vm->getAISContext();
ic->InitCurrent(); ic->InitCurrent();
if ( ic->MoreCurrent() ) { if ( ic->MoreCurrent() ) {
Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
int UIso = CurDrawer->UIsoAspect()->Number(); int UIso = CurDrawer->UIsoAspect()->Number();
int VIso = CurDrawer->VIsoAspect()->Number(); int VIso = CurDrawer->VIsoAspect()->Number();
GEOMToolsGUI_NbIsosDlg * NbIsosDlg = GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
NbIsosDlg->setU( UIso ); NbIsosDlg->setU( UIso );
NbIsosDlg->setV( VIso ); NbIsosDlg->setV( VIso );
if ( NbIsosDlg->exec() ) { if ( NbIsosDlg->exec() ) {
SUIT_OverrideCursor(); SUIT_OverrideCursor();
for(; ic->MoreCurrent(); ic->NextCurrent()) { for(; ic->MoreCurrent(); ic->NextCurrent()) {
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
int nbUIso = NbIsosDlg->getU(); int nbUIso = NbIsosDlg->getU();
int nbVIso = NbIsosDlg->getV(); int nbVIso = NbIsosDlg->getV();
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) ); 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) ); CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
ic->SetLocalAttributes(CurObject, CurDrawer); ic->SetLocalAttributes(CurObject, CurDrawer);
ic->Redisplay(CurObject); ic->Redisplay(CurObject);
} }
@ -343,12 +346,12 @@ void GEOMToolsGUI::OnOpen()
useSubItems = true; useSubItems = true;
obj = subobj; obj = subobj;
} }
else else
anIter->Next(); anIter->Next();
} }
obj->FindAttribute(anAttr, "AttributePersistentRef"); obj->FindAttribute(anAttr, "AttributePersistentRef");
while(useSubItems?anIter->More():!anAttr->_is_nil()) { while(useSubItems?anIter->More():!anAttr->_is_nil()) {
if(!obj->FindAttribute(anAttr, "AttributeIOR") && if(!obj->FindAttribute(anAttr, "AttributeIOR") &&
obj->FindAttribute(anAttr, "AttributePersistentRef")) { obj->FindAttribute(anAttr, "AttributePersistentRef")) {
_PTR(SComponent) FComp ( obj->GetFatherComponent() ); _PTR(SComponent) FComp ( obj->GetFatherComponent() );
@ -376,7 +379,7 @@ void GEOMToolsGUI::OnOpen()
} else { } else {
return; return;
} }
} }
else { else {
MESSAGE("loadComponentData(): Driver is null"); MESSAGE("loadComponentData(): Driver is null");
return; return;
@ -394,7 +397,7 @@ void GEOMToolsGUI::OnOpen()
// SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); // SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
// if (!CORBA::is_nil(SC)) // if (!CORBA::is_nil(SC))
// aStudyBuilder->LoadWith(SC,driver); // aStudyBuilder->LoadWith(SC,driver);
} }
} }
else { else {
MESSAGE("Component is null"); MESSAGE("Component is null");
@ -403,8 +406,8 @@ void GEOMToolsGUI::OnOpen()
if(useSubItems) { if(useSubItems) {
anIter->Next(); anIter->Next();
obj.reset( anIter->Value() ); obj.reset( anIter->Value() );
} }
else else
anAttr = NULL; anAttr = NULL;
} }
} }

View File

@ -7,7 +7,7 @@
#include "GEOM_Gen_i.hh" #include "GEOM_Gen_i.hh"
#include "GEOM_Object_i.hh" #include "GEOM_Object_i.hh"
#include <strstream> #include <strstream>
#include "Utils_CorbaException.hxx" #include "Utils_CorbaException.hxx"
#include "OpUtil.hxx" #include "OpUtil.hxx"
@ -33,16 +33,16 @@
//============================================================================ //============================================================================
// function : GEOM_Gen_i() // 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, GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId, PortableServer::ObjectId * contId,
const char *instanceName, const char *instanceName,
const char *interfaceName) : const char *interfaceName) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName) Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
{ {
_thisObj = this ; _thisObj = this;
_id = _poa->activate_object(_thisObj); _id = _poa->activate_object(_thisObj);
name_service = new SALOME_NamingService(_orb); 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, char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
const char* aLocalPersistentID, const char* aLocalPersistentID,
CORBA::Boolean isMultiFile, CORBA::Boolean isMultiFile,
CORBA::Boolean isASCII) CORBA::Boolean isASCII)
{ {
SALOMEDS::Study_var aStudy = theSObject->GetStudy(); SALOMEDS::Study_var aStudy = theSObject->GetStudy();
Handle(GEOM_Object) anObject = _impl->GetObject(aStudy->StudyId(), const_cast<char*>(aLocalPersistentID)); Handle(GEOM_Object) anObject = _impl->GetObject(aStudy->StudyId(), const_cast<char*>(aLocalPersistentID));
TCollection_AsciiString anEntry; TCollection_AsciiString anEntry;
TDF_Tool::Entry(anObject->GetEntry(), anEntry); TDF_Tool::Entry(anObject->GetEntry(), anEntry);
GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString()); GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString());
CORBA::String_var aPersRefString = _orb->object_to_string(obj); CORBA::String_var aPersRefString = _orb->object_to_string(obj);
@ -103,7 +103,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
//============================================================================ //============================================================================
// function : CanPublishInStudy // function : CanPublishInStudy
// purpose : // purpose :
//============================================================================ //============================================================================
bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
{ {
@ -114,7 +114,7 @@ bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
//============================================================================ //============================================================================
// function : PublishInStudy // function : PublishInStudy
// purpose : // purpose :
//============================================================================ //============================================================================
SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject, 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; if(aShape->_is_nil()) return aResultSO;
SALOMEDS::GenericAttribute_var anAttr; 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()) { if (aFather->_is_nil()) {
aFather = aStudyBuilder->NewComponent("GEOM"); aFather = aStudyBuilder->NewComponent("GEOM");
anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName"); 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()); aStudyBuilder->DefineComponentInstance(aFather, GEOM_Gen::_this());
} }
if (aFather->_is_nil()) return aResultSO; if (aFather->_is_nil()) return aResultSO;
if (CORBA::is_nil(theSObject)) { if (CORBA::is_nil(theSObject)) {
aResultSO = aStudyBuilder->NewObject(aFather); aResultSO = aStudyBuilder->NewObject(aFather);
} else { } 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 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); //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"); anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
TCollection_AsciiString aShapeName("Shape_"); TCollection_AsciiString aShapeName("Shape_");
if ( aShape->GetType() == GEOM_GROUP ) { if ( aShape->GetType() == GEOM_GROUP ) {
GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() ); 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 ) { } else if ( aShape->GetShapeType() == GEOM::VERTEX ) {
aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
aShapeName = "Vertex_"; aShapeName = "Vertex_";
} }
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); //if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
//else aShapeName = TCollection_AsciiString(strdup(theName)); //else aShapeName = TCollection_AsciiString(strdup(theName));
@ -221,7 +221,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
do { do {
aNewShapeName = aShapeName + TCollection_AsciiString(++i); aNewShapeName = aShapeName + TCollection_AsciiString(++i);
obj = theStudy->FindObject( aNewShapeName.ToCString() ); obj = theStudy->FindObject( aNewShapeName.ToCString() );
} }
while ( !obj->_is_nil() ); while ( !obj->_is_nil() );
aShapeName = aNewShapeName; aShapeName = aNewShapeName;
} }
@ -239,7 +239,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
return aResultSO._retn(); return aResultSO._retn();
} }
//============================================================================ //============================================================================
// function : Save() // function : Save()
// purpose : save OCAF/Geom document // purpose : save OCAF/Geom document
@ -276,7 +276,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
//============================================================================ //============================================================================
// function : SaveASCII() // function : SaveASCII()
// purpose : // purpose :
//============================================================================ //============================================================================
SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
const char* theURL, const char* theURL,
bool isMultiFile) { bool isMultiFile) {
@ -288,7 +288,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
//============================================================================ //============================================================================
// function : Load() // function : Load()
// purpose : // purpose :
//============================================================================ //============================================================================
CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream, const SALOMEDS::TMPFile& theStream,
const char* theURL, const char* theURL,
@ -327,7 +327,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
//============================================================================ //============================================================================
// function : LoadASCII() // function : LoadASCII()
// purpose : // purpose :
//============================================================================ //============================================================================
CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream, const SALOMEDS::TMPFile& theStream,
const char* theURL, 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(); if (anObject->_is_nil()) return aStreamFile._retn();
aStreamFile = anObject->GetShapeStream(); aStreamFile = anObject->GetShapeStream();
// Assign an ID the type of GEOM_Object // Assign an ID the type of GEOM_Object
theObjectID = anObject->GetType(); theObjectID = anObject->GetType();
@ -416,21 +416,21 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
} catch (Standard_Failure) { } catch (Standard_Failure) {
return false; return false;
} }
// SObject of the created shape is theObject or new Child of Component if theObject == geom component // SObject of the created shape is theObject or new Child of Component if theObject == geom component
SALOMEDS::SObject_var aNewSO; SALOMEDS::SObject_var aNewSO;
if (strcmp(theObject->GetFatherComponent()->GetID(),theObject->GetID()) == 0) { if (strcmp(theObject->GetFatherComponent()->GetID(),theObject->GetID()) == 0) {
aNewSO = aStudyBuilder->NewObject(theObject); aNewSO = aStudyBuilder->NewObject(theObject);
} else aNewSO = SALOMEDS::SObject::_duplicate(theObject); } else aNewSO = SALOMEDS::SObject::_duplicate(theObject);
//Create a new GEOM_Object //Create a new GEOM_Object
Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID); Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF); Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
aFunction->SetValue(aTopology); aFunction->SetValue(aTopology);
TCollection_AsciiString anEntry; TCollection_AsciiString anEntry;
TDF_Tool::Entry(anObj->GetEntry(), anEntry); TDF_Tool::Entry(anObj->GetEntry(), anEntry);
GEOM::GEOM_Object_var obj = GetObject(anObj->GetDocID(), anEntry.ToCString()); 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 // 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; SALOMEDS::SObject_var aResultSO;
if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO; if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
char* IOR; char* IOR;
if(!theFather->_is_nil()) { if(!theFather->_is_nil()) {
IOR = _orb->object_to_string(theFather); IOR = _orb->object_to_string(theFather);
SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR); SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR);
if(aFatherSO->_is_nil()) return aResultSO._retn(); if(aFatherSO->_is_nil()) return aResultSO._retn();
aResultSO = aStudyBuilder->NewObject(aFatherSO); aResultSO = aStudyBuilder->NewObject(aFatherSO);
//aStudyBuilder->Addreference(aResultSO, aResultSO); //aStudyBuilder->Addreference(aResultSO, aResultSO);
} }
aResultSO = PublishInStudy(theStudy, aResultSO, theObject, theName); aResultSO = PublishInStudy(theStudy, aResultSO, theObject, theName);
if(aResultSO->_is_nil()) return aResultSO._retn(); if(aResultSO->_is_nil()) return aResultSO._retn();
GEOM::ListOfGO_var aList = theObject->GetDependency(); GEOM::ListOfGO_var aList = theObject->GetDependency();
Standard_Integer aLength = aList->length(); Standard_Integer aLength = aList->length();
if(aLength < 1) return aResultSO._retn(); if(aLength < 1) return aResultSO._retn();
//Publish the arguments //Publish the arguments
for(Standard_Integer i = 0; i< aLength; i++) { for(Standard_Integer i = 0; i< aLength; i++) {
GEOM::GEOM_Object_var anObject = aList[i]; GEOM::GEOM_Object_var anObject = aList[i];
if(anObject->_is_nil()) continue; 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); SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
aStudyBuilder->Addreference(aSubSO, aSO); aStudyBuilder->Addreference(aSubSO, aSO);
} }
return aResultSO._retn(); return aResultSO._retn();
} }
//============================================================================ //============================================================================
// function : register() // function : register()
// purpose : register 'name' in 'name_service' // purpose : register 'name' in 'name_service'
//============================================================================ //============================================================================
void GEOM_Gen_i::register_name(char * name) void GEOM_Gen_i::register_name(char * name)
{ {
GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this()); 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 // function : GetIBasicOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theStudyID) GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -530,19 +530,19 @@ GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theS
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIBasicOperations" ); MESSAGE( "GEOM_Gen_i::GetIBasicOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IBasicOperations_i* aServant = GEOM_IBasicOperations_i* aServant =
new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID)); new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IBasicOperations_var operations = aServant->_this(); GEOM::GEOM_IBasicOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetITransformOperations // function : GetITransformOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::Long theStudyID) GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -550,19 +550,19 @@ GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::L
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetITransformOperations" ); MESSAGE( "GEOM_Gen_i::GetITransformOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_ITransformOperations_i* aServant = GEOM_ITransformOperations_i* aServant =
new GEOM_ITransformOperations_i(_poa, engine, _impl->GetITransformOperations(theStudyID)); new GEOM_ITransformOperations_i(_poa, engine, _impl->GetITransformOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_ITransformOperations_var operations = aServant->_this(); GEOM::GEOM_ITransformOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetI3DPrimOperations // function : GetI3DPrimOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long theStudyID) GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -570,19 +570,19 @@ GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long th
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetI3DPrimOperations" ); MESSAGE( "GEOM_Gen_i::GetI3DPrimOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_I3DPrimOperations_i* aServant = GEOM_I3DPrimOperations_i* aServant =
new GEOM_I3DPrimOperations_i(_poa, engine, _impl->GetI3DPrimOperations(theStudyID)); new GEOM_I3DPrimOperations_i(_poa, engine, _impl->GetI3DPrimOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_I3DPrimOperations_var operations = aServant->_this(); GEOM::GEOM_I3DPrimOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIShapesOperations // function : GetIShapesOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long theStudyID) GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -590,19 +590,19 @@ GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long th
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIShapesOperations" ); MESSAGE( "GEOM_Gen_i::GetIShapesOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IShapesOperations_i* aServant = GEOM_IShapesOperations_i* aServant =
new GEOM_IShapesOperations_i(_poa, engine, _impl->GetIShapesOperations(theStudyID)); new GEOM_IShapesOperations_i(_poa, engine, _impl->GetIShapesOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IShapesOperations_var operations = aServant->_this(); GEOM::GEOM_IShapesOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIBlocksOperations // function : GetIBlocksOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long theStudyID) GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -610,19 +610,19 @@ GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long th
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIBlocksOperations" ); MESSAGE( "GEOM_Gen_i::GetIBlocksOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IBlocksOperations_i* aServant = GEOM_IBlocksOperations_i* aServant =
new GEOM_IBlocksOperations_i(_poa, engine, _impl->GetIBlocksOperations(theStudyID)); new GEOM_IBlocksOperations_i(_poa, engine, _impl->GetIBlocksOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IBlocksOperations_var operations = aServant->_this(); GEOM::GEOM_IBlocksOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIBooleanOperations // function : GetIBooleanOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long theStudyID) GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -630,19 +630,19 @@ GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIBooleanOperations" ); MESSAGE( "GEOM_Gen_i::GetIBooleanOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IBooleanOperations_i* aServant = GEOM_IBooleanOperations_i* aServant =
new GEOM_IBooleanOperations_i(_poa, engine, _impl->GetIBooleanOperations(theStudyID)); new GEOM_IBooleanOperations_i(_poa, engine, _impl->GetIBooleanOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IBooleanOperations_var operations = aServant->_this(); GEOM::GEOM_IBooleanOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetICurvesOperations // function : GetICurvesOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long theStudyID) GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -650,19 +650,19 @@ GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long th
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetICurvesOperations" ); MESSAGE( "GEOM_Gen_i::GetICurvesOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_ICurvesOperations_i* aServant = GEOM_ICurvesOperations_i* aServant =
new GEOM_ICurvesOperations_i(_poa, engine, _impl->GetICurvesOperations(theStudyID)); new GEOM_ICurvesOperations_i(_poa, engine, _impl->GetICurvesOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_ICurvesOperations_var operations = aServant->_this(); GEOM::GEOM_ICurvesOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetILocalOperations // function : GetILocalOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theStudyID) GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -670,19 +670,19 @@ GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theS
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetILocalOperations" ); MESSAGE( "GEOM_Gen_i::GetILocalOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_ILocalOperations_i* aServant = GEOM_ILocalOperations_i* aServant =
new GEOM_ILocalOperations_i(_poa, engine, _impl->GetILocalOperations(theStudyID)); new GEOM_ILocalOperations_i(_poa, engine, _impl->GetILocalOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_ILocalOperations_var operations = aServant->_this(); GEOM::GEOM_ILocalOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIHealingOperations // function : GetIHealingOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long theStudyID) GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -690,19 +690,19 @@ GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::IHealingOperations" ); MESSAGE( "GEOM_Gen_i::IHealingOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IHealingOperations_i* aServant = GEOM_IHealingOperations_i* aServant =
new GEOM_IHealingOperations_i(_poa, engine, _impl->GetIHealingOperations(theStudyID)); new GEOM_IHealingOperations_i(_poa, engine, _impl->GetIHealingOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IHealingOperations_var operations = aServant->_this(); GEOM::GEOM_IHealingOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIInsertOperations // function : GetIInsertOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long theStudyID) GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -710,19 +710,19 @@ GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long th
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIInsertOperations" ); MESSAGE( "GEOM_Gen_i::GetIInsertOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IInsertOperations_i* aServant = GEOM_IInsertOperations_i* aServant =
new GEOM_IInsertOperations_i(_poa, engine, _impl->GetIInsertOperations(theStudyID)); new GEOM_IInsertOperations_i(_poa, engine, _impl->GetIInsertOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IInsertOperations_var operations = aServant->_this(); GEOM::GEOM_IInsertOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIMeasureOperations // function : GetIMeasureOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long theStudyID) GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -730,19 +730,19 @@ GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIMeasureOperations" ); MESSAGE( "GEOM_Gen_i::GetIMeasureOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IMeasureOperations_i* aServant = GEOM_IMeasureOperations_i* aServant =
new GEOM_IMeasureOperations_i(_poa, engine, _impl->GetIMeasureOperations(theStudyID)); new GEOM_IMeasureOperations_i(_poa, engine, _impl->GetIMeasureOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IMeasureOperations_var operations = aServant->_this(); GEOM::GEOM_IMeasureOperations_var operations = aServant->_this();
return operations._retn(); return operations._retn();
} }
//============================================================================ //============================================================================
// function : GetIGroupOperations // function : GetIGroupOperations
// purpose : // purpose :
//============================================================================ //============================================================================
GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theStudyID) GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
@ -750,12 +750,12 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIGroupOperations" ); MESSAGE( "GEOM_Gen_i::GetIGroupOperations" );
GEOM::GEOM_Gen_ptr engine = _this(); GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IGroupOperations_i* aServant = GEOM_IGroupOperations_i* aServant =
new GEOM_IGroupOperations_i(_poa, engine, _impl->GetIGroupOperations(theStudyID)); new GEOM_IGroupOperations_i(_poa, engine, _impl->GetIGroupOperations(theStudyID));
// activate the CORBA servant // activate the CORBA servant
GEOM::GEOM_IGroupOperations_var operations = aServant->_this(); GEOM::GEOM_IGroupOperations_var operations = aServant->_this();
return operations._retn(); 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(); if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil();
Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry());
if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil(); if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil();
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length()); 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]); 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 * 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()); Handle(GEOM_Object) anObject = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
if (anObject.IsNull()) return; if (anObject.IsNull()) return;
_impl->RemoveObject(anObject); _impl->RemoveObject(anObject);
return; return;
} }
//================================================================================= //=================================================================================
@ -815,34 +815,35 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) {
if(strcmp(stringIOR,"") != 0){ if(strcmp(stringIOR,"") != 0){
CORBA::Object_var anObject = _orb->string_to_object(stringIOR); CORBA::Object_var anObject = _orb->string_to_object(stringIOR);
if(!CORBA::is_nil(anObject)) 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() // 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; GEOM::GEOM_Object_var obj;
Handle(GEOM_Object) handle_object = _impl->GetObject(theStudyID, (char*)theEntry); 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) { TCollection_AsciiString stringIOR = handle_object->GetIOR();
CORBA::Object_var corba_object = _orb->string_to_object(stringIOR.ToCString()); if (stringIOR.Length() > 1) {
if(!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object); CORBA::Object_var corba_object = _orb->string_to_object(stringIOR.ToCString());
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(); obj = servant->_this();
stringIOR = _orb->object_to_string(obj); stringIOR = _orb->object_to_string(obj);
handle_object->SetIOR(stringIOR); 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" extern "C"
{ {
PortableServer::ObjectId * GEOMEngine_factory(CORBA::ORB_ptr orb, PortableServer::ObjectId * GEOMEngine_factory(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId, PortableServer::ObjectId * contId,
const char *instanceName, const char *instanceName,
const char * interfaceName) const char * interfaceName)
{ {
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, 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 myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
return myGEOM_Gen_i->getId() ; return myGEOM_Gen_i->getId();
} }
} }

View File

@ -6,16 +6,14 @@
// IDL headers // IDL headers
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen) #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 "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_IBasicOperations_i.hh"
#include "GEOM_ITransformOperations_i.hh" #include "GEOM_ITransformOperations_i.hh"
#include "GEOM_I3DPrimOperations_i.hh" #include "GEOM_I3DPrimOperations_i.hh"
@ -29,6 +27,8 @@
#include "GEOM_IMeasureOperations_i.hh" #include "GEOM_IMeasureOperations_i.hh"
#include "GEOM_IGroupOperations_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 // 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 / Destructor //
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
// constructor to be called for servant creation.
// constructor to be called for servant creation.
GEOM_Gen_i(); GEOM_Gen_i();
GEOM_Gen_i(CORBA::ORB_ptr orb, GEOM_Gen_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId, PortableServer::ObjectId * contId,
const char *instanceName, const char *instanceName,
const char *interfaceName); const char *interfaceName);
// destructor, doing nothing (for now) // 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 // // Inherited methods from SALOMEDS::Driver //
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
const char* theURL, 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, SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
const char* theURL, const char* theURL,
bool isMultiFile); bool isMultiFile);
CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent, CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream, const SALOMEDS::TMPFile& theStream,
const char* theURL, const char* theURL,
@ -103,13 +104,18 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
CORBA::Long theObjectID, CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject); SALOMEDS::SObject_ptr theObject);
//Adds theObject in the study with a name = theName, if theFather is not null the object is placed under theFather /*! \brief Adds theObject in the study with a name = theName, if
SALOMEDS::SObject_ptr AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM::GEOM_Object_ptr theObject, const char* theName, GEOM::GEOM_Object_ptr theFather); * 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 //Undos one transaction in the document associated with theStudyID
virtual void Undo(CORBA::Long 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 // // Operations methods //
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
//Returns a pointer to BasicOperations interface //Returns a pointer to BasicOperations interface
virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID) virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
//Returns a pointer to TransformOperations interface //Returns a pointer to TransformOperations interface
virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID) virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
throw (SALOME::SALOME_Exception); 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); throw (SALOME::SALOME_Exception);
//Adds a new sub shape //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); 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 GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
CORBA::Boolean isPublished, CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript); CORBA::Boolean& isValidScript);
char* GetDumpName (const char* theStudyEntry); char* GetDumpName (const char* theStudyEntry);
GEOM::string_array* GetAllDumpNames(); GEOM::string_array* GetAllDumpNames();
//********************************************************************************************************// //-----------------------------------------------------------------------//
// Internal methods // Internal methods //
//********************************************************************************************************// //-----------------------------------------------------------------------//
virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry); virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
private: private:
::GEOMImpl_Gen* _impl; ::GEOMImpl_Gen* _impl;
SALOME_NamingService * name_service; SALOME_NamingService * name_service;
char * _name; char * _name;
}; };
#endif #endif

View File

@ -36,7 +36,7 @@ GEOM_ICurvesOperations_i::~GEOM_ICurvesOperations_i()
/*! /*!
* MakeCirclePntVecR * MakeCirclePntVecR
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR
(GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
CORBA::Double theR) CORBA::Double theR)
@ -69,7 +69,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR
/*! /*!
* MakeCircleThreePnt * MakeCircleThreePnt
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt
(GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3) GEOM::GEOM_Object_ptr thePnt3)
@ -104,7 +104,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt
/*! /*!
* MakeEllipse * MakeEllipse
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
(GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
CORBA::Double theRMajor, double theRMinor) CORBA::Double theRMajor, double theRMinor)
@ -137,7 +137,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
/*! /*!
* MakeArc * MakeArc
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc
(GEOM::GEOM_Object_ptr thePnt1, (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt2,
@ -173,7 +173,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc
/*! /*!
* MakePolyline * MakePolyline
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline
(const GEOM::ListOfGO& thePoints) (const GEOM::ListOfGO& thePoints)
{ {
@ -209,7 +209,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline
/*! /*!
* MakeSplineBezier * MakeSplineBezier
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier
(const GEOM::ListOfGO& thePoints) (const GEOM::ListOfGO& thePoints)
{ {
@ -245,7 +245,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier
/*! /*!
* MakeSplineInterpolation * MakeSplineInterpolation
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
(const GEOM::ListOfGO& thePoints) (const GEOM::ListOfGO& thePoints)
{ {
@ -281,10 +281,11 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
/*! /*!
* MakeSketcher * 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 //Set a not done flag
GetOperations()->SetNotDone(); GetOperations()->SetNotDone();
@ -297,9 +298,10 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCom
// Make Sketcher // Make Sketcher
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeSketcher(theCommand, aWorkingPlane); GetOperations()->MakeSketcher(strdup(theCommand), aWorkingPlane);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); //return aGEOMObject._retn();
return GEOM::GEOM_Object::_nil();
return GetObject(anObject); return GetObject(anObject);
} }
@ -309,10 +311,11 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCom
/*! /*!
* MakeSketcherOnPlane * 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 //Set a not done flag
GetOperations()->SetNotDone(); GetOperations()->SetNotDone();
@ -322,7 +325,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane (const char*
// Make Sketcher // Make Sketcher
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane); GetOperations()->MakeSketcherOnPlane(strdup(theCommand), aWorkingPlane);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -4,12 +4,13 @@
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(GEOM_Gen)
#include "SALOME_GenericObj_i.hh" #include "SALOME_GenericObj_i.hh"
#include "GEOM_Object.hxx" #include "GEOM_Object.hxx"
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
class GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOME::GenericObj_i 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: public:
GEOM_Object_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, Handle(GEOM_Object) theImpl); GEOM_Object_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, Handle(GEOM_Object) theImpl);
~GEOM_Object_i(); ~GEOM_Object_i();
virtual char* GetEntry(); virtual char* GetEntry();
virtual CORBA::Long GetStudyID(); virtual CORBA::Long GetStudyID();
virtual CORBA::Long GetType(); virtual CORBA::Long GetType();
virtual GEOM::shape_type GetShapeType(); virtual GEOM::shape_type GetShapeType();
virtual void SetName(const char* theName); virtual void SetName(const char* theName);
virtual char* GetName(); virtual char* GetName();
virtual void SetStudyEntry(const char* theEntry); virtual void SetStudyEntry(const char* theEntry);
virtual char* GetStudyEntry(); virtual char* GetStudyEntry();
virtual GEOM::ListOfGO* GetDependency(); 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 bool IsMainShape() { return _impl->IsMainShape(); }
virtual GEOM::ListOfLong* GetSubShapeIndices(); virtual GEOM::ListOfLong* GetSubShapeIndices();
virtual GEOM::GEOM_Object_ptr GetMainShape(); virtual GEOM::GEOM_Object_ptr GetMainShape();
virtual bool IsShape(); virtual bool IsShape();
Handle(GEOM_Object) GetImpl() { return _impl; } Handle(GEOM_Object) GetImpl() { return _impl; }
private: private:
GEOM::GEOM_Gen_ptr _engine; GEOM::GEOM_Gen_ptr _engine;
Handle(GEOM_Object) _impl; Handle(GEOM_Object) _impl;
TopoDS_Shape _geom; TopoDS_Shape _geom;
}; };

View File

@ -54,9 +54,11 @@ LIB_SRC = \
GEOM_Gen_i.cc \ GEOM_Gen_i.cc \
GEOM_DumpPython.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 \ LIB_SERVER_IDL = GEOM_Gen.idl
GEOM_Gen.idl SALOME_GenericObj.idl
# Executables targets # Executables targets
BIN = BIN =
@ -84,7 +86,9 @@ EXPORT_HEADERS = GEOM_Object_i.hh \
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(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 # additional file to be cleaned
MOSTLYCLEAN = MOSTLYCLEAN =
@ -92,4 +96,3 @@ CLEAN =
DISTCLEAN = DISTCLEAN =
@CONCLUDE@ @CONCLUDE@