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

@ -87,8 +87,6 @@
using namespace std;
#include "SALOMEDSClient.hxx"
#include "SALOMEDS_SObject.hxx"
#include "SALOMEDS_Study.hxx"
//=======================================================================
@ -578,19 +576,22 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::stri
listIOR.length(nbSel);
int j=0;
SALOME_ListIteratorOfListIO It(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;
_PTR(Study) aStudy = appStudy->studyDS();
for(int i=0; It.More(); It.Next(), i++) {
for (int i=0; It.More(); It.Next(), i++) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()) {
if (IObject->hasEntry()) {
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr;
if(obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
_PTR(AttributeIOR) anIOR (anAttr);
CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>(aStudy.get())->ConvertIORToObject(anIOR->Value());
if(theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) {
//CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>
// (aStudy.get())->ConvertIORToObject(anIOR->Value());
CORBA::Object_var theObj = GeometryGUI::ClientSObjectToObject(obj);
if (!CORBA::is_nil(theObj) && theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) {
listIOR[j] = CORBA::string_dup(anIOR->Value().c_str());
j++;
}
@ -614,15 +615,16 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter
{
const char* anEntry = theIO->getEntry();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return GEOM::GEOM_Object::_nil();
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) );
if ( aSObj )
if (aSObj)
{
aReturnObject = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject() );
aReturnObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
theResult = !CORBA::is_nil( aReturnObject );
}
}
@ -655,7 +657,7 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
if ( aSObj )
{
GEOM::GEOM_Object_var aGeomObj =
GEOM::GEOM_Object::_narrow(dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject());
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) )
theListGO[ j++ ] = aGeomObj;
}

View File

@ -59,10 +59,6 @@
using namespace std;
#include <SALOMEDSClient.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDS_Study.hxx>
//================================================================
@ -210,18 +206,20 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
getDisplayer()->SetToActivate( true );
string entry = getEntry( object );
getDisplayer()->Redisplay( new SALOME_InteractiveObject( entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ) ) ), false );
getDisplayer()->Redisplay(new SALOME_InteractiveObject
(entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object))), false);
}
if ( withChildren ) {
SalomeApp_Study* aDoc = getStudy();
if ( aDoc && aDoc->studyDS() ) {
_PTR(Study) aStudy = aDoc->studyDS();
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( SalomeApp_Application::orb()->object_to_string( object ) ) );
_PTR(SObject) aSObj (aStudy->FindObjectIOR(SalomeApp_Application::orb()->object_to_string(object)));
if ( aSObj ) {
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(anIt->Value().get())->GetObject() );
GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow
(GeometryGUI::ClientSObjectToObject(anIt->Value()));
if ( !CORBA::is_nil( aChild ) ) {
if ( !aChild->_is_nil() ) {
string entry = getEntry( aChild );
@ -409,7 +407,8 @@ void GEOMBase_Helper::activate( const int theType )
_PTR(SObject) aRefSO;
if ( !aSO->ReferencedObject( aRefSO ) )
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(aSO.get())->GetObject() );
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow
(GeometryGUI::ClientSObjectToObject(aSO));
if ( !anObj->_is_nil() && anObj->GetType() == theType )
aList.Append( new SALOME_InteractiveObject( aSO->GetID().c_str(), "GEOM", aSO->GetName().c_str()) );
}
@ -498,7 +497,8 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN
GEOM::GEOM_Object_ptr aFatherObj = getFather( theObj );
getGeomEngine()->AddInStudy( dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy(), theObj, theName, aFatherObj );
getGeomEngine()->AddInStudy(GeometryGUI::ClientStudyToStudy(aStudy),
theObj, theName, aFatherObj);
}
//================================================================

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

View File

