DCQ : New Architecture...

This commit is contained in:
yfr 2003-09-25 15:49:07 +00:00
parent 6a85337399
commit 7f6a21ec46
46 changed files with 5798 additions and 6630 deletions

128
src/GEOMGUI/BooleanGUI.cxx Normal file
View File

@ -0,0 +1,128 @@
// 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
//
//
//
// File : BooleanGUI.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
using namespace std;
#include "BooleanGUI.h"
#include "QAD_Application.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "GeometryGUI_FuseDlg.h" // Method FUSE
#include "GeometryGUI_CommonDlg.h" // Method COMMON
#include "GeometryGUI_CutDlg.h" // Method CUT
#include "GeometryGUI_SectionDlg.h" // Method SECTION
//=======================================================================
// function : BooleanGUI()
// purpose : Constructor
//=======================================================================
BooleanGUI::BooleanGUI() :
QObject()
{
myGeomGUI = GeometryGUI::GetGeometryGUI();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
}
//=======================================================================
// function : ~BooleanGUI()
// purpose : Destructor
//=======================================================================
BooleanGUI::~BooleanGUI()
{
}
//=======================================================================
// function : OnGUIEvent()
// purpose :
//=======================================================================
bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{
myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
switch (theCommandID)
{
case 4011: // FUSE
{
GeometryGUI_FuseDlg *aDlg = new GeometryGUI_FuseDlg(parent, "", this, Sel);
break;
}
case 4012: // COMMON
{
GeometryGUI_CommonDlg *aDlg = new GeometryGUI_CommonDlg(parent, "", this, Sel);
break;
}
case 4013: // CUT
{
GeometryGUI_CutDlg *aDlg = new GeometryGUI_CutDlg(parent, "", this, Sel);
break;
}
case 4014: // SECTION
{
GeometryGUI_SectionDlg *aDlg = new GeometryGUI_SectionDlg(parent, "", this, Sel);
break;
}
default:
{
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
}
}
return true;
}
//=======================================================================
// function : MakeBooleanAndDisplay()
// purpose :
//=======================================================================
void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation)
{
try {
GEOM::GEOM_Shape_ptr result = myGeom->MakeBoolean(Shape1, Shape2, operation);
if(result->_is_nil()) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
return;
}
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type);
result->NameType(type);
if (myGeomGUI->Display(result, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch (const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
return;
}

58
src/GEOMGUI/BooleanGUI.h Normal file
View File

@ -0,0 +1,58 @@
// 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
//
//
//
// File : BooleanGUI.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef BOOLEANGUI_H
#define BOOLEANGUI_H
#include "GeometryGUI.h"
//=================================================================================
// class : BooleanGUI
// purpose :
//=================================================================================
class BooleanGUI : public QObject
{
Q_OBJECT /* for QT compatibility */
public :
BooleanGUI();
~BooleanGUI();
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1,
GEOM::GEOM_Shape_ptr Shape2,
const short operation);
private:
GeometryGUI* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,9 @@
#include "GEOM_Actor.h" #include "GEOM_Actor.h"
#include "GEOM_Sketcher.h" #include "GEOM_Sketcher.h"
#include "GEOM_Client.hxx"
#include <AIS_ListOfInteractive.hxx>
// Open CASCADE Includes // Open CASCADE Includes
#include <AIS_InteractiveContext.hxx> #include <AIS_InteractiveContext.hxx>
#include <Standard.hxx> #include <Standard.hxx>
@ -51,6 +54,7 @@
#include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
//================================================================================= //=================================================================================
// //
//================================================================================= //=================================================================================
@ -69,10 +73,10 @@ class GeometryGUI : public QObject
Q_OBJECT /* for QT compatibility */ Q_OBJECT /* for QT compatibility */
private : private :
GEOM::GEOM_Gen_var myComponentGeom;
GEOM_Client myShapeReader;
QAD_Desktop* myDesktop; QAD_Desktop* myDesktop;
QAD_Study* myActiveStudy; QAD_Study* myActiveStudy;
GEOM::GEOM_Gen_var myComponentGeom;
QDialog* myActiveDialogBox; /* Unique active dialog box */ QDialog* myActiveDialogBox; /* Unique active dialog box */
Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */ Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
vtkActorCollection* mySimulationActor; /* GEOM Actor used only during topo/geom simulations */ vtkActorCollection* mySimulationActor; /* GEOM Actor used only during topo/geom simulations */
@ -82,6 +86,13 @@ private :
Quantity_Color myShadingColor; Quantity_Color myShadingColor;
AIS_ListOfInteractive myListDisplayedObject;
bool mySettings_AddInStudy;
bool mySettings_Copy;
Standard_CString myFatherior;
public : public :
GeometryGUI(); GeometryGUI();
@ -90,43 +101,26 @@ public :
static GeometryGUI* GetOrCreateGeometryGUI( QAD_Desktop* desktop ); static GeometryGUI* GetOrCreateGeometryGUI( QAD_Desktop* desktop );
static GeometryGUI* GetGeometryGUI() ; static GeometryGUI* GetGeometryGUI() ;
QAD_Study* GetActiveStudy() ; QAD_Study* GetActiveStudy();
QAD_Desktop* GetDesktop() ; QAD_Desktop* GetDesktop() ;
GEOM_Client& GetShapeReader();
QDialog* GetActiveDialogBox() ; /* Returns the active DialogBox */ QDialog* GetActiveDialogBox(); /* Returns the active DialogBox */
void SetActiveDialogBox(QDialog* aDlg) ; /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */ void SetActiveDialogBox(QDialog* aDlg); /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
void SetState(int aState) ; void SetState(int aState);
void ResetState() ; /* Sets myState = -1 a private field to indicate wich method is active */ void ResetState(); /* Sets myState = -1 a private field to indicate wich method is active */
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
void OnEditCopy ();
void OnEditDelete ();
void OnVTKDisplayOnly ();
void OnDisplayOnly ();
void OnDisplayAll ( bool onlyPreviousDisplayedObject = false );
void SetDisplayedObjectList();
bool AddInStudy( bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0 ); bool AddInStudy( bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0 );
bool Display( GEOM::GEOM_Shape_ptr aShape, Standard_CString name = ""); bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
/* Import and export topology methods */
bool Import();
bool Export();
static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType) ; static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType) ;
static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) ; static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) ;
static void GetBipointDxDyDz( gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) ; static void GetBipointDxDyDz( gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) ;
static bool GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) ; static bool GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) ;
static bool LinearEdgeExtremities( const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) ; static bool LinearEdgeExtremities( const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) ;
static gp_Pnt ConvertClickToPoint( Standard_Real x, Standard_Real y, Handle(V3d_View) aView ) ; static gp_Pnt ConvertClickToPoint( Standard_Real x, Standard_Real y, Handle(V3d_View) aView ) ;
/* User dialog 1 parameter returned */ /* User dialog 1 parameter returned */
static double Parameter( Standard_Boolean& res, static double Parameter( Standard_Boolean& res,
const char* aValue1 = 0, const char* aValue1 = 0,
@ -137,91 +131,27 @@ public :
const int decimals = 6 ) ; const int decimals = 6 ) ;
/* Managed by IAPP */ /* Managed by IAPP */
Standard_EXPORT static bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ; Standard_EXPORT bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ;
Standard_EXPORT static bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent, Standard_EXPORT bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent,
QAD_StudyFrame* studyFrame ); QAD_StudyFrame* studyFrame );
Standard_EXPORT static bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent, Standard_EXPORT bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent,
QAD_StudyFrame* studyFrame ); QAD_StudyFrame* studyFrame );
Standard_EXPORT static bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent, Standard_EXPORT bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent,
QAD_StudyFrame* studyFrame ); QAD_StudyFrame* studyFrame );
Standard_EXPORT static void activeStudyChanged ( QAD_Desktop* parent ); Standard_EXPORT void activeStudyChanged ( QAD_Desktop* parent );
Standard_EXPORT static bool SetSettings ( QAD_Desktop* parent ); Standard_EXPORT bool SetSettings ( QAD_Desktop* parent );
Standard_EXPORT static void DefinePopup( QString & theContext, Standard_EXPORT void DefinePopup( QString & theContext,
QString & theParent, QString & theParent,
QString & theObject ); QString & theObject );
Standard_EXPORT static bool CustomPopup ( QAD_Desktop* parent, Standard_EXPORT bool CustomPopup ( QAD_Desktop* parent,
QPopupMenu* popup, QPopupMenu* popup,
const QString& theContext, const QString& theContext,
const QString& theParent, const QString& theParent,
const QString& theObject ); const QString& theObject );
Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); Standard_EXPORT void BuildPresentation(const Handle(SALOME_InteractiveObject)&);
void Archimede( const Handle(SALOME_InteractiveObject)& IO, const double aWeight,
const double aWaterDensity, const double aMeshingDeflection );
void MakePointAndDisplay( const double x, const double y, const double z ) ;
void MakeVectorAndDisplay( const gp_Pnt P1, const gp_Pnt P2 );
void MakeBoxAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ;
void MakePlaneAndDisplay( const gp_Pnt P1, const Standard_Real dx,
const Standard_Real dy, const Standard_Real dz, const Standard_Real TrimSize ) ;
void MakeSphereAndDisplay( const gp_Pnt aCenterPoint, const double aRadius) ;
void MakeCircleAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius) ;
void MakeEllipseAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Major_Radius, const Standard_Real Minor_Radius) ;
void MakeArcAndDisplay( gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint ) ;
void MakeLineAndDisplay( const gp_Pnt InitPoint, const gp_Pnt LastPoint) ;
void MakeCylinderAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius, const double aHeight ) ;
void MakeConeAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2, const double aHeight ) ;
void MakeTorusAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2 ) ;
void MakeBooleanAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2,
const short operation ) ;
void MakeRevolutionAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
const gp_Dir dir, Standard_Real revolAngle ) ;
void MakePrismAndDisplay( GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2 ) ;
void MakePipeAndDisplay( GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase ) ;
void MakeFillingAndDisplay( GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, const short maxdeg,
const double tol3d, const double tol2d, const short nbiter ) ;
void MakeRotationAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, const gp_Dir dir,
const Standard_Real angle ) ;
void MakeTranslationAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Vec V) ;
void MakeMultiTranslation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const double Step, const short NbTimes ) ;
void MakeMultiTranslation2DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir1, const double Step1, const short NbTimes1,
const gp_Dir Dir2, const double Step2, const short NbTimes2 ) ;
void MakeMultiRotation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes ) ;
void MakeMultiRotation2DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
const short NbTimes1, const double Step, const short NbTimes2 ) ;
void MakeCDGAndDisplay( GEOM::GEOM_Shape_ptr Shape );
void MakeScaleAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint,
const Standard_Real factor) ;
void MakeMirrorAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2 ) ;
void MakeSewingAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const Standard_Real precision ) ;
void MakeCompoundAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
void MakeShellAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
void MakeSolidAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
void MakeLinearEdgeAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ;
void MakeOrientationChangeAndDisplay( GEOM::GEOM_Shape_ptr Shape ) ;
void MakePartitionAndDisplay (const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR,
const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR,
const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR,
const GEOM::shape_type limit ) ;
void MakeWireAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ;
void MakeWorkingPlane( const gp_Pnt P, const gp_Dir D) ;
void MakeFaceAndDisplay( GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar ) ;
/* Simulation management */
bool CreateArrowForLinearEdge( const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone ) ;
void DisplaySimulationShape(const TopoDS_Shape& S) ;
void EraseSimulationShape() ;
/* Selection and objects management */ /* Selection and objects management */
TopoDS_Shape GetShapeFromIOR( QString IOR ); TopoDS_Shape GetShapeFromIOR( QString IOR );
bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) ; bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) ;
int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ; int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ;
@ -270,28 +200,99 @@ public :
Standard_Integer& aLocalContextId, Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ; bool& myUseLocalContext ) ;
/* Import and export topology methods */
bool Import();
bool Export();
void OnEditCopy();
void OnEditDelete();
void OnVTKDisplayOnly();
void OnDisplayOnly();
void OnDisplayAll(bool onlyPreviousDisplayedObject = false);
void SetDisplayedObjectList();
bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
/* Simulation management */
bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
void DisplaySimulationShape(const TopoDS_Shape& S);
void EraseSimulationShape();
void MakePointAndDisplay(const double x, const double y, const double z);
void MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint);
void MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius);
void MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Major_Radius,
const Standard_Real Minor_Radius);
void MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint);
void MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
void MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, const Standard_Real dy,
const Standard_Real dz, const Standard_Real TrimSize);
void MakeWorkingPlane(const gp_Pnt P, const gp_Dir D);
void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2);
void MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
const gp_Dir dir, Standard_Real revolAngle);
void MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, const short maxdeg,
const double tol3d, const double tol2d, const short nbiter);
void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase);
void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
void MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar);
void MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
/* Remove faces in a shape */ /* Remove faces in a shape */
bool OnSuppressFaces( const TopoDS_Shape& ShapeTopo, bool OnSuppressFaces( const TopoDS_Shape& ShapeTopo,
const char* ShapeTopoIOR, const char* ShapeTopoIOR,
const Standard_Integer& aLocalContextId, const Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ; bool& myUseLocalContext ) ;
/* Remove an hole in a topology (ListOfIdEndFace may be an empty list ) */ /* Remove an hole in a topology (ListOfIdEndFace may be an empty list ) */
bool OnSuppressHole( const char* ShapeTopoIOR, bool OnSuppressHole( const char* ShapeTopoIOR,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) ; const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) ;
/* Remove one or more holes in a face or a shell */ /* Remove one or more holes in a face or a shell */
bool OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, bool OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) ; const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) ;
/* Create a face corresponding to a hole on a shape */ /* Create a face corresponding to a hole on a shape */
bool OnFillingHole( const TopoDS_Shape& MainShape, bool OnFillingHole( const TopoDS_Shape& MainShape,
const char* ShapeTopoIOR, const char* ShapeTopoIOR,
const Standard_Integer& aLocalContextId, const Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ; bool& myUseLocalContext ) ;
void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V);
void MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
const gp_Dir dir, const Standard_Real angle);
void MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2);
void MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint,
const Standard_Real factor);
void MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
const gp_Dir Dir, const double Step, const short NbTimes);
void MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
const gp_Dir Dir1, const double Step1, const short NbTimes1,
const gp_Dir Dir2, const double Step2, const short NbTimes2);
void MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes);
void MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape,
const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
const short NbTimes1, const double Step, const short NbTimes2);
void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR,
const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR,
const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR,
const GEOM::shape_type limit ) ;
void Archimede(const Handle(SALOME_InteractiveObject)& IO, const double aWeight,
const double aWaterDensity, const double aMeshingDeflection);
/* Method for Fillet */ /* Method for Fillet */
bool OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR) ; bool OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR) ;
bool OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, bool OnFilletGetSelected(const TopoDS_Shape& ShapeTopo,
@ -300,7 +301,6 @@ public :
const int SubShapeType, const int SubShapeType,
Standard_Integer& aLocalContextId, Standard_Integer& aLocalContextId,
bool& myUseLocalContext ); bool& myUseLocalContext );
/* Methods for Chamfer */ /* Methods for Chamfer */
bool OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) ; bool OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) ;
bool OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, bool OnChamferGetSelected(const TopoDS_Shape& ShapeTopo,
@ -309,9 +309,13 @@ public :
Standard_Integer& aLocalContextId, Standard_Integer& aLocalContextId,
bool& myUseLocalContext ) ; bool& myUseLocalContext ) ;
/* Non modal dialog boxes magement */
void EmitSignalDeactivateDialog() ; void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
void EmitSignalCloseAllDialogs() ; const Standard_Real precision);
void MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape);
void MakeCDGAndDisplay( GEOM::GEOM_Shape_ptr Shape );
/* Sketcher management */ /* Sketcher management */
void OnSketchSegment(); void OnSketchSegment();
@ -334,6 +338,10 @@ public :
void OnSettingsPerpendicular(); void OnSettingsPerpendicular();
void OnSettingsTangent(); void OnSettingsTangent();
/* Non modal dialog boxes magement */
void EmitSignalDeactivateDialog() ;
void EmitSignalCloseAllDialogs() ;
signals: signals:
void SignalDeactivateActiveDialog() ; void SignalDeactivateActiveDialog() ;
void SignalCloseAllDialogs() ; void SignalCloseAllDialogs() ;

View File

@ -36,15 +36,12 @@
* Constructs a GeometryGUI_1Sel1Spin which is a child of 'parent', with the * Constructs a GeometryGUI_1Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin( QWidget* parent, const char* name, WFlags fl ) GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin(QWidget* parent, const char* name, WFlags fl)
: GeometryGUI_1Sel1Spin_QTD( parent, name, fl ) :GeometryGUI_1Sel1Spin_QTD(parent, name, fl)
{ {
SpinBox1->close(TRUE);
SpinBox1->close( TRUE ); SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
Layout2->addWidget( SpinBox_DX, 0, 1 );
} }

View File

@ -36,27 +36,25 @@
* Constructs a GeometryGUI_1Sel4Spin which is a child of 'parent', with the * Constructs a GeometryGUI_1Sel4Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin( QWidget* parent, const char* name, WFlags fl ) GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin(QWidget* parent, const char* name, WFlags fl)
: GeometryGUI_1Sel4Spin_QTD( parent, name, fl ) :GeometryGUI_1Sel4Spin_QTD(parent, name, fl)
{ {
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox3->close(TRUE);
SpinBox4->close(TRUE);
SpinBox1->close( TRUE ); SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
SpinBox2->close( TRUE ); Layout3->addWidget(SpinBox_DX, 0, 2);
SpinBox3->close( TRUE );
SpinBox4->close( TRUE );
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ; SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY");
Layout3->addWidget( SpinBox_DX, 0, 2 ); Layout3->addWidget(SpinBox_DY, 0, 4);
SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ; SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ");
Layout3->addWidget( SpinBox_DY, 0, 4 ); Layout3->addWidget(SpinBox_DZ, 0, 6);
SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ;
Layout3->addWidget( SpinBox_DZ, 0, 6 );
SpinBox_S = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_S" ) ;
Layout4->addWidget( SpinBox_S, 0, 1 );
SpinBox_S = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_S");
Layout4->addWidget(SpinBox_S, 0, 1);
} }

