Implementation notebook in the GEOM.

This commit is contained in:
rnv 2008-11-18 15:39:06 +00:00
parent 46248f9be4
commit a272957cb4
13 changed files with 132 additions and 49 deletions

View File

@ -621,7 +621,7 @@ bool BasicGUI_CircleDlg::isValid( QString& msg )
//return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
//nil point means origin of global CS
//nil vector means Z axis
return getRadius() > 0;
return getRadius() > 0 && GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview());
else if ( id == 1 )
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
@ -643,9 +643,15 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects )
switch ( getConstructorId() ) {
case 0 :
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
res = true;
break;
{
QStringList aParameters;
aParameters << GroupPntVecR->SpinBox_DX->text();
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
if ( !anObj->_is_nil() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
res = true;
break;
}
case 1 :
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 );
res = true;

View File

@ -409,7 +409,10 @@ bool BasicGUI_EllipseDlg::isValid( QString& msg )
//return !myPoint->_is_nil() && !myDir->_is_nil();
//nil point means origin of global CS
//nil vector means Z axis
return true;
bool ok = true;
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
return ok;
}
//=================================================================================
@ -420,11 +423,17 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects )
{
double aMajorR = GroupPoints->SpinBox_DX->value();
double aMinorR = GroupPoints->SpinBox_DY->value();
QStringList aParameters;
aParameters<<GroupPoints->SpinBox_DX->text();
aParameters<<GroupPoints->SpinBox_DY->text();
GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR );
if ( !anObj->_is_nil() )
for(int i = 0;i< aParameters.size();i++)
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !anObj->_is_nil() ) {
objects.push_back( anObj._retn() );
}
return true;
}

View File

@ -99,13 +99,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
QVBoxLayout* anOriGrpLayout = new QVBoxLayout( anOriGrp );
anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), anOriGrp ) );
myData[ X ] = new QDoubleSpinBox( anOriGrp );
myData[ X ] = new SalomeApp_DoubleSpinBox( anOriGrp );
anOriGrpLayout->addWidget( myData[ X ] );
anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), anOriGrp ) );
myData[ Y ] = new QDoubleSpinBox( anOriGrp );
myData[ Y ] = new SalomeApp_DoubleSpinBox( anOriGrp );
anOriGrpLayout->addWidget( myData[ Y ] );
anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), anOriGrp ) );
myData[ Z ] = new QDoubleSpinBox( anOriGrp );
myData[ Z ] = new SalomeApp_DoubleSpinBox( anOriGrp );
anOriGrpLayout->addWidget( myData[ Z ] );
aMainGrpLayout->addWidget( anOriGrp );
@ -114,13 +114,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
QVBoxLayout* aXAxisGrpLayout = new QVBoxLayout( aXAxisGrp );
aXAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), aXAxisGrp ) );
myData[ DX1 ] = new QDoubleSpinBox( aXAxisGrp );
myData[ DX1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp );
aXAxisGrpLayout->addWidget( myData[ DX1 ] );
aXAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), aXAxisGrp ) );
myData[ DY1 ] = new QDoubleSpinBox( aXAxisGrp );
myData[ DY1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp );
aXAxisGrpLayout->addWidget( myData[ DY1 ] );
aXAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), aXAxisGrp ) );
myData[ DZ1 ] = new QDoubleSpinBox( aXAxisGrp );
myData[ DZ1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp );
aXAxisGrpLayout->addWidget( myData[ DZ1 ] );
aMainGrpLayout->addWidget( aXAxisGrp );
@ -129,13 +129,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
QVBoxLayout* anYAxisGrpLayout = new QVBoxLayout( anYAxisGrp );
anYAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), anYAxisGrp ) );
myData[ DX2 ] = new QDoubleSpinBox( anYAxisGrp );
myData[ DX2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp );
anYAxisGrpLayout->addWidget( myData[ DX2 ] );
anYAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), anYAxisGrp ) );
myData[ DY2 ] = new QDoubleSpinBox( anYAxisGrp );
myData[ DY2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp );
anYAxisGrpLayout->addWidget( myData[ DY2 ] );
anYAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), anYAxisGrp ) );
myData[ DZ2 ] = new QDoubleSpinBox( anYAxisGrp );
myData[ DZ2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp );
anYAxisGrpLayout->addWidget( myData[ DZ2 ] );
aMainGrpLayout->addWidget( anYAxisGrp );
@ -698,8 +698,12 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg )
}
switch ( id ) {
case 0:
return isOk;
case 0: {
bool ok = true;
for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
ok = anIter.value()->isValid( msg, !IsPreview()) && ok;
return isOk && ok;
}
case 1:
return !Group1->LineEdit1->text().isEmpty() && isOk;
case 2:
@ -720,9 +724,21 @@ bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
getOperation() )->MakeMarker( myData[ X ]->value(), myData[ Y ]->value(), myData[ Z ]->value(),
myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value(),
myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() );
if ( !anObj->_is_nil() )
QStringList aParameters;
aParameters<<myData[X]->text();
aParameters<<myData[Y]->text();
aParameters<<myData[Z]->text();
aParameters<<myData[ DX1 ]->text();
aParameters<<myData[ DY1 ]->text();
aParameters<<myData[ DZ1 ]->text();
aParameters<<myData[ DX2 ]->text();
aParameters<<myData[ DY2 ]->text();
aParameters<<myData[ DZ2 ]->text();
if ( !anObj->_is_nil() ) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
return true;
}

View File