@ -1,12 +1,13 @@
#include <OCCViewer_ViewModel.h>
#include "GEOMGUI_Selection.h"
#include "GeometryGUI.h"
#include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx"
#include <SalomeApp_DataOwner.h>
#include <SalomeApp_Study.h>
#include <OCCViewer_ViewModel.h>
#include <SUIT_Session.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
@ -14,22 +15,27 @@
#include <SALOMEDSClient_SObject.hxx>
#include <SALOMEDSClient_Study.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOME_Prs.h>
#include <SALOME_InteractiveObject.hxx>
#include <SOCC_Prs.h>
#include <SVTK_Prs.h>
#include <SALOME_Actor.h>
#include <vtkActorCollection.h>
#include <OCCViewer_ViewModel.h>
#include <VTKViewer_ViewModel.h>
#include "GEOMImpl_Types.hxx"
// OCCT Includes
#include <AIS.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_ListOfInteractive.hxx>
// VTK Includes
#include <vtkActorCollection.h>
GEOMGUI_Selection::GEOMGUI_Selection()
{
}
@ -158,18 +164,17 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
(SUIT_Session::session()->activeApplication()->activeStudy());
if ( appStudy && index >= 0 && index < count() ) {
if (appStudy && index >= 0 && index < count()) {
_PTR(Study) study = appStudy->studyDS();
QString anEntry = entry( index );
QString anEntry = entry(index);
if ( study && !anEntry.isNull() ) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
if ( aSO ) {
SALOMEDS_SObject* aDSObj = dynamic_cast<SALOMEDS_SObject*>( aSO.get() );
return GEOM::GEOM_Object::_narrow( aDSObj->GetObject() );
if (study && !anEntry.isNull()) {
_PTR(SObject) aSO (study->FindObjectID(anEntry.latin1()));
if (aSO) {
CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSO);
return GEOM::GEOM_Object::_narrow(anObj);
}
}
}
return GEOM::GEOM_Object::_nil();
}

View File

@ -26,10 +26,9 @@
// Module : GEOM
// $Header$
#include <SOCC_ViewModel.h>
#include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx"
#include "GeometryGUI.h"
#include "GEOM_TypeFilter.h"
#include "GEOM_EdgeFilter.h"
@ -38,8 +37,9 @@
#include "GEOM_LogicalFilter.h"
#include "GEOM_OCCFilter.h"
#include "GEOM_AssemblyBuilder.h"
#include "GEOM_Actor.h"
#include "GEOM_AssemblyBuilder.h"
#include "GEOM_AISShape.hxx"
#include "GEOM_AISTrihedron.hxx"
#include "GEOM_VTKTrihedron.hxx"
@ -56,37 +56,42 @@
#include <SalomeApp_Tools.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOMEDSClient.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDSClient_SObject.hxx>
#include <SOCC_Prs.h>
#include <SOCC_ViewModel.h>
#include <SVTK_Prs.h>
#include <SVTK_ViewModel.h>
#include <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_MapIteratorOfMapOfInteger.hxx>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#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>
// VTK Includes
#include <vtkActorCollection.h>
// STL Includes
#include <cstring>
// CORBA Headers
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include "GEOMImpl_Types.hxx"
using namespace std;
//================================================================
@ -825,7 +830,7 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveOb
if ( SO )
{
// 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 ) )
{
// downcast to GEOM object

View File

@ -82,6 +82,40 @@ bool GeometryGUI::InitGeomGen()
return true;
}
//=======================================================================
// function : ClientSObjectToObject
// purpose :
//=======================================================================
CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
{
_PTR(GenericAttribute) anAttr;
CORBA::Object_var anObj;
try {
std::string aValue = theSObject->GetIOR();
if (strcmp(aValue.c_str(), "") != 0) {
CORBA::ORB_ptr anORB = SalomeApp_Application::orb();
anObj = anORB->string_to_object(aValue.c_str());
}
} catch(...) {
INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
}
return anObj._retn();
}
//=======================================================================
// function : ClientStudyToStudy
// purpose :
//=======================================================================
SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
{
SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
int aStudyID = theStudy->StudyId();
SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(aStudyID);
return aDSStudy._retn();
}
//=================================================================================
// class : CustomItem
// purpose : Set Font to a text.

View File

@ -34,9 +34,18 @@
#include "GEOMGUI.h"
#include "GEOM_Client.hxx"
#include "SALOME_InteractiveObject.hxx"
#include "SALOMEDSClient.hxx"
// QT Includes
#include <qmap.h>
#include "gp_Ax3.hxx"
// OCCT Includes
#include <gp_Ax3.hxx>
// IDL headers
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(SALOMEDS)
#ifdef WNT
#include <SALOME_WNT.hxx>
@ -75,6 +84,9 @@ public:
static GEOM::GEOM_Gen_var GetGeomGen() { return myComponentGeom; }
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
GEOM_Client& GetShapeReader() { return myShapeReader; }
Standard_CString& GetFatherior() { return myFatherior; }
//void SetState( const int state ) { myState = state; }
@ -137,10 +149,13 @@ protected:
private:
GEOMGUI* getLibrary( const QString& libraryName );
void createGeomAction( const int id, const QString& po_id, const QString& icon_id = QString(""), const int key = 0, const bool toggle = false );
void createGeomAction( const int id, const QString& po_id,
const QString& icon_id = QString(""),
const int key = 0, const bool toggle = false );
void createPopupItem( const int, const QString& clients, const QString& types,
const bool isSingle = false, const int isVisible = -1,
const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 );
const bool isExpandAll = false, const bool isOCC = false,
const int parentId = -1 );
private:
static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine
@ -158,4 +173,3 @@ private:
};
#endif