View File

@ -0,0 +1,56 @@
// 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
//
//
//
// File : GeometryGUI_1Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_1Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_1Spin::GeometryGUI_1Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_1Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout1->addWidget(SpinBox_DX, 0, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Spin::~GeometryGUI_1Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,47 @@
// 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
//
//
//
// File : GeometryGUI_1Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_1SPIN_H
#define GEOMETRYGUI_1SPIN_H
#include "GeometryGUI_1Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_1Spin : public GeometryGUI_1Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_1Spin();
GeometryGUI_SpinBox* SpinBox_DX;
};
#endif // GEOMETRYGUI_1SPIN_H

View File

@ -0,0 +1,68 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_1Spin_QTD.ui'
**
** Created: jeu sep 25 12:22:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_1Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_1Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_1Spin_QTD::GeometryGUI_1Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_1Spin_QTD" );
resize( 124, 55 );
setCaption( trUtf8( "GeometryGUI_1Spin_QTD" ) );
GeometryGUI_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 1 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox1, 0, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Spin_QTD::~GeometryGUI_1Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,40 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_1Spin_QTD.ui'
**
** Created: jeu sep 25 12:22:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_1SPIN_QTD_H
#define GEOMETRYGUI_1SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QSpinBox;
class GeometryGUI_1Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Spin_QTD();
QGroupBox* GroupBox1;
QSpinBox* SpinBox1;
QLabel* TextLabel1;
protected:
QGridLayout* GeometryGUI_1Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_1SPIN_QTD_H

View File

@ -36,15 +36,12 @@
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the * Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin( QWidget* parent, const char* name, WFlags fl ) GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin(QWidget* parent, const char* name, WFlags fl)
: GeometryGUI_2Sel1Spin_QTD( parent, name, fl ) :GeometryGUI_2Sel1Spin_QTD(parent, name, fl)
{ {
SpinBox1->close(TRUE);
SpinBox1->close( TRUE ); SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
Layout2->addWidget( SpinBox_DX, 0, 1 );
} }

View File

@ -0,0 +1,57 @@
// 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
//
//
//
// File : GeometryGUI_2Sel2Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Sel2Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Sel2Spin::GeometryGUI_2Sel2Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Sel2Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout2->addWidget(SpinBox_DY, 1, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel2Spin::~GeometryGUI_2Sel2Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,48 @@
// 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
//
//
//
// File : GeometryGUI_2Sel2Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SEL2SPIN_H
#define GEOMETRYGUI_2SEL2SPIN_H
#include "GeometryGUI_2Sel2Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Sel2Spin : public GeometryGUI_2Sel2Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_2Sel2Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
};
#endif // GEOMETRYGUI_2SEL2SPIN_H

View File

@ -0,0 +1,116 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Sel2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Sel2Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Sel2Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Sel2Spin_QTD::GeometryGUI_2Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Sel2Spin_QTD" );
resize( 129, 145 );
setCaption( trUtf8( "GeometryGUI_2Sel2Spin_QTD" ) );
GeometryGUI_2Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel2Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox2, 1, 1 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
TextLabel4->setText( trUtf8( "TL4" ) );
Layout2->addWidget( TextLabel4, 1, 0 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout2->addWidget( TextLabel3, 0, 0 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox1, 0, 1 );
Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 2 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel2Spin_QTD::~GeometryGUI_2Sel2Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,51 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Sel2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SEL2SPIN_QTD_H
#define GEOMETRYGUI_2SEL2SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_2Sel2Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel2Spin_QTD();
QGroupBox* GroupBox1;
QLineEdit* LineEdit1;
QSpinBox* SpinBox2;
QLabel* TextLabel4;
QLabel* TextLabel3;
QSpinBox* SpinBox1;
QPushButton* PushButton2;
QLabel* TextLabel2;
QLabel* TextLabel1;
QPushButton* PushButton1;
QLineEdit* LineEdit2;
protected:
QGridLayout* GeometryGUI_2Sel2Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout2;
};
#endif // GEOMETRYGUI_2SEL2SPIN_QTD_H

View File

@ -0,0 +1,60 @@
// 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
//
//
//
// File : GeometryGUI_2Sel3Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Sel3Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Sel3Spin::GeometryGUI_2Sel3Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Sel3Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox3->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout2->addWidget(SpinBox_DY, 1, 1);
SpinBox_DZ = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DZ");
Layout2->addWidget(SpinBox_DZ, 2, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel3Spin::~GeometryGUI_2Sel3Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,49 @@
// 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
//
//
//
// File : GeometryGUI_2Sel3Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SEL3SPIN_H
#define GEOMETRYGUI_2SEL3SPIN_H
#include "GeometryGUI_2Sel3Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Sel3Spin : public GeometryGUI_2Sel3Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Sel3Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_2Sel3Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
GeometryGUI_SpinBox* SpinBox_DZ;
};
#endif // GEOMETRYGUI_2SEL3SPIN_H

View File

@ -0,0 +1,127 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Sel3Spin_QTD.ui'
**
** Created: jeu sep 25 16:18:43 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Sel3Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Sel3Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Sel3Spin_QTD::GeometryGUI_2Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Sel3Spin_QTD" );
resize( 129, 173 );
setCaption( trUtf8( "GeometryGUI_2Sel3Spin_QTD" ) );
GeometryGUI_2Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel3Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout2->addWidget( TextLabel3, 0, 0 );
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox2, 1, 1 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
TextLabel4->setText( trUtf8( "TL4" ) );
Layout2->addWidget( TextLabel4, 1, 0 );
TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
TextLabel5->setText( trUtf8( "TL4" ) );
Layout2->addWidget( TextLabel5, 2, 0 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox1, 0, 1 );
SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" );
SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox3, 2, 1 );
Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 2 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel3Spin_QTD::~GeometryGUI_2Sel3Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,53 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Sel3Spin_QTD.ui'
**
** Created: jeu sep 25 16:18:43 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SEL3SPIN_QTD_H
#define GEOMETRYGUI_2SEL3SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_2Sel3Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel3Spin_QTD();
QGroupBox* GroupBox1;
QLineEdit* LineEdit1;
QLabel* TextLabel1;
QLabel* TextLabel2;
QLabel* TextLabel3;
QSpinBox* SpinBox2;
QLabel* TextLabel4;
QLabel* TextLabel5;
QSpinBox* SpinBox1;
QSpinBox* SpinBox3;
QPushButton* PushButton1;
QLineEdit* LineEdit2;
QPushButton* PushButton2;
protected:
QGridLayout* GeometryGUI_2Sel3Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout2;
};
#endif // GEOMETRYGUI_2SEL3SPIN_QTD_H

View File

@ -0,0 +1,60 @@
// 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
//
//
//
// File : GeometryGUI_2Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Spin::GeometryGUI_2Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout1->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout1->addWidget(SpinBox_DY, 1, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Spin::~GeometryGUI_2Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,48 @@
// 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
//
//
//
// File : GeometryGUI_2Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SPIN_H
#define GEOMETRYGUI_2SPIN_H
#include "GeometryGUI_2Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Spin : public GeometryGUI_2Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_2Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
};
#endif // GEOMETRYGUI_2SPIN_H

View File

@ -0,0 +1,79 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:30 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Spin_QTD::GeometryGUI_2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Spin_QTD" );
resize( 124, 83 );
setCaption( trUtf8( "GeometryGUI_2Spin_QTD" ) );
GeometryGUI_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox2, 1, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 1 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox1, 0, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Spin_QTD::~GeometryGUI_2Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -0,0 +1,42 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:30 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SPIN_QTD_H
#define GEOMETRYGUI_2SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QSpinBox;
class GeometryGUI_2Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Spin_QTD();
QGroupBox* GroupBox1;
QSpinBox* SpinBox2;
QSpinBox* SpinBox1;
QLabel* TextLabel1;
QLabel* TextLabel2;
protected:
QGridLayout* GeometryGUI_2Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_2SPIN_QTD_H

View File

@ -36,23 +36,21 @@
* Constructs a GeometryGUI_3Spin which is a child of 'parent', with the * Constructs a GeometryGUI_3Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f' * name 'name' and widget flags set to 'f'
*/ */
GeometryGUI_3Spin::GeometryGUI_3Spin( QWidget* parent, const char* name, WFlags fl ) GeometryGUI_3Spin::GeometryGUI_3Spin(QWidget* parent, const char* name, WFlags fl)
: GeometryGUI_3Spin_QTD( parent, name, fl ) :GeometryGUI_3Spin_QTD(parent, name, fl)
{ {
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox3->close(TRUE);
SpinBox1->close( TRUE ); SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
SpinBox2->close( TRUE ); Layout1->addWidget(SpinBox_DX, 0, 1);
SpinBox3->close( TRUE );
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ; SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout1->addWidget( SpinBox_DX, 0, 1 ); Layout1->addWidget(SpinBox_DY, 1, 1);
SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ;
Layout1->addWidget( SpinBox_DY, 1, 1 );
SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ;
Layout1->addWidget( SpinBox_DZ, 2, 1 );
SpinBox_DZ = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DZ");
Layout1->addWidget(SpinBox_DZ, 2, 1);
} }

View File

@ -29,7 +29,6 @@
using namespace std; using namespace std;
#include "GeometryGUI_BoxDlg.h" #include "GeometryGUI_BoxDlg.h"
#include <Precision.hxx>
#include <BRepPrimAPI_MakeBox.hxx> #include <BRepPrimAPI_MakeBox.hxx>
#include "GeometryGUI.h" #include "GeometryGUI.h"
@ -43,7 +42,7 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P")));
@ -76,7 +75,8 @@ GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, SALOME
/***************************************************************/ /***************************************************************/
/* Initialisations */ /* Initialisations */
Init(Sel); myPrimitiveGUI = thePrimitiveGUI;
Init();
} }
@ -94,7 +94,7 @@ GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_BoxDlg::Init(SALOME_Selection* Sel) void GeometryGUI_BoxDlg::Init()
{ {
/* init variables */ /* init variables */
myConstructorId = 0; myConstructorId = 0;
@ -144,7 +144,7 @@ void GeometryGUI_BoxDlg::Init(SALOME_Selection* Sel)
GroupPoints->show(); GroupPoints->show();
this->show(); this->show();
return ; return;
} }
@ -167,13 +167,14 @@ void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId)
GroupDimensions->hide(); GroupDimensions->hide();
resize(0, 0); resize(0, 0);
GroupPoints->show(); GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText("");
/* filter for next selection */ /* filter for next selection */
mySelection->AddFilter(myVertexFilter); mySelection->AddFilter(myVertexFilter);
connect (mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break; break;
} }
case 1: case 1:
@ -228,7 +229,7 @@ void GeometryGUI_BoxDlg::ClickOnApply()
case 0 : case 0 :
{ {
if(myOkPoint1 && myOkPoint2) if(myOkPoint1 && myOkPoint2)
myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2); myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
break; break;
} }
case 1 : case 1 :
@ -239,7 +240,7 @@ void GeometryGUI_BoxDlg::ClickOnApply()
double vz = GroupDimensions->SpinBox_DZ->GetValue(); double vz = GroupDimensions->SpinBox_DZ->GetValue();
myPoint1.SetCoord(0.0, 0.0, 0.0); myPoint1.SetCoord(0.0, 0.0, 0.0);
myPoint2.SetCoord(vx, vy, vz); myPoint2.SetCoord(vx, vy, vz);
myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2); myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
break; break;
} }
} }

View File

@ -33,6 +33,8 @@
#include "GeometryGUI_2Sel_QTD.h" #include "GeometryGUI_2Sel_QTD.h"
#include "GeometryGUI_3Spin.h" #include "GeometryGUI_3Spin.h"
#include "PrimitiveGUI.h"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
//================================================================================= //=================================================================================
@ -44,14 +46,16 @@ class GeometryGUI_BoxDlg : public GeometryGUI_Skeleton
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); GeometryGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_BoxDlg(); ~GeometryGUI_BoxDlg();
private : private :
void Init(SALOME_Selection* Sel); void Init();
void enterEvent(QEvent* e); void enterEvent(QEvent* e);
bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2); bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2);
PrimitiveGUI* myPrimitiveGUI;
double step; double step;
int myConstructorId; int myConstructorId;
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */

View File

@ -30,24 +30,7 @@ using namespace std;
#include "GeometryGUI_CommonDlg.h" #include "GeometryGUI_CommonDlg.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h" #include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qevent.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_CommonDlg() // class : GeometryGUI_CommonDlg()
@ -56,111 +39,33 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_CommonDlg::GeometryGUI_CommonDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_CommonDlg::GeometryGUI_CommonDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_COMMON"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_COMMON")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_COMMON_TITLE"));
setName( "GeometryGUI_CommonDlg" );
resize( 322, 220 );
setCaption( tr( "GEOM_COMMON_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CommonDlgLayout = new QGridLayout( this ); /***************************************************************/
GeometryGUI_CommonDlgLayout->setSpacing( 6 ); GroupConstructors->setTitle(tr("GEOM_COMMON"));
GeometryGUI_CommonDlgLayout->setMargin( 11 ); RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
/***************************************************************/ GroupCommon = new GeometryGUI_2Sel_QTD(this, "GroupCommon");
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupCommon->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupConstructors->setTitle( tr( "GEOM_COMMON" ) ); GroupCommon->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
GroupConstructors->setExclusive( TRUE ); GroupCommon->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
GroupConstructors->setColumnLayout(0, Qt::Vertical ); GroupCommon->PushButton1->setPixmap(image1);
GroupConstructors->layout()->setSpacing( 0 ); GroupCommon->PushButton2->setPixmap(image1);
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GeometryGUI_CommonDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/ Layout1->addWidget(GroupCommon, 1, 0);
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); /***************************************************************/
GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
SelectButtonC1A1Shape->setText( tr( "" ) );
SelectButtonC1A1Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
SelectButtonC1A2Shape->setText( tr( "" ) );
SelectButtonC1A2Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") );
TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") );
TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
GeometryGUI_CommonDlgLayout->addWidget( GroupConstructor1, 1, 0 );
/***************************************************************/ /* Initialisation */
GroupButtons = new QGroupBox( this, "GroupButtons" ); myBooleanGUI = theBooleanGUI;
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); Init();
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_1, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_CommonDlgLayout->addWidget( GroupButtons, 2, 0 );
/* Initialisation */
Init( Sel ) ;
} }
@ -171,7 +76,6 @@ GeometryGUI_CommonDlg::GeometryGUI_CommonDlg( QWidget* parent, const char* name,
GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg() GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg()
{ {
/* no need to delete child widgets, Qt does it all for us */ /* no need to delete child widgets, Qt does it all for us */
this->destroy(TRUE, TRUE) ;
} }
@ -180,181 +84,108 @@ GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CommonDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_CommonDlg::Init()
{
mySelection = Sel ;
myShape1.Nullify() ;
myShape2.Nullify() ;
myConstructorId = 0 ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
GroupConstructor1->show();
myConstructorId = 0 ;
myEditCurrentArgument = LineEditC1A1Shape ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
// TODO previous selection into argument
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CommonDlg::ConstructorsClicked(int constructorId)
{ {
GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; /* init variables */
myEditCurrentArgument = GroupCommon->LineEdit1;
switch (constructorId) myShape1.Nullify();
{ myShape2.Nullify();
case 0: myOkShape1 = myOkShape2 = false;
{
GroupConstructor1->show(); /* signals and slots connections */
myConstructorId = constructorId ; connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
myEditCurrentArgument = LineEditC1A1Shape ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
LineEditC1A2Shape->setText(tr("")) ;
Constructor1->setChecked( TRUE ); connect(GroupCommon->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
myOkShape1 = myOkShape2 = false ; connect(GroupCommon->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
break;
} connect(GroupCommon->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
} connect(GroupCommon->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
return ;
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */
GroupCommon->show();
this->show();
return;
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CommonDlg::ClickOnOk() void GeometryGUI_CommonDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CommonDlg::ClickOnApply() void GeometryGUI_CommonDlg::ClickOnApply()
{ {
switch(myConstructorId) myGeomGUI->GetDesktop()->putInfo(tr(""));
{
case 0 :
{
if(myOkShape1 && myOkShape2) {
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1 ) ;
}
break ;
}
}
// accept(); if(myOkShape1 && myOkShape2)
return ; myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1);
return;
} }
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection has changed // purpose : Called when selection has changed
//================================================================================= //=================================================================================
void GeometryGUI_CommonDlg::SelectionIntoArgument() void GeometryGUI_CommonDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("");
QString aString = ""; /* name of future selection */ QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel != 1 ) { if(nbSel != 1) {
switch (myConstructorId) if(myEditCurrentArgument == GroupCommon->LineEdit1)
{ myOkShape1 = false;
case 0: else if( myEditCurrentArgument == GroupCommon->LineEdit2)
{ myOkShape2 = false;
if ( myEditCurrentArgument == LineEditC1A1Shape ) { return;
myOkShape1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myOkShape2 = false ;
}
break ;
}
}
return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult ; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC1A1Shape ) { if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; return;
if( !testResult )
return ; if(myEditCurrentArgument == GroupCommon->LineEdit1) {
myShape1 = S ; myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
LineEditC1A1Shape->setText(aString) ; if(!testResult)
myOkShape1 = true ; return;
} myShape1 = S;
else if ( myEditCurrentArgument == LineEditC1A2Shape ) { GroupCommon->LineEdit1->setText(aString);
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myOkShape1 = true;
if( !testResult )
return ;
myShape2 = S ;
LineEditC1A2Shape->setText(aString) ;
myOkShape2 = true ;
} }
return ; else if(myEditCurrentArgument == GroupCommon->LineEdit2) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape2 = S;
GroupCommon->LineEdit2->setText(aString);
myOkShape2 = true;
}
return;
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -362,23 +193,18 @@ void GeometryGUI_CommonDlg::SelectionIntoArgument()
void GeometryGUI_CommonDlg::SetEditCurrentArgument() void GeometryGUI_CommonDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{ if(send == GroupCommon->PushButton1) {
case 0: /* default constructor */ GroupCommon->LineEdit1->setFocus();
{ myEditCurrentArgument = GroupCommon->LineEdit1;
if( send == SelectButtonC1A1Shape ) { }
LineEditC1A1Shape->setFocus() ; else if(send == GroupCommon->PushButton2) {
myEditCurrentArgument = LineEditC1A1Shape ; GroupCommon->LineEdit2->setFocus();
} myEditCurrentArgument = GroupCommon->LineEdit2;
else if(send == SelectButtonC1A2Shape) { }
LineEditC1A2Shape->setFocus() ; SelectionIntoArgument();
myEditCurrentArgument = LineEditC1A2Shape;
} return;
SelectionIntoArgument() ;
break;
}
}
return ;
} }
@ -389,79 +215,39 @@ void GeometryGUI_CommonDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void GeometryGUI_CommonDlg::LineEditReturnPressed() void GeometryGUI_CommonDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1Shape ) if(send == GroupCommon->LineEdit1)
myEditCurrentArgument = LineEditC1A1Shape ; myEditCurrentArgument = GroupCommon->LineEdit1;
else if ( send == LineEditC1A2Shape ) else if(send == GroupCommon->LineEdit2)
myEditCurrentArgument = LineEditC1A2Shape ; myEditCurrentArgument = GroupCommon->LineEdit2;
else else
return ; return;
/* User name of object input management */ GeometryGUI_Skeleton::LineEditReturnPressed();
/* If successfull the selection is changed and signal emitted... */ return;
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
} }
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
}
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_CommonDlg::enterEvent( QEvent * )
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CommonDlg::ActivateThisDialog() void GeometryGUI_CommonDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate any active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; return;
GroupConstructor1->setEnabled(true) ; }
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ; //=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_CommonDlg::enterEvent(QEvent * e)
{
if (GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
} }

