0016757: EDF 546 GEOM : Add Face and Disc in geom primitives

This commit is contained in:
dmv 2008-08-08 13:43:36 +00:00
parent c9fc0eec6a
commit bb33eafebd
21 changed files with 208 additions and 98 deletions

View File

@ -839,7 +839,7 @@ module GEOM
* \param theW horisontal size (width). * \param theW horisontal size (width).
* \return New GEOM_Object, containing the created face. * \return New GEOM_Object, containing the created face.
*/ */
GEOM_Object MakeFaceVecHW (in GEOM_Object theVec, in double theH, in double theW); GEOM_Object MakeFaceObjHW (in GEOM_Object theObj, in double theH, in double theW);
/*! /*!
* Create a Disk (circular face) with given center, normal vector and radius. * Create a Disk (circular face) with given center, normal vector and radius.
* \param thePnt disk center. * \param thePnt disk center.

View File

@ -129,7 +129,7 @@ module GEOM
GEOM_Object MakeFaceHW (in double theH, GEOM_Object MakeFaceHW (in double theH,
in double theW, in double theW,
in short theOrientation) ; in short theOrientation) ;
GEOM_Object MakeFaceVecHW (in GEOM_Object theVec, GEOM_Object MakeFaceObjHW (in GEOM_Object theObj,
in double theH, in double theH,
in double theW) ; in double theW) ;
GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt, GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt,

View File

@ -471,6 +471,20 @@ DlgRef_3Check::~DlgRef_3Check()
{ {
} }
//////////////////////////////////////////
// DlgRef_3Radio
//////////////////////////////////////////
DlgRef_3Radio::DlgRef_3Radio( QWidget* parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
setupUi( this );
}
DlgRef_3Radio::~DlgRef_3Radio()
{
}
////////////////////////////////////////// //////////////////////////////////////////
// DlgRef_3Sel1Check // DlgRef_3Sel1Check
////////////////////////////////////////// //////////////////////////////////////////

View File

@ -194,6 +194,8 @@ public:
~DlgRef_1Sel3Check(); ~DlgRef_1Sel3Check();
}; };
////////////////////////////////////////// //////////////////////////////////////////
// DlgRef_1Sel3Spin // DlgRef_1Sel3Spin
////////////////////////////////////////// //////////////////////////////////////////
@ -546,6 +548,22 @@ public:
~DlgRef_3Check(); ~DlgRef_3Check();
}; };
//////////////////////////////////////////
// DlgRef_1Sel3Radio
//////////////////////////////////////////
#include "ui_DlgRef_3Radio_QTD.h"
class DLGREF_EXPORT DlgRef_3Radio : public QWidget,
public Ui::DlgRef_3Radio_QTD
{
Q_OBJECT
public:
DlgRef_3Radio( QWidget* = 0, Qt::WindowFlags = 0 );
~DlgRef_3Radio();
};
////////////////////////////////////////// //////////////////////////////////////////
// DlgRef_3Sel1Check // DlgRef_3Sel1Check
////////////////////////////////////////// //////////////////////////////////////////

View File

@ -70,6 +70,7 @@ UIC_FILES = \
ui_DlgRef_2SelExt_QTD.h \ ui_DlgRef_2SelExt_QTD.h \
ui_DlgRef_2Spin_QTD.h \ ui_DlgRef_2Spin_QTD.h \
ui_DlgRef_3Check_QTD.h \ ui_DlgRef_3Check_QTD.h \
ui_DlgRef_3Radio_QTD.h \
ui_DlgRef_3Sel1Check_QTD.h \ ui_DlgRef_3Sel1Check_QTD.h \
ui_DlgRef_3Sel1Spin_QTD.h \ ui_DlgRef_3Sel1Spin_QTD.h \
ui_DlgRef_3Sel3Spin1Check_QTD.h \ ui_DlgRef_3Sel3Spin1Check_QTD.h \

View File

@ -91,7 +91,7 @@
<translation>face_hw.png</translation> <translation>face_hw.png</translation>
</message> </message>
<message> <message>
<source>ICON_DLG_FACE_VEC_HW</source> <source>ICON_DLG_FACE_OBJ_HW</source>
<translation>face_vechw.png</translation> <translation>face_vechw.png</translation>
</message> </message>
<message> <message>

View File

@ -420,6 +420,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_DISK</source> <source>GEOM_DISK</source>
<translation>Disk</translation> <translation>Disk</translation>
</message> </message>
<message>
<source>GEOM_DISK_TITLE</source>
<translation>Create A Disk</translation>
</message>
<message> <message>
<source>GEOM_DIMENSIONS</source> <source>GEOM_DIMENSIONS</source>
<translation>Dimensions</translation> <translation>Dimensions</translation>
@ -924,6 +928,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_OBJECT</source> <source>GEOM_OBJECT</source>
<translation>Object</translation> <translation>Object</translation>
</message> </message>
<message>
<source>GEOM_OBJECT_TYPE</source>
<translation>Object Type</translation>
</message>
<message> <message>
<source>GEOM_OBJECTS</source> <source>GEOM_OBJECTS</source>
<translation>Objects</translation> <translation>Objects</translation>

View File

@ -74,11 +74,11 @@ Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (aType == FACE_VEC_H_W) { if (aType == FACE_OBJ_H_W) {
Handle(GEOM_Function) aRefVec = aFI.GetRef1(); Handle(GEOM_Function) aRefFunct = aFI.GetRef1();
TopoDS_Shape aShapeVec = aRefVec->GetValue(); TopoDS_Shape aRefShape = aRefFunct->GetValue();
if (aShapeVec.ShapeType() == TopAbs_EDGE) { if (aRefShape.ShapeType() == TopAbs_EDGE) {
TopoDS_Edge anEdge = TopoDS::Edge(aShapeVec); TopoDS_Edge anEdge = TopoDS::Edge(aRefShape);
double aH = aFI.GetH() / 2.0; double aH = aFI.GetH() / 2.0;
double aW = aFI.GetW() / 2.0; double aW = aFI.GetW() / 2.0;
TopoDS_Vertex V1, V2; TopoDS_Vertex V1, V2;
@ -87,6 +87,12 @@ Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const
gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
gp_Pln aPlane (aP, aV); gp_Pln aPlane (aP, aV);
aShape = BRepBuilderAPI_MakeFace(aPlane, -aH, +aH, -aW, +aW).Shape(); aShape = BRepBuilderAPI_MakeFace(aPlane, -aH, +aH, -aW, +aW).Shape();
} else if (aRefShape.ShapeType() == TopAbs_FACE) {
double aH = aFI.GetH() / 2.0;
double aW = aFI.GetW() / 2.0;
gp_Ax3 anAx = GEOMImpl_IMeasureOperations::GetPosition(aRefShape);
gp_Pln aPln (anAx);
aShape = BRepBuilderAPI_MakeFace(aPln, -aH, +aH, -aW, +aW).Shape();
} }
} }
else if (aType == FACE_H_W) { else if (aType == FACE_H_W) {

View File

@ -249,21 +249,21 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double
//============================================================================= //=============================================================================
/*! /*!
* MakeFaceVecHW * MakeFaceObjHW
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceVecHW (Handle(GEOM_Object) theVec, Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Object) theObj,
double theH, double theW) double theH, double theW)
{ {
SetErrorCode(KO); SetErrorCode(KO);
if (theVec.IsNull()) return NULL; if (theObj.IsNull()) return NULL;
//Add a new Face object //Add a new Face object
Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE); Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
//Add a new Box function for creation a box relatively to two points //Add a new Box function for creation a box relatively to two points
Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_VEC_H_W); Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_OBJ_H_W);
if (aFunction.IsNull()) return NULL; if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly //Check if the function is set correctly
@ -271,7 +271,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceVecHW (Handle(GEOM_Objec
GEOMImpl_IFace aFI (aFunction); GEOMImpl_IFace aFI (aFunction);
Handle(GEOM_Function) aRefFunction1 = theVec->GetLastFunction(); Handle(GEOM_Function) aRefFunction1 = theObj->GetLastFunction();
if (aRefFunction1.IsNull()) if (aRefFunction1.IsNull())
return aFace; return aFace;
@ -297,8 +297,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceVecHW (Handle(GEOM_Objec
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceVecHW(" GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceObjHW("
<< theVec << ", " << theH << ", " << theW << ")"; << theObj << ", " << theH << ", " << theW << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aFace; return aFace;

View File

@ -37,7 +37,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1, Standard_EXPORT Handle(GEOM_Object) MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2); Handle(GEOM_Object) thePnt2);
Standard_EXPORT Handle(GEOM_Object) MakeFaceHW (double theH, double theW, int theOrientation); Standard_EXPORT Handle(GEOM_Object) MakeFaceHW (double theH, double theW, int theOrientation);
Standard_EXPORT Handle(GEOM_Object) MakeFaceVecHW (Handle(GEOM_Object) theVec, Standard_EXPORT Handle(GEOM_Object) MakeFaceObjHW (Handle(GEOM_Object) theObj,
double theH, double theW); double theH, double theW);
Standard_EXPORT Handle(GEOM_Object) MakeDiskThreePnt (Handle(GEOM_Object) thePnt1, Standard_EXPORT Handle(GEOM_Object) MakeDiskThreePnt (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2, Handle(GEOM_Object) thePnt2,

View File

@ -158,7 +158,7 @@
#define BOX_DX_DY_DZ 1 #define BOX_DX_DY_DZ 1
#define BOX_TWO_PNT 2 #define BOX_TWO_PNT 2
#define FACE_VEC_H_W 1 #define FACE_OBJ_H_W 1
#define FACE_H_W 2 #define FACE_H_W 2
#define DISK_PNT_VEC_R 1 #define DISK_PNT_VEC_R 1

View File

@ -130,11 +130,11 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
//============================================================================= //=============================================================================
/*! /*!
* MakeFaceVecHW * MakeFaceObjHW
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceVecHW GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
(GEOM::GEOM_Object_ptr theVec, (GEOM::GEOM_Object_ptr theObj,
CORBA::Double theH, CORBA::Double theH,
CORBA::Double theW) CORBA::Double theW)
{ {
@ -143,18 +143,18 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceVecHW
//Set a not done flag //Set a not done flag
GetOperations()->SetNotDone(); GetOperations()->SetNotDone();
if (theVec == NULL || theH == 0 || theW == 0) if (theObj == NULL || theH == 0 || theW == 0)
return aGEOMObject._retn(); return aGEOMObject._retn();
//Get the reference points //Get the reference points
Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
(theVec->GetStudyID(), theVec->GetEntry()); (theObj->GetStudyID(), theObj->GetEntry());
if (aFace.IsNull()) if (anObj.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
//Create the Face //Create the Face
Handle(GEOM_Object) anObject = GetOperations()->MakeFaceVecHW(aFace, theH, theW); Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -51,7 +51,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
CORBA::Double theW, CORBA::Double theW,
CORBA::Short theOrientation); CORBA::Short theOrientation);
GEOM::GEOM_Object_ptr MakeFaceVecHW (GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj,
CORBA::Double theH, CORBA::Double theH,
CORBA::Double theW); CORBA::Double theW);

View File

@ -787,17 +787,17 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceHW (CORBA::Double theH,
} }
//============================================================================= //=============================================================================
// MakeFaceVecHW: // MakeFaceObjHW:
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceVecHW (GEOM::GEOM_Object_ptr theVec, GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj,
CORBA::Double theH, CORBA::Double theH,
CORBA::Double theW) CORBA::Double theW)
{ {
beginService( " GEOM_Superv_i::MakeFaceVecHW" ); beginService( " GEOM_Superv_i::MakeFaceObjHW" );
MESSAGE("GEOM_Superv_i::MakeFaceVecHW"); MESSAGE("GEOM_Superv_i::MakeFaceObjHW");
get3DPrimOp(); get3DPrimOp();
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFaceVecHW(theVec, theH, theW); GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFaceObjHW(theObj, theH, theW);
endService( " GEOM_Superv_i::MakeFaceVecHW" ); endService( " GEOM_Superv_i::MakeFaceObjHW" );
return anObj; return anObj;
} }

View File

@ -190,7 +190,7 @@ public:
GEOM::GEOM_Object_ptr MakeFaceHW (CORBA::Double theH, GEOM::GEOM_Object_ptr MakeFaceHW (CORBA::Double theH,
CORBA::Double theW, CORBA::Double theW,
CORBA::Short theOrientation); CORBA::Short theOrientation);
GEOM::GEOM_Object_ptr MakeFaceVecHW (GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj,
CORBA::Double theH, CORBA::Double theH,
CORBA::Double theW); CORBA::Double theW);
GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,

View File

@ -139,7 +139,7 @@ def TestAll (geompy, math):
WantPlanarFace) #(List of GEOM_Object_ptr, Boolean)->GEOM_Object_ptr WantPlanarFace) #(List of GEOM_Object_ptr, Boolean)->GEOM_Object_ptr
Face2 = geompy.MakeFace(Sketcher, WantPlanarFace) Face2 = geompy.MakeFace(Sketcher, WantPlanarFace)
Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object_ptr Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object_ptr
Face4 = geompy.MakeFaceVecHW (vz, 200., 100.) #(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr Face4 = geompy.MakeFaceObjHW (vz, 200., 100.) #(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object_ptr, 1 Double)->GEOM_Object_ptr Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object_ptr, 1 Double)->GEOM_Object_ptr
Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object_ptr Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object_ptr

View File

@ -696,16 +696,17 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## Create a face from another plane and two sizes, ## Create a face from another plane and two sizes,
# vertical size and horisontal size. # vertical size and horisontal size.
# @param theVec Normale vector to the creating face. # @param theObj Normale vector to the creating face or
# the face object.
# @param theH Height (vertical size). # @param theH Height (vertical size).
# @param theW Width (horisontal size). # @param theW Width (horisontal size).
# @return New GEOM_Object, containing the created face. # @return New GEOM_Object, containing the created face.
# #
# @ref tui_creation_face "Example" # @ref tui_creation_face "Example"
def MakeFaceVecHW(self, theVec, theH, theW): def MakeFaceObjHW(self, theObj, theH, theW):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakeFaceVecHW(theVec, theH, theW) anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
RaiseIfFailed("MakeFaceVecHW", self.PrimOp) RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
return anObj return anObj
## Create a disk with given center, normal vector and radius. ## Create a disk with given center, normal vector and radius.

View File

@ -62,9 +62,9 @@ PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg( GeometryGUI* theGeometryGUI, QWidget
/***************************************************************/ /***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_DISK" ) ); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_DISK" ) );
mainFrame()->RadioButton1->setIcon( image0 ); mainFrame()->RadioButton1->setIcon( image3 );
mainFrame()->RadioButton2->setIcon( image2 ); mainFrame()->RadioButton2->setIcon( image0 );
mainFrame()->RadioButton3->setIcon( image3 ); mainFrame()->RadioButton3->setIcon( image2 );
GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() ); GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() );
GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
@ -92,7 +92,7 @@ PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg( GeometryGUI* theGeometryGUI, QWidget
GroupDimensions->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS" ) ); GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS" ) );
GroupOrientation = new DlgRef_3Check( centralWidget() ); GroupOrientation = new DlgRef_3Radio( centralWidget() );
GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) ); GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) );
GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) ); GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
GroupOrientation->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) ); GroupOrientation->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) );
@ -216,6 +216,16 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
switch ( constructorId ) { switch ( constructorId ) {
case 0: case 0:
{
GroupPntVecR->hide();
Group3Pnts->hide();
GroupDimensions->show();
GroupOrientation->show();
GroupOrientation->RadioButton1->setChecked( true );
myOrientationType = 1;
break;
}
case 1:
{ {
Group3Pnts->hide(); Group3Pnts->hide();
GroupPntVecR->show(); GroupPntVecR->show();
@ -226,7 +236,7 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
GroupPntVecR->LineEdit2->setText( "" ); GroupPntVecR->LineEdit2->setText( "" );
break; break;
} }
case 1: case 2:
{ {
GroupPntVecR->hide(); GroupPntVecR->hide();
Group3Pnts->show(); Group3Pnts->show();
@ -238,15 +248,6 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
Group3Pnts->LineEdit3->setText( "" ); Group3Pnts->LineEdit3->setText( "" );
break; break;
} }
case 2:
{
GroupPntVecR->hide();
Group3Pnts->hide();
GroupDimensions->show();
GroupOrientation->show();
GroupOrientation->RadioButton1->setChecked( true );
myOrientationType = 1;
}
} }
qApp->processEvents(); qApp->processEvents();
@ -292,7 +293,7 @@ bool PrimitiveGUI_DiskDlg::ClickOnApply()
//================================================================================= //=================================================================================
void PrimitiveGUI_DiskDlg::SelectionIntoArgument() void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
{ {
if (getConstructorId() == 2) { if (getConstructorId() == 0) {
displayPreview(); displayPreview();
return; return;
} }
@ -467,9 +468,9 @@ double PrimitiveGUI_DiskDlg::getRadius() const
double r = 0.; double r = 0.;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
r = GroupPntVecR->SpinBox_DX->value(); break;
case 2:
r = GroupDimensions->SpinBox_DX->value(); break; r = GroupDimensions->SpinBox_DX->value(); break;
case 1:
r = GroupPntVecR->SpinBox_DX->value(); break;
} }
return r; return r;
} }
@ -500,12 +501,12 @@ bool PrimitiveGUI_DiskDlg::isValid( QString& msg )
{ {
const int id = getConstructorId(); const int id = getConstructorId();
if ( id == 0 ) if ( id == 0 )
return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; return true;
else if ( id == 1 ) else if ( id == 1 )
return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
else if ( id == 2 )
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
else if ( id == 2 )
return true;
return false; return false;
} }
@ -521,15 +522,15 @@ bool PrimitiveGUI_DiskDlg::execute( ObjectList& objects )
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0 : case 0 :
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskPntVecR( myPoint, myDir, getRadius() ); anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskR( getRadius(), myOrientationType );
res = true; res = true;
break; break;
case 1 : case 1 :
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskThreePnt( myPoint1, myPoint2, myPoint3 ); anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskPntVecR( myPoint, myDir, getRadius() );
res = true; res = true;
break; break;
case 2 : case 2 :
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskR( getRadius(), myOrientationType ); anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskThreePnt( myPoint1, myPoint2, myPoint3 );
res = true; res = true;
break; break;
} }
@ -552,11 +553,11 @@ void PrimitiveGUI_DiskDlg::addSubshapesToStudy()
QMap<QString, GEOM::GEOM_Object_var> objMap; QMap<QString, GEOM::GEOM_Object_var> objMap;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 1:
objMap[GroupPntVecR->LineEdit1->text()] = myPoint; objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
objMap[GroupPntVecR->LineEdit2->text()] = myDir; objMap[GroupPntVecR->LineEdit2->text()] = myDir;
break; break;
case 1: case 2:
objMap[Group3Pnts->LineEdit1->text()] = myPoint1; objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
objMap[Group3Pnts->LineEdit2->text()] = myPoint2; objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
objMap[Group3Pnts->LineEdit3->text()] = myPoint3; objMap[Group3Pnts->LineEdit3->text()] = myPoint3;

View File

@ -31,7 +31,7 @@
class DlgRef_3Sel; class DlgRef_3Sel;
class DlgRef_2Sel1Spin; class DlgRef_2Sel1Spin;
class DlgRef_1Spin; class DlgRef_1Spin;
class DlgRef_3Check; class DlgRef_3Radio;
//================================================================================= //=================================================================================
// class : PrimitiveGUI_DiskDlg // class : PrimitiveGUI_DiskDlg
@ -65,7 +65,7 @@ private:
DlgRef_2Sel1Spin* GroupPntVecR; DlgRef_2Sel1Spin* GroupPntVecR;
DlgRef_3Sel* Group3Pnts; DlgRef_3Sel* Group3Pnts;
DlgRef_1Spin* GroupDimensions; DlgRef_1Spin* GroupDimensions;
DlgRef_3Check* GroupOrientation; DlgRef_3Radio* GroupOrientation;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();

View File

@ -53,7 +53,7 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
bool modal, Qt::WindowFlags fl ) bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ) : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_VEC_HW" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_OBJ_HW" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_HW" ) ) ); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_HW" ) ) );
@ -61,8 +61,8 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
/***************************************************************/ /***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) ); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) );
mainFrame()->RadioButton1->setIcon( image0 ); mainFrame()->RadioButton1->setIcon( image2 );
mainFrame()->RadioButton2->setIcon( image2 ); mainFrame()->RadioButton2->setIcon( image0 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
@ -74,12 +74,19 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
GroupPlane->PushButton1->setIcon( image1 ); GroupPlane->PushButton1->setIcon( image1 );
GroupPlane->LineEdit1->setReadOnly( true ); GroupPlane->LineEdit1->setReadOnly( true );
GroupType = new DlgRef_3Radio( centralWidget() );
GroupType->GroupBox1->setTitle( tr( "GEOM_OBJECT_TYPE" ) );
GroupType->RadioButton1->setText( tr( "GEOM_EDGE" ) );
GroupType->RadioButton2->setText( tr( "GEOM_FACE" ) );
GroupType->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
GroupType->RadioButton3->close();
GroupDimensions = new DlgRef_2Spin( centralWidget() ); GroupDimensions = new DlgRef_2Spin( centralWidget() );
GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) ); GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) );
GroupDimensions->TextLabel1->setText( tr( "GEOM_HEIGHT" ) ); GroupDimensions->TextLabel1->setText( tr( "GEOM_HEIGHT" ) );
GroupDimensions->TextLabel2->setText( tr( "GEOM_WIDTH" ) ); GroupDimensions->TextLabel2->setText( tr( "GEOM_WIDTH" ) );
GroupOrientation = new DlgRef_3Check( centralWidget() ); GroupOrientation = new DlgRef_3Radio( centralWidget() );
GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) ); GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) );
GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) ); GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
@ -88,6 +95,7 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupType );
layout->addWidget( GroupPlane ); layout->addWidget( GroupPlane );
layout->addWidget( GroupDimensions ); layout->addWidget( GroupDimensions );
layout->addWidget( GroupOrientation ); layout->addWidget( GroupOrientation );
@ -117,9 +125,11 @@ void PrimitiveGUI_FaceDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPlane->LineEdit1; myEditCurrentArgument = GroupPlane->LineEdit1;
GroupType->RadioButton1->setChecked(true);
myEdge = GEOM::GEOM_Object::_nil(); myEdge = GEOM::GEOM_Object::_nil();
myFace = GEOM::GEOM_Object::_nil();
globalSelection(); // close local contexts, if any globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); // localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
myOrientationType = 1; myOrientationType = 1;
@ -162,6 +172,9 @@ void PrimitiveGUI_FaceDlg::Init()
connect( GroupOrientation->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) ); connect( GroupOrientation->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
connect( GroupOrientation->RadioButton3, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) ); connect( GroupOrientation->RadioButton3, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
connect( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) );
connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) ); this, SLOT( SelectionIntoArgument() ) );
@ -204,6 +217,24 @@ void PrimitiveGUI_FaceDlg::RadioButtonClicked()
displayPreview(); displayPreview();
} }
//=================================================================================
// function : TypeBittonClicked()
// purpose : Radio button management
//=================================================================================
void PrimitiveGUI_FaceDlg::TypeButtonClicked()
{
if ( GroupType->RadioButton1->isChecked() ) {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GroupPlane->TextLabel1->setText( tr( "GEOM_EDGE" ) );
}
else if ( GroupType->RadioButton2->isChecked() ) {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) );
}
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -241,24 +272,28 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId )
case 0: case 0:
{ {
globalSelection(); // close local contexts, if any globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); GroupPlane->hide();
GroupDimensions->show();
myEditCurrentArgument = GroupPlane->LineEdit1; GroupOrientation->show();
myEditCurrentArgument->setText(""); GroupType->hide();
myEdge = GEOM::GEOM_Object::_nil(); GroupOrientation->RadioButton1->setChecked( true );
GroupDimensions->hide(); myOrientationType = 1;
GroupOrientation->hide();
GroupPlane->show();
break; break;
} }
case 1: case 1:
{ {
globalSelection(); // close local contexts, if any globalSelection(); // close local contexts, if any
GroupPlane->hide(); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GroupDimensions->show(); myEditCurrentArgument = GroupPlane->LineEdit1;
GroupOrientation->show(); myEditCurrentArgument->setText("");
GroupOrientation->RadioButton1->setChecked( true ); myEdge = GEOM::GEOM_Object::_nil();
myOrientationType = 1; myFace = GEOM::GEOM_Object::_nil();
GroupType->RadioButton1->setChecked( true );
TypeButtonClicked();
GroupDimensions->hide();
GroupOrientation->hide();
GroupType->show();
GroupPlane->show();
break; break;
} }
} }
@ -276,7 +311,7 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId )
//================================================================================= //=================================================================================
void PrimitiveGUI_FaceDlg::SelectionIntoArgument() void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
{ {
if (getConstructorId() != 0) { if (getConstructorId() == 0) {
displayPreview(); displayPreview();
return; return;
} }
@ -290,18 +325,25 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
if (GroupType->RadioButton2->isChecked())
aNeedType = TopAbs_FACE;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 ) { // Local Selection if ( aMap.Extent() == 1 ) { // Local Selection
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
if ( aNeedType == TopAbs_EDGE )
aName += QString( ":edge_%1" ).arg( anIndex ); aName += QString( ":edge_%1" ).arg( anIndex );
else
aName += QString( ":face_%1" ).arg( anIndex );
//Find SubShape Object in Father //Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName ); GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
@ -314,7 +356,7 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
aSelectedObject = aFindedObject; // get Object from study aSelectedObject = aFindedObject; // get Object from study
} }
else { // Global Selection else { // Global Selection
if ( aShape.ShapeType() != TopAbs_EDGE ) { if ( aShape.ShapeType() != aNeedType ) {
aSelectedObject = GEOM::GEOM_Object::_nil(); aSelectedObject = GEOM::GEOM_Object::_nil();
aName = ""; aName = "";
} }
@ -322,7 +364,10 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
} }
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
if ( myEditCurrentArgument == GroupPlane->LineEdit1 ) myEdge = aSelectedObject; if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_EDGE )
myEdge = aSelectedObject;
else if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_FACE )
myFace = aSelectedObject;
} }
displayPreview(); displayPreview();
} }
@ -339,7 +384,10 @@ void PrimitiveGUI_FaceDlg::SetEditCurrentArgument()
globalSelection(); // close previous local contexts globalSelection(); // close previous local contexts
if ( send == GroupPlane->PushButton1 ) { if ( send == GroupPlane->PushButton1 ) {
myEditCurrentArgument = GroupPlane->LineEdit1; myEditCurrentArgument = GroupPlane->LineEdit1;
if (GroupType->RadioButton1->isChecked())
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
else if (GroupType->RadioButton1->isChecked())
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
@ -409,9 +457,13 @@ bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
{ {
const int id = getConstructorId(); const int id = getConstructorId();
if ( id == 0 ) if ( id == 0 )
return !myEdge->_is_nil();
else if ( id == 1 )
return true; return true;
else if ( id == 1 ) {
if (GroupType->RadioButton1->isChecked())
return !myEdge->_is_nil();
else if (GroupType->RadioButton2->isChecked())
return !myFace->_is_nil();
}
return false; return false;
} }
@ -425,11 +477,14 @@ bool PrimitiveGUI_FaceDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0 : case 0 :
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceVecHW( myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() ); anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceHW( GroupDimensions->SpinBox_DX->value(), GroupDimensions->SpinBox_DY->value(), myOrientationType );
res = true; res = true;
break; break;
case 1 : case 1 :
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceHW( GroupDimensions->SpinBox_DX->value(), GroupDimensions->SpinBox_DY->value(), myOrientationType ); if ( GroupType->RadioButton1->isChecked() )
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceObjHW( myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() );
else if (GroupType->RadioButton2->isChecked())
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceObjHW( myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() );
res = true; res = true;
break; break;
} }
@ -448,8 +503,11 @@ void PrimitiveGUI_FaceDlg::addSubshapesToStudy()
{ {
QMap<QString, GEOM::GEOM_Object_var> objMap; QMap<QString, GEOM::GEOM_Object_var> objMap;
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0 : case 1 :
if ( GroupType->RadioButton1->isChecked() )
objMap[GroupPlane->LineEdit1->text()] = myEdge; objMap[GroupPlane->LineEdit1->text()] = myEdge;
if ( GroupType->RadioButton2->isChecked() )
objMap[GroupPlane->LineEdit1->text()] = myFace;
break; break;
} }
addSubshapesToFather( objMap ); addSubshapesToFather( objMap );

View File

@ -30,7 +30,7 @@
class DlgRef_2Spin; class DlgRef_2Spin;
class DlgRef_1Sel2Spin; class DlgRef_1Sel2Spin;
class DlgRef_3Check; class DlgRef_3Radio;
//================================================================================= //=================================================================================
// class : PrimitiveGUI_FaceDlg // class : PrimitiveGUI_FaceDlg
@ -60,12 +60,14 @@ private:
GEOM::GEOM_Object_var myPoint2; GEOM::GEOM_Object_var myPoint2;
GEOM::GEOM_Object_var myVector; GEOM::GEOM_Object_var myVector;
GEOM::GEOM_Object_var myEdge; GEOM::GEOM_Object_var myEdge;
GEOM::GEOM_Object_var myFace;
int myOrientationType; int myOrientationType;
DlgRef_2Spin* GroupDimensions; DlgRef_2Spin* GroupDimensions;
DlgRef_1Sel2Spin* GroupPlane; DlgRef_1Sel2Spin* GroupPlane;
DlgRef_3Check* GroupOrientation; DlgRef_3Radio* GroupOrientation;
DlgRef_3Radio* GroupType;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -81,6 +83,7 @@ private slots:
void ValueChangedInSpinBox( double ); void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double ); void SetDoubleSpinBoxStep( double );
void RadioButtonClicked(); void RadioButtonClicked();
void TypeButtonClicked();
}; };
#endif // BASICGUI_FACEDLG_H #endif // BASICGUI_FACEDLG_H