View File

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

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

View File

@ -27,6 +27,7 @@
// $Header$
#include "GEOMToolsGUI.h"
#include "GeometryGUI.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
@ -49,20 +50,19 @@
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_Prs.h>
#include "utilities.h"
// QT Includes
#include <qapplication.h>
#include <qmap.h>
#include "utilities.h"
// OCCT Includes
#include <TCollection_AsciiString.hxx>
using namespace std;
typedef QMap<QString, QString> FilterMap;
#include <SALOMEDS_SObject.hxx>
//=======================================================================
// function : getFileName
// purpose : Selection of a file name for Import/Export. Returns also
@ -300,25 +300,26 @@ void GEOMToolsGUI::OnEditDelete()
if ( !strcmp( obj->GetIOR().c_str(), geomIOR ) )
continue;
// iterate through all childres of obj, find IOR attributes on children and remove shapes that
// correspond to these IORs
for ( _PTR(ChildIterator) it ( aStudy->NewChildIterator( obj ) ); it->More();it->Next() ) {
_PTR(SObject) child ( it->Value() );
if ( child->FindAttribute( anAttr, "AttributeIOR" ) ) {
_PTR(AttributeIOR) anIOR( anAttr );
// iterate through all children of obj, find IOR attributes on children
// and remove shapes that correspond to these IORs
for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
_PTR(SObject) child (it->Value());
if (child->FindAttribute(anAttr, "AttributeIOR")) {
_PTR(AttributeIOR) anIOR (anAttr);
// Delete child( s ) shape in Client :
const TCollection_AsciiString ASCior( (char*)anIOR->Value().c_str() ) ;
getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCior );
const TCollection_AsciiString ASCior ((char*)anIOR->Value().c_str());
getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCior);
for ( view = views.first(); view; view = views.next() ) {
CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(child.get()))->GetObject();
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if ( !CORBA::is_nil( geomObj ) )
disp->Erase( geomObj, true, view );
}
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(child);
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow(corbaObj);
if (!CORBA::is_nil(geomObj)) {
for (view = views.first(); view; view = views.next()) {
disp->Erase(geomObj, true, view);
}
}
}
} // for ( childres of obj )
} // for ( children of obj )
// Erase main graphical object
for ( view = views.first(); view; view = views.next() )
@ -327,18 +328,18 @@ void GEOMToolsGUI::OnEditDelete()
// Delete main shape in Client :
if ( obj->FindAttribute( anAttr, "AttributeIOR" ) ) {
_PTR(AttributeIOR) anIOR( anAttr );
const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() ) ;
const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() );
getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCIor );
}
// Remove objects from Study
aStudyBuilder->RemoveObject( obj );
CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(obj.get()))->GetObject();
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if ( !CORBA::is_nil( geomObj ) )
GeometryGUI::GetGeomGen()->RemoveObject( geomObj );
// Remove objects from Study
aStudyBuilder->RemoveObject( obj );
//deleted = true;
} // MAIN LOOP of selected
@ -383,7 +384,7 @@ void GEOMToolsGUI::OnEditCopy()
GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]);
try {
GEOM::GEOM_IInsertOperations_var IOp = myGeom->GetIInsertOperations(aStudyID);
GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit) ;
GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit);
myGeomBase->Display(result);
}
catch (const SALOME::SALOME_Exception& S_ex) {
@ -463,10 +464,12 @@ bool GEOMToolsGUI::Import()
if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() );
QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true ));
GeometryGUI::GetGeomGen()->PublishInStudy(dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy(),
SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy(aStudy);
GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy,
SALOMEDS::SObject::_nil(),
anObj,
aPublishObjName );
aPublishObjName);
GEOM_Displayer( stud ).Display( anObj.in() );

