DCQ : New Sketcher + merge

This commit is contained in:
dcq 2004-05-04 14:04:19 +00:00
parent 988c5fc009
commit db1841de36
4 changed files with 54 additions and 29 deletions

View File

@ -675,11 +675,17 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)
QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName());
if(!Name.isEmpty()) { if(!Name.isEmpty()) {
// VTK // VTK
if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
GActor->setName(strdup(Name.latin1())); char* aCopy = CORBA::string_dup(Name.latin1());
GActor->setName(aCopy);
delete(aCopy);
}
// OCC // OCC
else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
GAISShape->setName(strdup(Name.latin1())); char* aCopy = CORBA::string_dup(Name.latin1());
GAISShape->setName(aCopy);
delete(aCopy);
}
} }
else else
return false; return false;
@ -916,55 +922,55 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString&
{ {
case TopAbs_COMPOUND: case TopAbs_COMPOUND:
{ {
aTypeString = strdup(tr("GEOM_COMPOUND")); aTypeString = CORBA::string_dup(tr("GEOM_COMPOUND"));
return true; return true;
} }
case TopAbs_COMPSOLID: case TopAbs_COMPSOLID:
{ {
aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; aTypeString = CORBA::string_dup(tr("GEOM_COMPOUNDSOLID")) ;
return true ; return true ;
} }
case TopAbs_SOLID: case TopAbs_SOLID:
{ {
aTypeString = strdup(tr("GEOM_SOLID")) ; aTypeString = CORBA::string_dup(tr("GEOM_SOLID")) ;
return true ; return true ;
} }
case TopAbs_SHELL: case TopAbs_SHELL:
{ {
aTypeString = strdup(tr("GEOM_SHELL")) ; aTypeString = CORBA::string_dup(tr("GEOM_SHELL")) ;
return true ; return true ;
} }
case TopAbs_FACE: case TopAbs_FACE:
{ {
BRepAdaptor_Surface surf(TopoDS::Face(aShape)); BRepAdaptor_Surface surf(TopoDS::Face(aShape));
if(surf.GetType() == GeomAbs_Plane) { if(surf.GetType() == GeomAbs_Plane) {
aTypeString = strdup(tr("GEOM_PLANE")); aTypeString = CORBA::string_dup(tr("GEOM_PLANE"));
return true; return true;
} }
else if(surf.GetType() == GeomAbs_Cylinder) { else if(surf.GetType() == GeomAbs_Cylinder) {
aTypeString = strdup(tr("GEOM_SURFCYLINDER")); aTypeString = CORBA::string_dup(tr("GEOM_SURFCYLINDER"));
return true; return true;
} }
else if(surf.GetType() == GeomAbs_Sphere) { else if(surf.GetType() == GeomAbs_Sphere) {
aTypeString = strdup(tr("GEOM_SURFSPHERE")); aTypeString = CORBA::string_dup(tr("GEOM_SURFSPHERE"));
return true ; return true ;
} }
else if(surf.GetType() == GeomAbs_Torus) { else if(surf.GetType() == GeomAbs_Torus) {
aTypeString = strdup(tr("GEOM_SURFTORUS")); aTypeString = CORBA::string_dup(tr("GEOM_SURFTORUS"));
return true ; return true ;
} }
else if(surf.GetType() == GeomAbs_Cone) { else if(surf.GetType() == GeomAbs_Cone) {
aTypeString = strdup(tr("GEOM_SURFCONE")); aTypeString = CORBA::string_dup(tr("GEOM_SURFCONE"));
return true ; return true ;
} }
else { else {
aTypeString = strdup(tr("GEOM_FACE")); aTypeString = CORBA::string_dup(tr("GEOM_FACE"));
return true; return true;
} }
} }
case TopAbs_WIRE: case TopAbs_WIRE:
{ {
aTypeString = strdup(tr("GEOM_WIRE")); aTypeString = CORBA::string_dup(tr("GEOM_WIRE"));
return true; return true;
} }
case TopAbs_EDGE: case TopAbs_EDGE:
@ -972,31 +978,31 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString&
BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); BRepAdaptor_Curve curv(TopoDS::Edge(aShape));
if(curv.GetType() == GeomAbs_Line) { if(curv.GetType() == GeomAbs_Line) {
if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6))
aTypeString = strdup(tr("GEOM_LINE")); aTypeString = CORBA::string_dup(tr("GEOM_LINE"));
else else
aTypeString = strdup(tr("GEOM_EDGE")); aTypeString = CORBA::string_dup(tr("GEOM_EDGE"));
return true; return true;
} }
else if(curv.GetType() == GeomAbs_Circle) { else if(curv.GetType() == GeomAbs_Circle) {
if(curv.IsClosed()) if(curv.IsClosed())
aTypeString = strdup(tr("GEOM_CIRCLE")); aTypeString = CORBA::string_dup(tr("GEOM_CIRCLE"));
else else
aTypeString = strdup(tr("GEOM_ARC")); aTypeString = CORBA::string_dup(tr("GEOM_ARC"));
return true; return true;
} }
else { else {
aTypeString = strdup(tr("GEOM_EDGE")); aTypeString = CORBA::string_dup(tr("GEOM_EDGE"));
return true; return true;
} }
} }
case TopAbs_VERTEX: case TopAbs_VERTEX:
{ {
aTypeString = strdup(tr("GEOM_VERTEX")); aTypeString = CORBA::string_dup(tr("GEOM_VERTEX"));
return true; return true;
} }
case TopAbs_SHAPE: case TopAbs_SHAPE:
{ {
aTypeString = strdup(tr("GEOM_SHAPE")); aTypeString = CORBA::string_dup(tr("GEOM_SHAPE"));
return true; return true;
} }
} }
@ -1211,7 +1217,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM
CORBA::String_var theValue = anIOR->Value(); CORBA::String_var theValue = anIOR->Value();
CORBA::Object_var theObj = _orb->string_to_object(theValue); CORBA::Object_var theObj = _orb->string_to_object(theValue);
if(theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) { if(theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) {
listIOR[j] = strdup(theValue); listIOR[j] = CORBA::string_dup(theValue);
j++; j++;
} }
} }
@ -1219,7 +1225,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM
else if(IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { else if(IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) {
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IObject); Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IObject);
Standard_CString ior = GIObject->getIOR(); Standard_CString ior = GIObject->getIOR();
listIOR[j] = strdup(ior); listIOR[j] = CORBA::string_dup(ior);
j++; j++;
} }
} }
@ -1455,7 +1461,9 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU
SALOMEDS::SObject_var theObj = listSO[0]; SALOMEDS::SObject_var theObj = listSO[0];
/* Create a SALOME_InteractiveObject with a SALOME::SObject */ /* Create a SALOME_InteractiveObject with a SALOME::SObject */
Standard_CString anEntry = theObj->GetID(); 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 */ /* Add as a selected object */
/* Clear any previous selection : */ /* Clear any previous selection : */
@ -1479,6 +1487,23 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y)
return true; 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 // EXPORTED METHODS

