// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include <vtkRenderer.h>
#include <qvaluelist.h>
-#include <qstringlist.h>
+#include <qstringlist.h>
#include "GEOMImpl_Types.hxx"
using namespace std;
#include "SALOMEDSClient.hxx"
-#include "SALOMEDS_SObject.hxx"
-#include "SALOMEDS_Study.hxx"
//=======================================================================
GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj );
if (GeomObject->_is_nil())
return result;
-
+
result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject);
return result;
}
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return false;
_PTR(Study) aStudy = appStudy->studyDS();
-
+
_PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) );
_PTR(GenericAttribute) anAttr;
if( obj ) {
}
}
}
-
+
return false;
}
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return nbSel;
_PTR(Study) aStudy = appStudy->studyDS();
-
+
_PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) );
-
+
_PTR(GenericAttribute) anAttr;
-
+
if ( obj && obj->FindAttribute( anAttr, "AttributeName") )
{
_PTR(AttributeName) aNameAttr ( anAttr );
- theName = aNameAttr->Value().c_str();
+ theName = aNameAttr->Value().c_str();
}
}
}
}
else
theName = QString( "%1_objects" ).arg( anObjs.length() );
-
+
return anObjs.length();
}
}
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return resultShape;
_PTR(Study) aStudy = appStudy->studyDS();
-
+
_PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) );
if ( !anObj )
return resultShape;
-
+
QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it ) {
if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) {
Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
-
+
AIS_ListOfInteractive List;
ic->DisplayedObjects(List);
AIS_ListOfInteractive List1;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return GEOM_Actor::New();
_PTR(Study) aStudy = appStudy->studyDS();
-
+
_PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) );
if ( !anObj )
return GEOM_Actor::New();
if (it.current()->getViewManager()->getType() != OCCViewer_Viewer::Type())
continue;
Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
-
+
AIS_ListOfInteractive aList;
anIC->DisplayedObjects( aList );
anIC->ObjectsInCollector( aList );
{
Handle(SALOME_InteractiveObject) anObj =
Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() );
-
+
if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 )
{
if( isOnlyInActiveView )
}
}
}
-
+
return Handle(AIS_InteractiveObject)();
}
testResult = false;
return res;
}
-
+
QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it ) {
if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) {
Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext();
-
+
AIS_ListOfInteractive List;
ic->DisplayedObjects(List);
AIS_ListOfInteractive List1;
ic->ObjectsInCollector(List1);
List.Append(List1);
-
+
AIS_ListIteratorOfListOfInteractive ite(List);
while(ite.More())
{
}
}
ite.Next();
- }
+ }
}
}
testResult = false;
{
GEOM::GEOM_Object_var aShape;
testResult = false;
-
+
/* case SObject */
if(IO->hasEntry()) {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
//=======================================================================
// function : ConvertListOfIOInListOfIOR()
-// purpose :
+// purpose :
//=======================================================================
void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR)
{
- int nbSel = aList.Extent();
+ int nbSel = aList.Extent();
listIOR.length(nbSel);
int j=0;
SALOME_ListIteratorOfListIO It(aList);
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
- if ( !appStudy ) return;
- _PTR(Study) aStudy = appStudy->studyDS();
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+ ( SUIT_Session::session()->activeApplication()->activeStudy() );
+ if ( !appStudy ) return;
+ _PTR(Study) aStudy = appStudy->studyDS();
- for(int i=0; It.More(); It.Next(), i++) {
+ for (int i=0; It.More(); It.Next(), i++) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
- if(IObject->hasEntry()) {
+ if (IObject->hasEntry()) {
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr;
- if(obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
+ if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) {
_PTR(AttributeIOR) anIOR (anAttr);
- CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>(aStudy.get())->ConvertIORToObject(anIOR->Value());
- if(theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) {
+ //CORBA::Object_var theObj = dynamic_cast<SALOMEDS_Study*>
+ // (aStudy.get())->ConvertIORToObject(anIOR->Value());
+ CORBA::Object_var theObj = GeometryGUI::ClientSObjectToObject(obj);
+ if (!CORBA::is_nil(theObj) && theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) {
listIOR[j] = CORBA::string_dup(anIOR->Value().c_str());
j++;
}
}
- }
+ }
}
listIOR.length(j);
}
//=======================================================================
// function : ConvertIOinGEOMObject()
-// purpose :
+// purpose :
//=======================================================================
-GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& theIO,
+GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& theIO,
Standard_Boolean& theResult )
-{
+{
theResult = Standard_False;
GEOM::GEOM_Object_var aReturnObject;
if ( !theIO.IsNull() )
{
const char* anEntry = theIO->getEntry();
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
+ ( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return GEOM::GEOM_Object::_nil();
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) );
-
- if ( aSObj )
+
+ if (aSObj)
{
- aReturnObject = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject() );
+ aReturnObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
theResult = !CORBA::is_nil( aReturnObject );
}
}
//=======================================================================
// function : ConvertListOfIOInListOfGO()
-// purpose :
+// purpose :
//=======================================================================
void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList,
GEOM::ListOfGO& theListGO,
const bool theShapesOnly )
{
- int nbSel = theList.Extent();
+ int nbSel = theList.Extent();
theListGO.length( nbSel );
SALOME_ListIteratorOfListIO anIter( theList );
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return;
_PTR(Study) aStudy = appStudy->studyDS();
-
+
int j = 0;
for ( int i=0; anIter.More(); anIter.Next(), i++ )
{
if ( aSObj )
{
- GEOM::GEOM_Object_var aGeomObj =
- GEOM::GEOM_Object::_narrow(dynamic_cast<SALOMEDS_SObject*>(aSObj.get())->GetObject());
+ GEOM::GEOM_Object_var aGeomObj =
+ GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) )
theListGO[ j++ ] = aGeomObj;
}
}
-
+
theListGO.length( j );
}
//=================================================================================
bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone)
{
- if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
+ if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE)
return false;
-
+
OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort();
Handle( V3d_View) view3d = vp3d->getView();
Standard_Real Width, Height;
view3d->Size(Width, Height);
const Standard_Real aHeight = (Width + Height) / 50.0;
-
+
try {
Standard_Real first, last;
Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last);
curv->D1( param, middleParamPoint, V1);
if(V1.Magnitude() < Precision::Confusion())
return false;
-
+
/* Topology orientation not geom orientation */
if(tds.Orientation() == TopAbs_REVERSED)
V1 *= -1.0;
-
+
gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1));
const Standard_Real radius1 = aHeight / 5.0;
if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) {
}
catch(Standard_Failure) {
// OCC failures are hard to catch in GUI.
- // This because of the position for #include <Standard_ErrorHandler.hxx> that is very critic to find
+ // This because of the position for #include <Standard_ErrorHandler.hxx> that is very critic to find
// in SALOME environment : compilation error !
}
return false;
//=================================================================================
// function : GetBipointDxDyDz()
-// purpose :
+// purpose :
//=================================================================================
void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz)
{
//=======================================================================
double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const char* aTitle1, const char* aTitle, const double bottom, const double top, const int decimals)
{
- GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(),
+ GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(),
aTitle, TRUE, 0, bottom, top, decimals);
int r = Dialog->exec();
float X = 0.0;
if(r == QDialog::Accepted) {
res = Standard_True;
X = Dialog->getValue();
- }
+ }
else
res = Standard_False;
delete Dialog;
//=======================================================================
// function : SelectionByNameInDialogs()
// purpose : Called when user has entered a name of object in a LineEdit.
-// : The selection is changed. Dialog box will receive the
+// : The selection is changed. Dialog box will receive the
// : corresponding signal to manage this event.
//=======================================================================
bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList)
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return false;
_PTR(Study) ST = appStudy->studyDS();
-
+
std::vector<_PTR(SObject)> listSO;
listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM");
-
+
if(listSO.size() < 1) {
const QString caption = QObject::tr("GEOM_WRN_WARNING");
const QString text = QObject::tr("GEOM_NAME_INCORRECT");
/* Add as a selected object */
/* Clear any previous selection : */
- /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */
+ /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */
// Sel->ClearIObjects(); //mzn
// Sel->AddIObject(SI); //mzn
return true;
SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop();
x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
- return true;
+ return true;
}
int aNumber = 0;
_PTR(SObject) obj;
- do
+ do
{
aName = theOperation+"_"+QString::number(++aNumber);
obj = aStudy->FindObject(aName.latin1());
- }
+ }
while (obj);
-
+
return aName;
}
{
QString anErrorCode(theErrorCode);
QString aComment(theComment);
-
+
QString aText = "";
if (!anErrorCode.isEmpty())
aText.append("\n" + QObject::tr(anErrorCode));
if (!aComment.isEmpty())
aText.append("\n" + QString(theComment));
-
+
SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ),
QObject::tr("GEOM_PRP_ABORT") + aText, "OK" );
}
QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
{
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-
+
if ( appStudy )
{
string anIOR = SalomeApp_Application::orb()->object_to_string( theObj );
_PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( anIOR ) );
_PTR(GenericAttribute) anAttr;
-
+
if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") )
{
_PTR(AttributeName) aNameAttr ( anAttr );
- return QString( aNameAttr->Value().c_str() );
+ return QString( aNameAttr->Value().c_str() );
}
}
}
-
- return QString("");
+
+ return QString("");
}
bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj )
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
//
//
//
using namespace std;
#include <SALOMEDSClient.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDS_Study.hxx>
-
-
//================================================================
SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
if ( activeStudy )
return SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-
+
return 0;
}
// Function : GEOMBase_Helper
// Purpose :
//================================================================
-GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop )
+GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop )
: myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false )
{
}
//================================================================
// Function : ~GEOMBase_Helper
-// Purpose :
+// Purpose :
//================================================================
GEOMBase_Helper::~GEOMBase_Helper()
{
//================================================================
// Function : display
-// Purpose :
+// Purpose :
//================================================================
void GEOMBase_Helper::display( const ObjectList& objList, const bool updateView )
{
//================================================================
// Function : erase
-// Purpose :
+// Purpose :
//================================================================
void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView )
{
//================================================================
// Function : erase
-// Purpose :
+// Purpose :
//================================================================
void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView )
{
//================================================================
// Function : redisplay
-// Purpose :
+// Purpose :
//================================================================
-void GEOMBase_Helper::redisplay( const ObjectList& objList,
+void GEOMBase_Helper::redisplay( const ObjectList& objList,
const bool withChildren,
const bool updateView )
{
//================================================================
// Function : redisplay
-// Purpose :
+// Purpose :
//================================================================
-void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
+void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
const bool withChildren,
const bool updateView )
{
// Default color will be used
getDisplayer()->UnsetColor();
getDisplayer()->UnsetWidth();
-
+
// Enable activisation of selection
getDisplayer()->SetToActivate( true );
-
+
string entry = getEntry( object );
- getDisplayer()->Redisplay( new SALOME_InteractiveObject( entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ) ) ), false );
+ getDisplayer()->Redisplay(new SALOME_InteractiveObject
+ (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object))), false);
}
-
+
if ( withChildren ) {
SalomeApp_Study* aDoc = getStudy();
if ( aDoc && aDoc->studyDS() ) {
_PTR(Study) aStudy = aDoc->studyDS();
- _PTR(SObject) aSObj ( aStudy->FindObjectIOR( SalomeApp_Application::orb()->object_to_string( object ) ) );
+ _PTR(SObject) aSObj (aStudy->FindObjectIOR(SalomeApp_Application::orb()->object_to_string(object)));
if ( aSObj ) {
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
- GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow( dynamic_cast<SALOMEDS_SObject*>(anIt->Value().get())->GetObject() );
+ GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow
+ (GeometryGUI::ClientSObjectToObject(anIt->Value()));
if ( !CORBA::is_nil( aChild ) ) {
if ( !aChild->_is_nil() ) {
string entry = getEntry( aChild );
}
}
}
- }
+ }
}
}
-
+
if ( updateView )
getDisplayer()->UpdateViewer();
}
const bool toRemoveFromEngine,
const double lineWidth )
{
- isPreview = true;
+ isPreview = true;
QString msg;
if ( !isValid( msg ) )
{
erasePreview( update );
- isPreview = false;
+ isPreview = false;
return;
}
//================================================================
void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
const bool append,
- const bool activate,
+ const bool activate,
const bool update,
const double lineWidth )
{
// Make a reference to GEOM_Object
getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) );
-
+
// Build prs
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
if ( aPrs == 0 || aPrs->IsNull() )
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
if (aView)
aView->Display( prs );
- }
-
+ }
+
// Add prs to the preview list
myPreview.push_back( (SALOME_Prs*)prs );
//================================================================
// Function : erasePreview
-// Purpose :
+// Purpose :
//================================================================
void GEOMBase_Helper::erasePreview( const bool update )
{
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
if (aView)
aView->Erase( *anIter, true );
- }
+ }
}
delete *anIter;
}
_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()) );
}
void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMode )
{
SALOME_ListIO aListOfIO;
-
+
ObjectList::const_iterator anIter = theObjs.begin();
for ( ; anIter != theObjs.end(); ++anIter )
{
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);
}
//================================================================
//================================================================
// Function : getStudy
-// Purpose : Returns the active study. It is recommended to use
+// Purpose : Returns the active study. It is recommended to use
// this method instead of direct desktop->getActiveStudy() calls
//================================================================
SalomeApp_Study* GEOMBase_Helper::getStudy() const
SUIT_Desktop* aDesktop = getDesktop();
if (!aDesktop)
return 0;
-
- QPtrList<SUIT_Application> anAppList = SUIT_Session::session()->applications();
-
+
+ QPtrList<SUIT_Application> anAppList = SUIT_Session::session()->applications();
+
SUIT_Application* anApp = 0;
for ( QPtrListIterator<SUIT_Application> it( anAppList ); it.current() ; ++it )
{
anApp = it.current();
- if ( anApp->desktop() == aDesktop )
+ if ( anApp->desktop() == aDesktop )
break;
}
//================================================================
// Function : getEntry
-// Purpose :
+// Purpose :
//================================================================
char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const
{
//================================================================
// Function : getDisplayer
-// Purpose :
+// Purpose :
//================================================================
GEOM_Displayer* GEOMBase_Helper::getDisplayer()
{
//================================================================
// Function : clearShapeBuffer
-// Purpose :
+// Purpose :
//================================================================
void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
{
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
_PTR(AttributeIOR) anIOR ( anAttr );
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
- GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
+ GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
}
}
}
//================================================================
// Function : openCommand
-// Purpose :
+// Purpose :
//================================================================
-bool GEOMBase_Helper::openCommand()
+bool GEOMBase_Helper::openCommand()
{
bool res = false;
if ( !getStudy() || hasCommand() )
return res;
-
+
GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() );
if ( !anOp->_is_nil() ) {
myCommand = new GEOM_Operation( SUIT_Session::session()->activeApplication(), anOp.in() );
myCommand->start();
res = true;
}
-
+
return res;
}
//================================================================
// Function : abortCommand
-// Purpose :
+// Purpose :
//================================================================
bool GEOMBase_Helper::abortCommand()
{
myCommand->abort();
myCommand = 0;
-
- return true;
+
+ return true;
}
//================================================================
// Function : commitCommand
-// Purpose :
+// Purpose :
//================================================================
bool GEOMBase_Helper::commitCommand( const char* )
{
myCommand->commit();
myCommand = 0;
- return true;
+ return true;
}
//================================================================
// Function : hasCommand
-// Purpose :
+// Purpose :
//================================================================
bool GEOMBase_Helper::hasCommand() const
{
//================================================================
// Function : getOperation
-// Purpose :
+// Purpose :
//================================================================
GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation()
{
//================================================================
// Function : checkViewWindow
-// Purpose :
+// Purpose :
//================================================================
bool GEOMBase_Helper::checkViewWindow()
{
if ( myViewWindow ){
QPtrList<SUIT_ViewWindow> aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows();
- for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it )
+ for ( QPtrListIterator<SUIT_ViewWindow> it( aViewWindowsList ); it.current(); ++it )
{
if ( myViewWindow == it.current() )
return true;
//================================================================
// Function : onAccept
// Purpose : This method should be called from dialog's slots onOk() and onApply()
-// It perfroms user input validation, then it
+// It perfroms user input validation, then it
// performs a proper operation and manages transactions, etc.
//================================================================
bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return false;
_PTR(Study) aStudy = appStudy->studyDS();
-
+
bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked();
if ( aLocked ) {
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(),
- QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") );
return false;
withChildren = false;
display( *it, false );
}
- else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client
+ else { // asv : fix of PAL6454. If publish==false, then the original shape was modified, and need to be re-cached in GEOM_Client
// before redisplay
clearShapeBuffer( *it );
withChildren = true;
msg = QObject::tr( "GEOM_PRP_ABORT" );
SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(),
- QObject::tr( "GEOM_ERROR_STATUS" ),
- msg,
+ QObject::tr( "GEOM_ERROR_STATUS" ),
+ msg,
QObject::tr( "BUT_OK" ) );
}
//================================================================
// Function : execute
-// Purpose : This method is called by onAccept().
-// It should perform the required operation and put all new or modified objects into
+// Purpose : This method is called by onAccept().
+// It should perform the required operation and put all new or modified objects into
// <objects> argument.Should return <false> if some error occurs during its execution.
//================================================================
bool GEOMBase_Helper::execute( ObjectList& objects )
TopoDS_Shape aShape;
if ( !GEOMBase::GetShape( theObj, aShape ) )
return "";
-
+
long aType = aShape.ShapeType();
-
+
switch ( aType )
{
case TopAbs_VERTEX : return QObject::tr( "GEOM_VERTEX" );
const SALOME_ListIO& GEOMBase_Helper::selectedIO()
{
mySelected.Clear();
-
+
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( app ) {
SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr();
if ( aSelMgr )
aSelMgr->selectedObjects( mySelected );
}
-
+
return mySelected;
}
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@
-#include <OCCViewer_ViewModel.h>
-
#include "GEOMGUI_Selection.h"
+
+#include "GeometryGUI.h"
#include "GEOM_Displayer.h"
-#include "GEOMImpl_Types.hxx"
#include <SalomeApp_DataOwner.h>
#include <SalomeApp_Study.h>
+#include <OCCViewer_ViewModel.h>
+
#include <SUIT_Session.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SALOMEDSClient_SObject.hxx>
#include <SALOMEDSClient_Study.hxx>
-#include <SALOMEDS_SObject.hxx>
+
#include <SALOME_Prs.h>
#include <SALOME_InteractiveObject.hxx>
#include <SOCC_Prs.h>
#include <SVTK_Prs.h>
#include <SALOME_Actor.h>
-#include <vtkActorCollection.h>
#include <OCCViewer_ViewModel.h>
#include <VTKViewer_ViewModel.h>
+#include "GEOMImpl_Types.hxx"
+
+// OCCT Includes
#include <AIS.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_ListOfInteractive.hxx>
+// VTK Includes
+#include <vtkActorCollection.h>
+
GEOMGUI_Selection::GEOMGUI_Selection()
{
}
QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const
{
if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() );
-
+
return SalomeApp_Selection::globalParam( p );
}
}
}
}
- }
+ }
else if ( viewType == VTKViewer_Viewer::Type() ) { // assuming VTK
SVTK_Prs* vtkPrs = (SVTK_Prs*) prs;
vtkActorCollection* lst = vtkPrs->GetObjects();
int dm = salActor->getDisplayMode();
if ( dm == 0 )
return "Wireframe";
- else if ( dm == 1 )
+ else if ( dm == 1 )
return "Shading";
} // if ( salome actor )
} // if ( actor )
_PTR(Study) study = appStudy->studyDS();
QString anEntry = entry( index );
- if ( study && !anEntry.isNull() ) {
+ if ( study && !anEntry.isNull() ) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
- if ( aSO && aSO->GetFatherComponent() )
+ if ( aSO && aSO->GetFatherComponent() )
return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
}
}
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();
}
-
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// Module : GEOM
// $Header$
-#include <SOCC_ViewModel.h>
-
#include "GEOM_Displayer.h"
-#include "GEOMImpl_Types.hxx"
+
+#include "GeometryGUI.h"
#include "GEOM_TypeFilter.h"
#include "GEOM_EdgeFilter.h"
#include "GEOM_LogicalFilter.h"
#include "GEOM_OCCFilter.h"
-#include "GEOM_AssemblyBuilder.h"
#include "GEOM_Actor.h"
+#include "GEOM_AssemblyBuilder.h"
+#include "GEOM_AISShape.hxx"
#include "GEOM_AISTrihedron.hxx"
#include "GEOM_VTKTrihedron.hxx"
#include <SalomeApp_Tools.h>
#include <SALOME_ListIteratorOfListIO.hxx>
-#include <SALOMEDSClient.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDSClient_SObject.hxx>
#include <SOCC_Prs.h>
+#include <SOCC_ViewModel.h>
#include <SVTK_Prs.h>
#include <SVTK_ViewModel.h>
-#include <TColStd_MapOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfInteger.hxx>
-
-#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDSClient_SObject.hxx>
-#include <GeometryGUI.h>
-#include <GEOM_AISShape.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
+// OCCT Includes
#include <AIS_Drawer.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
-#include <Geom_Plane.hxx>
+#include <StdSelect_TypeOfEdge.hxx>
+#include <StdSelect_TypeOfFace.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
-#include <gp_Pln.hxx>
+#include <Geom_Plane.hxx>
#include <Geom_Axis2Placement.hxx>
-#include <StdSelect_TypeOfEdge.hxx>
-#include <StdSelect_TypeOfFace.hxx>
+#include <gp_Pln.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
+// VTK Includes
#include <vtkActorCollection.h>
+// STL Includes
#include <cstring>
+// CORBA Headers
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+
+#include "GEOMImpl_Types.hxx"
+
using namespace std;
//================================================================
SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
{
SUIT_SelectionFilter* aFilter;
-
+
int aTopAbsMode = getTopAbsMode( theMode );
if ( aTopAbsMode != -1 )
aFilter = new GEOM_TypeFilter( getStudy(), aTopAbsMode, true ); //@ aFilter = new GEOM_TypeFilter( ( TopAbs_ShapeEnum )aTopAbsMode );
{
case GEOM_LINE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Line ); break;
case GEOM_CIRCLE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Circle ); break;
-
+
case GEOM_PLANE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Plane ); break;
case GEOM_CYLINDER : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cylinder ); break;
case GEOM_SPHERE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Sphere ); break;
case GEOM_TORUS : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Torus ); break;
case GEOM_REVOLUTION: aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Revol ); break;
case GEOM_CONE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cone ); break;
-
+
case GEOM_PREVIEW : aFilter = new GEOM_PreviewFilter( getStudy() ); break;
-
+
case GEOM_ALLSHAPES : aFilter = new GEOM_SelectionFilter(getStudy(), true ); break;
case GEOM_ALLGEOM : aFilter = new SalomeApp_TypeFilter( getStudy(), "GEOM" ); break;
-
+
default : aFilter = new GEOM_TypeFilter( getStudy(), theMode ); break;
}
-
+
return aFilter;
}
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
- if ( app )
+ if ( app )
{
string IOR = app->orb()->object_to_string( object );
- if ( IOR != "" )
+ if ( IOR != "" )
{
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
- if ( app )
+ if ( app )
{
string IOR = app->orb()->object_to_string( object );
- if ( IOR != "" )
+ if ( IOR != "" )
{
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( IOR ) );
GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* study )
{
myStudy = study;
-
+
/* Shading Color */
SUIT_Session* session = SUIT_Session::session();
SUIT_ResourceMgr* resMgr = session->resourceMgr();
* Display interactive object in the current viewer
*/
//=================================================================
-void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
+void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer,
SALOME_View* theViewFrame )
{
if ( vf )
{
SALOME_Prs* prs = buildPresentation( theIO, vf );
-
+
if ( prs )
{
vf->BeforeDisplay( this );
if ( updateViewer )
vf->Repaint();
-
+
delete prs; // delete presentation because displayer is its owner
}
}
return;
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
-
+
if ( vf ) {
SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() );
if ( prs ) {
SALOME_View* theViewFrame )
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
-
+
if ( vf ) {
vf->EraseAll( forced );
if ( updateViewer )
{
aTrh = new GEOM_AISTrihedron( aPlc );
- if ( HasColor() )
+ if ( HasColor() )
aTrh->SetColor( (Quantity_NameOfColor)GetColor() );
if ( HasWidth() )
if ( !aTrh.IsNull() )
{
aTrh->SetComponent( aPlc );
- aTrh->SetToUpdate();
+ aTrh->SetToUpdate();
}
}
}
// Setup shape properties here ..., e.g. display mode, color, transparency, etc
AISShape->SetDisplayMode( myDisplayMode );
AISShape->SetShadingColor( myShadingColor );
-
+
if ( HasColor() )
{
AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
return;
vtkActorCollection* theActors = 0;
-
+
if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE )
{
myToActivate = false;
GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
-
+
if ( HasColor() )
{
Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
// aTrh->SetSize( 0.5 * vf->GetTrihedronSize() );
vtkPrs->AddObject( aTrh );
-
+
theActors = vtkActorCollection::New();
theActors->AddItem( aTrh );
}
else
theActors = GEOM_AssemblyBuilder::BuildActors( myShape, 0, 0, Standard_True );
-
+
theActors->InitTraversal();
-
+
vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
vtkProperty* aProp = 0;
-
+
if ( HasColor() || HasWidth() )
{
aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe();
}
-
+
if ( HasColor() )
{
Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
while ( anActor != NULL )
{
SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor );
-
+
GActor->setIO( myIO );
if ( aProp )
GActor->PickableOn();
else
GActor->PickableOff();
-
+
vtkPrs->AddObject( GActor );
-
+
anActor = (vtkActor*)theActors->GetNextActor();
}
myViewFrame = GetActiveView();
if ( myViewFrame == 0 )
return 0;
-
+
SALOME_Prs* aPrs = myViewFrame->CreatePrs();
if ( aPrs == 0 )
return 0;
- internalReset();
+ internalReset();
setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) );
myType = theObj->GetType();
// Update presentation
- UpdatePrs( aPrs );
+ UpdatePrs( aPrs );
return aPrs;
}
* GEOM_Displayer::buildPresentation
* Builds/finds object's presentation for the current viewer
* Calls corresponding Update() method by means of double dispatch
- * [ internal ]
+ * [ internal ]
*/
//=================================================================
-SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
+SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
SALOME_View* theViewFrame )
{
SALOME_Prs* prs = 0;
internalReset();
myViewFrame = theViewFrame ? theViewFrame : GetActiveView();
-
- if ( myViewFrame )
+
+ if ( myViewFrame )
{
prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 );
- if ( prs )
+ if ( prs )
{
- if ( !theIO.IsNull() )
+ if ( !theIO.IsNull() )
{
// set interactive object
setIO( theIO );
// Find SOBject (because shape should be published previously)
SUIT_Session* session = SUIT_Session::session();
SUIT_Application* app = session->activeApplication();
- if ( app )
+ if ( app )
{
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( study )
{
_PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) );
- if ( SO )
+ if ( SO )
{
// get CORBA reference to data object
- CORBA::Object_var object = dynamic_cast<SALOMEDS_SObject*>(SO.get())->GetObject();
- if ( !CORBA::is_nil( object ) )
+ CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
+ if ( !CORBA::is_nil( object ) )
{
// downcast to GEOM object
GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object );
- if ( !GeomObject->_is_nil() )
+ if ( !GeomObject->_is_nil() )
{
// finally set shape
setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) );
return;
SalomeApp_SelectionMgr* sm = app->selectionMgr();
-
+
// remove all filters from selection
sm->clearFilters();
SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() );
vf->LocalSelection( prs, theMode );
delete prs; // delete presentation because displayer is its owner
- }
+ }
}
//=================================================================
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !app )
return;
-
+
SALOME_View* vf = GetActiveView();
if ( vf == 0 )
return;
-
+
// Close local context
vf->GlobalSelection( update );
clearTemporary( sm );
//@ aSel->ClearIndex();
-
+
sm->clearFilters();
-
+
// Remove filters from AIS_InteractiveContext
Handle(AIS_InteractiveContext) ic;
SOCC_Viewer* viewer = dynamic_cast<SOCC_Viewer*>( vf );
if ( !ic.IsNull() )
ic->RemoveFilters();
}
-
+
if ( theModes.Contains( GEOM_ALLOBJECTS ) )
return;
if ( aFilter )
aListOfFilters.append( aFilter );
}
-
+
aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR );
}
else
void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
{
SALOME_ListIteratorOfListIO Iter( theIOList );
- for ( ; Iter.More(); Iter.Next() )
+ for ( ; Iter.More(); Iter.Next() )
LocalSelection( Iter.Value(), theMode );
}
//=================================================================
/*!
* GEOM_Displayer::clearTemporary
- * Removes from selection temporary objects
+ * Removes from selection temporary objects
*/
//=================================================================
void GEOM_Displayer::clearTemporary( SalomeApp_SelectionMgr* theSelMgr )
{
SALOME_ListIO selected, toSelect;
theSelMgr->selectedObjects( selected );
-
+
for ( SALOME_ListIteratorOfListIO it( selected ) ; it.More(); it.Next() ) {
Handle(SALOME_InteractiveObject) io = it.Value();
- if ( !io.IsNull() && io->hasEntry() && strncmp( io->getEntry(), "TEMP_", 5 ) != 0 )
+ if ( !io.IsNull() && io->hasEntry() && strncmp( io->getEntry(), "TEMP_", 5 ) != 0 )
toSelect.Append( it.Value() );
}
-
+
theSelMgr->setSelectedObjects( toSelect, true );
}
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.
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include "GEOMGUI.h"
#include "GEOM_Client.hxx"
#include "SALOME_InteractiveObject.hxx"
+
+#include "SALOMEDSClient.hxx"
+
+// QT Includes
#include <qmap.h>
-#include "gp_Ax3.hxx"
+// OCCT Includes
+#include <gp_Ax3.hxx>
+
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_CLIENT_HEADER(SALOMEDS)
#ifdef WNT
#include <SALOME_WNT.hxx>
public:
// Constructor
- GeometryGUI();
+ GeometryGUI();
// Destructor
~GeometryGUI();
virtual void initialize( CAM_Application* );
virtual QString engineIOR() const;
- static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts
+ static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts
static GEOM::GEOM_Gen_var GetGeomGen() { return myComponentGeom; }
-
+
+ static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
+ static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
+
GEOM_Client& GetShapeReader() { return myShapeReader; }
Standard_CString& GetFatherior() { return myFatherior; }
//void SetState( const int state ) { myState = state; }
//int GetState() const { return myState; }
-
+
// Get active dialog box
QDialog* GetActiveDialogBox(){ return myActiveDialogBox; }
// Set active dialog box
void EmitSignalDefaultStepValueChanged( double newVal );
void OnGUIEvent( int id );
-
+
virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
private:
GEOMGUI* getLibrary( const QString& libraryName );
- void createGeomAction( const int id, const QString& po_id, const QString& icon_id = QString(""), const int key = 0, const bool toggle = false );
- void createPopupItem( const int, const QString& clients, const QString& types,
- const bool isSingle = false, const int isVisible = -1,
- const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 );
+ void createGeomAction( const int id, const QString& po_id,
+ const QString& icon_id = QString(""),
+ const int key = 0, const bool toggle = false );
+ void createPopupItem( const int, const QString& clients, const QString& types,
+ const bool isSingle = false, const int isVisible = -1,
+ const bool isExpandAll = false, const bool isOCC = false,
+ const int parentId = -1 );
private:
static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine
};
#endif
-
#include "utilities.h"
#include "SALOMEDSClient.hxx"
-#include "SALOMEDS_SObject.hxx"
-#include "SALOMEDS_Study.hxx"
// OCCT Includes
#include <TopExp_Explorer.hxx>
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@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// $Header$
#include "GEOMToolsGUI.h"
+
#include "GeometryGUI.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_Prs.h>
+#include "utilities.h"
+
+// QT Includes
#include <qapplication.h>
#include <qmap.h>
-#include "utilities.h"
+// OCCT Includes
+#include <TCollection_AsciiString.hxx>
using namespace std;
typedef QMap<QString, QString> FilterMap;
-#include <SALOMEDS_SObject.hxx>
-
-
-
-
//=======================================================================
// function : getFileName
-// purpose : Selection of a file name for Import/Export. Returns also
+// purpose : Selection of a file name for Import/Export. Returns also
// the selected file type code through <filter> argument.
//=======================================================================
-static QString getFileName( QWidget* parent,
- const QString& initial,
- const FilterMap& filterMap,
+static QString getFileName( QWidget* parent,
+ const QString& initial,
+ const FilterMap& filterMap,
const QString& caption,
bool open,
QString& format )
for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it )
filters.push_back( it.key() );
- SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true );
+ SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true );
if ( !caption.isEmpty() )
fd->setCaption( caption );
// function : GEOMToolsGUI()
// purpose : Constructor
//=======================================================================
-GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
+GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent )
: GEOMGUI( parent )
{
}
//=======================================================================
// function : OnGUIEvent()
-// purpose :
+// purpose :
//=======================================================================
bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(),
- QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") );
return;
}
-
+
// VSR 17/11/04: check if all objects selected belong to GEOM component --> start
// modifications of ASV 01.06.05
QString parentComp = getParentComponent( aStudy, selected );
if ( parentComp != geomComp ) {
SUIT_MessageBox::warn1 ( app->desktop(),
- QObject::tr("ERR_ERROR"),
+ QObject::tr("ERR_ERROR"),
QObject::tr("NON_GEOM_OBJECTS_SELECTED").arg( getGeometryGUI()->moduleName() ),
QObject::tr("BUT_OK") );
return;
}
// VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish
- if ( SUIT_MessageBox::warn2( app->desktop(),
+ if ( SUIT_MessageBox::warn2( app->desktop(),
QObject::tr( "GEOM_WRN_WARNING" ),
QObject::tr( "GEOM_REALLY_DELETE" ),
QObject::tr( "GEOM_BUT_YES" ),
// QAD_Operation* op = new SALOMEGUI_ImportOperation(.....);
// op->start();
-
+
// prepare list of SALOME_Views
QPtrList<SALOME_View> views;
SALOME_View* view;
if ( view )
views.append( view );
}
-
+
_PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
_PTR(GenericAttribute) anAttr;
GEOM_Displayer* disp = new GEOM_Displayer( appStudy );
if ( !strcmp( obj->GetIOR().c_str(), geomIOR ) )
continue;
- // iterate through all childres of obj, find IOR attributes on children and remove shapes that
- // correspond to these IORs
- for ( _PTR(ChildIterator) it ( aStudy->NewChildIterator( obj ) ); it->More();it->Next() ) {
- _PTR(SObject) child ( it->Value() );
- if ( child->FindAttribute( anAttr, "AttributeIOR" ) ) {
- _PTR(AttributeIOR) anIOR( anAttr );
+ // iterate through all children of obj, find IOR attributes on children
+ // and remove shapes that correspond to these IORs
+ for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
+ _PTR(SObject) child (it->Value());
+ if (child->FindAttribute(anAttr, "AttributeIOR")) {
+ _PTR(AttributeIOR) anIOR (anAttr);
// Delete child( s ) shape in Client :
- const TCollection_AsciiString ASCior( (char*)anIOR->Value().c_str() ) ;
- getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCior );
-
- for ( view = views.first(); view; view = views.next() ) {
- CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(child.get()))->GetObject();
- GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
- if ( !CORBA::is_nil( geomObj ) )
- disp->Erase( geomObj, true, view );
- }
+ const TCollection_AsciiString ASCior ((char*)anIOR->Value().c_str());
+ getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer(ASCior);
+
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(child);
+ GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow(corbaObj);
+ if (!CORBA::is_nil(geomObj)) {
+ for (view = views.first(); view; view = views.next()) {
+ disp->Erase(geomObj, true, view);
+ }
+ }
}
- } // for ( childres of obj )
+ } // for ( children of obj )
// Erase main graphical object
- for ( view = views.first(); view; view = views.next() )
+ for ( view = views.first(); view; view = views.next() )
disp->Erase( io, true, view );
// Delete main shape in Client :
if ( obj->FindAttribute( anAttr, "AttributeIOR" ) ) {
_PTR(AttributeIOR) anIOR( anAttr );
- const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() ) ;
+ const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() );
getGeometryGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCIor );
}
- // Remove objects from Study
- aStudyBuilder->RemoveObject( obj );
-
- CORBA::Object_var corbaObj = (dynamic_cast<SALOMEDS_SObject*>(obj.get()))->GetObject();
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
if ( !CORBA::is_nil( geomObj ) )
GeometryGUI::GetGeomGen()->RemoveObject( geomObj );
-
+
+ // Remove objects from Study
+ aStudyBuilder->RemoveObject( obj );
+
//deleted = true;
} // MAIN LOOP of selected
-
+
selected.Clear();
aSelMgr->setSelectedObjects( selected );
getGeometryGUI()->updateObjBrowser();
} // if ( selected not empty )
} // if ( selMgr && appStudy )
-
+
app->updateActions(); //SRN: BugID IPAL9377, case 1 for GEOM module
-
+
} // if ( app )
-
+
// if ( deleted )
// op->finish();
// else
// purpose :
//==============================================================================
void GEOMToolsGUI::OnEditCopy()
-{
-/*
+{
+/*
SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() );
GEOM::string_array_var listIOR = new GEOM::string_array;
Sel->ClearIObjects();
SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- int aStudyID = aStudy->StudyId();
+ int aStudyID = aStudy->StudyId();
for (unsigned int ind = 0; ind < listIOR->length();ind++) {
GEOM::GEOM_Object_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]);
try {
GEOM::GEOM_IInsertOperations_var IOp = myGeom->GetIInsertOperations(aStudyID);
- GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit) ;
+ GEOM::GEOM_Object_var result = IOp->MakeCopy(aShapeInit);
myGeomBase->Display(result);
}
catch (const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
}
-
+
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY"));
*/
}
{
SUIT_Application* app = getGeometryGUI()->getApp();
if (! app) return false;
-
+
SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
if ( !stud ) {
cout << "FAILED to cast active study to SalomeApp_Study" << endl;
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(),
- QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") );
return false;
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) {
- SUIT_MessageBox::error1( app->desktop(),
+ SUIT_MessageBox::error1( app->desktop(),
QObject::tr("WRN_WARNING"),
- QObject::tr( "GEOM Engine is not started" ),
+ QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") );
return false;
}
GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
if ( aInsOp->_is_nil() )
return false;
-
+
GEOM::GEOM_Object_var anObj;
// Obtain a list of available import formats
GEOM::string_array_var aFormats, aPatterns;
aInsOp->ImportTranslators( aFormats, aPatterns );
- for ( int i = 0, n = aFormats->length(); i < n; i++ )
+ for ( int i = 0, n = aFormats->length(); i < n; i++ )
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
QString fileType;
QString file = getFileName(app->desktop(), "", aMap, tr("GEOM_MEN_IMPORT"), true, fileType );
- if( file.isEmpty() || fileType.isEmpty() )
+ if( file.isEmpty() || fileType.isEmpty() )
return false;
-
+
GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
try {
SUIT_OverrideCursor wc;
anOp->start();
- anObj = aInsOp->Import( file.latin1(), fileType.latin1() );
+ anObj = aInsOp->Import( file.latin1(), fileType.latin1() );
if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() );
QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true ));
- GeometryGUI::GetGeomGen()->PublishInStudy(dynamic_cast<SALOMEDS_Study*>(aStudy.get())->GetStudy(),
- SALOMEDS::SObject::_nil(),
- anObj,
- aPublishObjName );
+
+ SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy(aStudy);
+ GeometryGUI::GetGeomGen()->PublishInStudy(aDSStudy,
+ SALOMEDS::SObject::_nil(),
+ anObj,
+ aPublishObjName);
GEOM_Displayer( stud ).Display( anObj.in() );
// update data model and object browser
getGeometryGUI()->updateObjBrowser( true );
-
- anOp->commit();
+
+ anOp->commit();
}
else {
anOp->abort();
wc.suspend();
- SUIT_MessageBox::error1( app->desktop(),
+ SUIT_MessageBox::error1( app->desktop(),
QObject::tr( "GEOM_ERROR" ),
- QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
+ QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
QObject::tr("BUT_OK") );
}
}
{
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return false;
-
+
SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
if ( !stud ) {
cout << "FAILED to cast active study to SalomeApp_Study" << endl;
return false;
}
_PTR(Study) aStudy = stud->studyDS();
-
+
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) {
- SUIT_MessageBox::error1( app->desktop(),
+ SUIT_MessageBox::error1( app->desktop(),
QObject::tr("WRN_WARNING"),
- QObject::tr( "GEOM Engine is not started" ),
+ QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") );
return false;
}
-
+
GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
if ( aInsOp->_is_nil() )
return false;
FilterMap aMap;
GEOM::string_array_var aFormats, aPatterns;
aInsOp->ExportTranslators( aFormats, aPatterns );
- for ( int i = 0, n = aFormats->length(); i < n; i++ )
+ for ( int i = 0, n = aFormats->length(); i < n; i++ )
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
// Get selected objects
if ( !found || anObj->_is_nil() )
continue;
-
+
QString fileType;
- QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap,
+ QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap,
tr("GEOM_MEN_EXPORT"), false, fileType);
-
+
// User has pressed "Cancel" --> stop the operation
if ( file.isEmpty() || fileType.isEmpty() )
return false;
-
+
GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
try {
SUIT_OverrideCursor wc;
-
+
app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( file, /*withExten=*/true )) );
-
+
anOp->start();
{
anOp->abort();
wc.suspend();
- SUIT_MessageBox::error1( app->desktop(),
+ SUIT_MessageBox::error1( app->desktop(),
QObject::tr( "GEOM_ERROR" ),
- QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
+ QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
QObject::tr("BUT_OK") );
return false;
}
- }
+ }
catch (const SALOME::SALOME_Exception& S_ex) {
//QtCatchCorbaException(S_ex);
anOp->abort();
return false;
}
}
-
- return true;
+
+ return true;
}
for ( SALOME_ListIteratorOfListIO it( iobjs ); it.More(); it.Next() ) {
Handle(SALOME_InteractiveObject) io = it.Value();
- if ( !io->hasEntry() )
+ if ( !io->hasEntry() )
continue;
QString compName = getParentComponent( study->FindObjectID( io->getEntry() ) );
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
#include "GEOMGUI.h"
#include <SALOMEDSClient.hxx>
-#include <SALOMEDS_Study.hxx>
#include <SALOME_ListIO.hxx>
+#include <CORBA.h>
//=================================================================================
// class : GEOMToolsGUI
private:
// Import and export topology methods
bool Import();
- bool Export();
-
+ bool Export();
+
void OnEditCopy();
void OnEditDelete();
void OnOpen();
// returns name of Module (Component) of given objects (usually selected objects)
- // if objects belong to different Components, a NULL string is returned.
+ // if objects belong to different Components, a NULL string is returned.
QString getParentComponent( _PTR( Study ), const SALOME_ListIO& );
QString getParentComponent( _PTR(SObject) );
};
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+//
//
-//
//
// File : GEOMToolsGUI_1.cxx
// Author : Sergey ANIKIN
#include <PythonConsole_PyConsole.h>
#include "GEOMToolsGUI.h"
+
#include "GeometryGUI.h"
-#include "GEOM_Actor.h"
-#include "GEOMBase.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement
#include "GEOMToolsGUI_NameDlg.h"
+#include "GEOM_Actor.h"
+#include "GEOMBase.h"
+
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SalomeApp_Study.h>
#include <SalomeApp_Module.h>
+#include "SALOMEDSClient.hxx"
+
+#include "utilities.h"
+
+// OCCT Includes
#include <AIS_Drawer.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_IsoAspect.hxx>
+// VTK Includes
#include <vtkBMPReader.h>
#include <vtkTexture.h>
#include <vtkTextureMapToPlane.h>
#include <vtkDataSetMapper.h>
#include <vtkRenderer.h>
+// QT Includes
#include <qfileinfo.h>
#include <qcolordialog.h>
#include <qspinbox.h>
#include <qapplication.h>
-#include "utilities.h"
-
using namespace std;
-#include "SALOMEDSClient.hxx"
-#include "SALOMEDS_Study.hxx"
-
-
void GEOMToolsGUI::OnSettingsColor()
{
SUIT_Desktop* desk = sess->activeApplication()->desktop();
QColor anInitColor = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "yellow" ) );
-
+
QColor aDialogColor = QColorDialog::getColor(anInitColor, desk );
- if( aDialogColor.isValid() )
+ if( aDialogColor.isValid() )
{
QString type = desk->activeWindow()->getViewManager()->getType();
if( type != OCCViewer_Viewer::Type() && type != VTKViewer_Viewer::Type() )
MESSAGE("Settings Color is not supported for current Viewer");
-
+
resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor );
}
}
if ( type != OCCViewer_Viewer::Type() )
return;
-
+
OCCViewer_Viewer* vm = (OCCViewer_Viewer*)vman->getViewModel();
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
-
+
int IsoU = resMgr->integerValue( "Geometry:SettingsIsoU", 1 );
int IsoV = resMgr->integerValue( "Geometry:SettingsIsoV", 1 );
-
+
ic->DefaultDrawer()->UIsoAspect()->SetNumber( IsoU );
ic->DefaultDrawer()->VIsoAspect()->SetNumber( IsoV );
-
- GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(desk, tr("GEOM_MEN_ISOS"), TRUE);
-
+
+ GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(desk, tr("GEOM_MEN_ISOS"), TRUE);
+
NbIsosDlg->SpinBoxU->setValue(IsoU);
NbIsosDlg->SpinBoxV->setValue(IsoV);
-
+
if(NbIsosDlg->exec()) {
IsoU = NbIsosDlg->SpinBoxU->text().toInt();
IsoV = NbIsosDlg->SpinBoxV->text().toInt();
-
+
ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso);
ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso);
resMgr->setValue("Geometry:SettingsIsoU", isoU);
double dd = GEOMBase::Parameter( res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3);
if(res) {
resMgr->setValue( "Geometry", "SettingsGeomStep", dd );
-
+
/* Emit signal to GeometryGUI_SpinBoxes */
getGeometryGUI()->EmitSignalDefaultStepValueChanged( dd );
}
bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked();
if ( aLocked ) {
SUIT_MessageBox::warn1 ( app->desktop(),
- QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED"),
QObject::tr("BUT_OK") );
return;
}
-
+
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
-
+
_PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) );
_PTR(GenericAttribute) anAttr;
if ( obj ) {
if( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName (anAttr);
-
+
QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if ( !newName.isEmpty() ) {
aName->SetValue( newName.latin1() ); // rename the SObject
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
PythonConsole* pyConsole = app->pythonConsole();
-
+
if(pyConsole)
pyConsole->exec("from GEOM_usinggeom import *");
}
if ( !isOCC )
return;
-
+
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
-
+
ic->InitCurrent();
if ( ic->MoreCurrent() ) {
Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-
+
int UIso = CurDrawer->UIsoAspect()->Number();
int VIso = CurDrawer->VIsoAspect()->Number();
-
+
GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
-
+
NbIsosDlg->setU( UIso );
NbIsosDlg->setV( VIso );
-
+
if ( NbIsosDlg->exec() ) {
SUIT_OverrideCursor();
for(; ic->MoreCurrent(); ic->NextCurrent()) {
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-
+
int nbUIso = NbIsosDlg->getU();
int nbVIso = NbIsosDlg->getV();
-
+
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) );
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
-
+
ic->SetLocalAttributes(CurObject, CurDrawer);
ic->Redisplay(CurObject);
}
useSubItems = true;
obj = subobj;
}
- else
+ else
anIter->Next();
}
obj->FindAttribute(anAttr, "AttributePersistentRef");
-
- while(useSubItems?anIter->More():!anAttr->_is_nil()) {
+
+ while(useSubItems?anIter->More():!anAttr->_is_nil()) {
if(!obj->FindAttribute(anAttr, "AttributeIOR") &&
obj->FindAttribute(anAttr, "AttributePersistentRef")) {
_PTR(SComponent) FComp ( obj->GetFatherComponent() );
} else {
return;
}
- }
+ }
else {
MESSAGE("loadComponentData(): Driver is null");
return;
// SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM");
// if (!CORBA::is_nil(SC))
// aStudyBuilder->LoadWith(SC,driver);
- }
+ }
}
else {
MESSAGE("Component is null");
if(useSubItems) {
anIter->Next();
obj.reset( anIter->Value() );
- }
- else
+ }
+ else
anAttr = NULL;
}
}
#include "GEOM_Gen_i.hh"
#include "GEOM_Object_i.hh"
-#include <strstream>
+#include <strstream>
#include "Utils_CorbaException.hxx"
#include "OpUtil.hxx"
//============================================================================
// function : GEOM_Gen_i()
-// purpose : constructor to be called for servant creation.
+// purpose : constructor to be called for servant creation.
//============================================================================
GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
const char *interfaceName) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
{
- _thisObj = this ;
+ _thisObj = this;
_id = _poa->activate_object(_thisObj);
name_service = new SALOME_NamingService(_orb);
char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
const char* aLocalPersistentID,
CORBA::Boolean isMultiFile,
- CORBA::Boolean isASCII)
-{
+ CORBA::Boolean isASCII)
+{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
Handle(GEOM_Object) anObject = _impl->GetObject(aStudy->StudyId(), const_cast<char*>(aLocalPersistentID));
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(anObject->GetEntry(), anEntry);
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(anObject->GetEntry(), anEntry);
GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString());
CORBA::String_var aPersRefString = _orb->object_to_string(obj);
//============================================================================
// function : CanPublishInStudy
-// purpose :
+// purpose :
//============================================================================
bool GEOM_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR)
{
//============================================================================
// function : PublishInStudy
-// purpose :
+// purpose :
//============================================================================
SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
if(aShape->_is_nil()) return aResultSO;
SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
- SALOMEDS::SComponent_var aFather = theStudy->FindComponent("GEOM");
+ SALOMEDS::SComponent_var aFather = theStudy->FindComponent("GEOM");
if (aFather->_is_nil()) {
aFather = aStudyBuilder->NewComponent("GEOM");
anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName");
aStudyBuilder->DefineComponentInstance(aFather, GEOM_Gen::_this());
}
if (aFather->_is_nil()) return aResultSO;
-
+
if (CORBA::is_nil(theSObject)) {
aResultSO = aStudyBuilder->NewObject(aFather);
} else {
- if (!theSObject->ReferencedObject(aResultSO))
+ if (!theSObject->ReferencedObject(aResultSO))
aResultSO = SALOMEDS::SObject::_duplicate(theSObject); //SRN: Added Aug 24,2004 : for the method AddInStudy with theFather argumenet != NULL
//THROW_SALOME_CORBA_EXCEPTION("Publish in study supervision graph error",SALOME::BAD_PARAM);
}
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
- TCollection_AsciiString aShapeName("Shape_");
+ TCollection_AsciiString aShapeName("Shape_");
if ( aShape->GetType() == GEOM_GROUP ) {
GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() );
} else if ( aShape->GetShapeType() == GEOM::VERTEX ) {
aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
aShapeName = "Vertex_";
- }
+ }
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
//else aShapeName = TCollection_AsciiString(strdup(theName));
do {
aNewShapeName = aShapeName + TCollection_AsciiString(++i);
obj = theStudy->FindObject( aNewShapeName.ToCString() );
- }
+ }
while ( !obj->_is_nil() );
aShapeName = aNewShapeName;
}
return aResultSO._retn();
}
-
+
//============================================================================
// function : Save()
// purpose : save OCAF/Geom document
//============================================================================
// function : SaveASCII()
// purpose :
-//============================================================================
+//============================================================================
SALOMEDS::TMPFile* GEOM_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile) {
//============================================================================
// function : Load()
// purpose :
-//============================================================================
+//============================================================================
CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
//============================================================================
// function : LoadASCII()
// purpose :
-//============================================================================
+//============================================================================
CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
if (anObject->_is_nil()) return aStreamFile._retn();
aStreamFile = anObject->GetShapeStream();
-
+
// Assign an ID the type of GEOM_Object
theObjectID = anObject->GetType();
} catch (Standard_Failure) {
return false;
}
-
+
// SObject of the created shape is theObject or new Child of Component if theObject == geom component
SALOMEDS::SObject_var aNewSO;
if (strcmp(theObject->GetFatherComponent()->GetID(),theObject->GetID()) == 0) {
aNewSO = aStudyBuilder->NewObject(theObject);
} else aNewSO = SALOMEDS::SObject::_duplicate(theObject);
-
- //Create a new GEOM_Object
- Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
- Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
+
+ //Create a new GEOM_Object
+ Handle(GEOM_Object) anObj = _impl->AddObject(aNewSO->GetStudy()->StudyId(), theObjectID);
+ Handle(GEOM_Function) aFunction = anObj->AddFunction(GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF);
aFunction->SetValue(aTopology);
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
GEOM::GEOM_Object_var obj = GetObject(anObj->GetDocID(), anEntry.ToCString());
// Add IORAttribute to the Study and set IOR of the created GEOM_Object to it
{
SALOMEDS::SObject_var aResultSO;
if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
-
- SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+
+ SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
char* IOR;
if(!theFather->_is_nil()) {
- IOR = _orb->object_to_string(theFather);
+ IOR = _orb->object_to_string(theFather);
SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR);
if(aFatherSO->_is_nil()) return aResultSO._retn();
aResultSO = aStudyBuilder->NewObject(aFatherSO);
//aStudyBuilder->Addreference(aResultSO, aResultSO);
- }
+ }
aResultSO = PublishInStudy(theStudy, aResultSO, theObject, theName);
if(aResultSO->_is_nil()) return aResultSO._retn();
GEOM::ListOfGO_var aList = theObject->GetDependency();
- Standard_Integer aLength = aList->length();
+ Standard_Integer aLength = aList->length();
if(aLength < 1) return aResultSO._retn();
- //Publish the arguments
+ //Publish the arguments
for(Standard_Integer i = 0; i< aLength; i++) {
GEOM::GEOM_Object_var anObject = aList[i];
if(anObject->_is_nil()) continue;
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
aStudyBuilder->Addreference(aSubSO, aSO);
}
-
+
return aResultSO._retn();
}
//============================================================================
-// function : register()
+// function : register()
// purpose : register 'name' in 'name_service'
//============================================================================
void GEOM_Gen_i::register_name(char * name)
{
GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this());
- name_service->Register(g, strdup(name));
+ name_service->Register(g, strdup(name));
}
//============================================================================
//============================================================================
// function : GetIBasicOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIBasicOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IBasicOperations_i* aServant =
new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IBasicOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetITransformOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_ITransformOperations_ptr GEOM_Gen_i::GetITransformOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetITransformOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_ITransformOperations_i* aServant =
new GEOM_ITransformOperations_i(_poa, engine, _impl->GetITransformOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_ITransformOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetI3DPrimOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_I3DPrimOperations_ptr GEOM_Gen_i::GetI3DPrimOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetI3DPrimOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_I3DPrimOperations_i* aServant =
new GEOM_I3DPrimOperations_i(_poa, engine, _impl->GetI3DPrimOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_I3DPrimOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIShapesOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IShapesOperations_ptr GEOM_Gen_i::GetIShapesOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIShapesOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IShapesOperations_i* aServant =
new GEOM_IShapesOperations_i(_poa, engine, _impl->GetIShapesOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IShapesOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIBlocksOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IBlocksOperations_ptr GEOM_Gen_i::GetIBlocksOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIBlocksOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IBlocksOperations_i* aServant =
new GEOM_IBlocksOperations_i(_poa, engine, _impl->GetIBlocksOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IBlocksOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIBooleanOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IBooleanOperations_ptr GEOM_Gen_i::GetIBooleanOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIBooleanOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IBooleanOperations_i* aServant =
new GEOM_IBooleanOperations_i(_poa, engine, _impl->GetIBooleanOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IBooleanOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetICurvesOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_ICurvesOperations_ptr GEOM_Gen_i::GetICurvesOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetICurvesOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_ICurvesOperations_i* aServant =
new GEOM_ICurvesOperations_i(_poa, engine, _impl->GetICurvesOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_ICurvesOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetILocalOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_ILocalOperations_ptr GEOM_Gen_i::GetILocalOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetILocalOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_ILocalOperations_i* aServant =
new GEOM_ILocalOperations_i(_poa, engine, _impl->GetILocalOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_ILocalOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIHealingOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IHealingOperations_ptr GEOM_Gen_i::GetIHealingOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::IHealingOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IHealingOperations_i* aServant =
new GEOM_IHealingOperations_i(_poa, engine, _impl->GetIHealingOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IHealingOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIInsertOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IInsertOperations_ptr GEOM_Gen_i::GetIInsertOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIInsertOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IInsertOperations_i* aServant =
new GEOM_IInsertOperations_i(_poa, engine, _impl->GetIInsertOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IInsertOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIMeasureOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IMeasureOperations_ptr GEOM_Gen_i::GetIMeasureOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIMeasureOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IMeasureOperations_i* aServant =
new GEOM_IMeasureOperations_i(_poa, engine, _impl->GetIMeasureOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IMeasureOperations_var operations = aServant->_this();
return operations._retn();
}
//============================================================================
// function : GetIGroupOperations
-// purpose :
+// purpose :
//============================================================================
GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theStudyID)
throw ( SALOME::SALOME_Exception )
Unexpect aCatch(SALOME_SalomeException);
MESSAGE( "GEOM_Gen_i::GetIGroupOperations" );
- GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM::GEOM_Gen_ptr engine = _this();
GEOM_IGroupOperations_i* aServant =
new GEOM_IGroupOperations_i(_poa, engine, _impl->GetIGroupOperations(theStudyID));
- // activate the CORBA servant
+ // activate the CORBA servant
GEOM::GEOM_IGroupOperations_var operations = aServant->_this();
return operations._retn();
}
if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil();
Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry());
if (aMainsShape.IsNull()) return GEOM::GEOM_Object::_nil();
-
+
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length());
for(Standard_Integer i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
* RemoveObject
*/
//=============================================================================
-void GEOM_Gen_i::RemoveObject(GEOM::GEOM_Object_ptr theObject)
+void GEOM_Gen_i::RemoveObject(GEOM::GEOM_Object_ptr theObject)
{
Handle(GEOM_Object) anObject = _impl->GetObject(theObject->GetStudyID(), theObject->GetEntry());
if (anObject.IsNull()) return;
_impl->RemoveObject(anObject);
- return;
-}
+ return;
+}
//=================================================================================
if(strcmp(stringIOR,"") != 0){
CORBA::Object_var anObject = _orb->string_to_object(stringIOR);
if(!CORBA::is_nil(anObject))
- aGeomObject = GEOM::GEOM_Object::_narrow(anObject.in()) ;
+ aGeomObject = GEOM::GEOM_Object::_narrow(anObject.in());
}
- return aGeomObject._retn() ;
+ return aGeomObject._retn();
}
//=================================================================================
// function : GetObject()
-// purpose :
+// purpose :
//=================================================================================
-GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject(CORBA::Long theStudyID, const char* theEntry)
+GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char* theEntry)
{
GEOM::GEOM_Object_var obj;
Handle(GEOM_Object) handle_object = _impl->GetObject(theStudyID, (char*)theEntry);
- if(handle_object.IsNull()) return NULL;
+ if (handle_object.IsNull()) return NULL;
+
TCollection_AsciiString stringIOR = handle_object->GetIOR();
- if(stringIOR.Length() > 1) {
+ if (stringIOR.Length() > 1) {
CORBA::Object_var corba_object = _orb->string_to_object(stringIOR.ToCString());
- if(!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object);
- return obj._retn();
- }
+ if (!CORBA::is_nil(corba_object)) obj = GEOM::GEOM_Object::_narrow(corba_object);
+ return obj._retn();
+ }
+
+ GEOM::GEOM_Gen_ptr engine = _this();
+ GEOM_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object);
- GEOM::GEOM_Gen_ptr engine = _this();
- GEOM_Object_i* servant = new GEOM_Object_i(_poa, engine, handle_object);
-
obj = servant->_this();
- stringIOR = _orb->object_to_string(obj);
+ stringIOR = _orb->object_to_string(obj);
handle_object->SetIOR(stringIOR);
- return obj._retn();
+ return obj._retn();
}
extern "C"
{
PortableServer::ObjectId * GEOMEngine_factory(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
+ PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
- const char *instanceName,
+ const char *instanceName,
const char * interfaceName)
{
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
- myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
- return myGEOM_Gen_i->getId() ;
+ myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
+ return myGEOM_Gen_i->getId();
}
}
-
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
-#include "SALOME_Component_i.hxx"
+#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
-//#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
#include "GEOM_IBasicOperations_i.hh"
#include "GEOM_ITransformOperations_i.hh"
#include "GEOM_I3DPrimOperations_i.hh"
#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
//-----------------------------------------------------------------------//
// Constructor / Destructor //
//-----------------------------------------------------------------------//
- // constructor to be called for servant creation.
+
+ // constructor to be called for servant creation.
GEOM_Gen_i();
GEOM_Gen_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
const char *interfaceName);
// destructor, doing nothing (for now)
//-----------------------------------------------------------------------//
// Inherited methods from SALOMEDS::Driver //
- //-----------------------------------------------------------------------//
+ //-----------------------------------------------------------------------//
SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile);
-
+
CORBA::Boolean Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject);
- //Adds theObject in the study with a name = theName, if theFather is not null the object is placed under theFather
- SALOMEDS::SObject_ptr AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM::GEOM_Object_ptr theObject, const char* theName, GEOM::GEOM_Object_ptr theFather);
+ /*! \brief Adds theObject in the study with a name = theName, if
+ * theFather is not null the object is placed under theFather
+ */
+ SALOMEDS::SObject_ptr AddInStudy (SALOMEDS::Study_ptr theStudy,
+ GEOM::GEOM_Object_ptr theObject,
+ const char* theName,
+ GEOM::GEOM_Object_ptr theFather);
//-----------------------------------------------------------------------//
- // Transaction methods //
- //-----------------------------------------------------------------------//
-
+ // Transaction methods //
+ //-----------------------------------------------------------------------//
+
//Undos one transaction in the document associated with theStudyID
virtual void Undo(CORBA::Long theStudyID);
//-----------------------------------------------------------------------//
// Operations methods //
- //-----------------------------------------------------------------------//
+ //-----------------------------------------------------------------------//
//Returns a pointer to BasicOperations interface
virtual GEOM::GEOM_IBasicOperations_ptr GetIBasicOperations (CORBA::Long theStudyID)
throw (SALOME::SALOME_Exception);
-
+
//Returns a pointer to TransformOperations interface
virtual GEOM::GEOM_ITransformOperations_ptr GetITransformOperations (CORBA::Long theStudyID)
throw (SALOME::SALOME_Exception);
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);
virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
- virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
+ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript);
char* GetDumpName (const char* theStudyEntry);
GEOM::string_array* GetAllDumpNames();
- //********************************************************************************************************//
- // Internal methods
- //********************************************************************************************************//
+ //-----------------------------------------------------------------------//
+ // Internal methods //
+ //-----------------------------------------------------------------------//
+
virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
private:
-
+
::GEOMImpl_Gen* _impl;
SALOME_NamingService * name_service;
- char * _name;
-
+ char * _name;
};
-#endif
+#endif
/*!
* MakeCirclePntVecR
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR
(GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
CORBA::Double theR)
/*!
* MakeCircleThreePnt
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCircleThreePnt
(GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3)
/*!
* MakeEllipse
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
(GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
CORBA::Double theRMajor, double theRMinor)
/*!
* MakeArc
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArc
(GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
/*!
* MakePolyline
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakePolyline
(const GEOM::ListOfGO& thePoints)
{
/*!
* MakeSplineBezier
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineBezier
(const GEOM::ListOfGO& thePoints)
{
/*!
* MakeSplineInterpolation
*/
-//=============================================================================
+//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
(const GEOM::ListOfGO& thePoints)
{
/*!
* 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();
// 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);
}
/*!
* 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();
// Make Sketcher
Handle(GEOM_Object) anObject =
- GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
+ GetOperations()->MakeSketcherOnPlane(strdup(theCommand), aWorkingPlane);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
#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
public:
GEOM_Object_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, Handle(GEOM_Object) theImpl);
~GEOM_Object_i();
-
+
virtual char* GetEntry();
-
+
virtual CORBA::Long GetStudyID();
-
+
virtual CORBA::Long GetType();
- virtual GEOM::shape_type GetShapeType();
+ virtual GEOM::shape_type GetShapeType();
virtual void SetName(const char* theName);
- virtual char* GetName();
+ virtual char* GetName();
virtual void SetStudyEntry(const char* theEntry);
- virtual char* GetStudyEntry();
+ virtual char* GetStudyEntry();
virtual GEOM::ListOfGO* GetDependency();
virtual bool IsMainShape() { return _impl->IsMainShape(); }
- virtual GEOM::ListOfLong* GetSubShapeIndices();
-
+ virtual GEOM::ListOfLong* GetSubShapeIndices();
+
virtual GEOM::GEOM_Object_ptr GetMainShape();
- virtual bool IsShape();
+ virtual bool IsShape();
Handle(GEOM_Object) GetImpl() { return _impl; }
private:
- GEOM::GEOM_Gen_ptr _engine;
- Handle(GEOM_Object) _impl;
+ GEOM::GEOM_Gen_ptr _engine;
+ Handle(GEOM_Object) _impl;
TopoDS_Shape _geom;
};
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 =
# 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 =
DISTCLEAN =
@CONCLUDE@
-