View File

@ -32,9 +32,9 @@
#include "GEOMGUI.h"
#include <SALOMEDSClient.hxx>
#include <SALOMEDS_Study.hxx>
#include <SALOME_ListIO.hxx>
#include <CORBA.h>
//=================================================================================
// class : GEOMToolsGUI

View File

@ -29,13 +29,15 @@
#include <PythonConsole_PyConsole.h>
#include "GEOMToolsGUI.h"
#include "GeometryGUI.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement
#include "GEOMToolsGUI_NameDlg.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
@ -59,11 +61,17 @@
#include <SalomeApp_Study.h>
#include <SalomeApp_Module.h>
#include "SALOMEDSClient.hxx"
#include "utilities.h"
// OCCT Includes
#include <AIS_Drawer.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_IsoAspect.hxx>
// VTK Includes
#include <vtkBMPReader.h>
#include <vtkTexture.h>
#include <vtkTextureMapToPlane.h>
@ -71,19 +79,14 @@
#include <vtkDataSetMapper.h>
#include <vtkRenderer.h>
// QT Includes
#include <qfileinfo.h>
#include <qcolordialog.h>
#include <qspinbox.h>
#include <qapplication.h>
#include "utilities.h"
using namespace std;
#include "SALOMEDSClient.hxx"
#include "SALOMEDS_Study.hxx"
void GEOMToolsGUI::OnSettingsColor()
{

View File

@ -42,7 +42,7 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
const char *interfaceName) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
{
_thisObj = this ;
_thisObj = this;
_id = _poa->activate_object(_thisObj);
name_service = new SALOME_NamingService(_orb);
@ -815,32 +815,33 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) {
if(strcmp(stringIOR,"") != 0){
CORBA::Object_var anObject = _orb->string_to_object(stringIOR);
if(!CORBA::is_nil(anObject))
aGeomObject = GEOM::GEOM_Object::_narrow(anObject.in()) ;
aGeomObject = GEOM::GEOM_Object::_narrow(anObject.in());
}
return aGeomObject._retn() ;
return aGeomObject._retn();
}
//=================================================================================
// function : GetObject()
// purpose :
//=================================================================================
GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject(CORBA::Long theStudyID, const char* theEntry)
GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* theEntry)
{
GEOM::GEOM_Object_var obj;
Handle(GEOM_Object) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
if(handle_object.IsNull()) return NULL;
if (handle_object.IsNull()) return NULL;
TCollection_AsciiString stringIOR = handle_object->GetIOR();
if(stringIOR.Length() > 1) {
if (stringIOR.Length() > 1) {
CORBA::Object_var corba_object = _orb->string_to_object(stringIOR.ToCString());
if(!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object);
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_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object);
obj = servant->_this();
stringIOR = _orb->object_to_string(obj);
stringIOR = _orb->object_to_string(obj);
handle_object->SetIOR(stringIOR);
return obj._retn();
}
@ -859,7 +860,6 @@ extern "C"
{
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
return myGEOM_Gen_i->getId() ;
return myGEOM_Gen_i->getId();
}
}

View File