@ -32,7 +32,7 @@
class DlgRef_1Sel;
class DlgRef_3Sel;
class QDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class QFrame;
class BasicGUI_MarkerDlg : public GEOMBase_Skeleton
@ -41,7 +41,7 @@ class BasicGUI_MarkerDlg : public GEOMBase_Skeleton
private:
enum { X, Y, Z, DX1, DY1, DZ1, DX2, DY2, DZ2 };
typedef QMap< int, QDoubleSpinBox* > DataMap;
typedef QMap< int, SalomeApp_DoubleSpinBox* > DataMap;
public:
BasicGUI_MarkerDlg( GeometryGUI*, QWidget* );

View File

@ -569,6 +569,20 @@ double BasicGUI_PlaneDlg::getSize() const
return 0.;
}
//=================================================================================
// function : getSize()
// purpose :
//=================================================================================
QString BasicGUI_PlaneDlg::getSizeAsString() const
{
switch ( getConstructorId() ) {
case 0 : return GroupPntDir->SpinBox_DX->text();
case 1 : return Group3Pnts->SpinBox_DX->text();
case 2 : return GroupFace->SpinBox_DX->text();
}
return QString();
}
//=================================================================================
// function : createOperation
// purpose :
@ -598,13 +612,17 @@ bool BasicGUI_PlaneDlg::isValid( QString& msg )
msg = QString( "Please, enter size greater than 0." );
return false;
}
if ( id == 0 )
return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir );
else if ( id == 1 )
return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) &&
GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() );
else if ( id == 1 ) {
return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ) &&
Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() );;
}
else if ( id == 2 )
return !CORBA::is_nil( myFace );
return !CORBA::is_nil( myFace ) && GroupFace->SpinBox_DX->isValid( msg, !IsPreview() );
return false;
}
@ -632,10 +650,11 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects )
res = true;
break;
}
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
if ( !anObj->_is_nil() ) {
anObj->SetParameters(getSizeAsString().toLatin1().constData());
objects.push_back( anObj._retn() );
}
return res;
}
//=================================================================================

View File

@ -55,6 +55,7 @@ private:
void Init();
void enterEvent( QEvent* );
double getSize() const;
QString getSizeAsString() const;
private:
GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace;

View File

@ -453,7 +453,16 @@ GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation()
//=================================================================================
bool BasicGUI_VectorDlg::isValid( QString& msg )
{
return getConstructorId() == 0 ? !myPoint1->_is_nil() && !myPoint2->_is_nil() : true;
if(getConstructorId() == 0)
return !myPoint1->_is_nil() && !myPoint2->_is_nil();
else if(getConstructorId() == 1)
{
bool ok = true;
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 ok;
}
}
//=================================================================================
@ -478,7 +487,16 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
double dx = GroupDimensions->SpinBox_DX->value();
double dy = GroupDimensions->SpinBox_DY->value();
double dz = GroupDimensions->SpinBox_DZ->value();
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
aParameters << GroupDimensions->SpinBox_DZ->text();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx, dy, dz );
if ( !anObj->_is_nil() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
res = true;
break;
}

View File

@ -56,7 +56,7 @@
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel3" >
@ -153,9 +153,9 @@
<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>

View File

@ -56,10 +56,10 @@
<number>6</number>
</property>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="3" column="0" >
<widget class="QLabel" name="TextLabel4" >
@ -166,9 +166,9 @@
<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>

View File

@ -180,7 +180,7 @@
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
</layout>
</widget>
@ -191,10 +191,10 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
</customwidget>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>PushButton1</tabstop>

View File

@ -111,13 +111,13 @@
</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="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="2" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
</layout>
</widget>
@ -128,9 +128,9 @@
<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>

View File

@ -152,7 +152,7 @@ SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
//=======================================================================
char* GeometryGUI::JoinObjectParameters(const QStringList& theParametersList)
{
return (char*)theParametersList.join(":").toLatin1().constData();
return theParametersList.join(":").toLatin1().data();
}
//=======================================================================
// function : GeometryGUI::GeometryGUI()

View File

@ -326,7 +326,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
#
# @ref swig_MakeVertexOnSurface "Example"
def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
theUParameter, theVParameter, Parameters = ParseParameters(theParameter)
theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
RaiseIfFailed("MakePointOnSurface", self.BasicOp)
@ -364,8 +364,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_vector "Example"
def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a vector between two points.
@ -427,8 +429,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_plane "Example"
def MakePlane(self,thePnt, theVec, theTrimSize):
# Example: see GEOM_TestAll.py
theTrimSize, Parameters = ParseParameters(theTrimSize);
anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
RaiseIfFailed("MakePlanePntVec", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a plane, passing through the three given points
@ -441,8 +445,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_plane "Example"
def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
# Example: see GEOM_TestAll.py
theTrimSize, Parameters = ParseParameters(theTrimSize);
anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a plane, similar to the existing one, but with another size of representing face.
@ -453,8 +459,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_plane "Example"
def MakePlaneFace(self,theFace, theTrimSize):
# Example: see GEOM_TestAll.py
theTrimSize, Parameters = ParseParameters(theTrimSize);
anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
RaiseIfFailed("MakePlaneFace", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a local coordinate system.
@ -466,8 +474,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref swig_MakeMarker "Example"
def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
# Example: see GEOM_TestAll.py
OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
RaiseIfFailed("MakeMarker", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a local coordinate system.
@ -535,8 +545,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_circle "Example"
def MakeCircle(self, thePnt, theVec, theR):
# Example: see GEOM_TestAll.py
theR, Parameters = ParseParameters(theR)
anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
anObj.SetParameters(Parameters)
return anObj
## Create a circle with given radius.
@ -583,8 +595,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_ellipse "Example"
def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor):
# Example: see GEOM_TestAll.py
theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
RaiseIfFailed("MakeEllipse", self.CurvesOp)
anObj.SetParameters(Parameters)
return anObj
## Create an ellipse with given radiuses.