View File

@ -29,91 +29,48 @@
#ifndef DIALOGBOX_COMMON_H #ifndef DIALOGBOX_COMMON_H
#define DIALOGBOX_COMMON_H #define DIALOGBOX_COMMON_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GEOM_ShapeTypeFilter.hxx" #include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Common.hxx> #include <BRepAlgoAPI_Common.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QFrame;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//================================================================================= //=================================================================================
// class : GeometryGUI_CommonDlg // class : GeometryGUI_CommonDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_CommonDlg : public QDialog class GeometryGUI_CommonDlg : public GeometryGUI_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_CommonDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_CommonDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_CommonDlg(); ~GeometryGUI_CommonDlg();
private: private:
void Init();
void enterEvent(QEvent * e);
void Init( SALOME_Selection* Sel ) ; BooleanGUI* myBooleanGUI;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ TopoDS_Shape myShape1; /* topology used */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ TopoDS_Shape myShape2; /* topology used */
SALOME_Selection* mySelection ; /* User shape selection */ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
TopoDS_Shape myShape1 ; /* topology used */ GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
TopoDS_Shape myShape2 ; /* topology used */ bool myOkShape1;
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ bool myOkShape2; /* to check when arguments are defined */
GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
bool myOkShape1 ;
bool myOkShape2 ; /* to check when arguments are defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
GeometryGUI_2Sel_QTD* GroupCommon;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1Shape;
QLineEdit* LineEditC1A2Shape;
QPushButton* SelectButtonC1A1Shape;
QPushButton* SelectButtonC1A2Shape;
QLabel* TextLabelC1A2Shape;
QLabel* TextLabelC1A1Shape;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void SetEditCurrentArgument();
void SelectionIntoArgument() ; void SelectionIntoArgument();
void LineEditReturnPressed() ; void LineEditReturnPressed();
void DeactivateActiveDialog() ; void ActivateThisDialog();
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_CommonDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructor1Layout;
}; };
#endif // DIALOGBOX_COMMON_H #endif // DIALOGBOX_COMMON_H

View File

@ -29,27 +29,13 @@
using namespace std; using namespace std;
#include "GeometryGUI_ConeDlg.h" #include "GeometryGUI_ConeDlg.h"
#include "GeometryGUI.h" #include <BRepPrimAPI_MakeCone.hxx>
#include "QAD_Application.h" #include <BRepPrimAPI_MakeCylinder.hxx>
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <qbuttongroup.h> #include "GeometryGUI.h"
#include <qgroupbox.h> #include "QAD_Desktop.h"
#include <qlabel.h> #include "QAD_Config.h"
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_ConeDlg() // class : GeometryGUI_ConeDlg()
@ -58,189 +44,44 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_ConeDlg::GeometryGUI_ConeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_ConeDlg::GeometryGUI_ConeDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_PV"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_DXYZ"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_CONE_TITLE"));
setName( "GeometryGUI_ConeDlg" );
resize( 303, 309 );
setCaption( tr( "GEOM_CONE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_ConeDlgLayout = new QGridLayout( this );
GeometryGUI_ConeDlgLayout->setSpacing( 6 );
GeometryGUI_ConeDlgLayout->setMargin( 11 );
/***************************************************************/ /***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupConstructors->setTitle(tr("GEOM_CONE"));
GroupConstructors->setTitle( tr( "GEOM_CONE" ) ); RadioButton1->setPixmap(image0);
GroupConstructors->setExclusive( TRUE ); RadioButton2->setPixmap(image1);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton3->close(TRUE);
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
Constructor2->setPixmap( image2 );
Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
GeometryGUI_ConeDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/ GroupPoints = new GeometryGUI_2Sel3Spin(this, "GroupPoints");
GroupButtons = new QGroupBox( this, "GroupButtons" ); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
GroupButtons->setTitle( tr( "" ) ); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupButtons->setColumnLayout(0, Qt::Vertical ); GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
GroupButtons->layout()->setSpacing( 0 ); GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
GroupButtons->layout()->setMargin( 0 ); GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT"));
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); GroupPoints->PushButton1->setPixmap(image2);
GroupButtonsLayout->setAlignment( Qt::AlignTop ); GroupPoints->PushButton2->setPixmap(image2);
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_ConeDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/ GroupDimensions = new GeometryGUI_3Spin(this, "GroupDimensions");
GroupC1 = new QGroupBox( this, "GroupC1" ); GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
GroupC1->setColumnLayout(0, Qt::Vertical ); GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
GroupC1->layout()->setSpacing( 0 ); GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT"));
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
SpinBox_C1A3 = new GeometryGUI_SpinBox(GroupC1, "GeomSpinBox_C1A3" ) ; Layout1->addWidget(GroupPoints, 1, 0);
SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); Layout1->addWidget(GroupDimensions, 1, 0);
GroupC1Layout->addWidget( SpinBox_C1A3 , 2, 2 ); /***************************************************************/
TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); /* Initialisations */
TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") ); myPrimitiveGUI = thePrimitiveGUI;
TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); Init();
TextLabelC1A4->setFrameShape( QLabel::NoFrame );
TextLabelC1A4->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A4 , 3, 2 ) ;
TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
TextLabelC1A5->setText( tr( "GEOM_HEIGHT" ) );
TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A5->setFrameShape( QLabel::NoFrame );
TextLabelC1A5->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A5, 4, 0 );
SpinBox_C1A5 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A5" ) ;
SpinBox_C1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A5->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A5 , 4, 2 ) ;
GeometryGUI_ConeDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupC2 = new QGroupBox( this, "GroupC2" );
GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) );
GroupC2->setColumnLayout(0, Qt::Vertical );
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabel_Height = new QLabel(GroupC2 , "TextLabel_Height" );
TextLabel_Height->setText( tr( "GEOM_HEIGHT" ) );
GroupC2Layout->addWidget( TextLabel_Height, 2, 0 );
TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" );
TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 );
TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" );
TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 );
SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ;
GroupC2Layout->addWidget( SpinBox_Radius1 , 0, 1 ) ;
SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ;
GroupC2Layout->addWidget( SpinBox_Radius2 , 1, 1 ) ;
SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ;
GroupC2Layout->addWidget( SpinBox_Height , 2, 1 ) ;
QSpacerItem* spacer1 = new QSpacerItem( 20, 60, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC2Layout->addItem( spacer1 );
GeometryGUI_ConeDlgLayout->addWidget(GroupC2 , 1, 0 );
/***************************************************************/
/* Initialisations */
Init(Sel) ;
} }
@ -258,223 +99,161 @@ GeometryGUI_ConeDlg::~GeometryGUI_ConeDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_ConeDlg::Init()
{ {
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myRadius1 = 100.0;
myRadius2 = 0.0;
myHeight = 300.0;
myOkRadius1 = myOkRadius2 = myOkHeight = true;
myOkPoint1 = myOkDir = false;
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
double step ; QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; step = St.toDouble();
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes & initial values */
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C1A3->SetValue( 100.0 ) ; GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C1A4->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */ GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
SpinBox_C1A4->SetValue( 0.0 ) ; GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C1A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */ GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C1A5->SetValue( 300.0 ) ; GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */ GroupPoints->SpinBox_DX->SetValue(myRadius1);
SpinBox_Radius1->SetValue( 100.0 ) ; GroupPoints->SpinBox_DY->SetValue(myRadius2);
SpinBox_Radius2->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */ GroupPoints->SpinBox_DZ->SetValue(myHeight);
SpinBox_Radius2->SetValue( 0.0 ) ; GroupDimensions->SpinBox_DX->SetValue(myRadius1);
SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */ GroupDimensions->SpinBox_DY->SetValue(myRadius2);
SpinBox_Height->SetValue( 300.0 ) ; GroupDimensions->SpinBox_DZ->SetValue(myHeight);
GroupC1->show();
GroupC2->hide();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myRadius1 = 100.0 ;
myRadius2 = 0.0 ;
myHeight = 300.0 ;
myOkRadius1 = true ;
myOkRadius2 = true ;
myOkHeight = true ;
myOkPoint1 = false ;
myOkDir = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
/* first filter used */
mySelection->AddFilter(myVertexFilter) ;
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( SpinBox_C1A5, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
/* to close dialog if study change */ connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
/* Move widget on the botton right corner of main widget */ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; /* displays Dialog */
this->move( x, y ) ; GroupDimensions->hide();
this->show() ; /* displays Dialog */ GroupPoints->show();
this->show();
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId) void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId)
{ {
mySelection->ClearFilters() ; myConstructorId = constructorId;
myGeomGUI->EraseSimulationShape() ; mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius1 = myOkRadius2 = true;
myRadius1 = 100.0;
myRadius2 = 0.0;
myHeight = 300.0;
switch(myConstructorId) switch(myConstructorId)
{ {
case 0 : case 0 :
{ {
GroupC1->hide(); GroupDimensions->hide();
GroupC2->show(); resize(0, 0);
myConstructorId = constructorId ; GroupPoints->show();
myOkHeight = myOkRadius1 = myOkRadius2 = myOkPoint1 = myOkDir = true ; myOkPoint1 = myOkDir = false;
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(tr(""));
GroupPoints->LineEdit2->setText(tr(""));
SpinBox_Radius1->SetValue( 100.0 ) ; /* radius 1 */ GroupPoints->SpinBox_DX->SetValue(myRadius1);
SpinBox_Radius2->SetValue( 0.0 ) ; /* radius 2 */ GroupPoints->SpinBox_DY->SetValue(myRadius2);
SpinBox_Height->SetValue( 300.0 ) ; /* height */ GroupPoints->SpinBox_DZ->SetValue(myHeight);
disconnect( mySelection, 0, this, 0 ); /* filter for next selection */
mySelection->AddFilter(myVertexFilter);
myRadius1 = 100.0 ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
myRadius2 = 0.0 ; break;
myHeight = 300.0 ;
myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
myDir.SetCoord( 0.0, 0.0, 1.0 ) ;
if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight ) {
gp_Dir aDir = myDir ;
/* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) {
aDir.Reverse() ;
}
MakeConeSimulationAndDisplay() ;
}
break ;
} }
case 1 : case 1 :
{ {
GroupC2->hide(); GroupPoints->hide();
GroupC1->show(); resize( 0, 0 );
myConstructorId = constructorId ; GroupDimensions->show();
myEditCurrentArgument = LineEditC1A1 ; myOkPoint1 = myOkDir = true;
myOkHeight = myOkRadius1 = myOkRadius2 = true ;
myOkPoint1 = myOkDir = false ;
SpinBox_C1A3->SetValue( 100.0 ) ; /* radius 1 */ GroupDimensions->SpinBox_DX->SetValue(myRadius1);
SpinBox_C1A4->SetValue( 0.0 ) ; /* radius 2 */ GroupDimensions->SpinBox_DY->SetValue(myRadius2);
SpinBox_C1A5->SetValue( 300.0 ) ; /* height */ GroupDimensions->SpinBox_DZ->SetValue(myHeight);
myRadius1 = 100.0 ; myPoint1.SetCoord(0.0, 0.0, 0.0);
myRadius2 = 0.0 ; myDir.SetCoord(0.0, 0.0, 1.0);
myHeight = 300.0 ;
disconnect( mySelection, 0, this, 0 ); MakeConeSimulationAndDisplay();
break ; break;
} }
} }
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::ClickOnOk() void GeometryGUI_ConeDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return;
return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::ClickOnApply() void GeometryGUI_ConeDlg::ClickOnApply()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->GetDesktop()->putInfo(tr(""));
mySimulationTopoDs.Nullify() ; if (mySimulationTopoDs.IsNull())
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; return;
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
switch(myConstructorId) if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
{ gp_Dir aDir = myDir;
case 0 : /* allows user to reverse direction of construction with a negative height */
{ if(this->myHeight < -Precision::Confusion())
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { aDir.Reverse();
gp_Dir aDir = myDir ; myPrimitiveGUI->MakeConeAndDisplay(myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight));
/* allows user to reverse direction of construction with a negative height */ }
if( this->myHeight < -Precision::Confusion() ) {
aDir.Reverse() ;
}
myGeomGUI->MakeConeAndDisplay( myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight) ) ;
}
break ;
}
case 1 :
{
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
gp_Dir aDir = myDir ;
/* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) {
aDir.Reverse() ;
}
myGeomGUI->MakeConeAndDisplay( myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight) ) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ; return ;
} }
@ -485,227 +264,85 @@ void GeometryGUI_ConeDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::SelectionIntoArgument() void GeometryGUI_ConeDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
/* Future name of selection */
QString aString = ""; int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; if(myEditCurrentArgument == GroupPoints->LineEdit1)
if ( nbSel != 1 ) { myOkPoint1 = false;
if ( myEditCurrentArgument == LineEditC1A1 ) { else if (myEditCurrentArgument == GroupPoints->LineEdit2)
LineEditC1A1->setText("") ; myOkDir = false;
myOkPoint1 = false ; return;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
LineEditC1A2->setText("") ;
myOkDir = false ;
}
return ;
} }
/* nbSel == 1 ! */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return ; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
LineEditC1A1->setText(aString) ; GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true ; myOkPoint1 = true;
} }
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) { else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S)); BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction(); myDir = curv.Line().Direction();
LineEditC1A2->setText(aString) ; GroupPoints->LineEdit2->setText(aString);
myOkDir = true ; myOkDir = true;
} }
if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
MakeConeSimulationAndDisplay() ; MakeConeSimulationAndDisplay();
} return;
return ;
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::SetEditCurrentArgument() void GeometryGUI_ConeDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); if(myConstructorId != 0)
mySelection->ClearFilters() ; return;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myVertexFilter) ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
case 1:
{
break ;
}
}
return ; QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
mySelection->AddFilter(myVertexFilter);
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
mySelection->AddFilter(myEdgeFilter);
}
this->SelectionIntoArgument();
return;
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::LineEditReturnPressed() void GeometryGUI_ConeDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 ) if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == LineEditC1A2 ) else if (send == GroupPoints->LineEdit2)
myEditCurrentArgument = LineEditC1A2 ; myEditCurrentArgument = GroupPoints->LineEdit2;
else else
return ; return;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
const QString objectUserName = LE->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
LE->setText( objectUserName ) ;
}
return ;
}
//================================================================================= GeometryGUI_Skeleton::LineEditReturnPressed();
// function : ValueChangedInSpinBox() return;
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ValueChangedInSpinBox( double newValue )
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QObject* send = (QObject*)sender();
if( send == SpinBox_C1A3 || send == SpinBox_Radius1 ) { /* radius1 */
myRadius1 = newValue ;
myOkRadius1 = true ;
} else if( send == SpinBox_C1A4 || send == SpinBox_Radius2 ) { /* radius2 */
myRadius2 = newValue ;
myOkRadius2 = true ;
}
else if( send == SpinBox_C1A5 || send == SpinBox_Height ) { /* algebric height */
myHeight = newValue ;
myOkHeight = true ;
}
if ( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight ) {
MakeConeSimulationAndDisplay() ;
}
return ;
}
//=================================================================================
// function : TextChangedInLineEdit()
// purpose :
//=================================================================================
// void GeometryGUI_ConeDlg::TextChangedInLineEdit(const QString& newText)
// {
// myGeomGUI->EraseSimulationShape() ;
// mySimulationTopoDs.Nullify() ;
// QLineEdit* send = (QLineEdit*)sender();
// QString newT = strdup(newText) ;
// int i ;
// if(send == LineEditC1A3) { /* radius1 */
// if( myVa->validate(newT, i) == myVa->Acceptable ) {
// myRadius1 = newText.toFloat() ;
// myOkRadius1 = true ;
// }
// else {
// myOkRadius1 = false ;
// }
// } else if(send == LineEditC1A4) { /* radius2 */
// if( myVb->validate(newT, i) == myVb->Acceptable ) {
// myRadius2 = newText.toFloat() ;
// myOkRadius2 = true ;
// }
// else {
// myOkRadius2 = false ;
// }
// } else if(send == LineEditC1A5) { /* algebric height */
// if( myVc->validate(newT, i) == myVc->Acceptable ) {
// myHeight = newText.toFloat() ;
// if( fabs(myHeight) > Precision::Confusion() )
// myOkHeight = true ;
// else
// myOkHeight = false ;
// }
// }else if(send == LineEdit_Radius1) { /* radius1 */
// if( myVa->validate(newT, i) == myVa->Acceptable ) {
// myRadius1 = newText.toFloat() ;
// myOkRadius1 = true ;
// }
// else {
// myOkRadius1 = false ;
// }
// } else if(send == LineEdit_Radius2) { /* radius2 */
// if( myVb->validate(newT, i) == myVb->Acceptable ) {
// myRadius2 = newText.toFloat() ;
// myOkRadius2 = true ;
// }
// else {
// myOkRadius2 = false ;
// }
// } else if(send == LineEdit_Height) { /* algebric height */
// if( myVc->validate(newT, i) == myVc->Acceptable ) {
// myHeight = newText.toFloat() ;
// if( fabs(myHeight) > Precision::Confusion() )
// myOkHeight = true ;
// else
// myOkHeight = false ;
// }
// }
// if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
// MakeConeSimulationAndDisplay() ;
// }
// return ;
// }
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
} }
@ -715,16 +352,11 @@ void GeometryGUI_ConeDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::ActivateThisDialog() void GeometryGUI_ConeDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; if(!mySimulationTopoDs.IsNull())
GroupC1->setEnabled(true) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
GroupC2->setEnabled(true) ; return;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
} }
@ -734,22 +366,39 @@ void GeometryGUI_ConeDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::enterEvent(QEvent* e) void GeometryGUI_ConeDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if (GroupConstructors->isEnabled())
return ; return;
ActivateThisDialog() ; this->ActivateThisDialog();
return ; return;
} }
//================================================================================= //=================================================================================
// function : closeEvent() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::closeEvent( QCloseEvent* e ) void GeometryGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
{ {
/* same than click on cancel button */ myGeomGUI->EraseSimulationShape();
this->ClickOnCancel() ; mySimulationTopoDs.Nullify();
return ; QObject* send = (QObject*)sender();
if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
myRadius1 = newValue;
myOkRadius1 = true;
}
else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
myRadius2 = newValue;
myOkRadius2 = true;
}
else if(send == GroupPoints->SpinBox_DZ || send == GroupDimensions->SpinBox_DZ) {
myHeight = newValue;
myOkHeight = true;
}
if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
MakeConeSimulationAndDisplay();
return;
} }
@ -759,30 +408,27 @@ void GeometryGUI_ConeDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void GeometryGUI_ConeDlg::MakeConeSimulationAndDisplay() void GeometryGUI_ConeDlg::MakeConeSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify();
gp_Dir aDir = myDir ; gp_Dir aDir = myDir;
try { try {
/* allows user to reverse direction of construction with a negative height */ /* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) { if(this->myHeight < -Precision::Confusion())
aDir.Reverse() ; aDir.Reverse();
}
gp_Ax2 anAxis(this->myPoint1, aDir) ;
if( fabs(myRadius1 - myRadius2) <= Precision::Confusion() ) { gp_Ax2 anAxis(this->myPoint1, aDir);
mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight) ).Shape() ;
} if(fabs(myRadius1 - myRadius2) <= Precision::Confusion())
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight)).Shape();
else { else {
if( fabs(myHeight) > Precision::Confusion() ) if(fabs(myHeight) > Precision::Confusion())
mySimulationTopoDs = BRepPrimAPI_MakeCone( anAxis, myRadius1, myRadius2, fabs(myHeight) ).Shape() ; mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape();
} }
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeConeSimulationAndDisplay" ) ; MESSAGE("Exception catched in MakeConeSimulationAndDisplay");
} }
return ; return;
} }

View File

@ -29,124 +29,66 @@
#ifndef DIALOGBOX_CONE_H #ifndef DIALOGBOX_CONE_H
#define DIALOGBOX_CONE_H #define DIALOGBOX_CONE_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GEOM_ShapeTypeFilter.hxx" #include "GeometryGUI_2Sel3Spin.h"
#include "GeometryGUI_3Spin.h"
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx" #include "GEOM_EdgeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <BRepPrimAPI_MakeCone.hxx> #include <gp_Pnt.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx> #include <gp_Dir.hxx>
#include <Precision.hxx>
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QSpinBox;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//================================================================================= //=================================================================================
// class : GeometryGUI_ConeDlg // class : GeometryGUI_ConeDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_ConeDlg : public QDialog class GeometryGUI_ConeDlg : public GeometryGUI_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_ConeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_ConeDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_ConeDlg(); ~GeometryGUI_ConeDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
void MakeConeSimulationAndDisplay();
void Init( SALOME_Selection* Sel ) ; PrimitiveGUI* myPrimitiveGUI;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void MakeConeSimulationAndDisplay() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ double step;
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ int myConstructorId;
SALOME_Selection* mySelection ; /* User shape selection */ Handle(GEOM_ShapeTypeFilter) myVertexFilter;
TopoDS_Shape mySimulationTopoDs ; Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
gp_Pnt myPoint1 ; /* Topology used */ gp_Pnt myPoint1; /* topology used */
gp_Dir myDir ; gp_Dir myDir;
bool myOkPoint1 ; bool myOkPoint1; /* to check when arguments is defined */
bool myOkDir ; /* to check when argument is defined */ bool myOkDir;
Standard_Real myRadius1 ; Standard_Real myRadius1;
Standard_Real myRadius2 ; Standard_Real myRadius2;
Standard_Real myHeight ; Standard_Real myHeight;
bool myOkRadius1 ; bool myOkRadius1;
bool myOkRadius2 ; bool myOkRadius2;
bool myOkHeight ; bool myOkHeight;
QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */
QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */
QDoubleValidator *myVc ; /* Double validator for numeric input myHeight */
int myConstructorId ; /* Current constructor id = radio button id */ GeometryGUI_2Sel3Spin* GroupPoints;
QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */ GeometryGUI_3Spin* GroupDimensions;
Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QGroupBox* GroupC1;
QGroupBox* GroupC2;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A2;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
GeometryGUI_SpinBox* SpinBox_C1A3 ;
QLabel* TextLabelC1A4;
GeometryGUI_SpinBox* SpinBox_C1A4 ;
QLabel* TextLabelC1A5;
GeometryGUI_SpinBox* SpinBox_C1A5 ;
QLabel* TextLabel_Radius1 ;
QLabel* TextLabel_Radius2 ;
QLabel* TextLabel_Height ;
GeometryGUI_SpinBox* SpinBox_Radius1 ;
GeometryGUI_SpinBox* SpinBox_Radius2 ;
GeometryGUI_SpinBox* SpinBox_Height ;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ActivateThisDialog();
void SelectionIntoArgument() ; void LineEditReturnPressed();
void LineEditReturnPressed() ; void SelectionIntoArgument();
void DeactivateActiveDialog() ; void SetEditCurrentArgument();
void ActivateThisDialog() ; void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox( double newValue ) ; void ValueChangedInSpinBox(double newValue);
protected:
QGridLayout* GeometryGUI_ConeDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
}; };
#endif // DIALOGBOX_CONE_H #endif // DIALOGBOX_CONE_H

