</widget>
</item>
<item row="0" column="1" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
</layout>
</widget>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
- <class>QtxDoubleSpinBox</class>
+ <class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
- <header location="global" >QtxDoubleSpinBox.h</header>
+ <header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
</widget>
</item>
<item row="2" column="1" colspan="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="4" column="1" colspan="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="3" column="1" colspan="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
</layout>
</widget>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
- <class>QtxDoubleSpinBox</class>
+ <class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
- <header location="global" >QtxDoubleSpinBox.h</header>
+ <header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
</widget>
</item>
<item row="0" column="1" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
</widget>
</item>
<item row="1" column="1" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
</layout>
</widget>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
- <class>QtxDoubleSpinBox</class>
+ <class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
- <header location="global" >QtxDoubleSpinBox.h</header>
+ <header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
#include <GeometryGUI.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Desktop.h>
spinBox->setRange( min, max );
spinBox->setSingleStep( step );
}
-
+// TODO: to replace these method:
void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox,
double min, double max,
double step, int decimals )
spinBox->setRange( min, max );
spinBox->setSingleStep( step );
}
+// TODO: by the following:
+void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
+ double min, double max,
+ double step, int decimals )
+{
+ spinBox->setDecimals( decimals ); // it's necessary to set decimals before the range setting,
+ // by default Qt rounds boundaries to 2 decimals at setRange
+ spinBox->setRange( min, max );
+ spinBox->setSingleStep( step );
+}
//=================================================================================
// function : ClickOnCancel()
#include <QDialog>
+class SalomeApp_DoubleSpinBox;
class GeometryGUI;
class DlgRef_Skeleton;
class QSpinBox;
protected:
void initSpinBox( QSpinBox*, int, int, int = 1 );
+ // TODO: to replace these method:
void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 );
+ // TODO: by the following:
+ void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 );
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );
def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
- self.PrimOp.SetParameters(Parameters)
anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a box with two specified opposite vertices,
# @ref tui_creation_face "Example"
def MakeFaceHW(self,theH, theW, theOrientation):
# Example: see GEOM_TestAll.py
+ theH,theW,Parameters = ParseParameters(theH, theW)
anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
RaiseIfFailed("MakeFaceHW", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a face from another plane and two sizes,
# @ref tui_creation_face "Example"
def MakeFaceObjHW(self, theObj, theH, theW):
# Example: see GEOM_TestAll.py
+ theH,theW,Parameters = ParseParameters(theH, theW)
anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a disk with given center, normal vector and radius.
# @ref tui_creation_disk "Example"
def MakeDiskPntVecR(self,thePnt, theVec, theR):
# Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a disk, passing through three given points
# @ref tui_creation_face "Example"
def MakeDiskR(self,theR, theOrientation):
# Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
RaiseIfFailed("MakeDiskR", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a cylinder with given base point, axis, radius and height.
# @ref tui_creation_cylinder "Example"
def MakeCylinder(self,thePnt, theAxis, theR, theH):
# Example: see GEOM_TestAll.py
+ theR,theH,Parameters = ParseParameters(theR, theH)
anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a cylinder with given radius and height at
# @ref tui_creation_cylinder "Example"
def MakeCylinderRH(self,theR, theH):
# Example: see GEOM_TestAll.py
+ theR,theH,Parameters = ParseParameters(theR, theH)
anObj = self.PrimOp.MakeCylinderRH(theR, theH)
RaiseIfFailed("MakeCylinderRH", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a sphere with given center and radius.
# @ref tui_creation_sphere "Example"
def MakeSpherePntR(self, thePnt, theR):
# Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
RaiseIfFailed("MakeSpherePntR", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a sphere with given center and radius.
# @ref tui_creation_sphere "Example"
def MakeSphereR(self, theR):
# Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeSphereR(theR)
RaiseIfFailed("MakeSphereR", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a cone with given base point, axis, height and radiuses.
# @ref tui_creation_cone "Example"
def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
# Example: see GEOM_TestAll.py
+ theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a cone with given height and radiuses at
# @ref tui_creation_cone "Example"
def MakeConeR1R2H(self,theR1, theR2, theH):
# Example: see GEOM_TestAll.py
+ theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a torus with given center, normal vector and radiuses.
# @ref tui_creation_torus "Example"
def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
# Example: see GEOM_TestAll.py
+ theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a torus with given radiuses at the origin of coordinate system.
# @ref tui_creation_torus "Example"
def MakeTorusRR(self, theRMajor, theRMinor):
# Example: see GEOM_TestAll.py
+ theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
RaiseIfFailed("MakeTorusRR", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
# end of l3_3d_primitives
double y = GroupDimensions->SpinBox_DY->value();
double z = GroupDimensions->SpinBox_DZ->value();
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
+
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
aParameters << GroupDimensions->SpinBox_DZ->text();
- getOperation()->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
res = true;
}
break;
// function : isValid
// purpose :
//=================================================================================
-bool PrimitiveGUI_ConeDlg::isValid (QString&)
+bool PrimitiveGUI_ConeDlg::isValid (QString& msg)
{
- return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ {
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
+ else if( getConstructorId() == 1 )
+ {
+ ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
+ return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
//=================================================================================
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
+
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ aParameters << GroupPoints->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
+
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ aParameters << GroupDimensions->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
}
// function : isValid
// purpose :
//=================================================================================
-bool PrimitiveGUI_CylinderDlg::isValid (QString&)
+bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
{
- return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ {
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+ else if( getConstructorId() == 1 )
+ {
+ ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+ return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
//=================================================================================
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
+
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderRH(getRadius(), getHeight());
+
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
}
// function : isValid
// purpose :
//=================================================================================
-bool PrimitiveGUI_DiskDlg::isValid (QString&)
+bool PrimitiveGUI_DiskDlg::isValid (QString& msg)
{
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ else if( getConstructorId() == 1 )
+ ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+
const int id = getConstructorId();
if (id == 0)
- return true;
+ return ok;
else if (id == 1)
- return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
+ return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0 && ok;
else if (id == 2)
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual(myPoint1, myPoint2) && !isEqual(myPoint1, myPoint3) && !isEqual(myPoint2, myPoint3);
bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
{
bool res = false;
+ QStringList aParameters;
GEOM::GEOM_Object_var anObj;
case 0:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskR(getRadius(), myOrientationType);
+
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskPntVecR(myPoint, myDir, getRadius());
+
+ aParameters << GroupPntVecR->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
case 2:
//=================================================================================
bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
{
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ {
+ ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+ else if( getConstructorId() == 1 )
+ {
+ ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+
const int id = getConstructorId();
if ( id == 0 )
- return true;
+ return ok;
else if ( id == 1 ) {
if (GroupType->RadioButton1->isChecked())
- return !myEdge->_is_nil();
+ return !myEdge->_is_nil() && ok;
else if (GroupType->RadioButton2->isChecked())
- return !myFace->_is_nil();
+ return !myFace->_is_nil() && ok;
}
return false;
}
bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
{
bool res = false;
+ QStringList aParameters;
GEOM::GEOM_Object_var anObj;
switch (getConstructorId()) {
case 0:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
GroupDimensions->SpinBox_DY->value(), myOrientationType);
+
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
case 1:
else if (GroupType->RadioButton2->isChecked())
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
+
+ aParameters << GroupPlane->SpinBox_DX->text();
+ aParameters << GroupPlane->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
}
//=================================================================================
bool PrimitiveGUI_SphereDlg::isValid( QString& msg )
{
- return getConstructorId() == 0 ? !myPoint->_is_nil() : true;
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ else if( getConstructorId() == 1 )
+ ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ return getConstructorId() == 0 ? !myPoint->_is_nil() && ok : ok;
}
//=================================================================================
{
if ( !CORBA::is_nil( myPoint ) ) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
+
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
}
break;
case 1 :
{
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
+
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
}
// function : isValid
// purpose :
//=================================================================================
-bool PrimitiveGUI_TorusDlg::isValid (QString&)
+bool PrimitiveGUI_TorusDlg::isValid (QString& msg)
{
- return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ {
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+ else if( getConstructorId() == 1 )
+ {
+ ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+ return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
//=================================================================================
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
+
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusRR(getRadius1(), getRadius2());
+
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
res = true;
break;
}