From: dcq Date: Tue, 4 May 2004 14:04:19 +0000 (+0000) Subject: DCQ : New Sketcher + merge X-Git-Tag: Ecole_Ete_a3~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=db1841de363e5e37522973407b6cc2ed49a6a8ea;p=modules%2Fgeom.git DCQ : New Sketcher + merge --- diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 05992b832..9e7925e68 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -675,11 +675,17 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); if(!Name.isEmpty()) { // VTK - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - GActor->setName(strdup(Name.latin1())); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + char* aCopy = CORBA::string_dup(Name.latin1()); + GActor->setName(aCopy); + delete(aCopy); + } // OCC - else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - GAISShape->setName(strdup(Name.latin1())); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + char* aCopy = CORBA::string_dup(Name.latin1()); + GAISShape->setName(aCopy); + delete(aCopy); + } } else return false; @@ -916,55 +922,55 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& { case TopAbs_COMPOUND: { - aTypeString = strdup(tr("GEOM_COMPOUND")); + aTypeString = CORBA::string_dup(tr("GEOM_COMPOUND")); return true; } case TopAbs_COMPSOLID: { - aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; + aTypeString = CORBA::string_dup(tr("GEOM_COMPOUNDSOLID")) ; return true ; } case TopAbs_SOLID: { - aTypeString = strdup(tr("GEOM_SOLID")) ; + aTypeString = CORBA::string_dup(tr("GEOM_SOLID")) ; return true ; } case TopAbs_SHELL: { - aTypeString = strdup(tr("GEOM_SHELL")) ; + aTypeString = CORBA::string_dup(tr("GEOM_SHELL")) ; return true ; } case TopAbs_FACE: { BRepAdaptor_Surface surf(TopoDS::Face(aShape)); if(surf.GetType() == GeomAbs_Plane) { - aTypeString = strdup(tr("GEOM_PLANE")); + aTypeString = CORBA::string_dup(tr("GEOM_PLANE")); return true; } else if(surf.GetType() == GeomAbs_Cylinder) { - aTypeString = strdup(tr("GEOM_SURFCYLINDER")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFCYLINDER")); return true; } else if(surf.GetType() == GeomAbs_Sphere) { - aTypeString = strdup(tr("GEOM_SURFSPHERE")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFSPHERE")); return true ; } else if(surf.GetType() == GeomAbs_Torus) { - aTypeString = strdup(tr("GEOM_SURFTORUS")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFTORUS")); return true ; } else if(surf.GetType() == GeomAbs_Cone) { - aTypeString = strdup(tr("GEOM_SURFCONE")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFCONE")); return true ; } else { - aTypeString = strdup(tr("GEOM_FACE")); + aTypeString = CORBA::string_dup(tr("GEOM_FACE")); return true; } } case TopAbs_WIRE: { - aTypeString = strdup(tr("GEOM_WIRE")); + aTypeString = CORBA::string_dup(tr("GEOM_WIRE")); return true; } case TopAbs_EDGE: @@ -972,31 +978,31 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); if(curv.GetType() == GeomAbs_Line) { if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) - aTypeString = strdup(tr("GEOM_LINE")); + aTypeString = CORBA::string_dup(tr("GEOM_LINE")); else - aTypeString = strdup(tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(tr("GEOM_EDGE")); return true; } else if(curv.GetType() == GeomAbs_Circle) { if(curv.IsClosed()) - aTypeString = strdup(tr("GEOM_CIRCLE")); + aTypeString = CORBA::string_dup(tr("GEOM_CIRCLE")); else - aTypeString = strdup(tr("GEOM_ARC")); + aTypeString = CORBA::string_dup(tr("GEOM_ARC")); return true; } else { - aTypeString = strdup(tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(tr("GEOM_EDGE")); return true; } } case TopAbs_VERTEX: { - aTypeString = strdup(tr("GEOM_VERTEX")); + aTypeString = CORBA::string_dup(tr("GEOM_VERTEX")); return true; } case TopAbs_SHAPE: { - aTypeString = strdup(tr("GEOM_SHAPE")); + aTypeString = CORBA::string_dup(tr("GEOM_SHAPE")); return true; } } @@ -1211,7 +1217,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM CORBA::String_var theValue = anIOR->Value(); CORBA::Object_var theObj = _orb->string_to_object(theValue); if(theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) { - listIOR[j] = strdup(theValue); + listIOR[j] = CORBA::string_dup(theValue); j++; } } @@ -1219,7 +1225,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM else if(IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IObject); Standard_CString ior = GIObject->getIOR(); - listIOR[j] = strdup(ior); + listIOR[j] = CORBA::string_dup(ior); j++; } } @@ -1455,7 +1461,9 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU SALOMEDS::SObject_var theObj = listSO[0]; /* Create a SALOME_InteractiveObject with a SALOME::SObject */ Standard_CString anEntry = theObj->GetID(); - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", strdup(objectUserName)); + char* aCopyobjectUserName = CORBA::string_dup(objectUserName); + Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", aCopyobjectUserName); + delete(aCopyobjectUserName); /* Add as a selected object */ /* Clear any previous selection : */ @@ -1479,6 +1487,23 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) return true; } +QString GEOMBase::GetDefaultName(const QString& theOperation) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + int aNumber = 0; + QString aName; + SALOMEDS::SObject_var obj; + + do + { + aName = theOperation+"_"+QString::number(++aNumber); + obj = aStudy->FindObject(aName); + } + while (!obj->_is_nil()); + + return aName; +} + //===================================================================================== // EXPORTED METHODS diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index db3bb1daa..b6de381c5 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -110,6 +110,9 @@ public : bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); + /* This method generates default names for results of geometrical operations */ + static QString GetDefaultName(const QString& theOperation); + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/GEOMContext/GEOMContext.h b/src/GEOMContext/GEOMContext.h index f5746fc2f..e83a93288 100644 --- a/src/GEOMContext/GEOMContext.h +++ b/src/GEOMContext/GEOMContext.h @@ -31,7 +31,6 @@ #include "QAD_Desktop.h" #include "GEOM_Client.hxx" -#include "GEOM_Sketcher.h" #include #include @@ -51,7 +50,6 @@ private : QDialog* myActiveDialogBox; /* Unique active dialog box */ GEOM_Client myShapeReader; Standard_CString myFatherior; - Sketch mySketcher; public : int myNbGeom; /* Unique name for a geom entity */ @@ -68,7 +66,6 @@ public : int& GetNbGeom(){return myNbGeom;}; GEOM_Client& GetShapeReader(){return myShapeReader;}; Standard_CString& GetFatherior(){return myFatherior;}; - Sketch& GetSketcher(){return mySketcher;}; bool LoadLibrary(QString GUILibrary); diff --git a/src/GEOMContext/Makefile.in b/src/GEOMContext/Makefile.in index ffb273015..991d7480e 100644 --- a/src/GEOMContext/Makefile.in +++ b/src/GEOMContext/Makefile.in @@ -60,6 +60,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@