View File

@ -30,25 +30,7 @@ using namespace std;
#include "GeometryGUI_CutDlg.h" #include "GeometryGUI_CutDlg.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h" #include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qevent.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_CutDlg() // class : GeometryGUI_CutDlg()
@ -57,111 +39,33 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_CutDlg::GeometryGUI_CutDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_CutDlg::GeometryGUI_CutDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CUT"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CUT")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_CUT_TITLE"));
setName( "GeometryGUI_CutDlg" );
resize( 322, 220 );
setCaption( tr( "GEOM_CUT_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CutDlgLayout = new QGridLayout( this ); /***************************************************************/
GeometryGUI_CutDlgLayout->setSpacing( 6 ); GroupConstructors->setTitle(tr("GEOM_CUT"));
GeometryGUI_CutDlgLayout->setMargin( 11 ); RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
/***************************************************************/ GroupCut = new GeometryGUI_2Sel_QTD(this, "GroupCut");
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupCut->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupConstructors->setTitle( tr( "GEOM_CUT" ) ); GroupCut->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
GroupConstructors->setExclusive( TRUE ); GroupCut->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
GroupConstructors->setColumnLayout(0, Qt::Vertical ); GroupCut->PushButton1->setPixmap(image1);
GroupConstructors->layout()->setSpacing( 0 ); GroupCut->PushButton2->setPixmap(image1);
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GeometryGUI_CutDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/ Layout1->addWidget(GroupCut, 1, 0);
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); /***************************************************************/
GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
SelectButtonC1A1Shape->setText( tr( "" ) );
SelectButtonC1A1Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
SelectButtonC1A2Shape->setText( tr( "" ) );
SelectButtonC1A2Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
TextLabelC1A2Shape->setText( tr( "GEOM_TOOL_OBJECT" ) );
TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
TextLabelC1A1Shape->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
GeometryGUI_CutDlgLayout->addWidget( GroupConstructor1, 1, 0 );
/***************************************************************/ /* Initialisation */
GroupButtons = new QGroupBox( this, "GroupButtons" ); myBooleanGUI = theBooleanGUI;
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); Init();
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_1, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_CutDlgLayout->addWidget( GroupButtons, 2, 0 );
/* Initialisation */
Init( Sel ) ;
} }
@ -172,190 +76,112 @@ GeometryGUI_CutDlg::GeometryGUI_CutDlg( QWidget* parent, const char* name, SALOM
GeometryGUI_CutDlg::~GeometryGUI_CutDlg() GeometryGUI_CutDlg::~GeometryGUI_CutDlg()
{ {
/* no need to delete child widgets, Qt does it all for us */ /* no need to delete child widgets, Qt does it all for us */
this->destroy(TRUE, TRUE) ;
} }
//================================================================================= //=================================================================================
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CutDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_CutDlg::Init()
{ {
mySelection = Sel ; /* init variables */
myShape1.Nullify() ; myEditCurrentArgument = GroupCut->LineEdit1;
myShape2.Nullify() ;
myConstructorId = 0 ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
GroupConstructor1->show(); myShape1.Nullify();
myConstructorId = 0 ; myShape2.Nullify();
myEditCurrentArgument = LineEditC1A1Shape ; myOkShape1 = myOkShape2 = false;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); connect(GroupCut->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
myGeom = GEOM::GEOM_Gen::_narrow(comp); connect(GroupCut->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
// TODO previous selection into argument ?
/* signals and slots connections */ connect(GroupCut->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(GroupCut->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ; /* displays Dialog */
GroupCut->show();
this->show();
return;
} }
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CutDlg::ConstructorsClicked(int constructorId)
{
GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
switch (constructorId)
{
case 0:
{
GroupConstructor1->show();
myConstructorId = constructorId ;
myEditCurrentArgument = LineEditC1A1Shape ;
LineEditC1A2Shape->setText(tr("")) ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
break;
}
}
return ;
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CutDlg::ClickOnOk() void GeometryGUI_CutDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CutDlg::ClickOnApply() void GeometryGUI_CutDlg::ClickOnApply()
{ {
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo(tr(""));
switch(myConstructorId)
{
case 0 :
{
if(myOkShape1 && myOkShape2) {
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2 ) ;
}
break ;
}
}
// accept(); if(myOkShape1 && myOkShape2)
return ; myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2);
return;
} }
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::ClickOnCancel()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection has changed // purpose : Called when selection has changed
//================================================================================= //=================================================================================
void GeometryGUI_CutDlg::SelectionIntoArgument() void GeometryGUI_CutDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel != 1 ) { if(nbSel != 1) {
switch (myConstructorId) if(myEditCurrentArgument == GroupCut->LineEdit1)
{ myOkShape1 = false;
case 0: else if( myEditCurrentArgument == GroupCut->LineEdit2)
{ myOkShape2 = false;
if ( myEditCurrentArgument == LineEditC1A1Shape ) { return;
myOkShape1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myOkShape2 = false ;
}
break ;
}
}
return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult ; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return ; return;
if ( myEditCurrentArgument == LineEditC1A1Shape ) { if(myEditCurrentArgument == GroupCut->LineEdit1) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if( !testResult ) if(!testResult)
return ; return;
myShape1 = S ; myShape1 = S;
LineEditC1A1Shape->setText(aString) ; GroupCut->LineEdit1->setText(aString);
myOkShape1 = true ; myOkShape1 = true;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape2 = S ;
LineEditC1A2Shape->setText(aString) ;
myOkShape2 = true ;
} }
else if(myEditCurrentArgument == GroupCut->LineEdit2) {
return ; myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape2 = S;
GroupCut->LineEdit2->setText(aString);
myOkShape2 = true;
}
return;
} }
@ -366,26 +192,19 @@ void GeometryGUI_CutDlg::SelectionIntoArgument()
void GeometryGUI_CutDlg::SetEditCurrentArgument() void GeometryGUI_CutDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if( send == SelectButtonC1A1Shape ) {
LineEditC1A1Shape->setFocus() ;
myEditCurrentArgument = LineEditC1A1Shape ;
}
else if(send == SelectButtonC1A2Shape) {
LineEditC1A2Shape->setFocus() ;
myEditCurrentArgument = LineEditC1A2Shape;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
if(send == GroupCut->PushButton1) {
GroupCut->LineEdit1->setFocus();
myEditCurrentArgument = GroupCut->LineEdit1;
}
else if(send == GroupCut->PushButton2) {
GroupCut->LineEdit2->setFocus();
myEditCurrentArgument = GroupCut->LineEdit2;
}
SelectionIntoArgument();
return;
}
//================================================================================= //=================================================================================
@ -394,79 +213,39 @@ void GeometryGUI_CutDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void GeometryGUI_CutDlg::LineEditReturnPressed() void GeometryGUI_CutDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1Shape ) if(send == GroupCut->LineEdit1)
myEditCurrentArgument = LineEditC1A1Shape ; myEditCurrentArgument = GroupCut->LineEdit1;
else if ( send == LineEditC1A2Shape ) else if(send == GroupCut->LineEdit2)
myEditCurrentArgument = LineEditC1A2Shape ; myEditCurrentArgument = GroupCut->LineEdit2;
else else
return ; return;
/* User name of object input management */ GeometryGUI_Skeleton::LineEditReturnPressed();
/* If successfull the selection is changed and signal emitted... */ return;
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
} }
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
}
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_CutDlg::enterEvent( QEvent * )
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CutDlg::ActivateThisDialog() void GeometryGUI_CutDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate any active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; return;
GroupConstructor1->setEnabled(true) ; }
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ; //=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_CutDlg::enterEvent(QEvent * e)
{
if(GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
} }

View File