View File

@ -110,6 +110,9 @@ public :
bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel);
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); 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; GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */

View File

@ -31,7 +31,6 @@
#include "QAD_Desktop.h" #include "QAD_Desktop.h"
#include "GEOM_Client.hxx" #include "GEOM_Client.hxx"
#include "GEOM_Sketcher.h"
#include <OSD_SharedLibrary.hxx> #include <OSD_SharedLibrary.hxx>
#include <qapplication.h> #include <qapplication.h>
@ -51,7 +50,6 @@ private :
QDialog* myActiveDialogBox; /* Unique active dialog box */ QDialog* myActiveDialogBox; /* Unique active dialog box */
GEOM_Client myShapeReader; GEOM_Client myShapeReader;
Standard_CString myFatherior; Standard_CString myFatherior;
Sketch mySketcher;
public : public :
int myNbGeom; /* Unique name for a geom entity */ int myNbGeom; /* Unique name for a geom entity */
@ -68,7 +66,6 @@ public :
int& GetNbGeom(){return myNbGeom;}; int& GetNbGeom(){return myNbGeom;};
GEOM_Client& GetShapeReader(){return myShapeReader;}; GEOM_Client& GetShapeReader(){return myShapeReader;};
Standard_CString& GetFatherior(){return myFatherior;}; Standard_CString& GetFatherior(){return myFatherior;};
Sketch& GetSketcher(){return mySketcher;};
bool LoadLibrary(QString GUILibrary); bool LoadLibrary(QString GUILibrary);

View File

@ -60,6 +60,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += -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@ @CONCLUDE@