@ -6,16 +6,14 @@
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
#include CORBA_CLIENT_HEADER(SALOMEDS)
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
//#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
#include "GEOM_IBasicOperations_i.hh"
#include "GEOM_ITransformOperations_i.hh"
#include "GEOM_I3DPrimOperations_i.hh"
@ -29,6 +27,8 @@
#include "GEOM_IMeasureOperations_i.hh"
#include "GEOM_IGroupOperations_i.hh"
//#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
//=====================================================================
// GEOM_Gen_i : class definition
@ -40,6 +40,7 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
//-----------------------------------------------------------------------//
// Constructor / Destructor //
//-----------------------------------------------------------------------//
// constructor to be called for servant creation.
GEOM_Gen_i();
GEOM_Gen_i(CORBA::ORB_ptr orb,
@ -103,11 +104,16 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject);
//Adds theObject in the study with a name = theName, if theFather is not null the object is placed under theFather
SALOMEDS::SObject_ptr AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM::GEOM_Object_ptr theObject, const char* theName, GEOM::GEOM_Object_ptr theFather);
/*! \brief Adds theObject in the study with a name = theName, if
* theFather is not null the object is placed under theFather
*/
SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_ptr theObject,
const char* theName,
GEOM::GEOM_Object_ptr theFather);
//-----------------------------------------------------------------------//
// Transaction methods //
// Transaction methods //
//-----------------------------------------------------------------------//
//Undos one transaction in the document associated with theStudyID
@ -169,7 +175,8 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
throw (SALOME::SALOME_Exception);
//Adds a new sub shape
virtual GEOM::GEOM_Object_ptr AddSubShape(GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfLong& theIndices);
virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfLong& theIndices);
virtual void RemoveObject(GEOM::GEOM_Object_ptr theObject);
@ -185,9 +192,10 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
GEOM::string_array* GetAllDumpNames();
//********************************************************************************************************//
// Internal methods
//********************************************************************************************************//
//-----------------------------------------------------------------------//
// Internal methods //
//-----------------------------------------------------------------------//
virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
private:
@ -195,7 +203,6 @@ class GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual public Engines_Comp
::GEOMImpl_Gen* _impl;
SALOME_NamingService * name_service;
char * _name;
};
#endif

View File

@ -282,9 +282,10 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
* MakeSketcher
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane)
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
(const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane)
{
GEOM::GEOM_Object_var aGEOMObject;
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_nil();
//Set a not done flag
GetOperations()->SetNotDone();
@ -297,9 +298,10 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCom
// Make Sketcher
Handle(GEOM_Object) anObject =
GetOperations()->MakeSketcher(theCommand, aWorkingPlane);
GetOperations()->MakeSketcher(strdup(theCommand), aWorkingPlane);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//return aGEOMObject._retn();
return GEOM::GEOM_Object::_nil();
return GetObject(anObject);
}
@ -310,9 +312,10 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher (const char* theCom
* MakeSketcherOnPlane
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
(const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
{
GEOM::GEOM_Object_var aGEOMObject;
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_nil();
//Set a not done flag
GetOperations()->SetNotDone();
@ -322,7 +325,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane (const char*
// Make Sketcher
Handle(GEOM_Object) anObject =
GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
GetOperations()->MakeSketcherOnPlane(strdup(theCommand), aWorkingPlane);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();

View File

@ -4,12 +4,13 @@
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_CLIENT_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(GEOM_Gen)
#include "SALOME_GenericObj_i.hh"
#include "GEOM_Object.hxx"
#include <TopoDS_Shape.hxx>
class GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual SALOME::GenericObj_i

View File

@ -54,9 +54,11 @@ LIB_SRC = \
GEOM_Gen_i.cc \
GEOM_DumpPython.cc
# SALOME_Component.idl
LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl #\
#SALOME_Exception.idl SALOME_GenericObj.idl
LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl \
GEOM_Gen.idl SALOME_GenericObj.idl
LIB_SERVER_IDL = GEOM_Gen.idl
# Executables targets
BIN =
@ -84,7 +86,9 @@ EXPORT_HEADERS = GEOM_Object_i.hh \
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMArchimede -lGEOMbasic -lGEOMimpl $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj
LDFLAGS += -lGEOMArchimede -lGEOMbasic -lGEOMimpl -lGEOMSketcher \
$(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset \
-L${KERNEL_ROOT_DIR}/lib/salome -lSalomeNS -lSalomeContainer -lSalomeGenericObj
# additional file to be cleaned
MOSTLYCLEAN =
@ -92,4 +96,3 @@ CLEAN =
DISTCLEAN =
@CONCLUDE@