@ -29,90 +29,48 @@
#ifndef DIALOGBOX_CUT_H #ifndef DIALOGBOX_CUT_H
#define DIALOGBOX_CUT_H #define DIALOGBOX_CUT_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GEOM_ShapeTypeFilter.hxx" #include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Cut.hxx> #include <BRepAlgoAPI_Cut.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QFrame;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//================================================================================= //=================================================================================
// class : GeometryGUI_CutDlg // class : GeometryGUI_CutDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_CutDlg : public QDialog class GeometryGUI_CutDlg : public GeometryGUI_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CutDlg(); ~GeometryGUI_CutDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
void Init( SALOME_Selection* Sel ) ; BooleanGUI* myBooleanGUI;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ TopoDS_Shape myShape1; /* topology used to fuse */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ TopoDS_Shape myShape2; /* topology used to fuse */
SALOME_Selection* mySelection ; /* User shape selection */ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
TopoDS_Shape myShape1 ; /* topology used to fuse */ GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
TopoDS_Shape myShape2 ; /* topology used to fuse */ bool myOkShape1; /* to check when arguments are defined */
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ bool myOkShape2;
GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
bool myOkShape1 ;
bool myOkShape2 ; /* to check when arguments are defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QButtonGroup* GroupConstructors; GeometryGUI_2Sel_QTD* GroupCut;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1Shape;
QLineEdit* LineEditC1A2Shape;
QPushButton* SelectButtonC1A1Shape;
QPushButton* SelectButtonC1A2Shape;
QLabel* TextLabelC1A2Shape;
QLabel* TextLabelC1A1Shape;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void SetEditCurrentArgument();
void SelectionIntoArgument() ; void SelectionIntoArgument();
void LineEditReturnPressed() ; void LineEditReturnPressed();
void DeactivateActiveDialog() ; void ActivateThisDialog();
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_CutDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructor1Layout;
}; };
#endif // DIALOGBOX_CUT_H #endif // DIALOGBOX_CUT_H

View File

@ -29,26 +29,12 @@
using namespace std; using namespace std;
#include "GeometryGUI_CylinderDlg.h" #include "GeometryGUI_CylinderDlg.h"
#include "GeometryGUI.h" #include <BRepPrimAPI_MakeCylinder.hxx>
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <qbuttongroup.h> #include "GeometryGUI.h"
#include <qgroupbox.h> #include "QAD_Desktop.h"
#include <qlabel.h> #include "QAD_Config.h"
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_CylinderDlg() // class : GeometryGUI_CylinderDlg()
@ -57,171 +43,42 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_PV"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_CylinderDlg" );
resize( 303, 281 );
setCaption( tr( "GEOM_CYLINDER_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CylinderDlgLayout = new QGridLayout( this );
GeometryGUI_CylinderDlgLayout->setSpacing( 6 );
GeometryGUI_CylinderDlgLayout->setMargin( 11 );
/***************************************************************/ setCaption(tr("GEOM_CYLINDER_TITLE"));
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_CylinderDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/ /***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupConstructors->setTitle(tr("GEOM_CYLINDER"));
GroupConstructors->setTitle( tr( "GEOM_CYLINDER" ) ); RadioButton1->setPixmap(image0);
GroupConstructors->setExclusive( TRUE ); RadioButton2->setPixmap(image1);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton3->close(TRUE);
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
Constructor2->setPixmap( image2 );
Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 3 );
GeometryGUI_CylinderDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setMinimumSize( QSize( 0, 0 ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_RADIUS" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ) ;
TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
TextLabelC1A4->setText( tr( "GEOM_HEIGHT" ) );
TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A4->setFrameShape( QLabel::NoFrame );
TextLabelC1A4->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ; GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 ); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
GeometryGUI_CylinderDlgLayout->addWidget( GroupC1, 1, 0 ); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS"));
GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT"));
GroupPoints->PushButton1->setPixmap(image2);
GroupPoints->PushButton2->setPixmap(image2);
/***************************************************************/ GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
GroupC2 = new QGroupBox( this, "GroupC2" ); GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) ); GroupDimensions->TextLabel1->setText(tr("GEOM_HEIGHT"));
GroupC2->setColumnLayout(0, Qt::Vertical ); GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS"));
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabel_Height = new QLabel(GroupC2 , "TextLabel_Height" );
TextLabel_Height->setText( tr( "GEOM_HEIGHT" ) );
GroupC2Layout->addWidget( TextLabel_Height, 1, 0 );
TextLabel_Radius = new QLabel( GroupC2, "TextLabel_Radius" );
TextLabel_Radius->setText( tr( "GEOM_RADIUS" ) );
GroupC2Layout->addWidget( TextLabel_Radius, 0, 0 );
SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ; Layout1->addWidget(GroupPoints, 1, 0);
SpinBox_Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Height->sizePolicy().hasHeightForWidth() ) ); Layout1->addWidget(GroupDimensions, 1, 0);
GroupC2Layout->addWidget( SpinBox_Height, 1, 1 ) ; /***************************************************************/
SpinBox_Radius = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius" ) ; /* Initialisations */
SpinBox_Radius->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Radius->sizePolicy().hasHeightForWidth() ) ); myPrimitiveGUI = thePrimitiveGUI;
GroupC2Layout->addWidget( SpinBox_Radius, 0, 1 ) ; Init();
QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC2Layout->addItem( spacer1 );
GeometryGUI_CylinderDlgLayout->addWidget(GroupC2 , 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
} }
@ -239,215 +96,154 @@ GeometryGUI_CylinderDlg::~GeometryGUI_CylinderDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_CylinderDlg::Init()
{ {
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myRadius = 100.0;
myHeight = 300.0;
myOkRadius = myOkHeight = true;
myOkPoint1 = myOkDir = false;
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
double step ; QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ); step = St.toDouble();
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
/* First constructor : radius */ /* First constructor : radius */
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
/* First constructor : algebric height */ /* First constructor : algebric height */
SpinBox_C1A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
/* Second constructor : radius */ /* Second constructor : radius */
SpinBox_Radius->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
/* Second constructor : algebric height */ /* Second constructor : algebric height */
SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
GroupC1->show(); GroupPoints->SpinBox_DX->SetValue(myRadius);
GroupC2->hide(); GroupPoints->SpinBox_DY->SetValue(myHeight);
myConstructorId = 0 ; GroupDimensions->SpinBox_DX->SetValue(myRadius);
Constructor1->setChecked( TRUE ); GroupDimensions->SpinBox_DY->SetValue(myHeight);
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
SpinBox_C1A3->SetValue( 100.0 ) ;
SpinBox_C1A4->SetValue( 300.0 ) ;
SpinBox_Radius->SetValue( 100.0 ) ;
SpinBox_Height->SetValue( 300.0 ) ;
myRadius = 100.0 ;
myHeight = 300.0 ;
myOkRadius = true ;
myOkHeight = true ;
myOkPoint1 = false ;
myOkDir = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
/* first filter used */
mySelection->AddFilter(myVertexFilter) ;
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( SpinBox_Radius, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
/* to close dialog if study change */ connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
/* Move widget on the botton right corner of main widget */ /* displays Dialog */
int x, y ; GroupDimensions->hide();
myGeomGUI->DefineDlgPosition( this, x, y ) ; GroupPoints->show();
this->move( x, y ) ; this->show();
this->show() ; /* displays Dialog */
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId) void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId)
{ {
mySelection->ClearFilters() ; myConstructorId = constructorId;
myGeomGUI->EraseSimulationShape() ; mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius = true;
myRadius = 100.0;
myHeight = 300.0;
switch(myConstructorId) switch(myConstructorId)
{ {
case 0 : case 0 :
{ {
GroupC1->hide(); GroupDimensions->hide();
GroupC2->show(); resize(0, 0);
myConstructorId = constructorId ; GroupPoints->show();
myOkHeight = myOkRadius = myOkPoint1 = myOkDir = true ; myOkPoint1 = myOkDir = false;
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(tr(""));
GroupPoints->LineEdit2->setText(tr(""));
SpinBox_Radius->SetValue( 100.0 ) ; GroupPoints->SpinBox_DX->SetValue(myRadius);
SpinBox_Height->SetValue( 300.0 ) ; GroupPoints->SpinBox_DY->SetValue(myHeight);
myRadius = 100.0 ;
myHeight = 300.0 ;
disconnect( mySelection, 0, this, 0 ); /* filter for next selection */
mySelection->AddFilter(myVertexFilter);
myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
myDir.SetCoord( 0.0, 0.0, 1.0 ) ; break;
if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
gp_Dir aDir = myDir ;
/* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) {
aDir.Reverse() ;
}
MakeCylinderSimulationAndDisplay() ;
}
break ;
} }
case 1 : case 1 :
{ {
GroupC2->hide(); GroupPoints->hide();
GroupC1->show(); resize( 0, 0 );
myConstructorId = constructorId ; GroupDimensions->show();
myEditCurrentArgument = LineEditC1A1 ; myOkPoint1 = myOkDir = true;
myOkHeight = myOkRadius = true ;
myOkPoint1 = myOkDir = false ; GroupDimensions->SpinBox_DX->SetValue(myRadius);
LineEditC1A1->setText( tr("") ); GroupDimensions->SpinBox_DY->SetValue(myHeight);
myPoint1.SetCoord(0.0, 0.0, 0.0);
SpinBox_C1A3->SetValue( 100.0 ) ; myDir.SetCoord(0.0, 0.0, 1.0);
SpinBox_C1A4->SetValue( 300.0 ) ;
myRadius = 100.0 ; MakeCylinderSimulationAndDisplay();
myHeight = 300.0 ; break;
disconnect( mySelection, 0, this, 0 );
break ;
} }
} }
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::ClickOnOk() void GeometryGUI_CylinderDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return;
return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::ClickOnApply() void GeometryGUI_CylinderDlg::ClickOnApply()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->GetDesktop()->putInfo(tr(""));
mySimulationTopoDs.Nullify() ; if (mySimulationTopoDs.IsNull())
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; return;
switch(myConstructorId) myGeomGUI->EraseSimulationShape();
{ mySimulationTopoDs.Nullify();
case 0 :
{
if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
gp_Dir aDir = myDir ;
/* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) {
aDir.Reverse() ;
}
myGeomGUI->MakeCylinderAndDisplay( myPoint1, aDir, myRadius, fabs(myHeight) ) ;
}
break ;
}
case 1 :
{
if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
gp_Dir aDir = myDir ;
/* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) {
aDir.Reverse() ;
}
myGeomGUI->MakeCylinderAndDisplay( myPoint1, aDir, myRadius, fabs(myHeight) ) ;
}
break ;
}
}
// accept();
return ;
}
if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) {
//================================================================================= gp_Dir aDir = myDir;
// function : ClickOnCancel() /* allows user to reverse direction of construction with a negative height */
// purpose : if(this->myHeight < -Precision::Confusion())
//================================================================================= aDir.Reverse();
void GeometryGUI_CylinderDlg::ClickOnCancel() myPrimitiveGUI->MakeCylinderAndDisplay(myPoint1, aDir, myRadius, fabs(myHeight));
{ }
mySelection->ClearFilters() ; return;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
} }
@ -457,169 +253,85 @@ void GeometryGUI_CylinderDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::SelectionIntoArgument() void GeometryGUI_CylinderDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
QString aString = ""; /* name of future selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel != 1 ) { if(nbSel != 1) {
if ( myEditCurrentArgument == LineEditC1A1 ) { if(myEditCurrentArgument == GroupPoints->LineEdit1)
LineEditC1A1->setText("") ; myOkPoint1 = false;
myOkPoint1 = false ; else if (myEditCurrentArgument == GroupPoints->LineEdit2)
} myOkDir = false;
else if ( myEditCurrentArgument == LineEditC1A2 ) { return;
LineEditC1A2->setText("") ;
myOkDir = false ;
}
return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return ; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
LineEditC1A1->setText(aString) ; GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true ; myOkPoint1 = true;
} }
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) { else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S)); BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction(); myDir = curv.Line().Direction();
GroupPoints->LineEdit2->setText(aString);
LineEditC1A2->setText(aString) ; myOkDir = true;
myOkDir = true ;
} }
if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
MakeCylinderSimulationAndDisplay() ; MakeCylinderSimulationAndDisplay();
} return;
return ;
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::SetEditCurrentArgument() void GeometryGUI_CylinderDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); if(myConstructorId != 0)
mySelection->ClearFilters() ; return;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myVertexFilter) ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
case 1:
{
break ;
}
}
return ; QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
mySelection->AddFilter(myVertexFilter);
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
mySelection->AddFilter(myEdgeFilter);
}
this->SelectionIntoArgument();
return;
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::LineEditReturnPressed() void GeometryGUI_CylinderDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 ) if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == LineEditC1A2 ) else if (send == GroupPoints->LineEdit2)
myEditCurrentArgument = LineEditC1A2 ; myEditCurrentArgument = GroupPoints->LineEdit2;
else else
return ; return;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
const QString objectUserName = LE->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
LE->setText( objectUserName ) ;
}
return ;
}
GeometryGUI_Skeleton::LineEditReturnPressed();
//================================================================================= return;
// function : ValueChangedInSpinBox
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QObject* send = (QObject*)sender();
if(send == SpinBox_C1A3 ) { /* radius */
myRadius = newValue ;
myOkRadius = true ;
if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
MakeCylinderSimulationAndDisplay() ;
}
} else if (send == SpinBox_C1A4 ) { /* algebric height */
myHeight = newValue ;
myOkHeight = true ;
if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
MakeCylinderSimulationAndDisplay() ;
}
}
else if (send == SpinBox_Height) { /* algebric height */
myOkHeight = true ;
myHeight = newValue ;
if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
MakeCylinderSimulationAndDisplay() ;
}
}
else if (send == SpinBox_Radius) { /* radius */
myRadius = newValue ;
myOkRadius = true ;
if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
MakeCylinderSimulationAndDisplay() ;
}
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
} }
@ -629,16 +341,11 @@ void GeometryGUI_CylinderDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::ActivateThisDialog() void GeometryGUI_CylinderDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; if(!mySimulationTopoDs.IsNull())
GroupC1->setEnabled(true) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
GroupC2->setEnabled(true) ; return;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
} }
@ -648,22 +355,36 @@ void GeometryGUI_CylinderDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::enterEvent(QEvent* e) void GeometryGUI_CylinderDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if (GroupConstructors->isEnabled())
return ; return;
ActivateThisDialog() ; this->ActivateThisDialog();
return ; return;
} }
//================================================================================= //=================================================================================
// function : closeEvent() // function : ValueChangedInSpinBox
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::closeEvent( QCloseEvent* e ) void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
{ {
/* same than click on cancel button */ myGeomGUI->EraseSimulationShape();
this->ClickOnCancel() ; mySimulationTopoDs.Nullify();
return ; QObject* send = (QObject*)sender();
/* radius */
if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
myRadius = newValue;
myOkRadius = true;
} /* algebric height */
else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
myHeight = newValue;
myOkHeight = true;
}
if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
MakeCylinderSimulationAndDisplay();
return;
} }
@ -673,23 +394,22 @@ void GeometryGUI_CylinderDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void GeometryGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() void GeometryGUI_CylinderDlg::MakeCylinderSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify();
gp_Dir aDir = this->myDir ; gp_Dir aDir = this->myDir;
try { try {
/* allows user to reverse direction of construction with a negative height */ /* allows user to reverse direction of construction with a negative height */
if( this->myHeight < -Precision::Confusion() ) { if(this->myHeight < -Precision::Confusion())
aDir.Reverse() ; aDir.Reverse();
}
gp_Ax2 anAxis(this->myPoint1, aDir) ;
mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, this->myRadius, fabs(myHeight) ).Shape() ; gp_Ax2 anAxis(this->myPoint1, aDir);
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeCylinderSimulationAndDisplay" ) ; MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay");
} }
return ; return;
} }

View File

@ -29,118 +29,64 @@
#ifndef DIALOGBOX_CYLINDER_H #ifndef DIALOGBOX_CYLINDER_H
#define DIALOGBOX_CYLINDER_H #define DIALOGBOX_CYLINDER_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel2Spin.h"
#include "GeometryGUI_2Spin.h"
#include "PrimitiveGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GEOM_EdgeFilter.hxx" #include "GEOM_EdgeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <Precision.hxx>
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class QRadioButton;
class GeometryGUI;
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
//================================================================================= //=================================================================================
// class : GeometryGUI_CylinderDlg // class : GeometryGUI_CylinderDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_CylinderDlg : public QDialog class GeometryGUI_CylinderDlg : public GeometryGUI_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_CylinderDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_CylinderDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_CylinderDlg(); ~GeometryGUI_CylinderDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
void MakeCylinderSimulationAndDisplay();
void Init( SALOME_Selection* Sel ) ; PrimitiveGUI* myPrimitiveGUI;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void MakeCylinderSimulationAndDisplay() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ double step;
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ int myConstructorId;
TopoDS_Shape mySimulationTopoDs ; Handle(GEOM_ShapeTypeFilter) myVertexFilter;
SALOME_Selection* mySelection ; /* User shape selection */ Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
gp_Pnt myPoint1 ; /* topology used */
gp_Dir myDir ;
Standard_Real myRadius ; gp_Pnt myPoint1; /* topology used */
Standard_Real myHeight ; gp_Dir myDir;
bool myOkRadius ; bool myOkPoint1; /* to check when arguments is defined */
bool myOkHeight ; bool myOkDir;
QDoubleValidator *myVa ; /* Double validator for numeric input */
QDoubleValidator *myVb ; /* Double validator for numeric input */
bool myOkPoint1 ; Standard_Real myRadius;
bool myOkDir ; /* to check when arguments is defined */ Standard_Real myHeight;
int myConstructorId ; /* Current constructor id = radio button id */ bool myOkRadius;
QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */ bool myOkHeight;
Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
QGroupBox* GroupButtons; GeometryGUI_2Sel2Spin* GroupPoints;
QPushButton* buttonApply; GeometryGUI_2Spin* GroupDimensions;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QGroupBox* GroupC1;
QGroupBox* GroupC2;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A2;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
GeometryGUI_SpinBox* SpinBox_C1A3 ;
QLabel* TextLabelC1A4 ;
GeometryGUI_SpinBox* SpinBox_C1A4 ;
QLabel* TextLabel_Radius ;
GeometryGUI_SpinBox* SpinBox_Radius ;
QLabel* TextLabel_Height ;
GeometryGUI_SpinBox* SpinBox_Height ;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ActivateThisDialog();
void SelectionIntoArgument() ; void LineEditReturnPressed();
void LineEditReturnPressed() ; void SelectionIntoArgument();
void DeactivateActiveDialog() ; void SetEditCurrentArgument();
void ActivateThisDialog() ; void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox( double newValue ) ; void ValueChangedInSpinBox(double newValue);
protected:
QGridLayout* GeometryGUI_CylinderDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
}; };
#endif // DIALOGBOX_CYLINDER_H #endif // DIALOGBOX_CYLINDER_H

View File

