mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-30 04:00:32 +05:00
Implementation Notebook in the GEOM.
This commit is contained in:
parent
38e241bb31
commit
8f8acbd807
@ -104,8 +104,8 @@ def ParseParameters(*parameters):
|
||||
if isinstance(parameter,str):
|
||||
if notebook.isVariable(parameter):
|
||||
Result.append(notebook.get(parameter))
|
||||
pass
|
||||
pass
|
||||
else:
|
||||
raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
|
||||
else:
|
||||
Result.append(parameter)
|
||||
pass
|
||||
|
@ -77,6 +77,7 @@ private slots:
|
||||
void SetEditCurrentArgument();
|
||||
void ReverseAngle();
|
||||
void ValueChangedInSpinBox( double );
|
||||
void TextValueChangedInSpinBox( const QString& );
|
||||
void ConstructorsClicked( int );
|
||||
void SetDoubleSpinBoxStep( double );
|
||||
};
|
||||
|
@ -184,6 +184,13 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
||||
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )),
|
||||
this, SLOT(TextValueChangedInSpinBox(const QString& )));
|
||||
connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )),
|
||||
this, SLOT(TextValueChangedInSpinBox(const QString& )));
|
||||
connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )),
|
||||
this, SLOT(TextValueChangedInSpinBox(const QString& )));
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
|
||||
@ -505,6 +512,40 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : TextValueChangedInSpinBox
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QString& s)
|
||||
{
|
||||
QObject* send = (QObject*)sender();
|
||||
bool isDigit = true;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
GroupPoints->SpinBox_DX->text().toDouble(&isDigit);
|
||||
if(!isDigit){
|
||||
GroupPoints->CheckButton1->setChecked(false);
|
||||
}
|
||||
GroupPoints->CheckButton1->setEnabled(isDigit);
|
||||
break;
|
||||
case 1:
|
||||
if (send == GroupDimensions->SpinBox_DX1) {
|
||||
GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit);
|
||||
if(!isDigit)
|
||||
GroupDimensions->CheckButton1->setChecked(false);
|
||||
GroupDimensions->CheckButton1->setEnabled(isDigit);
|
||||
}
|
||||
else if(send == GroupDimensions->SpinBox_DX2){
|
||||
GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit);
|
||||
if(!isDigit)
|
||||
GroupDimensions->CheckButton2->setChecked(false);
|
||||
GroupDimensions->CheckButton2->setEnabled(isDigit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -512,7 +553,6 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
|
||||
void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue)
|
||||
{
|
||||
QObject* send = (QObject*)sender();
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (send == GroupPoints->SpinBox_DX)
|
||||
@ -579,14 +619,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiTranslationDlg::isValid (QString& /*msg*/)
|
||||
bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
|
||||
{
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if (aConstructorId == 0)
|
||||
return !(myBase->_is_nil() || myVectorU->_is_nil());
|
||||
else if (aConstructorId == 1)
|
||||
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil());
|
||||
|
||||
if (aConstructorId == 0) {
|
||||
bool ok = true;
|
||||
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
|
||||
return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok;
|
||||
}
|
||||
else if (aConstructorId == 1) {
|
||||
bool ok = true;
|
||||
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
|
||||
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -600,11 +650,17 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
QStringList aParameters;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
|
||||
if(!IsPreview()) {
|
||||
aParameters<<GroupPoints->SpinBox_DX->text();
|
||||
aParameters<<GroupPoints->SpinBox_DY->text();
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
@ -614,13 +670,22 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
|
||||
myVectorV, myStepV, myNbTimesV);
|
||||
if(!IsPreview()) {
|
||||
aParameters<<GroupDimensions->SpinBox_DX1->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DY1->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DX2->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DY2->text();
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ private slots:
|
||||
void ReverseStepU();
|
||||
void ReverseStepV();
|
||||
void ValueChangedInSpinBox( double );
|
||||
void TextValueChangedInSpinBox( const QString& );
|
||||
void ConstructorsClicked( int );
|
||||
void SetDoubleSpinBoxStep( double );
|
||||
};
|
||||
|
@ -278,7 +278,7 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -295,8 +295,12 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
|
||||
if ( !anObj->_is_nil() )
|
||||
if ( !anObj->_is_nil() ) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
|
||||
}
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -151,6 +151,9 @@ void TransformationGUI_RotationDlg::Init()
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )),
|
||||
this, SLOT(TextValueChangedInSpinBox( const QString&)));
|
||||
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
|
||||
|
||||
@ -464,6 +467,16 @@ void TransformationGUI_RotationDlg::enterEvent (QEvent*)
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s)
|
||||
{
|
||||
bool isDigit = true;
|
||||
s.toDouble(&isDigit);
|
||||
if(!isDigit) {
|
||||
GroupPoints->CheckButton2->setChecked(false);
|
||||
}
|
||||
GroupPoints->CheckButton2->setEnabled(isDigit);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
@ -486,13 +499,13 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
|
||||
bool TransformationGUI_RotationDlg::isValid (QString& msg)
|
||||
{
|
||||
if (myObjects.length() < 1) return false;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
return !(myAxis->_is_nil());
|
||||
return !(myAxis->_is_nil()) && GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
|
||||
break;
|
||||
case 1:
|
||||
return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
@ -522,8 +535,12 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
|
||||
if (!anObj->_is_nil())
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
|
||||
}
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -74,6 +74,7 @@ private slots:
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ValueChangedInSpinBox();
|
||||
void TextValueChangedInSpinBox( const QString& );
|
||||
void CreateCopyModeChanged( bool );
|
||||
void ConstructorsClicked( int );
|
||||
void onReverse();
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <QtxDoubleSpinBox.h>
|
||||
#include <SalomeApp_DoubleSpinBox.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
@ -92,13 +92,13 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometry
|
||||
LineEdit2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
|
||||
TextLabel3 = new QLabel(tr("GEOM_SCALE_FACTOR"), GroupBox1);
|
||||
SpinBox_FX = new QtxDoubleSpinBox(GroupBox1);
|
||||
SpinBox_FX = new SalomeApp_DoubleSpinBox(GroupBox1);
|
||||
|
||||
TextLabel4 = new QLabel(tr("GEOM_SCALE_FACTOR_Y"), GroupBox1);
|
||||
SpinBox_FY = new QtxDoubleSpinBox(GroupBox1);
|
||||
SpinBox_FY = new SalomeApp_DoubleSpinBox(GroupBox1);
|
||||
|
||||
TextLabel5 = new QLabel(tr("GEOM_SCALE_FACTOR_Z"), GroupBox1);
|
||||
SpinBox_FZ = new QtxDoubleSpinBox(GroupBox1);
|
||||
SpinBox_FZ = new SalomeApp_DoubleSpinBox(GroupBox1);
|
||||
|
||||
CheckBoxCopy = new QCheckBox(tr("GEOM_CREATE_COPY"), GroupBox1);
|
||||
CheckBoxCopy->setChecked(true);
|
||||
@ -458,15 +458,19 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ScaleDlg::isValid (QString& /*msg*/)
|
||||
bool TransformationGUI_ScaleDlg::isValid (QString& msg)
|
||||
{
|
||||
if (myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001)
|
||||
{
|
||||
// && !myPoint->_is_nil()
|
||||
if (getConstructorId() == 0)
|
||||
return true;
|
||||
if (getConstructorId() == 0) {
|
||||
return SpinBox_FX->isValid( msg, !IsPreview() );
|
||||
}
|
||||
if (fabs(SpinBox_FY->value()) > 0.00001 &&
|
||||
fabs(SpinBox_FZ->value()) > 0.00001)
|
||||
fabs(SpinBox_FZ->value()) > 0.00001 &&
|
||||
SpinBox_FX->isValid( msg, !IsPreview()) &&
|
||||
SpinBox_FY->isValid( msg, !IsPreview()) &&
|
||||
SpinBox_FZ->isValid( msg, !IsPreview()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -492,8 +496,11 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
{
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
|
||||
if (!anObj->_is_nil())
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -518,6 +525,13 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value());
|
||||
if (!anObj->_is_nil())
|
||||
if(!IsPreview()) {
|
||||
QStringList aParameters;
|
||||
aParameters<<SpinBox_FX->text();
|
||||
aParameters<<SpinBox_FY->text();
|
||||
aParameters<<SpinBox_FZ->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
}
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QtxDoubleSpinBox;
|
||||
class SalomeApp_DoubleSpinBox;
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_ScaleDlg
|
||||
@ -79,9 +79,9 @@ private:
|
||||
QLabel* TextLabel3;
|
||||
QLabel* TextLabel4;
|
||||
QLabel* TextLabel5;
|
||||
QtxDoubleSpinBox* SpinBox_FX;
|
||||
QtxDoubleSpinBox* SpinBox_FY;
|
||||
QtxDoubleSpinBox* SpinBox_FZ;
|
||||
SalomeApp_DoubleSpinBox* SpinBox_FX;
|
||||
SalomeApp_DoubleSpinBox* SpinBox_FY;
|
||||
SalomeApp_DoubleSpinBox* SpinBox_FZ;
|
||||
QCheckBox* CheckBoxCopy;
|
||||
|
||||
private slots:
|
||||
|
@ -516,19 +516,25 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_TranslationDlg::isValid (QString& /*msg*/)
|
||||
bool TransformationGUI_TranslationDlg::isValid (QString& msg)
|
||||
{
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
if (myObjects.length() < 1) return false;
|
||||
|
||||
switch (aConstructorId) {
|
||||
case 0:
|
||||
return true;
|
||||
case 0:
|
||||
{
|
||||
bool ok = true;
|
||||
ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
|
||||
return ok;
|
||||
}
|
||||
case 1:
|
||||
return !(myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
case 2:
|
||||
return !(myVector->_is_nil());
|
||||
return !(myVector->_is_nil()) && GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -553,13 +559,21 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
double dy = GroupPoints->SpinBox2->value();
|
||||
double dz = GroupPoints->SpinBox3->value();
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters<<GroupPoints->SpinBox1->text();
|
||||
aParameters<<GroupPoints->SpinBox2->text();
|
||||
aParameters<<GroupPoints->SpinBox3->text();
|
||||
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
|
||||
if (!anObj->_is_nil())
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -599,6 +613,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
QStringList aParameters;
|
||||
bool byDistance = GroupPoints->CheckBox1->isChecked();
|
||||
if (byDistance) {
|
||||
double aDistance = GroupPoints->SpinBox3->value();
|
||||
@ -606,8 +621,12 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
|
||||
if (!anObj->_is_nil())
|
||||
if (!anObj->_is_nil()) {
|
||||
if(toCreateCopy)
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(GroupPoints->SpinBox3->text().toLatin1().constData());
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user