mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-23 16:05:37 +05:00
DCQ : New Architecture...
This commit is contained in:
parent
6a85337399
commit
7f6a21ec46
128
src/GEOMGUI/BooleanGUI.cxx
Normal file
128
src/GEOMGUI/BooleanGUI.cxx
Normal 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
58
src/GEOMGUI/BooleanGUI.h
Normal 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
@ -38,6 +38,9 @@
|
||||
#include "GEOM_Actor.h"
|
||||
#include "GEOM_Sketcher.h"
|
||||
|
||||
#include "GEOM_Client.hxx"
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
|
||||
// Open CASCADE Includes
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Standard.hxx>
|
||||
@ -51,6 +54,7 @@
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS)
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
|
||||
//=================================================================================
|
||||
//
|
||||
//=================================================================================
|
||||
@ -69,10 +73,10 @@ class GeometryGUI : public QObject
|
||||
Q_OBJECT /* for QT compatibility */
|
||||
|
||||
private :
|
||||
|
||||
GEOM::GEOM_Gen_var myComponentGeom;
|
||||
GEOM_Client myShapeReader;
|
||||
QAD_Desktop* myDesktop;
|
||||
QAD_Study* myActiveStudy;
|
||||
GEOM::GEOM_Gen_var myComponentGeom;
|
||||
QDialog* myActiveDialogBox; /* Unique active dialog box */
|
||||
Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
|
||||
vtkActorCollection* mySimulationActor; /* GEOM Actor used only during topo/geom simulations */
|
||||
@ -82,6 +86,13 @@ private :
|
||||
|
||||
Quantity_Color myShadingColor;
|
||||
|
||||
AIS_ListOfInteractive myListDisplayedObject;
|
||||
|
||||
bool mySettings_AddInStudy;
|
||||
bool mySettings_Copy;
|
||||
Standard_CString myFatherior;
|
||||
|
||||
|
||||
public :
|
||||
|
||||
GeometryGUI();
|
||||
@ -90,43 +101,26 @@ public :
|
||||
static GeometryGUI* GetOrCreateGeometryGUI( QAD_Desktop* desktop );
|
||||
static GeometryGUI* GetGeometryGUI() ;
|
||||
|
||||
QAD_Study* GetActiveStudy() ;
|
||||
QAD_Study* GetActiveStudy();
|
||||
QAD_Desktop* GetDesktop() ;
|
||||
GEOM_Client& GetShapeReader();
|
||||
|
||||
QDialog* GetActiveDialogBox() ; /* Returns the active DialogBox */
|
||||
void SetActiveDialogBox(QDialog* aDlg) ; /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
|
||||
QDialog* GetActiveDialogBox(); /* Returns the active DialogBox */
|
||||
void SetActiveDialogBox(QDialog* aDlg); /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
|
||||
|
||||
void SetState(int aState) ;
|
||||
void ResetState() ; /* Sets myState = -1 a private field to indicate wich method is active */
|
||||
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
|
||||
void SetState(int aState);
|
||||
void ResetState(); /* Sets myState = -1 a private field to indicate wich method is active */
|
||||
|
||||
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 Display( GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
|
||||
|
||||
/* Import and export topology methods */
|
||||
bool Import();
|
||||
bool Export();
|
||||
|
||||
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
|
||||
bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
|
||||
|
||||
static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType) ;
|
||||
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 bool GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) ;
|
||||
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 ) ;
|
||||
|
||||
/* User dialog 1 parameter returned */
|
||||
static double Parameter( Standard_Boolean& res,
|
||||
const char* aValue1 = 0,
|
||||
@ -137,91 +131,27 @@ public :
|
||||
const int decimals = 6 ) ;
|
||||
|
||||
/* Managed by IAPP */
|
||||
Standard_EXPORT static bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ;
|
||||
Standard_EXPORT static bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent,
|
||||
Standard_EXPORT bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ;
|
||||
Standard_EXPORT bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent,
|
||||
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 );
|
||||
Standard_EXPORT static bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent,
|
||||
Standard_EXPORT bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent,
|
||||
QAD_StudyFrame* studyFrame );
|
||||
Standard_EXPORT static void activeStudyChanged ( QAD_Desktop* parent );
|
||||
Standard_EXPORT static bool SetSettings ( QAD_Desktop* parent );
|
||||
Standard_EXPORT static void DefinePopup( QString & theContext,
|
||||
Standard_EXPORT void activeStudyChanged ( QAD_Desktop* parent );
|
||||
Standard_EXPORT bool SetSettings ( QAD_Desktop* parent );
|
||||
Standard_EXPORT void DefinePopup( QString & theContext,
|
||||
QString & theParent,
|
||||
QString & theObject );
|
||||
Standard_EXPORT static bool CustomPopup ( QAD_Desktop* parent,
|
||||
Standard_EXPORT bool CustomPopup ( QAD_Desktop* parent,
|
||||
QPopupMenu* popup,
|
||||
const QString& theContext,
|
||||
const QString& theParent,
|
||||
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 */
|
||||
|
||||
TopoDS_Shape GetShapeFromIOR( QString IOR );
|
||||
bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) ;
|
||||
int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ;
|
||||
@ -270,28 +200,99 @@ public :
|
||||
Standard_Integer& aLocalContextId,
|
||||
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 */
|
||||
bool OnSuppressFaces( const TopoDS_Shape& ShapeTopo,
|
||||
const char* ShapeTopoIOR,
|
||||
const Standard_Integer& aLocalContextId,
|
||||
bool& myUseLocalContext ) ;
|
||||
|
||||
/* Remove an hole in a topology (ListOfIdEndFace may be an empty list ) */
|
||||
bool OnSuppressHole( const char* ShapeTopoIOR,
|
||||
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace,
|
||||
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 */
|
||||
bool OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR,
|
||||
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) ;
|
||||
|
||||
/* Create a face corresponding to a hole on a shape */
|
||||
bool OnFillingHole( const TopoDS_Shape& MainShape,
|
||||
const char* ShapeTopoIOR,
|
||||
const Standard_Integer& aLocalContextId,
|
||||
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 */
|
||||
bool OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR) ;
|
||||
bool OnFilletGetSelected(const TopoDS_Shape& ShapeTopo,
|
||||
@ -300,7 +301,6 @@ public :
|
||||
const int SubShapeType,
|
||||
Standard_Integer& aLocalContextId,
|
||||
bool& myUseLocalContext );
|
||||
|
||||
/* Methods for Chamfer */
|
||||
bool OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) ;
|
||||
bool OnChamferGetSelected(const TopoDS_Shape& ShapeTopo,
|
||||
@ -309,9 +309,13 @@ public :
|
||||
Standard_Integer& aLocalContextId,
|
||||
bool& myUseLocalContext ) ;
|
||||
|
||||
/* Non modal dialog boxes magement */
|
||||
void EmitSignalDeactivateDialog() ;
|
||||
void EmitSignalCloseAllDialogs() ;
|
||||
|
||||
void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
|
||||
const Standard_Real precision);
|
||||
void MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape);
|
||||
|
||||
|
||||
void MakeCDGAndDisplay( GEOM::GEOM_Shape_ptr Shape );
|
||||
|
||||
/* Sketcher management */
|
||||
void OnSketchSegment();
|
||||
@ -334,6 +338,10 @@ public :
|
||||
void OnSettingsPerpendicular();
|
||||
void OnSettingsTangent();
|
||||
|
||||
/* Non modal dialog boxes magement */
|
||||
void EmitSignalDeactivateDialog() ;
|
||||
void EmitSignalCloseAllDialogs() ;
|
||||
|
||||
signals:
|
||||
void SignalDeactivateActiveDialog() ;
|
||||
void SignalCloseAllDialogs() ;
|
||||
|
@ -36,15 +36,12 @@
|
||||
* Constructs a GeometryGUI_1Sel1Spin which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'
|
||||
*/
|
||||
GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin( QWidget* parent, const char* name, WFlags fl )
|
||||
: GeometryGUI_1Sel1Spin_QTD( parent, name, fl )
|
||||
GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin(QWidget* parent, const char* name, WFlags fl)
|
||||
:GeometryGUI_1Sel1Spin_QTD(parent, name, fl)
|
||||
{
|
||||
|
||||
SpinBox1->close( TRUE );
|
||||
|
||||
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
|
||||
Layout2->addWidget( SpinBox_DX, 0, 1 );
|
||||
|
||||
SpinBox1->close(TRUE);
|
||||
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
|
||||
Layout2->addWidget(SpinBox_DX, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,27 +36,25 @@
|
||||
* Constructs a GeometryGUI_1Sel4Spin which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'
|
||||
*/
|
||||
GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin( QWidget* parent, const char* name, WFlags fl )
|
||||
: GeometryGUI_1Sel4Spin_QTD( parent, name, fl )
|
||||
GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin(QWidget* parent, const char* name, WFlags fl)
|
||||
:GeometryGUI_1Sel4Spin_QTD(parent, name, fl)
|
||||
{
|
||||
SpinBox1->close(TRUE);
|
||||
SpinBox2->close(TRUE);
|
||||
SpinBox3->close(TRUE);
|
||||
SpinBox4->close(TRUE);
|
||||
|
||||
SpinBox1->close( TRUE );
|
||||
SpinBox2->close( TRUE );
|
||||
SpinBox3->close( TRUE );
|
||||
SpinBox4->close( TRUE );
|
||||
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
|
||||
Layout3->addWidget(SpinBox_DX, 0, 2);
|
||||
|
||||
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
|
||||
Layout3->addWidget( SpinBox_DX, 0, 2 );
|
||||
SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY");
|
||||
Layout3->addWidget(SpinBox_DY, 0, 4);
|
||||
|
||||
SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ;
|
||||
Layout3->addWidget( SpinBox_DY, 0, 4 );
|
||||
|
||||
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_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);
|
||||
}
|
||||
|
||||
|
||||
|
56
src/GEOMGUI/GeometryGUI_1Spin.cxx
Normal file
56
src/GEOMGUI/GeometryGUI_1Spin.cxx
Normal 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
|
||||
}
|
47
src/GEOMGUI/GeometryGUI_1Spin.h
Normal file
47
src/GEOMGUI/GeometryGUI_1Spin.h
Normal 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
|
68
src/GEOMGUI/GeometryGUI_1Spin_QTD.cxx
Normal file
68
src/GEOMGUI/GeometryGUI_1Spin_QTD.cxx
Normal 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
|
||||
}
|
||||
|
40
src/GEOMGUI/GeometryGUI_1Spin_QTD.h
Normal file
40
src/GEOMGUI/GeometryGUI_1Spin_QTD.h
Normal 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
|
@ -36,15 +36,12 @@
|
||||
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'
|
||||
*/
|
||||
GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin( QWidget* parent, const char* name, WFlags fl )
|
||||
: GeometryGUI_2Sel1Spin_QTD( parent, name, fl )
|
||||
GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin(QWidget* parent, const char* name, WFlags fl)
|
||||
:GeometryGUI_2Sel1Spin_QTD(parent, name, fl)
|
||||
{
|
||||
|
||||
SpinBox1->close( TRUE );
|
||||
|
||||
SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ;
|
||||
Layout2->addWidget( SpinBox_DX, 0, 1 );
|
||||
|
||||
SpinBox1->close(TRUE);
|
||||
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
|
||||
Layout2->addWidget(SpinBox_DX, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
57
src/GEOMGUI/GeometryGUI_2Sel2Spin.cxx
Normal file
57
src/GEOMGUI/GeometryGUI_2Sel2Spin.cxx
Normal 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
|
||||
}
|
48
src/GEOMGUI/GeometryGUI_2Sel2Spin.h
Normal file
48
src/GEOMGUI/GeometryGUI_2Sel2Spin.h
Normal 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
|
116
src/GEOMGUI/GeometryGUI_2Sel2Spin_QTD.cxx
Normal file
116
src/GEOMGUI/GeometryGUI_2Sel2Spin_QTD.cxx
Normal 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
|
||||
}
|
||||
|
51
src/GEOMGUI/GeometryGUI_2Sel2Spin_QTD.h
Normal file
51
src/GEOMGUI/GeometryGUI_2Sel2Spin_QTD.h
Normal 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
|
60
src/GEOMGUI/GeometryGUI_2Sel3Spin.cxx
Normal file
60
src/GEOMGUI/GeometryGUI_2Sel3Spin.cxx
Normal 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
|
||||
}
|
49
src/GEOMGUI/GeometryGUI_2Sel3Spin.h
Normal file
49
src/GEOMGUI/GeometryGUI_2Sel3Spin.h
Normal 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
|
127
src/GEOMGUI/GeometryGUI_2Sel3Spin_QTD.cxx
Normal file
127
src/GEOMGUI/GeometryGUI_2Sel3Spin_QTD.cxx
Normal 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
|
||||
}
|
||||
|
53
src/GEOMGUI/GeometryGUI_2Sel3Spin_QTD.h
Normal file
53
src/GEOMGUI/GeometryGUI_2Sel3Spin_QTD.h
Normal 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
|
60
src/GEOMGUI/GeometryGUI_2Spin.cxx
Normal file
60
src/GEOMGUI/GeometryGUI_2Spin.cxx
Normal 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
|
||||
}
|
48
src/GEOMGUI/GeometryGUI_2Spin.h
Normal file
48
src/GEOMGUI/GeometryGUI_2Spin.h
Normal 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
|
79
src/GEOMGUI/GeometryGUI_2Spin_QTD.cxx
Normal file
79
src/GEOMGUI/GeometryGUI_2Spin_QTD.cxx
Normal 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
|
||||
}
|
||||
|
42
src/GEOMGUI/GeometryGUI_2Spin_QTD.h
Normal file
42
src/GEOMGUI/GeometryGUI_2Spin_QTD.h
Normal 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
|
@ -36,23 +36,21 @@
|
||||
* Constructs a GeometryGUI_3Spin which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'
|
||||
*/
|
||||
GeometryGUI_3Spin::GeometryGUI_3Spin( QWidget* parent, const char* name, WFlags fl )
|
||||
: GeometryGUI_3Spin_QTD( parent, name, fl )
|
||||
GeometryGUI_3Spin::GeometryGUI_3Spin(QWidget* parent, const char* name, WFlags fl)
|
||||
:GeometryGUI_3Spin_QTD(parent, name, fl)
|
||||
{
|
||||
SpinBox1->close(TRUE);
|
||||
SpinBox2->close(TRUE);
|
||||
SpinBox3->close(TRUE);
|
||||
|
||||
SpinBox1->close( TRUE );
|
||||
SpinBox2->close( TRUE );
|
||||
SpinBox3->close( TRUE );
|
||||
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
|
||||
Layout1->addWidget(SpinBox_DX, 0, 1);
|
||||
|
||||
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 );
|
||||
|
||||
SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ;
|
||||
Layout1->addWidget( SpinBox_DZ, 2, 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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
using namespace std;
|
||||
#include "GeometryGUI_BoxDlg.h"
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
@ -43,7 +42,7 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// 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)
|
||||
{
|
||||
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 */
|
||||
Init(Sel);
|
||||
myPrimitiveGUI = thePrimitiveGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg()
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_BoxDlg::Init(SALOME_Selection* Sel)
|
||||
void GeometryGUI_BoxDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myConstructorId = 0;
|
||||
@ -144,7 +144,7 @@ void GeometryGUI_BoxDlg::Init(SALOME_Selection* Sel)
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -167,13 +167,14 @@ void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId)
|
||||
GroupDimensions->hide();
|
||||
resize(0, 0);
|
||||
GroupPoints->show();
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
/* filter for next selection */
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
connect (mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
@ -228,7 +229,7 @@ void GeometryGUI_BoxDlg::ClickOnApply()
|
||||
case 0 :
|
||||
{
|
||||
if(myOkPoint1 && myOkPoint2)
|
||||
myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
|
||||
myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
|
||||
break;
|
||||
}
|
||||
case 1 :
|
||||
@ -239,7 +240,7 @@ void GeometryGUI_BoxDlg::ClickOnApply()
|
||||
double vz = GroupDimensions->SpinBox_DZ->GetValue();
|
||||
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||
myPoint2.SetCoord(vx, vy, vz);
|
||||
myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
|
||||
myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "GeometryGUI_2Sel_QTD.h"
|
||||
#include "GeometryGUI_3Spin.h"
|
||||
|
||||
#include "PrimitiveGUI.h"
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
//=================================================================================
|
||||
@ -44,14 +46,16 @@ class GeometryGUI_BoxDlg : public GeometryGUI_Skeleton
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private :
|
||||
void Init(SALOME_Selection* Sel);
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2);
|
||||
|
||||
PrimitiveGUI* myPrimitiveGUI;
|
||||
|
||||
double step;
|
||||
int myConstructorId;
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
|
||||
|
@ -30,24 +30,7 @@ using namespace std;
|
||||
#include "GeometryGUI_CommonDlg.h"
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Application.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()
|
||||
@ -56,111 +39,33 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_CommonDlg::GeometryGUI_CommonDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_CommonDlg::GeometryGUI_CommonDlg(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)
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_COMMON")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_COMMON")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
setName( "GeometryGUI_CommonDlg" );
|
||||
resize( 322, 220 );
|
||||
setCaption( tr( "GEOM_COMMON_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
setCaption(tr("GEOM_COMMON_TITLE"));
|
||||
|
||||
GeometryGUI_CommonDlgLayout = new QGridLayout( this );
|
||||
GeometryGUI_CommonDlgLayout->setSpacing( 6 );
|
||||
GeometryGUI_CommonDlgLayout->setMargin( 11 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_COMMON"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_COMMON" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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() ) );
|
||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
||||
GeometryGUI_CommonDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
GroupCommon = new GeometryGUI_2Sel_QTD(this, "GroupCommon");
|
||||
GroupCommon->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupCommon->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
|
||||
GroupCommon->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
|
||||
GroupCommon->PushButton1->setPixmap(image1);
|
||||
GroupCommon->PushButton2->setPixmap(image1);
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
Layout1->addWidget(GroupCommon, 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_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 ) ;
|
||||
/* Initialisation */
|
||||
myBooleanGUI = theBooleanGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +76,6 @@ GeometryGUI_CommonDlg::GeometryGUI_CommonDlg( QWidget* parent, const char* name,
|
||||
GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg()
|
||||
{
|
||||
/* 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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CommonDlg::Init( SALOME_Selection* Sel )
|
||||
{
|
||||
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)
|
||||
void GeometryGUI_CommonDlg::Init()
|
||||
{
|
||||
GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupCommon->LineEdit1;
|
||||
|
||||
switch (constructorId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
GroupConstructor1->show();
|
||||
myConstructorId = constructorId ;
|
||||
myEditCurrentArgument = LineEditC1A1Shape ;
|
||||
LineEditC1A2Shape->setText(tr("")) ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myOkShape1 = myOkShape2 = false ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
myShape1.Nullify();
|
||||
myShape2.Nullify();
|
||||
myOkShape1 = myOkShape2 = false;
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect(GroupCommon->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupCommon->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(GroupCommon->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupCommon->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
/* displays Dialog */
|
||||
GroupCommon->show();
|
||||
this->show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CommonDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CommonDlg::ClickOnApply()
|
||||
{
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkShape1 && myOkShape2) {
|
||||
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1 ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
|
||||
// accept();
|
||||
return ;
|
||||
if(myOkShape1 && myOkShape2)
|
||||
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()
|
||||
// purpose : Called when selection has changed
|
||||
//=================================================================================
|
||||
void GeometryGUI_CommonDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText("") ;
|
||||
QString aString = ""; /* name of future selection */
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
|
||||
myOkShape1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
|
||||
myOkShape2 = false ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupCommon->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
else if( myEditCurrentArgument == GroupCommon->LineEdit2)
|
||||
myOkShape2 = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 */
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
Standard_Boolean testResult ;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
||||
if( !testResult )
|
||||
return ;
|
||||
myShape1 = S ;
|
||||
LineEditC1A1Shape->setText(aString) ;
|
||||
myOkShape1 = true ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
||||
if( !testResult )
|
||||
return ;
|
||||
myShape2 = S ;
|
||||
LineEditC1A2Shape->setText(aString) ;
|
||||
myOkShape2 = true ;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupCommon->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
GroupCommon->LineEdit1->setText(aString);
|
||||
myOkShape1 = 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()
|
||||
// purpose :
|
||||
@ -362,23 +193,18 @@ void GeometryGUI_CommonDlg::SelectionIntoArgument()
|
||||
void GeometryGUI_CommonDlg::SetEditCurrentArgument()
|
||||
{
|
||||
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 == GroupCommon->PushButton1) {
|
||||
GroupCommon->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupCommon->LineEdit1;
|
||||
}
|
||||
else if(send == GroupCommon->PushButton2) {
|
||||
GroupCommon->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupCommon->LineEdit2;
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -389,79 +215,39 @@ void GeometryGUI_CommonDlg::SetEditCurrentArgument()
|
||||
//=================================================================================
|
||||
void GeometryGUI_CommonDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1Shape )
|
||||
myEditCurrentArgument = LineEditC1A1Shape ;
|
||||
else if ( send == LineEditC1A2Shape )
|
||||
myEditCurrentArgument = LineEditC1A2Shape ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupCommon->LineEdit1)
|
||||
myEditCurrentArgument = GroupCommon->LineEdit1;
|
||||
else if(send == GroupCommon->LineEdit2)
|
||||
myEditCurrentArgument = GroupCommon->LineEdit2;
|
||||
else
|
||||
return ;
|
||||
|
||||
/* User name of object input management */
|
||||
/* If successfull the selection is changed and signal emitted... */
|
||||
/* so SelectionIntoArgument() is automatically called. */
|
||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
||||
QWidget* thisWidget = (QWidget*)this ;
|
||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
||||
myEditCurrentArgument->setText( objectUserName ) ;
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CommonDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate any active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupConstructor1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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;
|
||||
}
|
||||
|
@ -29,91 +29,48 @@
|
||||
#ifndef DIALOGBOX_COMMON_H
|
||||
#define DIALOGBOX_COMMON_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_2Sel_QTD.h"
|
||||
|
||||
#include "BooleanGUI.h"
|
||||
|
||||
#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
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_CommonDlg : public QDialog
|
||||
class GeometryGUI_CommonDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent * e);
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
BooleanGUI* myBooleanGUI;
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
TopoDS_Shape myShape1 ; /* topology used */
|
||||
TopoDS_Shape myShape2 ; /* topology used */
|
||||
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
|
||||
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 */
|
||||
TopoDS_Shape myShape1; /* topology used */
|
||||
TopoDS_Shape myShape2; /* topology used */
|
||||
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
|
||||
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
|
||||
bool myOkShape1;
|
||||
bool myOkShape2; /* to check when arguments are defined */
|
||||
|
||||
|
||||
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;
|
||||
GeometryGUI_2Sel_QTD* GroupCommon;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void LineEditReturnPressed();
|
||||
void ActivateThisDialog();
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_CommonDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupConstructor1Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_COMMON_H
|
||||
|
@ -29,27 +29,13 @@
|
||||
using namespace std;
|
||||
#include "GeometryGUI_ConeDlg.h"
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Config.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <BRepPrimAPI_MakeCone.hxx>
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
|
||||
#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>
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Config.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GeometryGUI_ConeDlg()
|
||||
@ -58,189 +44,44 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_ConeDlg::GeometryGUI_ConeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_ConeDlg::GeometryGUI_ConeDlg(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)
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_PV")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_DXYZ")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
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 );
|
||||
setCaption(tr("GEOM_CONE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_CONE" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_CONE"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->setPixmap(image1);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
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_ConeDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
GroupPoints = new GeometryGUI_2Sel3Spin(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
|
||||
GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
|
||||
GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
|
||||
GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT"));
|
||||
GroupPoints->PushButton1->setPixmap(image2);
|
||||
GroupPoints->PushButton2->setPixmap(image2);
|
||||
|
||||
/***************************************************************/
|
||||
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->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 );
|
||||
GroupDimensions = new GeometryGUI_3Spin(this, "GroupDimensions");
|
||||
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
|
||||
GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
|
||||
GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
|
||||
GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT"));
|
||||
|
||||
SpinBox_C1A3 = new GeometryGUI_SpinBox(GroupC1, "GeomSpinBox_C1A3" ) ;
|
||||
SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
|
||||
GroupC1Layout->addWidget( SpinBox_C1A3 , 2, 2 );
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
Layout1->addWidget(GroupDimensions, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
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 ) ;
|
||||
|
||||
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) ;
|
||||
/* Initialisations */
|
||||
myPrimitiveGUI = thePrimitiveGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -258,223 +99,161 @@ GeometryGUI_ConeDlg::~GeometryGUI_ConeDlg()
|
||||
// function : Init()
|
||||
// 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 */
|
||||
double step ;
|
||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
|
||||
step = St.toDouble() ;
|
||||
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||
step = St.toDouble();
|
||||
|
||||
/* min, max, step and decimals for spin boxes */
|
||||
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */
|
||||
SpinBox_C1A3->SetValue( 100.0 ) ;
|
||||
SpinBox_C1A4->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */
|
||||
SpinBox_C1A4->SetValue( 0.0 ) ;
|
||||
SpinBox_C1A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */
|
||||
SpinBox_C1A5->SetValue( 300.0 ) ;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||
|
||||
SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */
|
||||
SpinBox_Radius1->SetValue( 100.0 ) ;
|
||||
SpinBox_Radius2->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */
|
||||
SpinBox_Radius2->SetValue( 0.0 ) ;
|
||||
SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */
|
||||
SpinBox_Height->SetValue( 300.0 ) ;
|
||||
|
||||
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) ;
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupPoints->SpinBox_DY->SetValue(myRadius2);
|
||||
GroupPoints->SpinBox_DZ->SetValue(myHeight);
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupDimensions->SpinBox_DY->SetValue(myRadius2);
|
||||
GroupDimensions->SpinBox_DZ->SetValue(myHeight);
|
||||
|
||||
/* 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
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(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
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() ) ) ;
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupPoints->SpinBox_DZ, 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(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
|
||||
/* 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 */
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||
|
||||
/* displays Dialog */
|
||||
GroupDimensions->hide();
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
myConstructorId = constructorId;
|
||||
mySelection->ClearFilters();
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
myOkHeight = myOkRadius1 = myOkRadius2 = true;
|
||||
myRadius1 = 100.0;
|
||||
myRadius2 = 0.0;
|
||||
myHeight = 300.0;
|
||||
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
GroupC1->hide();
|
||||
GroupC2->show();
|
||||
myConstructorId = constructorId ;
|
||||
myOkHeight = myOkRadius1 = myOkRadius2 = myOkPoint1 = myOkDir = true ;
|
||||
{
|
||||
GroupDimensions->hide();
|
||||
resize(0, 0);
|
||||
GroupPoints->show();
|
||||
myOkPoint1 = myOkDir = false;
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText(tr(""));
|
||||
GroupPoints->LineEdit2->setText(tr(""));
|
||||
|
||||
SpinBox_Radius1->SetValue( 100.0 ) ; /* radius 1 */
|
||||
SpinBox_Radius2->SetValue( 0.0 ) ; /* radius 2 */
|
||||
SpinBox_Height->SetValue( 300.0 ) ; /* height */
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupPoints->SpinBox_DY->SetValue(myRadius2);
|
||||
GroupPoints->SpinBox_DZ->SetValue(myHeight);
|
||||
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
|
||||
myRadius1 = 100.0 ;
|
||||
myRadius2 = 0.0 ;
|
||||
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 ;
|
||||
/* filter for next selection */
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
break;
|
||||
}
|
||||
case 1 :
|
||||
{
|
||||
GroupC2->hide();
|
||||
GroupC1->show();
|
||||
myConstructorId = constructorId ;
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
myOkHeight = myOkRadius1 = myOkRadius2 = true ;
|
||||
myOkPoint1 = myOkDir = false ;
|
||||
GroupPoints->hide();
|
||||
resize( 0, 0 );
|
||||
GroupDimensions->show();
|
||||
myOkPoint1 = myOkDir = true;
|
||||
|
||||
SpinBox_C1A3->SetValue( 100.0 ) ; /* radius 1 */
|
||||
SpinBox_C1A4->SetValue( 0.0 ) ; /* radius 2 */
|
||||
SpinBox_C1A5->SetValue( 300.0 ) ; /* height */
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupDimensions->SpinBox_DY->SetValue(myRadius2);
|
||||
GroupDimensions->SpinBox_DZ->SetValue(myHeight);
|
||||
|
||||
myRadius1 = 100.0 ;
|
||||
myRadius2 = 0.0 ;
|
||||
myHeight = 300.0 ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
break ;
|
||||
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||
myDir.SetCoord(0.0, 0.0, 1.0);
|
||||
|
||||
MakeConeSimulationAndDisplay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 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() ;
|
||||
}
|
||||
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() ;
|
||||
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();
|
||||
myPrimitiveGUI->MakeConeAndDisplay(myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight));
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -485,227 +264,85 @@ void GeometryGUI_ConeDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
|
||||
/* Future name of selection */
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
||||
LineEditC1A1->setText("") ;
|
||||
myOkPoint1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
||||
LineEditC1A2->setText("") ;
|
||||
myOkDir = false ;
|
||||
}
|
||||
return ;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myOkDir = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 ! */
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
|
||||
/* gp_Pnt : not used */
|
||||
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
|
||||
LineEditC1A1->setText(aString) ;
|
||||
myOkPoint1 = true ;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
/* gp_Pnt : not used */
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) {
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
||||
myDir = curv.Line().Direction();
|
||||
LineEditC1A2->setText(aString) ;
|
||||
myOkDir = true ;
|
||||
GroupPoints->LineEdit2->setText(aString);
|
||||
myOkDir = true;
|
||||
}
|
||||
|
||||
if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
|
||||
MakeConeSimulationAndDisplay() ;
|
||||
}
|
||||
return ;
|
||||
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
|
||||
MakeConeSimulationAndDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
mySelection->ClearFilters() ;
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
if(myConstructorId != 0)
|
||||
return;
|
||||
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1 )
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
else if ( send == LineEditC1A2 )
|
||||
myEditCurrentArgument = LineEditC1A2 ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else if (send == GroupPoints->LineEdit2)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
else
|
||||
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 ;
|
||||
}
|
||||
return;
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// 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 ;
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -715,16 +352,11 @@ void GeometryGUI_ConeDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupC2->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if( !mySimulationTopoDs.IsNull() )
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_ConeDlg::closeEvent( QCloseEvent* e )
|
||||
void GeometryGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
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()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
gp_Dir aDir = myDir ;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
gp_Dir aDir = myDir;
|
||||
|
||||
try {
|
||||
/* allows user to reverse direction of construction with a negative height */
|
||||
if( this->myHeight < -Precision::Confusion() ) {
|
||||
aDir.Reverse() ;
|
||||
}
|
||||
|
||||
gp_Ax2 anAxis(this->myPoint1, aDir) ;
|
||||
if(this->myHeight < -Precision::Confusion())
|
||||
aDir.Reverse();
|
||||
|
||||
if( fabs(myRadius1 - myRadius2) <= Precision::Confusion() ) {
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight) ).Shape() ;
|
||||
}
|
||||
gp_Ax2 anAxis(this->myPoint1, aDir);
|
||||
|
||||
if(fabs(myRadius1 - myRadius2) <= Precision::Confusion())
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight)).Shape();
|
||||
else {
|
||||
if( fabs(myHeight) > Precision::Confusion() )
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeCone( anAxis, myRadius1, myRadius2, fabs(myHeight) ).Shape() ;
|
||||
if(fabs(myHeight) > Precision::Confusion())
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape();
|
||||
}
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE( "Exception catched in MakeConeSimulationAndDisplay" ) ;
|
||||
MESSAGE("Exception catched in MakeConeSimulationAndDisplay");
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -29,124 +29,66 @@
|
||||
#ifndef DIALOGBOX_CONE_H
|
||||
#define DIALOGBOX_CONE_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_2Sel3Spin.h"
|
||||
#include "GeometryGUI_3Spin.h"
|
||||
|
||||
#include "PrimitiveGUI.h"
|
||||
|
||||
#include "GEOM_EdgeFilter.hxx"
|
||||
#include "GeometryGUI_SpinBox.h"
|
||||
|
||||
#include <BRepPrimAPI_MakeCone.hxx>
|
||||
#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 QSpinBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class GeometryGUI;
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : GeometryGUI_ConeDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_ConeDlg : public QDialog
|
||||
class GeometryGUI_ConeDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
void MakeConeSimulationAndDisplay();
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void MakeConeSimulationAndDisplay() ;
|
||||
PrimitiveGUI* myPrimitiveGUI;
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
TopoDS_Shape mySimulationTopoDs ;
|
||||
double step;
|
||||
int myConstructorId;
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
||||
|
||||
gp_Pnt myPoint1 ; /* Topology used */
|
||||
gp_Dir myDir ;
|
||||
bool myOkPoint1 ;
|
||||
bool myOkDir ; /* to check when argument is defined */
|
||||
gp_Pnt myPoint1; /* topology used */
|
||||
gp_Dir myDir;
|
||||
bool myOkPoint1; /* to check when arguments is defined */
|
||||
bool myOkDir;
|
||||
|
||||
Standard_Real myRadius1 ;
|
||||
Standard_Real myRadius2 ;
|
||||
Standard_Real myHeight ;
|
||||
bool myOkRadius1 ;
|
||||
bool myOkRadius2 ;
|
||||
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 */
|
||||
Standard_Real myRadius1;
|
||||
Standard_Real myRadius2;
|
||||
Standard_Real myHeight;
|
||||
bool myOkRadius1;
|
||||
bool myOkRadius2;
|
||||
bool myOkHeight;
|
||||
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */
|
||||
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 ;
|
||||
GeometryGUI_2Sel3Spin* GroupPoints;
|
||||
GeometryGUI_3Spin* GroupDimensions;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ValueChangedInSpinBox( double newValue ) ;
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_ConeDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
QGridLayout* GroupC2Layout;
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ValueChangedInSpinBox(double newValue);
|
||||
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_CONE_H
|
||||
|
@ -30,25 +30,7 @@ using namespace std;
|
||||
#include "GeometryGUI_CutDlg.h"
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Application.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()
|
||||
@ -57,111 +39,33 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_CutDlg::GeometryGUI_CutDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_CutDlg::GeometryGUI_CutDlg(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)
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CUT")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CUT")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
setName( "GeometryGUI_CutDlg" );
|
||||
resize( 322, 220 );
|
||||
setCaption( tr( "GEOM_CUT_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
setCaption(tr("GEOM_CUT_TITLE"));
|
||||
|
||||
GeometryGUI_CutDlgLayout = new QGridLayout( this );
|
||||
GeometryGUI_CutDlgLayout->setSpacing( 6 );
|
||||
GeometryGUI_CutDlgLayout->setMargin( 11 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_CUT"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_CUT" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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() ) );
|
||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
||||
GeometryGUI_CutDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
GroupCut = new GeometryGUI_2Sel_QTD(this, "GroupCut");
|
||||
GroupCut->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupCut->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
|
||||
GroupCut->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
|
||||
GroupCut->PushButton1->setPixmap(image1);
|
||||
GroupCut->PushButton2->setPixmap(image1);
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
Layout1->addWidget(GroupCut, 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_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 ) ;
|
||||
/* Initialisation */
|
||||
myBooleanGUI = theBooleanGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -172,190 +76,112 @@ GeometryGUI_CutDlg::GeometryGUI_CutDlg( QWidget* parent, const char* name, SALOM
|
||||
GeometryGUI_CutDlg::~GeometryGUI_CutDlg()
|
||||
{
|
||||
/* no need to delete child widgets, Qt does it all for us */
|
||||
this->destroy(TRUE, TRUE) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CutDlg::Init( SALOME_Selection* Sel )
|
||||
void GeometryGUI_CutDlg::Init()
|
||||
{
|
||||
mySelection = Sel ;
|
||||
myShape1.Nullify() ;
|
||||
myShape2.Nullify() ;
|
||||
myConstructorId = 0 ;
|
||||
|
||||
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupCut->LineEdit1;
|
||||
|
||||
GroupConstructor1->show();
|
||||
myConstructorId = 0 ;
|
||||
myEditCurrentArgument = LineEditC1A1Shape ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myOkShape1 = myOkShape2 = false ;
|
||||
myShape1.Nullify();
|
||||
myShape2.Nullify();
|
||||
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");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
|
||||
// TODO previous selection into argument ?
|
||||
connect(GroupCut->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupCut->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
/* 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(GroupCut->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupCut->PushButton2, 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 */
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CutDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CutDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkShape1 && myOkShape2) {
|
||||
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2 ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
|
||||
// accept();
|
||||
return ;
|
||||
if(myOkShape1 && myOkShape2)
|
||||
myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CutDlg::ClickOnCancel()
|
||||
{
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
//=================================================================================
|
||||
void GeometryGUI_CutDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText("") ;
|
||||
QString aString = ""; /* name of selection */
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
|
||||
myOkShape1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
|
||||
myOkShape2 = false ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupCut->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
else if( myEditCurrentArgument == GroupCut->LineEdit2)
|
||||
myOkShape2 = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 */
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
Standard_Boolean testResult ;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
Standard_Boolean testResult;
|
||||
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( !testResult )
|
||||
return ;
|
||||
myShape1 = S ;
|
||||
LineEditC1A1Shape->setText(aString) ;
|
||||
myOkShape1 = true ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
||||
if( !testResult )
|
||||
return ;
|
||||
myShape2 = S ;
|
||||
LineEditC1A2Shape->setText(aString) ;
|
||||
myOkShape2 = true ;
|
||||
if(myEditCurrentArgument == GroupCut->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
GroupCut->LineEdit1->setText(aString);
|
||||
myOkShape1 = true;
|
||||
}
|
||||
|
||||
return ;
|
||||
else if(myEditCurrentArgument == GroupCut->LineEdit2) {
|
||||
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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1Shape )
|
||||
myEditCurrentArgument = LineEditC1A1Shape ;
|
||||
else if ( send == LineEditC1A2Shape )
|
||||
myEditCurrentArgument = LineEditC1A2Shape ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupCut->LineEdit1)
|
||||
myEditCurrentArgument = GroupCut->LineEdit1;
|
||||
else if(send == GroupCut->LineEdit2)
|
||||
myEditCurrentArgument = GroupCut->LineEdit2;
|
||||
else
|
||||
return ;
|
||||
|
||||
/* User name of object input management */
|
||||
/* If successfull the selection is changed and signal emitted... */
|
||||
/* so SelectionIntoArgument() is automatically called. */
|
||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
||||
QWidget* thisWidget = (QWidget*)this ;
|
||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
||||
myEditCurrentArgument->setText( objectUserName ) ;
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CutDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate any active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupConstructor1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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;
|
||||
}
|
||||
|
@ -29,90 +29,48 @@
|
||||
#ifndef DIALOGBOX_CUT_H
|
||||
#define DIALOGBOX_CUT_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_2Sel_QTD.h"
|
||||
|
||||
#include "BooleanGUI.h"
|
||||
|
||||
#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
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_CutDlg : public QDialog
|
||||
class GeometryGUI_CutDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
BooleanGUI* myBooleanGUI;
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
TopoDS_Shape myShape1 ; /* topology used to fuse */
|
||||
TopoDS_Shape myShape2 ; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
|
||||
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 */
|
||||
TopoDS_Shape myShape1; /* topology used to fuse */
|
||||
TopoDS_Shape myShape2; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
|
||||
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
|
||||
bool myOkShape1; /* to check when arguments are defined */
|
||||
bool myOkShape2;
|
||||
|
||||
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;
|
||||
GeometryGUI_2Sel_QTD* GroupCut;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void LineEditReturnPressed();
|
||||
void ActivateThisDialog();
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_CutDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupConstructor1Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_CUT_H
|
||||
|
@ -29,26 +29,12 @@
|
||||
using namespace std;
|
||||
#include "GeometryGUI_CylinderDlg.h"
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Config.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
|
||||
#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>
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Config.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GeometryGUI_CylinderDlg()
|
||||
@ -57,171 +43,42 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg(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)
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_PV")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_DXYZ")));
|
||||
|
||||
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 );
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
setCaption(tr("GEOM_CYLINDER_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_CYLINDER" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_CYLINDER"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->setPixmap(image1);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ;
|
||||
GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 );
|
||||
|
||||
GeometryGUI_CylinderDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
|
||||
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);
|
||||
|
||||
/***************************************************************/
|
||||
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, 1, 0 );
|
||||
TextLabel_Radius = new QLabel( GroupC2, "TextLabel_Radius" );
|
||||
TextLabel_Radius->setText( tr( "GEOM_RADIUS" ) );
|
||||
GroupC2Layout->addWidget( TextLabel_Radius, 0, 0 );
|
||||
GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
|
||||
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
|
||||
GroupDimensions->TextLabel1->setText(tr("GEOM_HEIGHT"));
|
||||
GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS"));
|
||||
|
||||
SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ;
|
||||
SpinBox_Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Height->sizePolicy().hasHeightForWidth() ) );
|
||||
GroupC2Layout->addWidget( SpinBox_Height, 1, 1 ) ;
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
Layout1->addWidget(GroupDimensions, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
SpinBox_Radius = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius" ) ;
|
||||
SpinBox_Radius->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Radius->sizePolicy().hasHeightForWidth() ) );
|
||||
GroupC2Layout->addWidget( SpinBox_Radius, 0, 1 ) ;
|
||||
|
||||
QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed );
|
||||
GroupC2Layout->addItem( spacer1 );
|
||||
|
||||
GeometryGUI_CylinderDlgLayout->addWidget(GroupC2 , 1, 0 );
|
||||
/***************************************************************/
|
||||
|
||||
Init(Sel) ; /* Initialisations */
|
||||
/* Initialisations */
|
||||
myPrimitiveGUI = thePrimitiveGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -239,215 +96,154 @@ GeometryGUI_CylinderDlg::~GeometryGUI_CylinderDlg()
|
||||
// function : Init()
|
||||
// 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 */
|
||||
double step ;
|
||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
|
||||
step = St.toDouble() ;
|
||||
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||
step = St.toDouble();
|
||||
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
/* 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 */
|
||||
SpinBox_C1A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
||||
GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||
/* 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 */
|
||||
SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
||||
GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||
|
||||
GroupC1->show();
|
||||
GroupC2->hide();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
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) ;
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius);
|
||||
GroupPoints->SpinBox_DY->SetValue(myHeight);
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius);
|
||||
GroupDimensions->SpinBox_DY->SetValue(myHeight);
|
||||
|
||||
/* 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
connect( SpinBox_Radius, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
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() ) ) ;
|
||||
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())) ;
|
||||
|
||||
/* 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 */
|
||||
/* displays Dialog */
|
||||
GroupDimensions->hide();
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
myConstructorId = constructorId;
|
||||
mySelection->ClearFilters();
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
myOkHeight = myOkRadius = true;
|
||||
myRadius = 100.0;
|
||||
myHeight = 300.0;
|
||||
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
GroupC1->hide();
|
||||
GroupC2->show();
|
||||
myConstructorId = constructorId ;
|
||||
myOkHeight = myOkRadius = myOkPoint1 = myOkDir = true ;
|
||||
{
|
||||
GroupDimensions->hide();
|
||||
resize(0, 0);
|
||||
GroupPoints->show();
|
||||
myOkPoint1 = myOkDir = false;
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText(tr(""));
|
||||
GroupPoints->LineEdit2->setText(tr(""));
|
||||
|
||||
SpinBox_Radius->SetValue( 100.0 ) ;
|
||||
SpinBox_Height->SetValue( 300.0 ) ;
|
||||
myRadius = 100.0 ;
|
||||
myHeight = 300.0 ;
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius);
|
||||
GroupPoints->SpinBox_DY->SetValue(myHeight);
|
||||
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
|
||||
myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
|
||||
myDir.SetCoord( 0.0, 0.0, 1.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() ;
|
||||
}
|
||||
MakeCylinderSimulationAndDisplay() ;
|
||||
}
|
||||
break ;
|
||||
/* filter for next selection */
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
break;
|
||||
}
|
||||
case 1 :
|
||||
{
|
||||
GroupC2->hide();
|
||||
GroupC1->show();
|
||||
myConstructorId = constructorId ;
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
myOkHeight = myOkRadius = true ;
|
||||
myOkPoint1 = myOkDir = false ;
|
||||
LineEditC1A1->setText( tr("") );
|
||||
|
||||
SpinBox_C1A3->SetValue( 100.0 ) ;
|
||||
SpinBox_C1A4->SetValue( 300.0 ) ;
|
||||
myRadius = 100.0 ;
|
||||
myHeight = 300.0 ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
break ;
|
||||
GroupPoints->hide();
|
||||
resize( 0, 0 );
|
||||
GroupDimensions->show();
|
||||
myOkPoint1 = myOkDir = true;
|
||||
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius);
|
||||
GroupDimensions->SpinBox_DY->SetValue(myHeight);
|
||||
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||
myDir.SetCoord(0.0, 0.0, 1.0);
|
||||
|
||||
MakeCylinderSimulationAndDisplay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
switch(myConstructorId)
|
||||
{
|
||||
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 ;
|
||||
}
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::ClickOnCancel()
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
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();
|
||||
myPrimitiveGUI->MakeCylinderAndDisplay(myPoint1, aDir, myRadius, fabs(myHeight));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -457,169 +253,85 @@ void GeometryGUI_CylinderDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
|
||||
QString aString = ""; /* name of future selection */
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
||||
LineEditC1A1->setText("") ;
|
||||
myOkPoint1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
||||
LineEditC1A2->setText("") ;
|
||||
myOkDir = false ;
|
||||
}
|
||||
return ;
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myOkDir = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
/* gp_Pnt : not used */
|
||||
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
|
||||
LineEditC1A1->setText(aString) ;
|
||||
myOkPoint1 = true ;
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) {
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
||||
myDir = curv.Line().Direction();
|
||||
|
||||
LineEditC1A2->setText(aString) ;
|
||||
myOkDir = true ;
|
||||
GroupPoints->LineEdit2->setText(aString);
|
||||
myOkDir = true;
|
||||
}
|
||||
|
||||
if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) {
|
||||
MakeCylinderSimulationAndDisplay() ;
|
||||
}
|
||||
return ;
|
||||
if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
|
||||
MakeCylinderSimulationAndDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
mySelection->ClearFilters() ;
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
if(myConstructorId != 0)
|
||||
return;
|
||||
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1 )
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
else if ( send == LineEditC1A2 )
|
||||
myEditCurrentArgument = LineEditC1A2 ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else if (send == GroupPoints->LineEdit2)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
else
|
||||
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 ;
|
||||
}
|
||||
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 ;
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -629,16 +341,11 @@ void GeometryGUI_CylinderDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupC2->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if( !mySimulationTopoDs.IsNull() )
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// function : ValueChangedInSpinBox
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_CylinderDlg::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
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()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
gp_Dir aDir = this->myDir ;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
gp_Dir aDir = this->myDir;
|
||||
|
||||
try {
|
||||
/* allows user to reverse direction of construction with a negative height */
|
||||
if( this->myHeight < -Precision::Confusion() ) {
|
||||
aDir.Reverse() ;
|
||||
}
|
||||
gp_Ax2 anAxis(this->myPoint1, aDir) ;
|
||||
if(this->myHeight < -Precision::Confusion())
|
||||
aDir.Reverse();
|
||||
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, this->myRadius, fabs(myHeight) ).Shape() ;
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
gp_Ax2 anAxis(this->myPoint1, aDir);
|
||||
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE( "Exception catched in MakeCylinderSimulationAndDisplay" ) ;
|
||||
MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay");
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -29,118 +29,64 @@
|
||||
#ifndef 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 "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
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_CylinderDlg : public QDialog
|
||||
class GeometryGUI_CylinderDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
void MakeCylinderSimulationAndDisplay();
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void MakeCylinderSimulationAndDisplay() ;
|
||||
PrimitiveGUI* myPrimitiveGUI;
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
|
||||
TopoDS_Shape mySimulationTopoDs ;
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
|
||||
gp_Pnt myPoint1 ; /* topology used */
|
||||
gp_Dir myDir ;
|
||||
double step;
|
||||
int myConstructorId;
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
||||
|
||||
Standard_Real myRadius ;
|
||||
Standard_Real myHeight ;
|
||||
bool myOkRadius ;
|
||||
bool myOkHeight ;
|
||||
QDoubleValidator *myVa ; /* Double validator for numeric input */
|
||||
QDoubleValidator *myVb ; /* Double validator for numeric input */
|
||||
gp_Pnt myPoint1; /* topology used */
|
||||
gp_Dir myDir;
|
||||
bool myOkPoint1; /* to check when arguments is defined */
|
||||
bool myOkDir;
|
||||
|
||||
bool myOkPoint1 ;
|
||||
bool myOkDir ; /* to check when arguments is defined */
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
|
||||
Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */
|
||||
Standard_Real myRadius;
|
||||
Standard_Real myHeight;
|
||||
bool myOkRadius;
|
||||
bool myOkHeight;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonApply;
|
||||
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 ;
|
||||
GeometryGUI_2Sel2Spin* GroupPoints;
|
||||
GeometryGUI_2Spin* GroupDimensions;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ValueChangedInSpinBox( double newValue ) ;
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_CylinderDlgLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
QGridLayout* GroupC2Layout;
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ValueChangedInSpinBox(double newValue);
|
||||
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_CYLINDER_H
|
||||
|
@ -39,7 +39,7 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// 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)
|
||||
{
|
||||
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 */
|
||||
Init(Sel);
|
||||
myBooleanGUI = theBooleanGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +83,7 @@ GeometryGUI_FuseDlg::~GeometryGUI_FuseDlg()
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_FuseDlg::Init(SALOME_Selection* Sel)
|
||||
void GeometryGUI_FuseDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupFuse->LineEdit1;
|
||||
@ -101,7 +102,7 @@ void GeometryGUI_FuseDlg::Init(SALOME_Selection* Sel)
|
||||
connect(GroupFuse->PushButton1, 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 */
|
||||
GroupFuse->show();
|
||||
@ -132,7 +133,7 @@ void GeometryGUI_FuseDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
|
||||
if(myOkShape1 && myOkShape2)
|
||||
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3);
|
||||
myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -243,7 +244,7 @@ void GeometryGUI_FuseDlg::ActivateThisDialog()
|
||||
//=================================================================================
|
||||
void GeometryGUI_FuseDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
if (GroupConstructors->isEnabled())
|
||||
if(GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_2Sel_QTD.h"
|
||||
|
||||
#include "BooleanGUI.h"
|
||||
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
|
||||
//=================================================================================
|
||||
@ -43,13 +45,15 @@ class GeometryGUI_FuseDlg : public GeometryGUI_Skeleton
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init(SALOME_Selection* Sel);
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
BooleanGUI* myBooleanGUI;
|
||||
|
||||
TopoDS_Shape myShape1; /* topology used to fuse */
|
||||
TopoDS_Shape myShape2; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
|
||||
@ -57,15 +61,15 @@ private:
|
||||
bool myOkShape1; /* to check when arguments are defined */
|
||||
bool myOkShape2;
|
||||
|
||||
GeometryGUI_2Sel_QTD* GroupFuse ;
|
||||
GeometryGUI_2Sel_QTD* GroupFuse;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void ActivateThisDialog() ;
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void LineEditReturnPressed();
|
||||
void ActivateThisDialog();
|
||||
|
||||
};
|
||||
|
||||
|
@ -30,25 +30,7 @@ using namespace std;
|
||||
#include "GeometryGUI_SectionDlg.h"
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
|
||||
#include "QAD_Application.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()
|
||||
@ -57,109 +39,33 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_SectionDlg::GeometryGUI_SectionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_SectionDlg::GeometryGUI_SectionDlg(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)
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SECTION")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SECTION")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
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 );
|
||||
setCaption(tr("GEOM_SECTION_TITLE"));
|
||||
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_SECTION" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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() ) );
|
||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
||||
GeometryGUI_SectionDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_SECTION"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
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_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 );
|
||||
GroupSection = new GeometryGUI_2Sel_QTD(this, "GroupSection");
|
||||
GroupSection->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupSection->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
|
||||
GroupSection->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
|
||||
GroupSection->PushButton1->setPixmap(image1);
|
||||
GroupSection->PushButton2->setPixmap(image1);
|
||||
|
||||
/* Initialisation */
|
||||
Init( Sel ) ;
|
||||
Layout1->addWidget(GroupSection, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisation */
|
||||
myBooleanGUI = theBooleanGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -170,7 +76,6 @@ GeometryGUI_SectionDlg::GeometryGUI_SectionDlg( QWidget* parent, const char* na
|
||||
GeometryGUI_SectionDlg::~GeometryGUI_SectionDlg()
|
||||
{
|
||||
/* 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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::Init( SALOME_Selection* Sel )
|
||||
void GeometryGUI_SectionDlg::Init()
|
||||
{
|
||||
mySelection = Sel ;
|
||||
myShape1.Nullify() ;
|
||||
myShape2.Nullify() ;
|
||||
myConstructorId = 0 ;
|
||||
|
||||
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupSection->LineEdit1;
|
||||
|
||||
GroupConstructor1->show();
|
||||
myConstructorId = 0 ;
|
||||
myEditCurrentArgument = LineEditC1A1Shape ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myOkShape1 = myOkShape2 = false ;
|
||||
myShape1.Nullify();
|
||||
myShape2.Nullify();
|
||||
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");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
|
||||
// TODO previous selection into argument ?
|
||||
connect(GroupSection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupSection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
/* 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(GroupSection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupSection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( GroupConstructors, SIGNAL(clicked(int) ),this, SLOT( ConstructorsClicked(int) ) );
|
||||
connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
/* displays Dialog */
|
||||
GroupSection->show();
|
||||
this->show();
|
||||
|
||||
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 ;
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkShape1 && myOkShape2) {
|
||||
myGeomGUI->MakeBooleanAndDisplay(myGeomShape1, myGeomShape2, 4 ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// accept();
|
||||
return ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
|
||||
if(myOkShape1 && myOkShape2)
|
||||
myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 4);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::ClickOnCancel()
|
||||
{
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection has changed
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText("") ;
|
||||
QString aString = ""; /* future the name of selection */
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
|
||||
myOkShape1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
|
||||
myOkShape2 = false ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupSection->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
else if( myEditCurrentArgument == GroupSection->LineEdit2)
|
||||
myOkShape2 = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 */
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
Standard_Boolean testResult ;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
|
||||
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
||||
if( !testResult )
|
||||
return ;
|
||||
myShape1 = S ;
|
||||
LineEditC1A1Shape->setText(aString) ;
|
||||
myOkShape1 = true ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
||||
if( !testResult )
|
||||
return ;
|
||||
myShape2 = S ;
|
||||
LineEditC1A2Shape->setText(aString) ;
|
||||
myOkShape2 = true ;
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupSection->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
GroupSection->LineEdit1->setText(aString);
|
||||
myOkShape1 = true;
|
||||
}
|
||||
|
||||
return ;
|
||||
else if(myEditCurrentArgument == GroupSection->LineEdit2) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape2 = S;
|
||||
GroupSection->LineEdit2->setText(aString);
|
||||
myOkShape2 = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -365,25 +194,18 @@ void GeometryGUI_SectionDlg::SetEditCurrentArgument()
|
||||
{
|
||||
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 == GroupSection->PushButton1) {
|
||||
GroupSection->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupSection->LineEdit1;
|
||||
}
|
||||
else if(send == GroupSection->PushButton2) {
|
||||
GroupSection->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupSection->LineEdit2;
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
@ -392,80 +214,39 @@ void GeometryGUI_SectionDlg::SetEditCurrentArgument()
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1Shape )
|
||||
myEditCurrentArgument = LineEditC1A1Shape ;
|
||||
else if ( send == LineEditC1A2Shape )
|
||||
myEditCurrentArgument = LineEditC1A2Shape ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupSection->LineEdit1)
|
||||
myEditCurrentArgument = GroupSection->LineEdit1;
|
||||
else if(send == GroupSection->LineEdit2)
|
||||
myEditCurrentArgument = GroupSection->LineEdit2;
|
||||
else
|
||||
return ;
|
||||
|
||||
/* User name of object input management */
|
||||
/* If successfull the selection is changed and signal emitted... */
|
||||
/* so SelectionIntoArgument() is automatically called. */
|
||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
||||
QWidget* thisWidget = (QWidget*)this ;
|
||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
||||
myEditCurrentArgument->setText( objectUserName ) ;
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SectionDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate any active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupConstructor1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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;
|
||||
}
|
||||
|
@ -29,88 +29,48 @@
|
||||
#ifndef DIALOGBOX_SECTION_H
|
||||
#define DIALOGBOX_SECTION_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_2Sel_QTD.h"
|
||||
|
||||
#include "BooleanGUI.h"
|
||||
|
||||
#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
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_SectionDlg : public QDialog{
|
||||
class GeometryGUI_SectionDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
BooleanGUI* myBooleanGUI;
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
TopoDS_Shape myShape1 ; /* topology used to fuse */
|
||||
TopoDS_Shape myShape2 ; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
|
||||
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 */
|
||||
TopoDS_Shape myShape1; /* topology used to fuse */
|
||||
TopoDS_Shape myShape2; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
|
||||
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
|
||||
bool myOkShape1; /* to check when arguments are defined */
|
||||
bool myOkShape2;
|
||||
|
||||
|
||||
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;
|
||||
GeometryGUI_2Sel_QTD* GroupSection;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void LineEditReturnPressed();
|
||||
void ActivateThisDialog();
|
||||
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_SectionDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupConstructor1Layout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_SECTION_H
|
||||
|
@ -39,7 +39,7 @@
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
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)
|
||||
setName("GeometryGUI_Skeleton");
|
||||
@ -51,7 +51,7 @@ GeometryGUI_Skeleton::GeometryGUI_Skeleton(QWidget* parent, const char* name, SA
|
||||
GroupMedium->close(TRUE);
|
||||
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()));
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
// int x, y ;
|
||||
// myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
||||
// int x, y;
|
||||
// myGeomGUI->DefineDlgPosition( this, x, y );
|
||||
|
||||
/* displays Dialog */
|
||||
RadioButton1->setChecked(TRUE);
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ void GeometryGUI_Skeleton::LineEditReturnPressed()
|
||||
//=================================================================================
|
||||
void GeometryGUI_Skeleton::DeactivateActiveDialog()
|
||||
{
|
||||
Layout1->setEnabled(false);
|
||||
this->setEnabled(false);
|
||||
mySelection->ClearFilters();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
@ -156,8 +156,8 @@ void GeometryGUI_Skeleton::DeactivateActiveDialog()
|
||||
void GeometryGUI_Skeleton::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog();
|
||||
Layout1->setEnabled(true);
|
||||
myGeomGUI->EmitSignalDeactivateDialog();
|
||||
this->setEnabled(true);
|
||||
myGeomGUI->SetActiveDialogBox((QDialog*)this);
|
||||
return;
|
||||
}
|
||||
|
@ -28,30 +28,12 @@
|
||||
|
||||
using namespace std;
|
||||
#include "GeometryGUI_SphereDlg.h"
|
||||
#include "GeometryGUI_SpinBox.h"
|
||||
|
||||
#include <BRepPrimAPI_MakeSphere.hxx>
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.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()
|
||||
@ -60,138 +42,38 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_SphereDlg::GeometryGUI_SphereDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_SphereDlg::GeometryGUI_SphereDlg(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)
|
||||
{
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_P")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_DXYZ")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
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 );
|
||||
setCaption(tr("GEOM_SPHERE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_SPHERE" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_SPHERE"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->setPixmap(image1);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A2" ) ;
|
||||
GroupConstructor1Layout->addWidget( SpinBox_C1A2, 1, 2 );
|
||||
GroupPoints = new GeometryGUI_1Sel1Spin(this, "GroupPoints");
|
||||
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"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructor2 = new QGroupBox( this, "GroupConstructor2" );
|
||||
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 );
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
Layout1->addWidget(GroupDimensions, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
SpinBox_C2A1 = new GeometryGUI_SpinBox( GroupConstructor2, "GeomSpinBox_C2A1" ) ;
|
||||
GroupConstructor2Layout->addWidget( SpinBox_C2A1, 0, 1 );
|
||||
|
||||
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 */
|
||||
/* Initialisations */
|
||||
myPrimitiveGUI = thePrimitiveGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -209,146 +91,101 @@ GeometryGUI_SphereDlg::~GeometryGUI_SphereDlg()
|
||||
// function : Init()
|
||||
// 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 */
|
||||
double step ;
|
||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
|
||||
step = St.toDouble() ;
|
||||
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||
step = St.toDouble();
|
||||
|
||||
/* min, max, step and decimals for spin boxes */
|
||||
SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
|
||||
SpinBox_C1A2->SetValue( 100.0 ) ;
|
||||
SpinBox_C2A1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
|
||||
SpinBox_C2A1->SetValue( 100.0 ) ;
|
||||
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius);
|
||||
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 */
|
||||
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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
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) ) ) ;
|
||||
connect( SpinBox_C2A1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
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)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
GroupConstructor1->show();
|
||||
GroupConstructor2->hide();
|
||||
myConstructorId = constructorId ;
|
||||
myEditCurrentArgument = SpinBox_C1A2 ;
|
||||
LineEditC1A1->setText(tr("")) ;
|
||||
SpinBox_C1A2->SetValue( 100.0 ) ;
|
||||
myRadius = 100.0 ;
|
||||
myOkRadius = true ;
|
||||
myOkPoint1 = false ;
|
||||
GroupDimensions->hide();
|
||||
resize(0, 0);
|
||||
GroupPoints->show();
|
||||
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius);
|
||||
myOkPoint1 = false;
|
||||
|
||||
/* filter for next selections */
|
||||
mySelection->ClearFilters() ;
|
||||
mySelection->AddFilter( myVertexFilter );
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
GroupConstructor1->hide();
|
||||
GroupConstructor2->show();
|
||||
myConstructorId = constructorId ;
|
||||
myEditCurrentArgument = SpinBox_C2A1 ;;
|
||||
SpinBox_C2A1->SetValue( 100.0 ) ;
|
||||
myRadius = 100.0 ;
|
||||
myOkRadius = true ;
|
||||
myPoint1.SetCoord( 0.0, 0.0, 0.0 ); /* at origin */
|
||||
myOkPoint1 = false ;
|
||||
GroupPoints->hide();
|
||||
resize( 0, 0 );
|
||||
GroupDimensions->show();
|
||||
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius);
|
||||
myPoint1.SetCoord(0.0, 0.0, 0.0); /* at origin */
|
||||
myOkPoint1 = true;
|
||||
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
/* no filters here */
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
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()
|
||||
@ -356,24 +193,26 @@ void GeometryGUI_SphereDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void GeometryGUI_SphereDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SphereDlg::ClickOnCancel()
|
||||
void GeometryGUI_SphereDlg::ClickOnApply()
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
if(myOkPoint1 && myOkRadius)
|
||||
myPrimitiveGUI->MakeSphereAndDisplay(myPoint1, myRadius);
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -384,35 +223,33 @@ void GeometryGUI_SphereDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void GeometryGUI_SphereDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
|
||||
/* Future name of selection */
|
||||
QString aString = "";
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
||||
LineEditC1A1->setText("") ;
|
||||
myOkPoint1 = false ;
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
myOkPoint1 = false;
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 ! */
|
||||
TopoDS_Shape S;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
/* Constructor 1 treatment */
|
||||
if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
|
||||
LineEditC1A1->setText(aString) ;
|
||||
myOkPoint1 = true ;
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
|
||||
if( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) {
|
||||
if(myOkPoint1 && myOkRadius) {
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
@ -424,114 +261,50 @@ void GeometryGUI_SphereDlg::SelectionIntoArgument()
|
||||
//=================================================================================
|
||||
void GeometryGUI_SphereDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1 )
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else
|
||||
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 ;
|
||||
return;
|
||||
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SphereDlg::SetEditCurrentArgument()
|
||||
{
|
||||
if(myConstructorId != 0)
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// 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() ;
|
||||
if(send == GroupPoints->PushButton1) {
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
this->SelectionIntoArgument();
|
||||
}
|
||||
return ;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_SphereDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate other active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupConstructor1->setEnabled(true) ;
|
||||
GroupConstructor2->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if( !mySimulationTopoDs.IsNull() )
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// function : ValueChangedInSpinBox()
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -29,103 +29,54 @@
|
||||
#ifndef DIALOGBOX_SPHERE_H
|
||||
#define DIALOGBOX_SPHERE_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_1Sel1Spin.h"
|
||||
#include "GeometryGUI_1Spin.h"
|
||||
|
||||
#include "PrimitiveGUI.h"
|
||||
|
||||
#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
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_SphereDlg : public QDialog
|
||||
class GeometryGUI_SphereDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private :
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
||||
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 */
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
Standard_Real myRadius ;
|
||||
bool myOkRadius ;
|
||||
QDoubleValidator *myVa ; /* Double validator for numeric input myRadius in LineEditC1A2 */
|
||||
QDoubleValidator *myVb ; /* Double validator for numeric input myRadius in LineEditC2A1 */
|
||||
PrimitiveGUI* myPrimitiveGUI;
|
||||
|
||||
bool myOkPoint1 ; /* Are true when myPoint is defined */
|
||||
QWidget* myEditCurrentArgument; /* Current LineEdit or SpinBox */
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
|
||||
double step;
|
||||
int myConstructorId;
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
|
||||
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent( QEvent* e);
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
gp_Pnt myPoint1; /* Points containing the vector */
|
||||
Standard_Real myRadius;
|
||||
bool myOkRadius; /* Are true when myPoint is defined */
|
||||
bool myOkPoint1;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonApply;
|
||||
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;
|
||||
GeometryGUI_1Sel1Spin* GroupPoints;
|
||||
GeometryGUI_1Spin* GroupDimensions;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void LineEditReturnPressed() ;
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ValueChangedInSpinBox( double newValue ) ;
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ValueChangedInSpinBox(double newValue);
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_SphereDlgLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupConstructor1Layout;
|
||||
QGridLayout* GroupConstructor2Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_SPHERE_H
|
||||
|
@ -29,29 +29,12 @@
|
||||
using namespace std;
|
||||
#include "GeometryGUI_TorusDlg.h"
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Application.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Config.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <BRepPrimAPI_MakeTorus.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
|
||||
#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>
|
||||
|
||||
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Config.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GeometryGUI_TorusDlg()
|
||||
@ -60,173 +43,42 @@ using namespace std;
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GeometryGUI_TorusDlg::GeometryGUI_TorusDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
|
||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
||||
GeometryGUI_TorusDlg::GeometryGUI_TorusDlg(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)
|
||||
{
|
||||
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_PV")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_DXYZ")));
|
||||
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 image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
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 );
|
||||
setCaption(tr("GEOM_TORUS_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_TORUS" ) );
|
||||
GroupConstructors->setExclusive( TRUE );
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
||||
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 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_TORUS"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->setPixmap(image1);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
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_TorusDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
|
||||
GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
|
||||
GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
|
||||
GroupPoints->PushButton1->setPixmap(image2);
|
||||
GroupPoints->PushButton2->setPixmap(image2);
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
|
||||
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
|
||||
GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
|
||||
GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
|
||||
|
||||
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 );
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
Layout1->addWidget(GroupDimensions, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
|
||||
SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
|
||||
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 );
|
||||
|
||||
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) ;
|
||||
/* Initialisations */
|
||||
myPrimitiveGUI = thePrimitiveGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -244,79 +96,59 @@ GeometryGUI_TorusDlg::~GeometryGUI_TorusDlg()
|
||||
// function : Init()
|
||||
// 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 */
|
||||
double step ;
|
||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
|
||||
step = St.toDouble() ;
|
||||
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||
step = St.toDouble();
|
||||
|
||||
/* min, max, step and decimals for spin boxes */
|
||||
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
|
||||
SpinBox_C1A4->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
|
||||
SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
|
||||
SpinBox_Radius2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
|
||||
|
||||
GroupC1->show();
|
||||
GroupC2->hide();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
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) ;
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupPoints->SpinBox_DY->SetValue(myRadius2);
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupDimensions->SpinBox_DY->SetValue(myRadius2);
|
||||
|
||||
/* 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
||||
connect( SpinBox_C1A4, 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(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect(GroupPoints->LineEdit1, 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 ;
|
||||
}
|
||||
|
||||
@ -328,51 +160,48 @@ void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel )
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
myConstructorId = constructorId;
|
||||
mySelection->ClearFilters();
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
myOkRadius1 = myOkRadius2 = true;
|
||||
myRadius1 = 300.0;
|
||||
myRadius2 = 100.0;
|
||||
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
GroupC1->hide();
|
||||
GroupC2->show();
|
||||
myConstructorId = constructorId ;
|
||||
myOkRadius1 = myOkPoint1 = myOkRadius2 = myOkDir = true ;
|
||||
{
|
||||
GroupDimensions->hide();
|
||||
resize(0, 0);
|
||||
GroupPoints->show();
|
||||
myOkPoint1 = myOkDir = false;
|
||||
|
||||
SpinBox_C1A3->SetValue( 300.0 ) ; /* radius 1 */
|
||||
SpinBox_C1A4->SetValue( 100.0 ) ; /* radius 2 */
|
||||
myRadius1 = 300.0 ;
|
||||
myRadius2 = 100.0 ;
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setText(tr(""));
|
||||
GroupPoints->LineEdit2->setText(tr(""));
|
||||
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
GroupPoints->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupPoints->SpinBox_DY->SetValue(myRadius2);
|
||||
|
||||
myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ;
|
||||
myDir.SetCoord( 0.0, 0.0, 1.0 ) ;
|
||||
|
||||
if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
|
||||
gp_Dir aDir = myDir ;
|
||||
|
||||
MakeTorusSimulationAndDisplay() ;
|
||||
}
|
||||
/* filter for next selection */
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
break ;
|
||||
}
|
||||
case 1 :
|
||||
{
|
||||
GroupC2->hide();
|
||||
GroupC1->show();
|
||||
myConstructorId = constructorId ;
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
myOkRadius1 = myOkRadius2 = true ;
|
||||
myOkPoint1 = myOkDir = false ;
|
||||
{
|
||||
GroupPoints->hide();
|
||||
resize( 0, 0 );
|
||||
GroupDimensions->show();
|
||||
myOkPoint1 = myOkDir = true;
|
||||
|
||||
SpinBox_Radius1->SetValue( 300.0 ) ;
|
||||
SpinBox_Radius2->SetValue( 100.0 ) ;
|
||||
myRadius1 = 300.0 ;
|
||||
myRadius2 = 100.0 ;
|
||||
GroupDimensions->SpinBox_DX->SetValue(myRadius1);
|
||||
GroupDimensions->SpinBox_DY->SetValue(myRadius2);
|
||||
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||
myDir.SetCoord(0.0, 0.0, 1.0);
|
||||
|
||||
LineEditC1A1->setText( tr("") );
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
MakeTorusSimulationAndDisplay();
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@ -380,60 +209,32 @@ void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId)
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
switch(myConstructorId)
|
||||
{
|
||||
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 ;
|
||||
}
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// 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() ;
|
||||
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 )
|
||||
myPrimitiveGUI->MakeTorusAndDisplay(myPoint1, myDir, myRadius1, myRadius2);
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -444,45 +245,39 @@ void GeometryGUI_TorusDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
QString aString = ""; /* Name of future selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
||||
LineEditC1A1->setText("") ;
|
||||
myOkPoint1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
||||
LineEditC1A2->setText("") ;
|
||||
myOkDir = false ;
|
||||
}
|
||||
return ;
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if (nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myOkDir = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
/* gp_Pnt : not used */
|
||||
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
|
||||
LineEditC1A1->setText(aString) ;
|
||||
myOkPoint1 = true ;
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) {
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
||||
myDir = curv.Line().Direction();
|
||||
LineEditC1A2->setText(aString) ;
|
||||
myOkDir = true ;
|
||||
GroupPoints->LineEdit2->setText(aString);
|
||||
myOkDir = true;
|
||||
}
|
||||
|
||||
if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) {
|
||||
MakeTorusSimulationAndDisplay() ;
|
||||
}
|
||||
return ;
|
||||
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2)
|
||||
MakeTorusSimulationAndDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -492,32 +287,24 @@ void GeometryGUI_TorusDlg::SelectionIntoArgument()
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
mySelection->ClearFilters() ;
|
||||
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 ;
|
||||
}
|
||||
}
|
||||
if(myConstructorId != 0)
|
||||
return;
|
||||
|
||||
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()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1 )
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
else if ( send == LineEditC1A2)
|
||||
myEditCurrentArgument = LineEditC1A2;
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else if (send == GroupPoints->LineEdit2)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
else
|
||||
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 ;
|
||||
}
|
||||
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 ;
|
||||
GeometryGUI_Skeleton::LineEditReturnPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -610,16 +333,11 @@ void GeometryGUI_TorusDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupC2->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if( !mySimulationTopoDs.IsNull() )
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
return ;
|
||||
GeometryGUI_Skeleton::ActivateThisDialog();
|
||||
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)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// function : ValueChangedInSpinBox
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e )
|
||||
void GeometryGUI_TorusDlg::ValueChangedInSpinBox(double newValue)
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
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()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
try {
|
||||
gp_Ax2 anAxis(this->myPoint1, this->myDir) ;
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeTorus( anAxis, this->myRadius1, this->myRadius2 ).Shape() ;
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
gp_Ax2 anAxis(this->myPoint1, this->myDir);
|
||||
mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, this->myRadius1, this->myRadius2).Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE( "Exception catched in MakeTorusSimulationAndDisplay" ) ;
|
||||
MESSAGE("Exception catched in MakeTorusSimulationAndDisplay");
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -29,120 +29,64 @@
|
||||
#ifndef DIALOGBOX_TORUS_H
|
||||
#define DIALOGBOX_TORUS_H
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include "GEOM_EdgeFilter.hxx"
|
||||
#include "GeometryGUI_SpinBox.h"
|
||||
#include "GeometryGUI_Skeleton.h"
|
||||
#include "GeometryGUI_2Sel2Spin.h"
|
||||
#include "GeometryGUI_2Spin.h"
|
||||
|
||||
#include "PrimitiveGUI.h"
|
||||
|
||||
#include "GEOM_EdgeFilter.hxx"
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <BRepPrimAPI_MakeTorus.hxx>
|
||||
#include <gp_Pnt.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
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GeometryGUI_TorusDlg : public QDialog
|
||||
class GeometryGUI_TorusDlg : public GeometryGUI_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
void MakeTorusSimulationAndDisplay();
|
||||
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void MakeTorusSimulationAndDisplay() ;
|
||||
PrimitiveGUI* myPrimitiveGUI;
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
|
||||
TopoDS_Shape mySimulationTopoDs ;
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
double step;
|
||||
int myConstructorId;
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
||||
|
||||
gp_Pnt myPoint1 ; /* Topology used */
|
||||
gp_Dir myDir ;
|
||||
bool myOkPoint1 ;
|
||||
bool myOkDir ; /* to check when arguments is defined */
|
||||
gp_Pnt myPoint1; /* topology used */
|
||||
gp_Dir myDir;
|
||||
bool myOkPoint1; /* to check when arguments is defined */
|
||||
bool myOkDir;
|
||||
|
||||
Standard_Real myRadius1 ;
|
||||
Standard_Real myRadius2 ;
|
||||
bool myOkRadius1 ;
|
||||
bool myOkRadius2 ;
|
||||
QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */
|
||||
QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */
|
||||
Standard_Real myRadius1;
|
||||
Standard_Real myRadius2;
|
||||
bool myOkRadius1;
|
||||
bool myOkRadius2;
|
||||
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */
|
||||
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 ;
|
||||
GeometryGUI_2Sel2Spin* GroupPoints;
|
||||
GeometryGUI_2Spin* GroupDimensions;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ValueChangedInSpinBox( double newValue ) ;
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ValueChangedInSpinBox(double newValue);
|
||||
|
||||
protected:
|
||||
QGridLayout* GeometryGUI_TorusDlgLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
QGridLayout* GroupC2Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_TORUS_H
|
||||
|
@ -47,6 +47,8 @@ PO_FILES = \
|
||||
# Libraries targets
|
||||
LIB = libGEOMGUI.la
|
||||
LIB_SRC = GeometryGUI.cxx \
|
||||
BooleanGUI.cxx \
|
||||
PrimitiveGUI.cxx \
|
||||
GeometryGUI_SpinBox.cxx \
|
||||
GeometryGUI_Skeleton_QTD.cxx \
|
||||
GeometryGUI_Skeleton.cxx \
|
||||
@ -58,6 +60,14 @@ LIB_SRC = GeometryGUI.cxx \
|
||||
GeometryGUI_1Sel4Spin.cxx \
|
||||
GeometryGUI_2Sel1Spin_QTD.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.cxx \
|
||||
GeometryGUI_TransparencyDlg.cxx \
|
||||
@ -117,6 +127,8 @@ LIB_SRC = GeometryGUI.cxx \
|
||||
|
||||
LIB_MOC = \
|
||||
GeometryGUI.h \
|
||||
BooleanGUI.h \
|
||||
PrimitiveGUI.h \
|
||||
GeometryGUI_SpinBox.h \
|
||||
GeometryGUI_Skeleton_QTD.h \
|
||||
GeometryGUI_Skeleton.h \
|
||||
@ -128,6 +140,14 @@ LIB_MOC = \
|
||||
GeometryGUI_1Sel4Spin.h \
|
||||
GeometryGUI_2Sel1Spin_QTD.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.h \
|
||||
GeometryGUI_TransparencyDlg.h \
|
||||
|
239
src/GEOMGUI/PrimitiveGUI.cxx
Normal file
239
src/GEOMGUI/PrimitiveGUI.cxx
Normal 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;
|
||||
}
|
65
src/GEOMGUI/PrimitiveGUI.h
Normal file
65
src/GEOMGUI/PrimitiveGUI.h
Normal 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
|
Loading…
Reference in New Issue
Block a user