@ -39,7 +39,7 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE")));
@ -64,7 +64,8 @@ GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, SALO
/***************************************************************/ /***************************************************************/
/* Initialisation */ /* Initialisation */
Init(Sel); myBooleanGUI = theBooleanGUI;
Init();
} }
@ -82,7 +83,7 @@ GeometryGUI_FuseDlg::~GeometryGUI_FuseDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_FuseDlg::Init(SALOME_Selection* Sel) void GeometryGUI_FuseDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupFuse->LineEdit1; myEditCurrentArgument = GroupFuse->LineEdit1;
@ -101,7 +102,7 @@ void GeometryGUI_FuseDlg::Init(SALOME_Selection* Sel)
connect(GroupFuse->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupFuse->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupFuse->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupFuse->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */ /* displays Dialog */
GroupFuse->show(); GroupFuse->show();
@ -132,7 +133,7 @@ void GeometryGUI_FuseDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if(myOkShape1 && myOkShape2) if(myOkShape1 && myOkShape2)
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3); myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3);
return; return;
} }
@ -243,7 +244,7 @@ void GeometryGUI_FuseDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void GeometryGUI_FuseDlg::enterEvent(QEvent* e) void GeometryGUI_FuseDlg::enterEvent(QEvent* e)
{ {
if (GroupConstructors->isEnabled()) if(GroupConstructors->isEnabled())
return; return;
this->ActivateThisDialog(); this->ActivateThisDialog();
return; return;

View File

@ -32,6 +32,8 @@
#include "GeometryGUI_Skeleton.h" #include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel_QTD.h" #include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Fuse.hxx> #include <BRepAlgoAPI_Fuse.hxx>
//================================================================================= //=================================================================================
@ -43,13 +45,15 @@ class GeometryGUI_FuseDlg : public GeometryGUI_Skeleton
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); GeometryGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_FuseDlg(); ~GeometryGUI_FuseDlg();
private: private:
void Init(SALOME_Selection* Sel); void Init();
void enterEvent(QEvent* e); void enterEvent(QEvent* e);
BooleanGUI* myBooleanGUI;
TopoDS_Shape myShape1; /* topology used to fuse */ TopoDS_Shape myShape1; /* topology used to fuse */
TopoDS_Shape myShape2; /* topology used to fuse */ TopoDS_Shape myShape2; /* topology used to fuse */
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
@ -57,15 +61,15 @@ private:
bool myOkShape1; /* to check when arguments are defined */ bool myOkShape1; /* to check when arguments are defined */
bool myOkShape2; bool myOkShape2;
GeometryGUI_2Sel_QTD* GroupFuse ; GeometryGUI_2Sel_QTD* GroupFuse;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void SetEditCurrentArgument();
void SelectionIntoArgument() ; void SelectionIntoArgument();
void LineEditReturnPressed() ; void LineEditReturnPressed();
void ActivateThisDialog() ; void ActivateThisDialog();
}; };

View File

@ -30,25 +30,7 @@ using namespace std;
#include "GeometryGUI_SectionDlg.h" #include "GeometryGUI_SectionDlg.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h" #include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_SectionDlg() // class : GeometryGUI_SectionDlg()
@ -57,109 +39,33 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_SectionDlg::GeometryGUI_SectionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_SectionDlg::GeometryGUI_SectionDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SECTION"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SECTION")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_SECTION_TITLE"));
setName( "GeometryGUI_SectionDlg" );
resize( 303, 224 );
setCaption( tr( "GEOM_SECTION_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_SectionDlgLayout = new QGridLayout( this );
GeometryGUI_SectionDlgLayout->setSpacing( 6 );
GeometryGUI_SectionDlgLayout->setMargin( 11 );
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); /***************************************************************/
GroupConstructors->setTitle( tr( "GEOM_SECTION" ) ); GroupConstructors->setTitle(tr("GEOM_SECTION"));
GroupConstructors->setExclusive( TRUE ); RadioButton1->setPixmap(image0);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton2->close(TRUE);
GroupConstructors->layout()->setSpacing( 0 ); RadioButton3->close(TRUE);
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GeometryGUI_SectionDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/ GroupSection = new GeometryGUI_2Sel_QTD(this, "GroupSection");
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); GroupSection->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupSection->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
GroupConstructor1->setColumnLayout(0, Qt::Vertical ); GroupSection->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
GroupConstructor1->layout()->setSpacing( 0 ); GroupSection->PushButton1->setPixmap(image1);
GroupConstructor1->layout()->setMargin( 0 ); GroupSection->PushButton2->setPixmap(image1);
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
SelectButtonC1A1Shape->setText( tr( "" ) );
SelectButtonC1A1Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
SelectButtonC1A2Shape->setText( tr( "" ) );
SelectButtonC1A2Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") );
TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") );
TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
GeometryGUI_SectionDlgLayout->addWidget( GroupConstructor1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_SectionDlgLayout->addWidget( GroupButtons, 2, 0 );
/* Initialisation */ Layout1->addWidget(GroupSection, 1, 0);
Init( Sel ) ; /***************************************************************/
/* Initialisation */
myBooleanGUI = theBooleanGUI;
Init();
} }
@ -170,7 +76,6 @@ GeometryGUI_SectionDlg::GeometryGUI_SectionDlg( QWidget* parent, const char* na
GeometryGUI_SectionDlg::~GeometryGUI_SectionDlg() GeometryGUI_SectionDlg::~GeometryGUI_SectionDlg()
{ {
/* no need to delete child widgets, Qt does it all for us */ /* no need to delete child widgets, Qt does it all for us */
this->destroy(TRUE, TRUE) ;
} }
@ -179,184 +84,108 @@ GeometryGUI_SectionDlg::~GeometryGUI_SectionDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SectionDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_SectionDlg::Init()
{ {
mySelection = Sel ; /* init variables */
myShape1.Nullify() ; myEditCurrentArgument = GroupSection->LineEdit1;
myShape2.Nullify() ;
myConstructorId = 0 ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
GroupConstructor1->show(); myShape1.Nullify();
myConstructorId = 0 ; myShape2.Nullify();
myEditCurrentArgument = LineEditC1A1Shape ; myOkShape1 = myOkShape2 = false;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); connect(GroupSection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
myGeom = GEOM::GEOM_Gen::_narrow(comp); connect(GroupSection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
// TODO previous selection into argument ?
/* signals and slots connections */ connect(GroupSection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(GroupSection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ),this, SLOT( ConstructorsClicked(int) ) ); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; /* displays Dialog */
connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; GroupSection->show();
this->show();
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); return;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ;
} }
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_SectionDlg::ConstructorsClicked(int constructorId)
{
GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
switch (constructorId)
{
case 0:
{
GroupConstructor1->show();
myConstructorId = constructorId ;
myEditCurrentArgument = LineEditC1A1Shape ;
LineEditC1A2Shape->setText(tr("")) ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
break;
}
}
return ;
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SectionDlg::ClickOnOk() void GeometryGUI_SectionDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return ; return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SectionDlg::ClickOnApply() void GeometryGUI_SectionDlg::ClickOnApply()
{ {
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo(tr(""));
switch(myConstructorId)
{ if(myOkShape1 && myOkShape2)
case 0 : myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 4);
{
if(myOkShape1 && myOkShape2) { return;
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1, myGeomShape2, 4 ) ;
}
break ;
}
}
// accept();
return ;
} }
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_SectionDlg::ClickOnCancel()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection has changed // purpose : Called when selection has changed
//================================================================================= //=================================================================================
void GeometryGUI_SectionDlg::SelectionIntoArgument() void GeometryGUI_SectionDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("");
QString aString = ""; /* future the name of selection */ QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel != 1 ) { if(nbSel != 1) {
switch (myConstructorId) if(myEditCurrentArgument == GroupSection->LineEdit1)
{ myOkShape1 = false;
case 0: else if( myEditCurrentArgument == GroupSection->LineEdit2)
{ myOkShape2 = false;
if ( myEditCurrentArgument == LineEditC1A1Shape ) { return;
myOkShape1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myOkShape2 = false ;
}
break ;
}
}
return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult ; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ; if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; if(myEditCurrentArgument == GroupSection->LineEdit1) {
if( !testResult ) myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
return ; if(!testResult)
myShape1 = S ; return;
LineEditC1A1Shape->setText(aString) ; myShape1 = S;
myOkShape1 = true ; GroupSection->LineEdit1->setText(aString);
} myOkShape1 = true;
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape2 = S ;
LineEditC1A2Shape->setText(aString) ;
myOkShape2 = true ;
} }
else if(myEditCurrentArgument == GroupSection->LineEdit2) {
return ; myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape2 = S;
GroupSection->LineEdit2->setText(aString);
myOkShape2 = true;
}
return;
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -365,25 +194,18 @@ void GeometryGUI_SectionDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId) if(send == GroupSection->PushButton1) {
{ GroupSection->LineEdit1->setFocus();
case 0: /* default constructor */ myEditCurrentArgument = GroupSection->LineEdit1;
{ }
if( send == SelectButtonC1A1Shape ) { else if(send == GroupSection->PushButton2) {
LineEditC1A1Shape->setFocus() ; GroupSection->LineEdit2->setFocus();
myEditCurrentArgument = LineEditC1A1Shape ; myEditCurrentArgument = GroupSection->LineEdit2;
} }
else if(send == SelectButtonC1A2Shape) { SelectionIntoArgument();
LineEditC1A2Shape->setFocus() ;
myEditCurrentArgument = LineEditC1A2Shape;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
return;
}
//================================================================================= //=================================================================================
@ -392,80 +214,39 @@ void GeometryGUI_SectionDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void GeometryGUI_SectionDlg::LineEditReturnPressed() void GeometryGUI_SectionDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1Shape ) if(send == GroupSection->LineEdit1)
myEditCurrentArgument = LineEditC1A1Shape ; myEditCurrentArgument = GroupSection->LineEdit1;
else if ( send == LineEditC1A2Shape ) else if(send == GroupSection->LineEdit2)
myEditCurrentArgument = LineEditC1A2Shape ; myEditCurrentArgument = GroupSection->LineEdit2;
else else
return ; return;
/* User name of object input management */ GeometryGUI_Skeleton::LineEditReturnPressed();
/* If successfull the selection is changed and signal emitted... */ return;
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
} }
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_SectionDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
}
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_SectionDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_SectionDlg::enterEvent( QEvent * )
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SectionDlg::ActivateThisDialog() void GeometryGUI_SectionDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate any active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; return;
GroupConstructor1->setEnabled(true) ; }
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ; //=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_SectionDlg::enterEvent(QEvent * e)
{
if(GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
} }

View File

@ -29,88 +29,48 @@
#ifndef DIALOGBOX_SECTION_H #ifndef DIALOGBOX_SECTION_H
#define DIALOGBOX_SECTION_H #define DIALOGBOX_SECTION_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GEOM_ShapeTypeFilter.hxx" #include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Section.hxx> #include <BRepAlgoAPI_Section.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//================================================================================= //=================================================================================
// class : GeometryGUI_SectionDlg // class : GeometryGUI_SectionDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_SectionDlg : public QDialog{ class GeometryGUI_SectionDlg : public GeometryGUI_Skeleton
{
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_SectionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_SectionDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_SectionDlg(); ~GeometryGUI_SectionDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
void Init( SALOME_Selection* Sel ) ; BooleanGUI* myBooleanGUI;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ TopoDS_Shape myShape1; /* topology used to fuse */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ TopoDS_Shape myShape2; /* topology used to fuse */
SALOME_Selection* mySelection ; /* User shape selection */ GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
TopoDS_Shape myShape1 ; /* topology used to fuse */ GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
TopoDS_Shape myShape2 ; /* topology used to fuse */ bool myOkShape1; /* to check when arguments are defined */
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ bool myOkShape2;
GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
bool myOkShape1 ;
bool myOkShape2 ; /* to check when arguments are defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
GeometryGUI_2Sel_QTD* GroupSection;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A2Shape;
QLineEdit* LineEditC1A1Shape;
QPushButton* SelectButtonC1A1Shape;
QPushButton* SelectButtonC1A2Shape;
QLabel* TextLabelC1A2Shape;
QLabel* TextLabelC1A1Shape;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void SetEditCurrentArgument();
void SelectionIntoArgument() ; void SelectionIntoArgument();
void LineEditReturnPressed() ; void LineEditReturnPressed();
void DeactivateActiveDialog() ; void ActivateThisDialog();
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_SectionDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupConstructor1Layout;
QGridLayout* GroupButtonsLayout;
}; };
#endif // DIALOGBOX_SECTION_H #endif // DIALOGBOX_SECTION_H

View File

@ -39,7 +39,7 @@
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_Skeleton::GeometryGUI_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) GeometryGUI_Skeleton::GeometryGUI_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton_QTD(parent, name, modal, fl) :GeometryGUI_Skeleton_QTD(parent, name, modal, fl)
{ {
if (!name) if (!name)
setName("GeometryGUI_Skeleton"); setName("GeometryGUI_Skeleton");
@ -51,7 +51,7 @@ GeometryGUI_Skeleton::GeometryGUI_Skeleton(QWidget* parent, const char* name, SA
GroupMedium->close(TRUE); GroupMedium->close(TRUE);
resize(0, 0); resize(0, 0);
Init(Sel) ; Init(Sel);
} }
@ -87,13 +87,13 @@ void GeometryGUI_Skeleton::Init(SALOME_Selection* Sel)
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
// int x, y ; // int x, y;
// myGeomGUI->DefineDlgPosition( this, x, y ) ; // myGeomGUI->DefineDlgPosition( this, x, y );
/* displays Dialog */ /* displays Dialog */
RadioButton1->setChecked(TRUE); RadioButton1->setChecked(TRUE);
return ; return;
} }
@ -140,7 +140,7 @@ void GeometryGUI_Skeleton::LineEditReturnPressed()
//================================================================================= //=================================================================================
void GeometryGUI_Skeleton::DeactivateActiveDialog() void GeometryGUI_Skeleton::DeactivateActiveDialog()
{ {
Layout1->setEnabled(false); this->setEnabled(false);
mySelection->ClearFilters(); mySelection->ClearFilters();
disconnect(mySelection, 0, this, 0); disconnect(mySelection, 0, this, 0);
myGeomGUI->EraseSimulationShape(); myGeomGUI->EraseSimulationShape();
@ -156,8 +156,8 @@ void GeometryGUI_Skeleton::DeactivateActiveDialog()
void GeometryGUI_Skeleton::ActivateThisDialog() void GeometryGUI_Skeleton::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ /* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog(); myGeomGUI->EmitSignalDeactivateDialog();
Layout1->setEnabled(true); this->setEnabled(true);
myGeomGUI->SetActiveDialogBox((QDialog*)this); myGeomGUI->SetActiveDialogBox((QDialog*)this);
return; return;
} }

View File

@ -28,30 +28,12 @@
using namespace std; using namespace std;
#include "GeometryGUI_SphereDlg.h" #include "GeometryGUI_SphereDlg.h"
#include "GeometryGUI_SpinBox.h"
#include <BRepPrimAPI_MakeSphere.hxx>
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h" #include "QAD_Desktop.h"
#include "QAD_Config.h" #include "QAD_Config.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qvalidator.h>
#include <qpixmap.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_SphereDlg() // class : GeometryGUI_SphereDlg()
@ -60,138 +42,38 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_SphereDlg::GeometryGUI_SphereDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_SphereDlg::GeometryGUI_SphereDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_P"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_SPHERE_TITLE"));
setName( "GeometryGUI_SphereDlg" );
resize( 303, 219 );
setCaption( tr( "GEOM_SPHERE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_SphereDlgLayout = new QGridLayout( this );
GeometryGUI_SphereDlgLayout->setSpacing( 6 );
GeometryGUI_SphereDlgLayout->setMargin( 11 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_SphereDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/ /***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupConstructors->setTitle(tr("GEOM_SPHERE"));
GroupConstructors->setTitle( tr( "GEOM_SPHERE" ) ); RadioButton1->setPixmap(image0);
GroupConstructors->setExclusive( TRUE ); RadioButton2->setPixmap(image1);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton3->close(TRUE);
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
GroupConstructors->insert( Constructor2, 1 );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
Constructor2->setPixmap( image2 );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
GeometryGUI_SphereDlgLayout->addWidget( GroupConstructors, 0, 0 );
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
GroupConstructor1->setTitle( tr( "GEOM_SPHERE_CR" ) );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_CENTER" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupConstructor1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_RADIUS" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A2, 1, 0 );
SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A2" ) ; GroupPoints = new GeometryGUI_1Sel1Spin(this, "GroupPoints");
GroupConstructor1Layout->addWidget( SpinBox_C1A2, 1, 2 ); GroupPoints->GroupBox1->setTitle(tr("GEOM_SPHERE_CR"));
GroupPoints->TextLabel1->setText(tr("GEOM_CENTER"));
GroupPoints->TextLabel2->setText(tr("GEOM_RADIUS"));
GroupPoints->PushButton1->setPixmap(image2);
GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor1, 1, 0 ); GroupDimensions = new GeometryGUI_1Spin(this, "GroupDimensions");
GroupDimensions->GroupBox1->setTitle(tr("GEOM_SPHERE_RO"));
GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS"));
/***************************************************************/ Layout1->addWidget(GroupPoints, 1, 0);
GroupConstructor2 = new QGroupBox( this, "GroupConstructor2" ); Layout1->addWidget(GroupDimensions, 1, 0);
GroupConstructor2->setTitle( tr( "GEOM_SPHERE_RO" ) ); /***************************************************************/
GroupConstructor2->setColumnLayout(0, Qt::Vertical );
GroupConstructor2->layout()->setSpacing( 0 );
GroupConstructor2->layout()->setMargin( 0 );
GroupConstructor2Layout = new QGridLayout( GroupConstructor2->layout() );
GroupConstructor2Layout->setAlignment( Qt::AlignTop );
GroupConstructor2Layout->setSpacing( 6 );
GroupConstructor2Layout->setMargin( 11 );
SpinBox_C2A1 = new GeometryGUI_SpinBox( GroupConstructor2, "GeomSpinBox_C2A1" ) ; /* Initialisations */
GroupConstructor2Layout->addWidget( SpinBox_C2A1, 0, 1 ); myPrimitiveGUI = thePrimitiveGUI;
Init();
TextLabelC2A1 = new QLabel( GroupConstructor2, "TextLabelC2A1" );
TextLabelC2A1->setText( tr( "GEOM_RADIUS" ) );
TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A1->setFrameShape( QLabel::NoFrame );
TextLabelC2A1->setFrameShadow( QLabel::Plain );
GroupConstructor2Layout->addWidget( TextLabelC2A1, 0, 0 );
QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
GroupConstructor2Layout->addItem( spacer_5, 1, 1 );
GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor2, 1, 0 );
Init(Sel) ; /* Initialisations */
} }
@ -209,146 +91,101 @@ GeometryGUI_SphereDlg::~GeometryGUI_SphereDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_SphereDlg::Init()
{ {
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myPoint1.SetCoord(0.0, 0.0, 0.0);
myRadius = 100.0;
myOkPoint1 = myOkRadius = false;
/* Vertices Filter for all arguments */
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
double step ; QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; step = St.toDouble();
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C1A2->SetValue( 100.0 ) ; GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C2A1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupPoints->SpinBox_DX->SetValue(myRadius);
SpinBox_C2A1->SetValue( 100.0 ) ; GroupDimensions->SpinBox_DX->SetValue(myRadius);
GroupConstructor1->show();
GroupConstructor2->hide();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myPoint1.SetCoord( 0.0, 0.0, 0.0 );
myRadius = 100.0 ;
myOkRadius = true ;
myOkPoint1 = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* Filters definition */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; /* displays Dialog */
connect( SpinBox_C2A1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; GroupDimensions->hide();
GroupPoints->show();
this->show();
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; return;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
} }
//================================================================================= //=================================================================================
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::ConstructorsClicked(int constructorId) void GeometryGUI_SphereDlg::ConstructorsClicked(int constructorId)
{ {
myGeomGUI->EraseSimulationShape() ; myConstructorId = constructorId;
mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myRadius = 100.0;
myOkRadius = true;
switch (constructorId) switch (constructorId)
{ {
case 0: case 0:
{ {
GroupConstructor1->show(); GroupDimensions->hide();
GroupConstructor2->hide(); resize(0, 0);
myConstructorId = constructorId ; GroupPoints->show();
myEditCurrentArgument = SpinBox_C1A2 ;
LineEditC1A1->setText(tr("")) ; myEditCurrentArgument = GroupPoints->LineEdit1;
SpinBox_C1A2->SetValue( 100.0 ) ; GroupPoints->LineEdit1->setText("");
myRadius = 100.0 ;
myOkRadius = true ; GroupPoints->SpinBox_DX->SetValue(myRadius);
myOkPoint1 = false ; myOkPoint1 = false;
/* filter for next selections */ /* filter for next selections */
mySelection->ClearFilters() ; mySelection->AddFilter(myVertexFilter);
mySelection->AddFilter( myVertexFilter ); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
break; break;
} }
case 1: case 1:
{ {
GroupConstructor1->hide(); GroupPoints->hide();
GroupConstructor2->show(); resize( 0, 0 );
myConstructorId = constructorId ; GroupDimensions->show();
myEditCurrentArgument = SpinBox_C2A1 ;;
SpinBox_C2A1->SetValue( 100.0 ) ; GroupDimensions->SpinBox_DX->SetValue(myRadius);
myRadius = 100.0 ; myPoint1.SetCoord(0.0, 0.0, 0.0); /* at origin */
myOkRadius = true ; myOkPoint1 = true;
myPoint1.SetCoord( 0.0, 0.0, 0.0 ); /* at origin */
myOkPoint1 = false ;
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
/* no filters here */
mySelection->ClearFilters() ;
break; break;
} }
} }
return ; return ;
} }
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_SphereDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if( myOkPoint1 && myOkRadius ) {
myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ;
}
break ;
}
case 1 :
{
if( myOkRadius )
myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ;
break ;
}
}
return ;
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
@ -356,24 +193,26 @@ void GeometryGUI_SphereDlg::ClickOnApply()
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::ClickOnOk() void GeometryGUI_SphereDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return;
return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnCancel() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::ClickOnCancel() void GeometryGUI_SphereDlg::ClickOnApply()
{ {
mySelection->ClearFilters() ; myGeomGUI->GetDesktop()->putInfo(tr(""));
myGeomGUI->EraseSimulationShape() ; if (mySimulationTopoDs.IsNull())
mySimulationTopoDs.Nullify() ; return;
disconnect( mySelection, 0, this, 0 ); myGeomGUI->EraseSimulationShape();
myGeomGUI->ResetState() ; mySimulationTopoDs.Nullify();
reject() ;
if(myOkPoint1 && myOkRadius)
myPrimitiveGUI->MakeSphereAndDisplay(myPoint1, myRadius);
return ; return ;
} }
@ -384,35 +223,33 @@ void GeometryGUI_SphereDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::SelectionIntoArgument() void GeometryGUI_SphereDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
/* Future name of selection */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel != 1 ) { if(nbSel != 1) {
if ( myEditCurrentArgument == LineEditC1A1 ) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
LineEditC1A1->setText("") ; GroupPoints->LineEdit1->setText("");
myOkPoint1 = false ; myOkPoint1 = false;
} }
return ; return;
} }
/* nbSel == 1 ! */ /* nbSel == 1 ! */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return ; return;
/* Constructor 1 treatment */ /* Constructor 1 treatment */
if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
LineEditC1A1->setText(aString) ; GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true ; myOkPoint1 = true;
} }
if( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) { if(myOkPoint1 && myOkRadius) {
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
} }
return ; return ;
} }
@ -424,114 +261,50 @@ void GeometryGUI_SphereDlg::SelectionIntoArgument()
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::LineEditReturnPressed() void GeometryGUI_SphereDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 ) if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = GroupPoints->LineEdit1;
else else
return ; return;
/* User name of object input management */ GeometryGUI_Skeleton::LineEditReturnPressed();
/* If successfull the selection is changed and signal emitted... */ return;
/* so SelectionIntoArgument() is automatically called. */
QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
const QString objectUserName = LE->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
LE->setText( objectUserName ) ;
}
return ;
} }
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_SphereDlg::ValueChangedInSpinBox( double newValue )
{
myRadius = newValue ;
myOkRadius = true ;
if ( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) {
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
}
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::SetEditCurrentArgument() void GeometryGUI_SphereDlg::SetEditCurrentArgument()
{ {
if(myConstructorId != 0)
return;
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myVertexFilter) ;
SelectionIntoArgument() ;
}
break;
}
case 1:
{
/* no selection button here */
break;
}
} if(send == GroupPoints->PushButton1) {
return ; GroupPoints->LineEdit1->setFocus();
} myEditCurrentArgument = GroupPoints->LineEdit1;
mySelection->AddFilter(myVertexFilter);
//================================================================================= this->SelectionIntoArgument();
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_SphereDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupConstructor2->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
} }
return ;
return;
} }
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::ActivateThisDialog() void GeometryGUI_SphereDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate other active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; if(!mySimulationTopoDs.IsNull())
GroupConstructor1->setEnabled(true) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
GroupConstructor2->setEnabled(true) ; return;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
} }
@ -541,20 +314,27 @@ void GeometryGUI_SphereDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::enterEvent(QEvent* e) void GeometryGUI_SphereDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if (GroupConstructors->isEnabled())
return ; return;
ActivateThisDialog() ; this->ActivateThisDialog();
return;
} }
//================================================================================= //=================================================================================
// function : closeEvent() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_SphereDlg::closeEvent( QCloseEvent* e ) void GeometryGUI_SphereDlg::ValueChangedInSpinBox(double newValue)
{ {
this->ClickOnCancel() ; /* same than click on cancel button */ myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
myRadius = newValue;
myOkRadius = true;
if (myOkPoint1 && myOkRadius) {
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
return;
} }

View File

@ -29,103 +29,54 @@
#ifndef DIALOGBOX_SPHERE_H #ifndef DIALOGBOX_SPHERE_H
#define DIALOGBOX_SPHERE_H #define DIALOGBOX_SPHERE_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GEOM_ShapeTypeFilter.hxx" #include "GeometryGUI_1Sel1Spin.h"
#include "GeometryGUI_1Spin.h"
#include "PrimitiveGUI.h"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QSpinBox;
class QPushButton;
class GeometryGUI_SpinBox;
class QRadioButton;
class GeometryGUI;
//================================================================================= //=================================================================================
// class : GeometryGUI_SphereDlg // class : GeometryGUI_SphereDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_SphereDlg : public QDialog class GeometryGUI_SphereDlg : public GeometryGUI_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_SphereDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_SphereDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_SphereDlg(); ~GeometryGUI_SphereDlg();
private : private :
void Init();
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ void enterEvent(QEvent* e);
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
gp_Pnt myPoint1 ; /* Points containing the vector */
Standard_Real myRadius ; PrimitiveGUI* myPrimitiveGUI;
bool myOkRadius ;
QDoubleValidator *myVa ; /* Double validator for numeric input myRadius in LineEditC1A2 */
QDoubleValidator *myVb ; /* Double validator for numeric input myRadius in LineEditC2A1 */
bool myOkPoint1 ; /* Are true when myPoint is defined */ double step;
QWidget* myEditCurrentArgument; /* Current LineEdit or SpinBox */ int myConstructorId;
int myConstructorId ; /* Current constructor id = radio button id */ Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
void closeEvent( QCloseEvent* e ) ; gp_Pnt myPoint1; /* Points containing the vector */
void enterEvent( QEvent* e); Standard_Real myRadius;
void Init( SALOME_Selection* Sel ) ; bool myOkRadius; /* Are true when myPoint is defined */
bool myOkPoint1;
QGroupBox* GroupButtons; GeometryGUI_1Sel1Spin* GroupPoints;
QPushButton* buttonApply; GeometryGUI_1Spin* GroupDimensions;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
// QLineEdit* LineEditC1A2;
QGroupBox* GroupConstructor2;
// QLineEdit* LineEditC2A1;
GeometryGUI_SpinBox* SpinBox_C1A2 ;
GeometryGUI_SpinBox* SpinBox_C2A1 ;
QLabel* TextLabelC2A1;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void LineEditReturnPressed() ; void ActivateThisDialog();
void SetEditCurrentArgument() ; void LineEditReturnPressed();
void SelectionIntoArgument() ; void SelectionIntoArgument();
void DeactivateActiveDialog() ; void SetEditCurrentArgument();
void ActivateThisDialog() ; void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox( double newValue ) ; void ValueChangedInSpinBox(double newValue);
protected:
QGridLayout* GeometryGUI_SphereDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupConstructor1Layout;
QGridLayout* GroupConstructor2Layout;
}; };
#endif // DIALOGBOX_SPHERE_H #endif // DIALOGBOX_SPHERE_H

View File

@ -29,29 +29,12 @@
using namespace std; using namespace std;
#include "GeometryGUI_TorusDlg.h" #include "GeometryGUI_TorusDlg.h"
#include "GeometryGUI.h" #include <BRepPrimAPI_MakeTorus.hxx>
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <qbuttongroup.h> #include "GeometryGUI.h"
#include <qgroupbox.h> #include "QAD_Desktop.h"
#include <qlabel.h> #include "QAD_Config.h"
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//================================================================================= //=================================================================================
// class : GeometryGUI_TorusDlg() // class : GeometryGUI_TorusDlg()
@ -60,173 +43,42 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
GeometryGUI_TorusDlg::GeometryGUI_TorusDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) GeometryGUI_TorusDlg::GeometryGUI_TorusDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV")));
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_PV"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_DXYZ")));
if ( !name ) setCaption(tr("GEOM_TORUS_TITLE"));
setName( "GeometryGUI_TorusDlg" );
resize( 303, 219 );
setCaption( tr( "GEOM_TORUS_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_TorusDlgLayout = new QGridLayout( this );
GeometryGUI_TorusDlgLayout->setSpacing( 6 );
GeometryGUI_TorusDlgLayout->setMargin( 11 );
/***************************************************************/ /***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupConstructors->setTitle(tr("GEOM_TORUS"));
GroupConstructors->setTitle( tr( "GEOM_TORUS" ) ); RadioButton1->setPixmap(image0);
GroupConstructors->setExclusive( TRUE ); RadioButton2->setPixmap(image1);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton3->close(TRUE);
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
Constructor2->setPixmap( image2 );
Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 2 );
GeometryGUI_TorusDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/ GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
GroupButtons = new QGroupBox( this, "GroupButtons" ); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
GroupButtons->setTitle( tr( "" ) ); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupButtons->setColumnLayout(0, Qt::Vertical ); GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
GroupButtons->layout()->setSpacing( 0 ); GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
GroupButtons->layout()->setMargin( 0 ); GroupPoints->PushButton1->setPixmap(image2);
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); GroupPoints->PushButton2->setPixmap(image2);
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_TorusDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/ GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
GroupC1 = new QGroupBox( this, "GroupC1" ); GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
GroupC1->setColumnLayout(0, Qt::Vertical ); GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); Layout1->addWidget(GroupPoints, 1, 0);
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); Layout1->addWidget(GroupDimensions, 1, 0);
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); /***************************************************************/
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; /* Initialisations */
SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); myPrimitiveGUI = thePrimitiveGUI;
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); Init();
TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A4->setFrameShape( QLabel::NoFrame );
TextLabelC1A4->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 );
GeometryGUI_TorusDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupC2 = new QGroupBox( this, "GroupC2" );
GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) );
GroupC2->setColumnLayout(0, Qt::Vertical );
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" );
TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") );
GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 );
TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" );
TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") );
GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 );
SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ;
GroupC2Layout->addWidget( SpinBox_Radius1, 0, 1 );
SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ;
GroupC2Layout->addWidget( SpinBox_Radius2, 1, 1 );
QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed );
GroupC2Layout->addItem( spacer1 );
GeometryGUI_TorusDlgLayout->addWidget(GroupC2 , 1, 0 );
/***************************************************************/
/* Initialisations */
Init(Sel) ;
} }
@ -244,79 +96,59 @@ GeometryGUI_TorusDlg::~GeometryGUI_TorusDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel ) void GeometryGUI_TorusDlg::Init()
{ {
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myRadius1 = 300.0;
myRadius2 = 100.0;
myOkRadius1 = myOkRadius2 = true;
myOkPoint1 = myOkDir = false;
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
double step ; QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; step = St.toDouble();
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes & initial values */
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_C1A4->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
SpinBox_Radius2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
GroupC1->show(); GroupPoints->SpinBox_DX->SetValue(myRadius1);
GroupC2->hide(); GroupPoints->SpinBox_DY->SetValue(myRadius2);
myConstructorId = 0 ; GroupDimensions->SpinBox_DX->SetValue(myRadius1);
Constructor1->setChecked( TRUE ); GroupDimensions->SpinBox_DY->SetValue(myRadius2);
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
SpinBox_C1A3->SetValue( 300.0 ) ;
SpinBox_C1A4->SetValue( 100.0 ) ;
SpinBox_Radius1->SetValue( 300.0 ) ;
SpinBox_Radius2->SetValue( 100.0 ) ;
myRadius1 = 300.0 ;
myRadius2 = 100.0 ;
myOkRadius1 = true ;
myOkRadius2 = true ;
myOkPoint1 = false ;
myOkDir = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
/* first filter used */
mySelection->AddFilter(myVertexFilter) ;
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
/* displays Dialog */
GroupDimensions->hide();
GroupPoints->show();
this->show();
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ; return ;
} }
@ -328,51 +160,48 @@ void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel )
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId) void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId)
{ {
mySelection->ClearFilters() ; myConstructorId = constructorId;
myGeomGUI->EraseSimulationShape() ; mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkRadius1 = myOkRadius2 = true;
myRadius1 = 300.0;
myRadius2 = 100.0;
switch(myConstructorId) switch(myConstructorId)
{ {
case 0 : case 0 :
{ {
GroupC1->hide(); GroupDimensions->hide();
GroupC2->show(); resize(0, 0);
myConstructorId = constructorId ; GroupPoints->show();
myOkRadius1 = myOkPoint1 = myOkRadius2 = myOkDir = true ; myOkPoint1 = myOkDir = false;
SpinBox_C1A3->SetValue( 300.0 ) ; /* radius 1 */ myEditCurrentArgument = GroupPoints->LineEdit1;
SpinBox_C1A4->SetValue( 100.0 ) ; /* radius 2 */ GroupPoints->LineEdit1->setText(tr(""));
myRadius1 = 300.0 ; GroupPoints->LineEdit2->setText(tr(""));
myRadius2 = 100.0 ;
disconnect( mySelection, 0, this, 0 ); GroupPoints->SpinBox_DX->SetValue(myRadius1);
GroupPoints->SpinBox_DY->SetValue(myRadius2);
myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; /* filter for next selection */
myDir.SetCoord( 0.0, 0.0, 1.0 ) ; mySelection->AddFilter(myVertexFilter);
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
gp_Dir aDir = myDir ;
MakeTorusSimulationAndDisplay() ;
}
break ; break ;
} }
case 1 : case 1 :
{ {
GroupC2->hide(); GroupPoints->hide();
GroupC1->show(); resize( 0, 0 );
myConstructorId = constructorId ; GroupDimensions->show();
myEditCurrentArgument = LineEditC1A1 ; myOkPoint1 = myOkDir = true;
myOkRadius1 = myOkRadius2 = true ;
myOkPoint1 = myOkDir = false ;
SpinBox_Radius1->SetValue( 300.0 ) ; GroupDimensions->SpinBox_DX->SetValue(myRadius1);
SpinBox_Radius2->SetValue( 100.0 ) ; GroupDimensions->SpinBox_DY->SetValue(myRadius2);
myRadius1 = 300.0 ; myPoint1.SetCoord(0.0, 0.0, 0.0);
myRadius2 = 100.0 ; myDir.SetCoord(0.0, 0.0, 1.0);
LineEditC1A1->setText( tr("") ); MakeTorusSimulationAndDisplay();
disconnect( mySelection, 0, this, 0 );
break ; break ;
} }
} }
@ -380,60 +209,32 @@ void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId)
} }
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_TorusDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return;
}
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::ClickOnApply() void GeometryGUI_TorusDlg::ClickOnApply()
{ {
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo(tr(""));
myGeomGUI->EraseSimulationShape() ; if (mySimulationTopoDs.IsNull())
mySimulationTopoDs.Nullify() ; return;
switch(myConstructorId) myGeomGUI->EraseSimulationShape();
{ mySimulationTopoDs.Nullify();
case 0 :
{
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ;
}
break ;
}
case 1 :
{
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ;
}
break ;
}
}
// accept();
return ;
}
//================================================================================= if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 )
// function : ClickOnOk() myPrimitiveGUI->MakeTorusAndDisplay(myPoint1, myDir, myRadius1, myRadius2);
// purpose :
//=================================================================================
void GeometryGUI_TorusDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_TorusDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ; return ;
} }
@ -444,45 +245,39 @@ void GeometryGUI_TorusDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::SelectionIntoArgument() void GeometryGUI_TorusDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
QString aString = ""; /* Name of future selection */ int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if (nbSel != 1) {
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; if(myEditCurrentArgument == GroupPoints->LineEdit1)
if ( nbSel != 1 ) { myOkPoint1 = false;
if ( myEditCurrentArgument == LineEditC1A1 ) { else if (myEditCurrentArgument == GroupPoints->LineEdit2)
LineEditC1A1->setText("") ; myOkDir = false;
myOkPoint1 = false ; return;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
LineEditC1A2->setText("") ;
myOkDir = false ;
}
return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return ; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
LineEditC1A1->setText(aString) ; GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true ; myOkPoint1 = true;
} }
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) { else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S)); BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction(); myDir = curv.Line().Direction();
LineEditC1A2->setText(aString) ; GroupPoints->LineEdit2->setText(aString);
myOkDir = true ; myOkDir = true;
} }
if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2)
MakeTorusSimulationAndDisplay() ; MakeTorusSimulationAndDisplay();
} return;
return ;
} }
@ -492,32 +287,24 @@ void GeometryGUI_TorusDlg::SelectionIntoArgument()
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::SetEditCurrentArgument() void GeometryGUI_TorusDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); if(myConstructorId != 0)
mySelection->ClearFilters() ; return;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myVertexFilter) ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
case 1:
{
break ;
}
}
return ; QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
mySelection->AddFilter(myVertexFilter);
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
mySelection->AddFilter(myEdgeFilter);
}
this->SelectionIntoArgument();
return;
} }
@ -528,79 +315,15 @@ void GeometryGUI_TorusDlg::SetEditCurrentArgument()
void GeometryGUI_TorusDlg::LineEditReturnPressed() void GeometryGUI_TorusDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 ) if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == LineEditC1A2) else if (send == GroupPoints->LineEdit2)
myEditCurrentArgument = LineEditC1A2; myEditCurrentArgument = GroupPoints->LineEdit2;
else else
return ; return;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ;
const QString objectUserName = LE->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
LE->setText( objectUserName ) ;
}
return ;
}
GeometryGUI_Skeleton::LineEditReturnPressed();
//================================================================================= return;
// function : ValueChangedInSpinBox
// purpose :
//=================================================================================
void GeometryGUI_TorusDlg::ValueChangedInSpinBox( double newValue )
{
QObject* send = (QObject*)sender();
if(send == SpinBox_C1A3 ) {
myRadius1 = newValue ;
myOkRadius1 = true ;
}
else if(send == SpinBox_C1A4 ) {
myRadius2 = newValue ;
myOkRadius2 = true ;
}
else if(send == SpinBox_Radius1 ) {
myRadius1 = newValue ;
myOkRadius1 = true ;
}
else if(send == SpinBox_Radius2 ) {
myRadius2 = newValue ;
myOkRadius2 = true ;
}
if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
MakeTorusSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_TorusDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
} }
@ -610,16 +333,11 @@ void GeometryGUI_TorusDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::ActivateThisDialog() void GeometryGUI_TorusDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ GeometryGUI_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; if(!mySimulationTopoDs.IsNull())
GroupC1->setEnabled(true) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
GroupC2->setEnabled(true) ; return;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
} }
@ -629,22 +347,35 @@ void GeometryGUI_TorusDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::enterEvent(QEvent* e) void GeometryGUI_TorusDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if (GroupConstructors->isEnabled())
return ; return;
ActivateThisDialog() ; this->ActivateThisDialog();
return ; return;
} }
//================================================================================= //=================================================================================
// function : closeEvent() // function : ValueChangedInSpinBox
// purpose : // purpose :
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e ) void GeometryGUI_TorusDlg::ValueChangedInSpinBox(double newValue)
{ {
/* same than click on cancel button */ myGeomGUI->EraseSimulationShape();
this->ClickOnCancel() ; mySimulationTopoDs.Nullify();
return ; QObject* send = (QObject*)sender();
if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
myRadius1 = newValue;
myOkRadius1 = true;
}
else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
myRadius2 = newValue;
myOkRadius2 = true;
}
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2)
MakeTorusSimulationAndDisplay();
return;
} }
@ -654,17 +385,16 @@ void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void GeometryGUI_TorusDlg::MakeTorusSimulationAndDisplay() void GeometryGUI_TorusDlg::MakeTorusSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify();
try { try {
gp_Ax2 anAxis(this->myPoint1, this->myDir) ; gp_Ax2 anAxis(this->myPoint1, this->myDir);
mySimulationTopoDs = BRepPrimAPI_MakeTorus( anAxis, this->myRadius1, this->myRadius2 ).Shape() ; mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, this->myRadius1, this->myRadius2).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeTorusSimulationAndDisplay" ) ; MESSAGE("Exception catched in MakeTorusSimulationAndDisplay");
} }
return ; return;
} }

View File

@ -29,120 +29,64 @@
#ifndef DIALOGBOX_TORUS_H #ifndef DIALOGBOX_TORUS_H
#define DIALOGBOX_TORUS_H #define DIALOGBOX_TORUS_H
#include "SALOME_Selection.h" #include "GeometryGUI_Skeleton.h"
#include "GEOM_ShapeTypeFilter.hxx" #include "GeometryGUI_2Sel2Spin.h"
#include "GEOM_EdgeFilter.hxx" #include "GeometryGUI_2Spin.h"
#include "GeometryGUI_SpinBox.h"
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx"
#include <TopoDS_Shape.hxx>
#include <BRepPrimAPI_MakeTorus.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Dir.hxx> #include <gp_Dir.hxx>
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QSpinBox ;
class GeometryGUI;
//================================================================================= //=================================================================================
// class : GeometryGUI_TorusDlg // class : GeometryGUI_TorusDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class GeometryGUI_TorusDlg : public QDialog class GeometryGUI_TorusDlg : public GeometryGUI_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
GeometryGUI_TorusDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); GeometryGUI_TorusDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_TorusDlg(); ~GeometryGUI_TorusDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
void MakeTorusSimulationAndDisplay();
void Init( SALOME_Selection* Sel ) ; PrimitiveGUI* myPrimitiveGUI;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void MakeTorusSimulationAndDisplay() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ double step;
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ int myConstructorId;
TopoDS_Shape mySimulationTopoDs ; Handle(GEOM_ShapeTypeFilter) myVertexFilter;
SALOME_Selection* mySelection ; /* User shape selection */ Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
gp_Pnt myPoint1 ; /* Topology used */ gp_Pnt myPoint1; /* topology used */
gp_Dir myDir ; gp_Dir myDir;
bool myOkPoint1 ; bool myOkPoint1; /* to check when arguments is defined */
bool myOkDir ; /* to check when arguments is defined */ bool myOkDir;
Standard_Real myRadius1 ; Standard_Real myRadius1;
Standard_Real myRadius2 ; Standard_Real myRadius2;
bool myOkRadius1 ; bool myOkRadius1;
bool myOkRadius2 ; bool myOkRadius2;
QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */
QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */
int myConstructorId ; /* Current constructor id = radio button id */ GeometryGUI_2Sel2Spin* GroupPoints;
QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */ GeometryGUI_2Spin* GroupDimensions;
Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QGroupBox* GroupC1;
QGroupBox* GroupC2;
QPushButton* SelectButtonC1A1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
GeometryGUI_SpinBox* SpinBox_C1A3 ;
GeometryGUI_SpinBox* SpinBox_C1A4 ;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
QLabel* TextLabelC1A4;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QLabel* TextLabel_Radius1 ;
QLabel* TextLabel_Radius2 ;
GeometryGUI_SpinBox* SpinBox_Radius1 ;
GeometryGUI_SpinBox* SpinBox_Radius2 ;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ActivateThisDialog();
void SelectionIntoArgument() ; void LineEditReturnPressed();
void LineEditReturnPressed() ; void SelectionIntoArgument();
void DeactivateActiveDialog() ; void SetEditCurrentArgument();
void ActivateThisDialog() ; void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox( double newValue ) ; void ValueChangedInSpinBox(double newValue);
protected:
QGridLayout* GeometryGUI_TorusDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
}; };
#endif // DIALOGBOX_TORUS_H #endif // DIALOGBOX_TORUS_H

View File

@ -47,6 +47,8 @@ PO_FILES = \
# Libraries targets # Libraries targets
LIB = libGEOMGUI.la LIB = libGEOMGUI.la
LIB_SRC = GeometryGUI.cxx \ LIB_SRC = GeometryGUI.cxx \
BooleanGUI.cxx \
PrimitiveGUI.cxx \
GeometryGUI_SpinBox.cxx \ GeometryGUI_SpinBox.cxx \
GeometryGUI_Skeleton_QTD.cxx \ GeometryGUI_Skeleton_QTD.cxx \
GeometryGUI_Skeleton.cxx \ GeometryGUI_Skeleton.cxx \
@ -58,6 +60,14 @@ LIB_SRC = GeometryGUI.cxx \
GeometryGUI_1Sel4Spin.cxx \ GeometryGUI_1Sel4Spin.cxx \
GeometryGUI_2Sel1Spin_QTD.cxx \ GeometryGUI_2Sel1Spin_QTD.cxx \
GeometryGUI_2Sel1Spin.cxx \ GeometryGUI_2Sel1Spin.cxx \
GeometryGUI_2Sel2Spin_QTD.cxx \
GeometryGUI_2Sel2Spin.cxx \
GeometryGUI_2Sel3Spin_QTD.cxx \
GeometryGUI_2Sel3Spin.cxx \
GeometryGUI_1Spin_QTD.cxx \
GeometryGUI_1Spin.cxx \
GeometryGUI_2Spin_QTD.cxx \
GeometryGUI_2Spin.cxx \
GeometryGUI_3Spin_QTD.cxx \ GeometryGUI_3Spin_QTD.cxx \
GeometryGUI_3Spin.cxx \ GeometryGUI_3Spin.cxx \
GeometryGUI_TransparencyDlg.cxx \ GeometryGUI_TransparencyDlg.cxx \
@ -117,6 +127,8 @@ LIB_SRC = GeometryGUI.cxx \
LIB_MOC = \ LIB_MOC = \
GeometryGUI.h \ GeometryGUI.h \
BooleanGUI.h \
PrimitiveGUI.h \
GeometryGUI_SpinBox.h \ GeometryGUI_SpinBox.h \
GeometryGUI_Skeleton_QTD.h \ GeometryGUI_Skeleton_QTD.h \
GeometryGUI_Skeleton.h \ GeometryGUI_Skeleton.h \
@ -128,6 +140,14 @@ LIB_MOC = \
GeometryGUI_1Sel4Spin.h \ GeometryGUI_1Sel4Spin.h \
GeometryGUI_2Sel1Spin_QTD.h \ GeometryGUI_2Sel1Spin_QTD.h \
GeometryGUI_2Sel1Spin.h \ GeometryGUI_2Sel1Spin.h \
GeometryGUI_2Sel2Spin_QTD.h \
GeometryGUI_2Sel2Spin.h \
GeometryGUI_2Sel3Spin_QTD.h \
GeometryGUI_2Sel3Spin.h \
GeometryGUI_1Spin_QTD.h \
GeometryGUI_1Spin.h \
GeometryGUI_2Spin_QTD.h \
GeometryGUI_2Spin.h \
GeometryGUI_3Spin_QTD.h \ GeometryGUI_3Spin_QTD.h \
GeometryGUI_3Spin.h \ GeometryGUI_3Spin.h \
GeometryGUI_TransparencyDlg.h \ GeometryGUI_TransparencyDlg.h \

View File

@ -0,0 +1,239 @@
// 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
//
//
//
// File : PrimitiveGUI.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
using namespace std;
#include "PrimitiveGUI.h"
#include "QAD_Application.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "GeometryGUI_BoxDlg.h" // Method BOX
#include "GeometryGUI_CylinderDlg.h" // Method CYLINDER
#include "GeometryGUI_SphereDlg.h" // Method SPHERE
#include "GeometryGUI_TorusDlg.h" // Method TORUS
#include "GeometryGUI_ConeDlg.h" // Method CONE
//=======================================================================
// function : PrimitiveGUI()
// purpose : Constructor
//=======================================================================
PrimitiveGUI::PrimitiveGUI() :
QObject()
{
myGeomGUI = GeometryGUI::GetGeometryGUI();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
}
//=======================================================================
// function : ~PrimitiveGUI()
// purpose : Destructor
//=======================================================================
PrimitiveGUI::~PrimitiveGUI()
{
}
//=======================================================================
// function : OnGUIEvent()
// purpose :
//=======================================================================
bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{
myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
switch (theCommandID)
{
case 3021: // BOX
{
GeometryGUI_BoxDlg *aDlg = new GeometryGUI_BoxDlg(parent, "", this, Sel);
break;
}
case 3022: // CYLINDER
{
GeometryGUI_CylinderDlg *aDlg = new GeometryGUI_CylinderDlg(parent, "", this, Sel);
break;
}
case 3023: // SPHERE
{
GeometryGUI_SphereDlg *aDlg = new GeometryGUI_SphereDlg(parent, "", this, Sel);
break;
}
case 3024: // TORUS
{
GeometryGUI_TorusDlg *aDlg = new GeometryGUI_TorusDlg(parent, "", this, Sel);
break;
}
case 3025: // CONE
{
GeometryGUI_ConeDlg *aDlg = new GeometryGUI_ConeDlg(parent, "", this, Sel);
break;
}
default:
{
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
}
}
return true;
}
//=======================================================================
// function : MakeBoxAndDisplay()
// purpose :
//=======================================================================
void PrimitiveGUI::MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
{
try {
GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z());
box->NameType(tr("GEOM_BOX"));
if(myGeomGUI->Display(box, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch(const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
}
//=====================================================================================
// function : MakeCylinderAndDisplay()
// purpose :
//=====================================================================================
void PrimitiveGUI::MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius, const double aHeight)
{
try {
if(Radius <= Precision::Confusion() || aHeight <= Precision::Confusion())
return;
GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z());
GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z());
GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
GEOM::GEOM_Shape_var result = myGeom->MakeCylinder(pstruct, dstruct, Radius, aHeight);
if (result->_is_nil()) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
return;
}
result->NameType(tr("GEOM_CYLINDER"));
if(myGeomGUI->Display(result, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch(const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
return;
}
//=====================================================================================
// function : MakeSphere()
// purpose :
//=====================================================================================
void PrimitiveGUI::MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double aRadius)
{
try {
if(aRadius <= Precision::Confusion())
return;
GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius);
result->NameType(tr("GEOM_SPHERE"));
if (myGeomGUI->Display(result, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch (const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
return;
}
//=====================================================================================
// function : MakeTorusAndDisplay()
// purpose :
//=====================================================================================
void PrimitiveGUI::MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2)
{
try {
if(Radius1 <= Precision::Confusion() || Radius2 <= Precision::Confusion())
return;
GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z());
GEOM::PointStruct d = myGeom ->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z());
GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
GEOM::GEOM_Shape_var result = myGeom->MakeTorus(pstruct, dstruct, Radius1, Radius2);
if(result->_is_nil()) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
return;
}
result->NameType(tr("GEOM_TORUS"));
if(myGeomGUI->Display(result, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch(const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
return;
}
//=====================================================================================
// function : MakeConeAndDisplay()
// purpose :
//=====================================================================================
void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2, const double aHeight)
{
try {
if((Radius1 <= Precision::Confusion() && Radius2 <= Precision::Confusion()) || aHeight <= Precision::Confusion())
return;
GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z());
GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z());
GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
GEOM::GEOM_Shape_var result = myGeom->MakeCone(pstruct, dstruct, Radius1, Radius2, aHeight);
if(result->_is_nil()) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
return;
}
result->NameType(tr("GEOM_CONE"));
if(myGeomGUI->Display(result, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch(const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
return;
}

View File

@ -0,0 +1,65 @@
// 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
//
//
//
// File : PrimitiveGUI.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef PRIMITIVEGUI_H
#define PRIMITIVEGUI_H
#include "GeometryGUI.h"
#include <Precision.hxx>
//=================================================================================
// class : PrimitiveGUI
// purpose :
//=================================================================================
class PrimitiveGUI : public QObject
{
Q_OBJECT /* for QT compatibility */
public :
PrimitiveGUI();
~PrimitiveGUI();
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
void MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius, const double aHeight);
void MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double aRadius);
void MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2);
void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2, const double aHeight);
private:
GeometryGUI* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
#endif