mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
Eliminate useless GetSubShape() lines in the python dump
This commit is contained in:
parent
0514da352f
commit
03f77667e6
@ -92,7 +92,7 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg (GeometryGUI* theGeomet
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
CreateCopyModeChanged();
|
||||
|
||||
Init();
|
||||
}
|
||||
@ -119,7 +119,8 @@ void TransformationGUI_MirrorDlg::Init()
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
myObjects.clear();
|
||||
myArgument.nullify();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -132,10 +133,7 @@ void TransformationGUI_MirrorDlg::Init()
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
|
||||
|
||||
initName(tr("GEOM_MIRROR"));
|
||||
|
||||
@ -152,7 +150,7 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked (int constructorId)
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
GroupPoints->LineEdit2->clear();
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
myArgument.nullify();
|
||||
|
||||
switch (constructorId) {
|
||||
case 0: // mirror an object by point
|
||||
@ -198,7 +196,7 @@ bool TransformationGUI_MirrorDlg::ClickOnApply()
|
||||
|
||||
initName();
|
||||
|
||||
myObjects.length(0);
|
||||
myObjects.clear();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setText("");
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
@ -215,89 +213,35 @@ bool TransformationGUI_MirrorDlg::ClickOnApply()
|
||||
void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
|
||||
myObjects = getSelected( TopAbs_SHAPE, -1 );
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else {
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
myArgument = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
if ( CORBA::is_nil(myArgument) )
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(myArgument);
|
||||
|
||||
}
|
||||
else {
|
||||
TopAbs_ShapeEnum aNeedType = ( getConstructorId() == 1 ) ?
|
||||
TopAbs_EDGE : ( ( getConstructorId() == 2 ) ? TopAbs_FACE : TopAbs_VERTEX );
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
|
||||
TopoDS_Shape aShape;
|
||||
if (GEOMBase::GetShape(myArgument, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
if (getConstructorId() == 1)
|
||||
aNeedType = TopAbs_EDGE;
|
||||
else if (getConstructorId() == 2)
|
||||
aNeedType = TopAbs_FACE;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
if (aNeedType == TopAbs_VERTEX)
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
else
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(myArgument, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
myArgument = aShapesOp->GetSubShape(myArgument, anIndex);
|
||||
}
|
||||
else {
|
||||
myArgument = aFindedObject; // get Object from study
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aShape.ShapeType() != aNeedType) {
|
||||
myArgument = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myArgument->_is_nil() && !myObjects.length())
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
myArgument = aSelectedObject;
|
||||
if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
/* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));*/
|
||||
// here commented, because multiple objects can be selected IPAL 21437
|
||||
else {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
|
||||
myArgument.nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -331,6 +275,7 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
||||
break;
|
||||
case 2:
|
||||
globalSelection(GEOM_PLANE);
|
||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -350,20 +295,6 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == GroupPoints->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -402,7 +333,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MirrorDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MirrorDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
return !(myObjects.length() == 0 || myArgument->_is_nil());
|
||||
return !myObjects.isEmpty() && myArgument;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -422,15 +353,15 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
|
||||
case 0:
|
||||
{
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->MirrorPointCopy(myObjects[i], myArgument);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->MirrorPointCopy(myObjects[i].get(), myArgument.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->MirrorPoint(myObjects[i], myArgument);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->MirrorPoint(myObjects[i].get(), myArgument.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -441,15 +372,15 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
|
||||
case 1:
|
||||
{
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->MirrorAxisCopy(myObjects[i], myArgument);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->MirrorAxisCopy(myObjects[i].get(), myArgument.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->MirrorAxis(myObjects[i], myArgument);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->MirrorAxis(myObjects[i].get(), myArgument.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -460,15 +391,15 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
|
||||
case 2:
|
||||
{
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->MirrorPlaneCopy(myObjects[i], myArgument);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->MirrorPlaneCopy(myObjects[i].get(), myArgument.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->MirrorPlane(myObjects[i], myArgument);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->MirrorPlane(myObjects[i].get(), myArgument.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -501,9 +432,9 @@ void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr theStu
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MirrorDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
void TransformationGUI_MirrorDlg::CreateCopyModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckButton1->isChecked());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -514,18 +445,14 @@ void TransformationGUI_MirrorDlg::addSubshapesToStudy()
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
||||
if (toCreateCopy) {
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myArgument;
|
||||
break;
|
||||
case 1:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myArgument;
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
GEOMBase::PublishSubObject( myArgument.get() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_MIRRORDLG_H
|
||||
#define TRANSFORMATIONGUI_MIRRORDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_2Sel1Spin2Check;
|
||||
|
||||
@ -57,8 +58,8 @@ private:
|
||||
void enterEvent( QEvent* );
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myArgument;
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GeomObjPtr myArgument;
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
@ -69,11 +70,10 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked( int );
|
||||
void CreateCopyModeChanged( bool );
|
||||
void CreateCopyModeChanged();
|
||||
};
|
||||
|
||||
#endif // TRANSFORMATIONGUI_MIRRORDLG_H
|
||||
|
@ -126,6 +126,11 @@ void TransformationGUI_MultiRotationDlg::Init()
|
||||
|
||||
int SpecificStep1 = 5;
|
||||
int SpecificStep2 = 1;
|
||||
// init variables
|
||||
myAng = 45.0;
|
||||
myStep = 50.0;
|
||||
myNbTimes1 = myNbTimes2 = 2;
|
||||
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
|
||||
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
||||
@ -139,18 +144,14 @@ void TransformationGUI_MultiRotationDlg::Init()
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStep);
|
||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
|
||||
|
||||
// init variables
|
||||
myAng = 45.0;
|
||||
myStep = 50.0;
|
||||
myNbTimes1 = myNbTimes2 = 2;
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
myBase.nullify();
|
||||
myVector.nullify();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -165,11 +166,6 @@ void TransformationGUI_MultiRotationDlg::Init()
|
||||
connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
|
||||
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
|
||||
@ -219,7 +215,8 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId)
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
myBase.nullify();
|
||||
myVector.nullify();
|
||||
|
||||
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
|
||||
|
||||
@ -233,7 +230,8 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId)
|
||||
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
myBase = myVector = GEOM::GEOM_Object::_nil();
|
||||
myBase.nullify();
|
||||
myVector.nullify();
|
||||
|
||||
GroupDimensions->SpinBox_DX1->setValue(myAng);
|
||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
|
||||
@ -290,82 +288,33 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply()
|
||||
void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2)
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
GEOM::GEOM_Object_var aSelectedObject =
|
||||
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
|
||||
if ( !GEOMBase::IsShape(aSelectedObject) )
|
||||
return;
|
||||
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = aSelectedObject;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||
TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 ) ?
|
||||
TopAbs_EDGE : TopAbs_SHAPE;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
myVector = aFindedObject; // get existing object
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aShape.ShapeType() != TopAbs_EDGE) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
myVector = aSelectedObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVector->_is_nil())
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
|
||||
myBase = aSelectedObject;
|
||||
if ( !myVector )
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if (!myVector->_is_nil() && myBase->_is_nil())
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
myVector = aSelectedObject;
|
||||
if ( !myBase )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVector->_is_nil())
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
|
||||
myBase = aSelectedObject;
|
||||
if ( !myVector )
|
||||
GroupDimensions->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||
if (!myVector->_is_nil() && myBase->_is_nil())
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) {
|
||||
myVector = aSelectedObject;
|
||||
if ( !myBase )
|
||||
GroupDimensions->PushButton1->click();
|
||||
}
|
||||
|
||||
@ -374,6 +323,16 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
else {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
||||
myBase.nullify();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
|
||||
myVector.nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -430,20 +389,6 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -542,19 +487,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
|
||||
{
|
||||
bool ok = true;
|
||||
bool ok = false;
|
||||
switch(getConstructorId()){
|
||||
case 0:
|
||||
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myBase && myVector;
|
||||
break;
|
||||
case 1:
|
||||
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;
|
||||
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
|
||||
GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
|
||||
GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
|
||||
GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
|
||||
myBase && myVector;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return !(myBase->_is_nil() || myVector->_is_nil()) && ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -572,16 +520,16 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
|
||||
anObj = anOper->MultiRotate1D(myBase, myVector, myNbTimes1);
|
||||
if ( myBase && myVector ) {
|
||||
anObj = anOper->MultiRotate1D(myBase.get(), myVector.get(), myNbTimes1);
|
||||
if(!IsPreview())
|
||||
aParameters<<GroupPoints->SpinBox_DX->text();
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
|
||||
anObj = anOper->MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
|
||||
if ( myBase && myVector ) {
|
||||
anObj = anOper->MultiRotate2D(myBase.get(), myVector.get(), myAng, myNbTimes1, myStep, myNbTimes2);
|
||||
if(!IsPreview()) {
|
||||
aParameters<<GroupDimensions->SpinBox_DX1->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DY1->text();
|
||||
@ -608,17 +556,14 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myVector;
|
||||
break;
|
||||
case 1:
|
||||
objMap[GroupDimensions->LineEdit2->text()] = myVector;
|
||||
GEOMBase::PublishSubObject( myVector.get() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -634,7 +579,7 @@ void TransformationGUI_MultiRotationDlg::restoreSubShapes (SALOMEDS::Study_ptr
|
||||
// and we need to point the first argument directly
|
||||
GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
|
||||
anArgs->length(1);
|
||||
anArgs[0] = myBase;
|
||||
anArgs[0] = myBase.copy();
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
|
||||
/*theFindMethod=*/GEOM::FSM_MultiTransformed,
|
||||
/*theInheritFirstArg=*/true,
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H
|
||||
#define TRANSFORMATIONGUI_MULTIROTATIONDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_2Sel4Spin1Check;
|
||||
class DlgRef_2Sel1SpinInt;
|
||||
@ -58,7 +59,7 @@ private:
|
||||
void enterEvent( QEvent* );
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myBase, myVector;
|
||||
GEOM::GeomObjPtr myBase, myVector;
|
||||
int myNbTimes1;
|
||||
int myNbTimes2;
|
||||
Standard_Real myAng;
|
||||
@ -74,7 +75,6 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ReverseAngle();
|
||||
|
@ -141,6 +141,10 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
int SpecificStep = 1;
|
||||
// init variables
|
||||
myStepU = myStepV = 50.0;
|
||||
myNbTimesU = myNbTimesV = 2;
|
||||
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
|
||||
initSpinBox(GroupPoints->SpinBox_DY, 1, 999, SpecificStep);
|
||||
@ -156,10 +160,6 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
||||
GroupDimensions->SpinBox_DX2->setValue(myStepV);
|
||||
GroupDimensions->SpinBox_DY2->setValue(myNbTimesV);
|
||||
|
||||
// init variables
|
||||
myStepU = myStepV = 50.0;
|
||||
myNbTimesU = myNbTimesV = 2;
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
|
||||
@ -167,7 +167,9 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
GroupDimensions->LineEdit3->setText("");
|
||||
|
||||
myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
|
||||
myBase.nullify();
|
||||
myVectorU.nullify();
|
||||
myVectorV.nullify();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -183,12 +185,6 @@ void TransformationGUI_MultiTranslationDlg::Init()
|
||||
connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
|
||||
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
@ -246,7 +242,8 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructor
|
||||
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
myBase = myVectorU = GEOM::GEOM_Object::_nil();
|
||||
myBase.nullify();
|
||||
myVectorU.nullify();
|
||||
|
||||
GroupPoints->SpinBox_DX->setValue(myStepU);
|
||||
GroupPoints->SpinBox_DY->setValue(myNbTimesU);
|
||||
@ -262,7 +259,9 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked (int constructor
|
||||
GroupDimensions->LineEdit1->setText("");
|
||||
GroupDimensions->LineEdit2->setText("");
|
||||
GroupDimensions->LineEdit3->setText("");
|
||||
myBase = myVectorU = myVectorV = GEOM::GEOM_Object::_nil();
|
||||
myBase.nullify();
|
||||
myVectorU.nullify();
|
||||
myVectorV.nullify();
|
||||
|
||||
GroupDimensions->SpinBox_DX1->setValue(myStepU);
|
||||
GroupDimensions->SpinBox_DY1->setValue(myNbTimesU);
|
||||
@ -319,105 +318,65 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
|
||||
void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2)
|
||||
myVectorU = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
|
||||
if ( !GEOMBase::IsShape(aSelectedObject) )
|
||||
return;
|
||||
|
||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1)
|
||||
myBase = aSelectedObject;
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit3 ) ?
|
||||
TopAbs_EDGE : TopAbs_SHAPE;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
else
|
||||
myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = aFindedObject;
|
||||
else
|
||||
myVectorU = aFindedObject;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aShape.ShapeType() != TopAbs_EDGE) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
if (myEditCurrentArgument == GroupDimensions->LineEdit3)
|
||||
myVectorV = aSelectedObject;
|
||||
else
|
||||
myVectorU = aSelectedObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVectorU->_is_nil())
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
|
||||
myBase = aSelectedObject;
|
||||
if ( !myVectorU )
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||
if (!myVectorU->_is_nil() && myBase->_is_nil())
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
||||
myVectorU = aSelectedObject;
|
||||
if ( !myBase )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit1) {
|
||||
if (!myBase->_is_nil() && myVectorU->_is_nil())
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
|
||||
myBase = aSelectedObject;
|
||||
if ( !myVectorU )
|
||||
GroupDimensions->PushButton2->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit2) {
|
||||
if (!myVectorU->_is_nil() && myVectorV->_is_nil())
|
||||
else if ( !myVectorV )
|
||||
GroupDimensions->PushButton3->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupDimensions->LineEdit3) {
|
||||
if (!myVectorV->_is_nil() && myBase->_is_nil())
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) {
|
||||
myVectorU = aSelectedObject;
|
||||
if ( !myVectorV )
|
||||
GroupDimensions->PushButton3->click();
|
||||
else if ( !myBase )
|
||||
GroupDimensions->PushButton1->click();
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) {
|
||||
myVectorV = aSelectedObject;
|
||||
if ( !myBase )
|
||||
GroupDimensions->PushButton1->click();
|
||||
else if ( !myVectorU )
|
||||
GroupDimensions->PushButton2->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
else {
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit1 )
|
||||
myBase.nullify();
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||
myEditCurrentArgument == GroupDimensions->LineEdit2 )
|
||||
myVectorU.nullify();
|
||||
else if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
|
||||
myVectorV.nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -488,21 +447,6 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
|
||||
send == GroupDimensions->LineEdit3) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -652,23 +596,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
|
||||
//=================================================================================
|
||||
bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
|
||||
{
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
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;
|
||||
bool ok = false;
|
||||
switch ( getConstructorId() ) {
|
||||
case 0:
|
||||
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
|
||||
GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
|
||||
myBase && myVectorU;
|
||||
break;
|
||||
case 1:
|
||||
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
|
||||
GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
|
||||
GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
|
||||
GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
|
||||
myBase && myVectorU && myVectorV;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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;
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -687,9 +632,9 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
|
||||
createPathPreview ( myVectorU );
|
||||
anObj = anOper->MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
|
||||
if ( myBase && myVectorU ) {
|
||||
createPathPreview ( myVectorU.get() );
|
||||
anObj = anOper->MultiTranslate1D(myBase.get(), myVectorU.get(), myStepU, myNbTimesU);
|
||||
if(!IsPreview()) {
|
||||
aParameters<<GroupPoints->SpinBox_DX->text();
|
||||
aParameters<<GroupPoints->SpinBox_DY->text();
|
||||
@ -698,13 +643,12 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
|
||||
!CORBA::is_nil(myVectorV)) {
|
||||
createPathPreview ( myVectorU );
|
||||
createPathPreview ( myVectorV );
|
||||
anObj = anOper->MultiTranslate2D(myBase,
|
||||
myVectorU, myStepU, myNbTimesU,
|
||||
myVectorV, myStepV, myNbTimesV);
|
||||
if ( myBase && myVectorU && myVectorV ) {
|
||||
createPathPreview ( myVectorU.get() );
|
||||
createPathPreview ( myVectorV.get() );
|
||||
anObj = anOper->MultiTranslate2D(myBase.get(),
|
||||
myVectorU.get(), myStepU, myNbTimesU,
|
||||
myVectorV.get(), myStepV, myNbTimesV);
|
||||
if(!IsPreview()) {
|
||||
aParameters<<GroupDimensions->SpinBox_DX1->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DY1->text();
|
||||
@ -731,18 +675,17 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myVectorU;
|
||||
GEOMBase::PublishSubObject( myVectorU.get() );
|
||||
break;
|
||||
case 1:
|
||||
objMap[GroupDimensions->LineEdit2->text()] = myVectorU;
|
||||
objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
|
||||
GEOMBase::PublishSubObject( myVectorU.get() );
|
||||
GEOMBase::PublishSubObject( myVectorV.get() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -758,7 +701,7 @@ void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_pt
|
||||
// and we need to point the first argument directly
|
||||
GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
|
||||
anArgs->length(1);
|
||||
anArgs[0] = myBase;
|
||||
anArgs[0] = myBase.copy();
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
|
||||
/*theFindMethod=*/GEOM::FSM_MultiTransformed,
|
||||
/*theInheritFirstArg=*/true,
|
||||
@ -770,7 +713,7 @@ void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_pt
|
||||
// function : createPathPreview
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Object_var thePath )
|
||||
void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Object_ptr thePath )
|
||||
{
|
||||
if ( IsPreview() ) {
|
||||
TopoDS_Shape aShape;
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
|
||||
#define TRANSFORMATIONGUI_MULTITRANSLATIONDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_2Sel2Spin1Check;
|
||||
class DlgRef_3Sel4Spin2Check;
|
||||
@ -56,10 +57,10 @@ protected:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void createPathPreview( GEOM::GEOM_Object_var );
|
||||
void createPathPreview( GEOM::GEOM_Object_ptr );
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myBase, myVectorU, myVectorV;
|
||||
GEOM::GeomObjPtr myBase, myVectorU, myVectorV;
|
||||
int myNbTimesU;
|
||||
int myNbTimesV;
|
||||
Standard_Real myStepU;
|
||||
@ -75,7 +76,6 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ReverseStepU();
|
||||
|
@ -102,6 +102,8 @@ void TransformationGUI_OffsetDlg::Init()
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
|
||||
myObjects.clear();
|
||||
|
||||
/* Get setting of step value from file configuration */
|
||||
double step = 1;
|
||||
|
||||
@ -111,7 +113,7 @@ void TransformationGUI_OffsetDlg::Init()
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked( true );
|
||||
CreateCopyModeChanged( true );
|
||||
CreateCopyModeChanged();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -124,7 +126,7 @@ void TransformationGUI_OffsetDlg::Init()
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged( bool ) ) );
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged() ) );
|
||||
|
||||
initName( tr( "GEOM_OFFSET" ) );
|
||||
|
||||
@ -165,44 +167,19 @@ bool TransformationGUI_OffsetDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void TransformationGUI_OffsetDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText( "" );
|
||||
QString aName;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if ( aNbSel < 1 ) {
|
||||
myObjects.length( 0 );
|
||||
return;
|
||||
myObjects = getSelected( TopAbs_SHAPE, -1 );
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else {
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
|
||||
// nbSel > 0
|
||||
GEOMBase::ConvertListOfIOInListOfGO (aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_OffsetDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if ( send == GroupPoints->LineEdit1 ) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
@ -271,17 +248,14 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_OffsetDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_OffsetDlg::isValid( QString& msg )
|
||||
{
|
||||
//return !(myObjects.length() == 0);
|
||||
if ( myObjects.length() == 0 ) return false;
|
||||
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myObjects.isEmpty();
|
||||
for ( int i = 0; i < myObjects.count() && ok; i++ ) {
|
||||
GEOM::shape_type aType = myObjects[i]->GetShapeType();
|
||||
if ( aType != GEOM::FACE && aType != GEOM::SHELL && aType != GEOM::SOLID ) {
|
||||
ok = aType == GEOM::FACE || aType == GEOM::SHELL || aType == GEOM::SOLID;
|
||||
if ( !ok )
|
||||
msg = tr( "ERROR_SHAPE_TYPE" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -297,9 +271,9 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
|
||||
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
|
||||
|
||||
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
for ( int i = 0; i < myObjects.count(); i++ ) {
|
||||
|
||||
anObj = anOper->OffsetShapeCopy( myObjects[i], GetOffset() );
|
||||
anObj = anOper->OffsetShapeCopy( myObjects[i].get(), GetOffset() );
|
||||
if ( !anObj->_is_nil() ) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
|
||||
@ -309,8 +283,8 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.length(); i++ ) {
|
||||
anObj = anOper->OffsetShape( myObjects[i], GetOffset() );
|
||||
for ( int i = 0; i < myObjects.count(); i++ ) {
|
||||
anObj = anOper->OffsetShape( myObjects[i].get(), GetOffset() );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
@ -349,7 +323,7 @@ double TransformationGUI_OffsetDlg::GetOffset() const
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_OffsetDlg::CreateCopyModeChanged( bool isCreateCopy )
|
||||
void TransformationGUI_OffsetDlg::CreateCopyModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled( isCreateCopy );
|
||||
mainFrame()->GroupBoxName->setEnabled( GroupPoints->CheckButton1->isChecked() );
|
||||
}
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_OFFSETDLG_H
|
||||
#define TRANSFORMATIONGUI_OFFSETDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_1Sel1Spin1Check;
|
||||
|
||||
@ -57,7 +58,7 @@ private:
|
||||
double GetOffset() const;
|
||||
|
||||
private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
|
||||
DlgRef_1Sel1Spin1Check* GroupPoints;
|
||||
|
||||
@ -66,10 +67,9 @@ private slots:
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void SelectionIntoArgument();
|
||||
void LineEditReturnPressed();
|
||||
void SetEditCurrentArgument();
|
||||
void ValueChangedInSpinBox();
|
||||
void CreateCopyModeChanged( bool );
|
||||
void CreateCopyModeChanged();
|
||||
};
|
||||
|
||||
#endif // TRANSFORMATIONGUI_OFFSETDLG_H
|
||||
|
@ -91,7 +91,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
||||
|
||||
// Activate Create a Copy mode
|
||||
Group1->CheckButton1->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
CreateCopyModeChanged();
|
||||
|
||||
Init();
|
||||
}
|
||||
@ -127,7 +127,10 @@ void TransformationGUI_PositionDlg::Init()
|
||||
|
||||
Group1->CheckButton2->setEnabled(false);
|
||||
|
||||
myStartLCS = myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
myObjects.clear();
|
||||
myStartLCS.nullify();
|
||||
myEndLCS.nullify();
|
||||
myPath.nullify();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -142,12 +145,7 @@ void TransformationGUI_PositionDlg::Init()
|
||||
connect(Group1->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(Group1->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group1->LineEdit4, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(Group1->LineEdit5, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(Group1->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
connect(Group1->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
|
||||
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
connect(Group1->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
|
||||
@ -169,9 +167,9 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
|
||||
Group1->LineEdit2->clear();
|
||||
Group1->LineEdit4->clear();
|
||||
Group1->LineEdit5->clear();
|
||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
myPath = GEOM::GEOM_Object::_nil();
|
||||
myStartLCS.nullify();
|
||||
myEndLCS.nullify();
|
||||
myPath.nullify();
|
||||
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
@ -300,7 +298,7 @@ bool TransformationGUI_PositionDlg::ClickOnApply()
|
||||
|
||||
initName();
|
||||
|
||||
myObjects.length(0);
|
||||
myObjects.clear();
|
||||
myEditCurrentArgument = Group1->LineEdit1;
|
||||
myEditCurrentArgument->setText("");
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
@ -319,120 +317,57 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == Group1->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == Group1->LineEdit2)
|
||||
myStartLCS = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == Group1->LineEdit4)
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == Group1->LineEdit5)
|
||||
myPath = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == Group1->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
/* if (getConstructorId() == 2)
|
||||
Group1->PushButton5->click();*/
|
||||
if ( myEditCurrentArgument == Group1->LineEdit1 ) {
|
||||
myObjects = getSelected( TopAbs_SHAPE, -1 );
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else if (myEditCurrentArgument == Group1->LineEdit2) {
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
myStartLCS = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
if ( CORBA::is_nil(myStartLCS) )
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(myStartLCS);
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myStartLCS->_is_nil() && myEndLCS->_is_nil())
|
||||
Group1->PushButton4->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == Group1->LineEdit4) {
|
||||
myEndLCS = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
myEndLCS = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
if ( CORBA::is_nil(myEndLCS) )
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(myEndLCS);
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myEndLCS->_is_nil() && !myObjects.length())
|
||||
else if ( myEditCurrentArgument == Group1->LineEdit5 ) {
|
||||
QList<TopAbs_ShapeEnum> types;
|
||||
types << TopAbs_EDGE << TopAbs_WIRE;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( types );
|
||||
TopoDS_Shape aShape;
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
myPath = aSelectedObject;
|
||||
if ( myObjects.isEmpty() )
|
||||
Group1->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == Group1->LineEdit5) {
|
||||
myPath = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
if ( aSelectedObject->_is_nil() )
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(myPath);
|
||||
// Local Selection
|
||||
TopoDS_Shape S;
|
||||
if (!GEOMBase::GetShape(aSelectedObject, S))
|
||||
return;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
if (aMap.Extent() == 1) {
|
||||
int anIndex = aMap(1);
|
||||
aName.append(":edge_" + QString::number(anIndex));
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else { // get Object from study
|
||||
aSelectedObject = aFindedObject;
|
||||
else {
|
||||
myPath.nullify();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (S.ShapeType() != TopAbs_EDGE && S.ShapeType() != TopAbs_WIRE) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
myPath = aSelectedObject;
|
||||
|
||||
if (!myPath->_is_nil() && !myObjects.length())
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_SHAPE );
|
||||
TopoDS_Shape aShape;
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
if ( myEditCurrentArgument == Group1->LineEdit2 ) {
|
||||
myStartLCS = aSelectedObject;
|
||||
if ( !myEndLCS )
|
||||
Group1->PushButton4->click();
|
||||
else if ( myObjects.isEmpty() )
|
||||
Group1->PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
/* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));*/
|
||||
// here commented, because multiple objects can be selected IPAL 21437
|
||||
else if ( myEditCurrentArgument == Group1->LineEdit4 ) {
|
||||
myEndLCS = aSelectedObject;
|
||||
if ( myObjects.isEmpty() )
|
||||
Group1->PushButton1->click();
|
||||
else if ( getConstructorId() == 1 && !myStartLCS )
|
||||
Group1->PushButton2->click();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( myEditCurrentArgument == Group1->LineEdit2 )
|
||||
myStartLCS.nullify();
|
||||
else if ( myEditCurrentArgument == Group1->LineEdit4 )
|
||||
myEndLCS.nullify();
|
||||
}
|
||||
}
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -528,27 +463,6 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == Group1->LineEdit1 ||
|
||||
send == Group1->LineEdit2 ||
|
||||
send == Group1->LineEdit4 ||
|
||||
send == Group1->LineEdit5 ) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
|
||||
if (send == Group1->LineEdit5)
|
||||
Group1->CheckButton2->setEnabled(true);
|
||||
else
|
||||
Group1->CheckButton2->setEnabled(false);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -590,15 +504,21 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_PositionDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_PositionDlg::isValid (QString& /*msg*/)
|
||||
{
|
||||
bool res;
|
||||
if (getConstructorId() == 0)
|
||||
res = !(myObjects.length() == 0 || myEndLCS->_is_nil());
|
||||
else if ( getConstructorId() == 1 )
|
||||
res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil());
|
||||
else if ( getConstructorId() == 2 )
|
||||
res = !(myObjects.length() == 0 || myPath->_is_nil());
|
||||
|
||||
return res;
|
||||
bool ok = false;
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
ok = !myObjects.isEmpty() && myEndLCS;
|
||||
break;
|
||||
case 1:
|
||||
ok = !myObjects.isEmpty() && myStartLCS && myEndLCS;
|
||||
break;
|
||||
case 2:
|
||||
ok = !myObjects.isEmpty() && myPath;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -616,10 +536,10 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
{
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = toCreateCopy ?
|
||||
anOper->PositionShapeCopy(myObjects[i], myObjects[i], myEndLCS) :
|
||||
anOper->PositionShape(myObjects[i], myObjects[i], myEndLCS);
|
||||
anOper->PositionShapeCopy(myObjects[i].get(), myObjects[i].get(), myEndLCS.get()) :
|
||||
anOper->PositionShape(myObjects[i].get(), myObjects[i].get(), myEndLCS.get());
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
@ -629,10 +549,10 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = toCreateCopy ?
|
||||
anOper->PositionShapeCopy(myObjects[i], myStartLCS, myEndLCS) :
|
||||
anOper->PositionShape(myObjects[i], myStartLCS, myEndLCS);
|
||||
anOper->PositionShapeCopy(myObjects[i].get(), myStartLCS.get(), myEndLCS.get()) :
|
||||
anOper->PositionShape(myObjects[i].get(), myStartLCS.get(), myEndLCS.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -643,8 +563,8 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
|
||||
{
|
||||
double aDistance = Group1->SpinBox_DX->value();
|
||||
bool toReverse = Group1->CheckButton3->isChecked();
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = anOper->PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse);
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
anObj = anOper->PositionAlongPath(myObjects[i].get(), myPath.get(), aDistance, toCreateCopy, toReverse);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -676,9 +596,9 @@ void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
void TransformationGUI_PositionDlg::CreateCopyModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
mainFrame()->GroupBoxName->setEnabled(Group1->CheckButton1->isChecked());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -687,9 +607,6 @@ void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
//=================================================================================
|
||||
void TransformationGUI_PositionDlg::addSubshapesToStudy()
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
objMap[Group1->LineEdit5->text()] = myPath;
|
||||
|
||||
addSubshapesToFather(objMap);
|
||||
if ( getConstructorId() == 2 )
|
||||
GEOMBase::PublishSubObject( myPath.get() );
|
||||
}
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_POSITIONDLG_H
|
||||
#define TRANSFORMATIONGUI_POSITIONDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_4Sel1Spin3Check;
|
||||
|
||||
@ -57,10 +58,10 @@ private:
|
||||
void enterEvent( QEvent* );
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myStartLCS;
|
||||
GEOM::GEOM_Object_var myEndLCS;
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myPath;
|
||||
GEOM::GeomObjPtr myStartLCS;
|
||||
GEOM::GeomObjPtr myEndLCS;
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
GEOM::GeomObjPtr myPath;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
@ -71,11 +72,10 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked( int );
|
||||
void CreateCopyModeChanged( bool );
|
||||
void CreateCopyModeChanged();
|
||||
void ValueChangedInSpinBox();
|
||||
void SelectionTypeButtonClicked();
|
||||
};
|
||||
|
@ -99,7 +99,7 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
CreateCopyModeChanged();
|
||||
|
||||
Init();
|
||||
}
|
||||
@ -132,7 +132,11 @@ void TransformationGUI_RotationDlg::Init()
|
||||
GroupPoints->LineEdit4->setText("");
|
||||
GroupPoints->LineEdit5->setText("");
|
||||
|
||||
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
myObjects.clear();
|
||||
myAxis.nullify();
|
||||
myCentPoint.nullify();
|
||||
myPoint1.nullify();
|
||||
myPoint2.nullify();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -147,15 +151,12 @@ void TransformationGUI_RotationDlg::Init()
|
||||
connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
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()));
|
||||
|
||||
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->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
|
||||
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
|
||||
|
||||
initName(tr("GEOM_ROTATION"));
|
||||
@ -179,7 +180,7 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
|
||||
GroupPoints->LineEdit2->clear();
|
||||
GroupPoints->ShowRows(4, 4, true);
|
||||
|
||||
myAxis = GEOM::GEOM_Object::_nil();
|
||||
myAxis.nullify();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
@ -196,7 +197,9 @@ void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
|
||||
GroupPoints->LineEdit4->clear();
|
||||
GroupPoints->LineEdit5->clear();
|
||||
|
||||
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
myCentPoint.nullify();
|
||||
myPoint1.nullify();
|
||||
myPoint2.nullify();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
@ -237,7 +240,7 @@ bool TransformationGUI_RotationDlg::ClickOnApply()
|
||||
|
||||
initName();
|
||||
|
||||
myObjects.length(0);
|
||||
myObjects.clear();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setText("");
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
@ -254,122 +257,76 @@ bool TransformationGUI_RotationDlg::ClickOnApply()
|
||||
void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
|
||||
myObjects = getSelected( TopAbs_SHAPE, -1 );
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else {
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
||||
myAxis = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
||||
myCentPoint = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit4)
|
||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit5)
|
||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
GEOM::GEOM_Object_var aSelectedObject;
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
|
||||
if ( CORBA::is_nil(aSelectedObject) )
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
// Get Selected object if selected subshape
|
||||
TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 ) ?
|
||||
TopAbs_EDGE : TopAbs_VERTEX;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
|
||||
TopoDS_Shape aShape;
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||
{
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
|
||||
aNeedType = TopAbs_EDGE;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1)
|
||||
{
|
||||
int anIndex = aMap(1);
|
||||
if (aNeedType == TopAbs_EDGE)
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
else
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else {
|
||||
aSelectedObject = aFindedObject; // get Object from study
|
||||
}
|
||||
}
|
||||
else // Global Selection
|
||||
{
|
||||
if (aShape.ShapeType() != aNeedType) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
/* if (myObjects.length()) {
|
||||
if (getConstructorId() == 0 && myAxis->_is_nil() || getConstructorId() == 1 && myCentPoint->_is_nil() )
|
||||
GroupPoints->PushButton2->click();
|
||||
}*/ // here commented, because multiple objects can be selected IPAL 21437
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
||||
if ( getConstructorId() == 0 ) {
|
||||
myAxis = aSelectedObject;
|
||||
if (!myAxis->_is_nil() && !myObjects.length())
|
||||
if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
|
||||
else if ( getConstructorId() == 1 ) {
|
||||
myCentPoint = aSelectedObject;
|
||||
if (!myCentPoint->_is_nil() && myPoint1->_is_nil())
|
||||
if ( !myPoint1 )
|
||||
GroupPoints->PushButton4->click();
|
||||
else if ( !myPoint2 )
|
||||
GroupPoints->PushButton5->click();
|
||||
else if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) {
|
||||
myPoint1 = aSelectedObject;
|
||||
if ( !myPoint2 )
|
||||
GroupPoints->PushButton5->click();
|
||||
else if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
else if ( !myCentPoint )
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) {
|
||||
myPoint2 = aSelectedObject;
|
||||
if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
else if ( !myCentPoint )
|
||||
GroupPoints->PushButton2->click();
|
||||
else if ( !myPoint1 )
|
||||
GroupPoints->PushButton4->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit4) {
|
||||
myPoint1 = aSelectedObject;
|
||||
if (!myPoint1->_is_nil() && myPoint2->_is_nil())
|
||||
GroupPoints->PushButton5->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit5) {
|
||||
myPoint2 = aSelectedObject;
|
||||
if (!myPoint2->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
else {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
||||
if ( getConstructorId() == 0 )
|
||||
myAxis.nullify();
|
||||
else if ( getConstructorId() == 1 )
|
||||
myCentPoint.nullify();
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) {
|
||||
myPoint1.nullify();
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) {
|
||||
myPoint2.nullify();
|
||||
}
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
// clear selection
|
||||
/* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));*/
|
||||
// here commented, because multiple objects can be selected IPAL 21437
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -447,20 +404,6 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == GroupPoints->LineEdit1 ||
|
||||
send == GroupPoints->LineEdit2) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -518,19 +461,18 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_RotationDlg::isValid (QString& msg)
|
||||
{
|
||||
bool ok = false;
|
||||
switch (getConstructorId()) {
|
||||
case 0: {
|
||||
bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
|
||||
return myObjects.length() > 0 && !(myAxis->_is_nil()) && ok;
|
||||
case 0:
|
||||
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myObjects.isEmpty() && myAxis;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
return myObjects.length() > 0 && !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
ok = !myObjects.isEmpty() && myCentPoint && myPoint1 && myPoint2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -552,9 +494,9 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
|
||||
QStringList aParameters;
|
||||
aParameters<<GroupPoints->SpinBox_DX->text();
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
|
||||
anObj = anOper->RotateCopy(myObjects[i].get(), myAxis.get(), GetAngle() * PI180);
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
@ -564,9 +506,9 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->Rotate(myObjects[i], myAxis, GetAngle() * PI180);
|
||||
anObj = anOper->Rotate(myObjects[i].get(), myAxis.get(), GetAngle() * PI180);
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
@ -582,17 +524,17 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
|
||||
case 1:
|
||||
{
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2);
|
||||
anObj = anOper->RotateThreePointsCopy(myObjects[i].get(), myCentPoint.get(), myPoint1.get(), myPoint2.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2);
|
||||
anObj = anOper->RotateThreePoints(myObjects[i].get(), myCentPoint.get(), myPoint1.get(), myPoint2.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -618,7 +560,7 @@ void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
|
||||
// and we need to point the first argument directly
|
||||
GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
|
||||
anArgs->length(1);
|
||||
anArgs[0] = myCurrObject;
|
||||
anArgs[0] = myCurrObject.copy();
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true,
|
||||
@ -639,9 +581,9 @@ double TransformationGUI_RotationDlg::GetAngle() const
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_RotationDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
void TransformationGUI_RotationDlg::CreateCopyModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckButton1->isChecked());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -662,17 +604,17 @@ void TransformationGUI_RotationDlg::addSubshapesToStudy()
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
|
||||
if (toCreateCopy) {
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myAxis;
|
||||
GEOMBase::PublishSubObject( myAxis.get() );
|
||||
break;
|
||||
case 1:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myCentPoint;
|
||||
objMap[GroupPoints->LineEdit4->text()] = myPoint1;
|
||||
objMap[GroupPoints->LineEdit5->text()] = myPoint2;
|
||||
GEOMBase::PublishSubObject( myCentPoint.get() );
|
||||
GEOMBase::PublishSubObject( myPoint1.get() );
|
||||
GEOMBase::PublishSubObject( myPoint2.get() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_ROTATIONDLG_H
|
||||
#define TRANSFORMATIONGUI_ROTATIONDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_4Sel1Spin2Check;
|
||||
|
||||
@ -58,9 +59,9 @@ private:
|
||||
double GetAngle() const;
|
||||
|
||||
private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myCurrObject;
|
||||
GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
GEOM::GeomObjPtr myCurrObject;
|
||||
GEOM::GeomObjPtr myAxis, myCentPoint, myPoint1, myPoint2;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
@ -71,12 +72,11 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ValueChangedInSpinBox();
|
||||
void TextValueChangedInSpinBox( const QString& );
|
||||
void CreateCopyModeChanged( bool );
|
||||
void CreateCopyModeChanged();
|
||||
void ConstructorsClicked( int );
|
||||
void onReverse();
|
||||
};
|
||||
|
@ -130,7 +130,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometry
|
||||
CheckBoxCopy->hide();
|
||||
|
||||
// Activate Create a Copy mode
|
||||
CreateCopyModeChanged(true);
|
||||
CreateCopyModeChanged();
|
||||
|
||||
// Allowed inheritance of children and visual properties by the scaling result
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
@ -167,7 +167,8 @@ void TransformationGUI_ScaleDlg::Init()
|
||||
LineEdit1->setText("");
|
||||
LineEdit2->setText("");
|
||||
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
myObjects.clear();
|
||||
myPoint.nullify();
|
||||
|
||||
// Signals and slots connections
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
@ -177,9 +178,6 @@ void TransformationGUI_ScaleDlg::Init()
|
||||
connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(SpinBox_FX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(SpinBox_FY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(SpinBox_FZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
@ -187,7 +185,7 @@ void TransformationGUI_ScaleDlg::Init()
|
||||
// san : Commented so as not to override specific step settings
|
||||
//connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
connect(CheckBoxCopy, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
|
||||
|
||||
initName(tr("GEOM_SCALE"));
|
||||
|
||||
@ -202,7 +200,7 @@ void TransformationGUI_ScaleDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
myPoint.nullify();
|
||||
LineEdit2->clear();
|
||||
|
||||
switch (constructorId) {
|
||||
@ -262,7 +260,7 @@ bool TransformationGUI_ScaleDlg::ClickOnApply()
|
||||
|
||||
initName(tr("GEOM_SCALE"));
|
||||
|
||||
myObjects.length(0);
|
||||
myObjects.clear();
|
||||
myEditCurrentArgument = LineEdit1;
|
||||
myEditCurrentArgument->setText("");
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
@ -279,86 +277,32 @@ bool TransformationGUI_ScaleDlg::ClickOnApply()
|
||||
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
|
||||
if ( myEditCurrentArgument == LineEdit1 ) {
|
||||
myObjects = getSelected( TopAbs_SHAPE, -1 );
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else {
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == LineEdit2)
|
||||
myPoint = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == LineEdit1)
|
||||
{
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
}
|
||||
else if (myEditCurrentArgument == LineEdit2)
|
||||
{
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
if (aSelList.Extent() == 1)
|
||||
{
|
||||
aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
if ( !CORBA::is_nil( aSelectedObject ) )
|
||||
{
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
}
|
||||
else {
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
|
||||
TopoDS_Shape aShape;
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||
{
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1)
|
||||
{
|
||||
int anIndex = aMap(1);
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
}
|
||||
else
|
||||
aSelectedObject = aFindedObject; // get Object from study
|
||||
}
|
||||
else // Global Selection
|
||||
{
|
||||
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
myPoint = aSelectedObject;
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myPoint->_is_nil() && !myObjects.length())
|
||||
if ( myObjects.isEmpty() )
|
||||
PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
/* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));*/
|
||||
// here commented, because multiple objects can be selected IPAL 21437
|
||||
else {
|
||||
myPoint.nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -401,20 +345,6 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == LineEdit1 || send == LineEdit2)
|
||||
{
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -473,20 +403,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ScaleDlg::isValid (QString& msg)
|
||||
{
|
||||
// && !myPoint->_is_nil()
|
||||
if (getConstructorId() == 0) {
|
||||
bool ok = SpinBox_FX->isValid( msg, !IsPreview() );
|
||||
return myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001 && ok;
|
||||
bool ok = false;
|
||||
if ( getConstructorId() == 0 ) {
|
||||
ok = SpinBox_FX->isValid( msg, !IsPreview() ) &&
|
||||
!myObjects.isEmpty() &&
|
||||
qAbs( SpinBox_FX->value() ) > 0.00001;
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
ok = SpinBox_FX->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = SpinBox_FY->isValid( msg, !IsPreview() ) && ok;
|
||||
ok = SpinBox_FZ->isValid( msg, !IsPreview() ) && ok;
|
||||
return myObjects.length() > 0 &&
|
||||
fabs(SpinBox_FX->value()) > 0.00001 &&
|
||||
fabs(SpinBox_FY->value()) > 0.00001 &&
|
||||
fabs(SpinBox_FZ->value()) > 0.00001 && ok;
|
||||
else {
|
||||
ok = SpinBox_FX->isValid( msg, !IsPreview() ) &&
|
||||
SpinBox_FY->isValid( msg, !IsPreview() ) &&
|
||||
SpinBox_FZ->isValid( msg, !IsPreview() ) &&
|
||||
!myObjects.isEmpty() &&
|
||||
qAbs( SpinBox_FX->value() ) > 0.00001 &&
|
||||
qAbs( SpinBox_FY->value() ) > 0.00001 &&
|
||||
qAbs( SpinBox_FZ->value() ) > 0.00001;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -507,9 +439,9 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
{
|
||||
if (toCreateCopy)
|
||||
{
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
for (int i = 0; i < myObjects.count(); i++)
|
||||
{
|
||||
anObj = anOper->ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
|
||||
anObj = anOper->ScaleShapeCopy(myObjects[i].get(), myPoint.get(), SpinBox_FX->value());
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
|
||||
@ -519,9 +451,9 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
for (int i = 0; i < myObjects.count(); i++)
|
||||
{
|
||||
anObj = anOper->ScaleShape(myObjects[i], myPoint, SpinBox_FX->value());
|
||||
anObj = anOper->ScaleShape(myObjects[i].get(), myPoint.get(), SpinBox_FX->value());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -532,9 +464,9 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
{
|
||||
if (toCreateCopy)
|
||||
{
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
for (int i = 0; i < myObjects.count(); i++)
|
||||
{
|
||||
anObj = anOper->ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
anObj = anOper->ScaleShapeAlongAxesCopy(myObjects[i].get(), myPoint.get(), SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value());
|
||||
if (!anObj->_is_nil())
|
||||
if(!IsPreview()) {
|
||||
@ -549,9 +481,9 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < myObjects.length(); i++)
|
||||
for (int i = 0; i < myObjects.count(); i++)
|
||||
{
|
||||
anObj = anOper->ScaleShapeAlongAxes(myObjects[i], myPoint, SpinBox_FX->value(),
|
||||
anObj = anOper->ScaleShapeAlongAxes(myObjects[i].get(), myPoint.get(), SpinBox_FX->value(),
|
||||
SpinBox_FY->value(), SpinBox_FZ->value());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
@ -586,9 +518,9 @@ void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ScaleDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
void TransformationGUI_ScaleDlg::CreateCopyModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
mainFrame()->GroupBoxName->setEnabled(CheckBoxCopy->isChecked());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -600,11 +532,6 @@ void TransformationGUI_ScaleDlg::addSubshapesToStudy()
|
||||
bool toCreateCopy = IsPreview() || CheckBoxCopy->isChecked();
|
||||
if (toCreateCopy)
|
||||
{
|
||||
if (!myPoint->_is_nil())
|
||||
{
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
objMap[LineEdit2->text()] = myPoint;
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
GEOMBase::PublishSubObject( myPoint.get() );
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_SCALEDLG_H
|
||||
#define TRANSFORMATIONGUI_SCALEDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QGroupBox;
|
||||
@ -62,8 +63,8 @@ private:
|
||||
void enterEvent( QEvent* );
|
||||
|
||||
private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myPoint; /* Central Point */
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
GEOM::GeomObjPtr myPoint; /* Central Point */
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
@ -87,12 +88,11 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked( int );
|
||||
void ValueChangedInSpinBox();
|
||||
void CreateCopyModeChanged( bool );
|
||||
void CreateCopyModeChanged();
|
||||
void SetDoubleSpinBoxStep( double );
|
||||
};
|
||||
|
||||
|
@ -105,7 +105,7 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckBox2->setChecked(true);
|
||||
CreateCopyModeChanged(true);
|
||||
CreateCopyModeChanged();
|
||||
|
||||
Init();
|
||||
}
|
||||
@ -147,7 +147,10 @@ void TransformationGUI_TranslationDlg::Init()
|
||||
GroupPoints->LineEdit2->setText("");
|
||||
GroupPoints->LineEdit3->setText("");
|
||||
|
||||
myVector = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
myObjects.clear();
|
||||
myVector.nullify();
|
||||
myPoint1.nullify();
|
||||
myPoint2.nullify();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
@ -161,16 +164,14 @@ void TransformationGUI_TranslationDlg::Init()
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ?
|
||||
|
||||
connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged(bool)));
|
||||
connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
|
||||
connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(ActivateDistanceChanged()));
|
||||
connect(GroupPoints->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
|
||||
|
||||
initName(tr("GEOM_TRANSLATION"));
|
||||
|
||||
@ -223,7 +224,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
|
||||
GroupPoints->CheckBox1->hide();
|
||||
|
||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
myPoint1.nullify();
|
||||
myPoint2.nullify();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
@ -242,8 +244,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
|
||||
GroupPoints->CheckBox1->show();
|
||||
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
ActivateDistanceChanged(GroupPoints->CheckBox1->isChecked());
|
||||
myVector.nullify();
|
||||
ActivateDistanceChanged();
|
||||
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
@ -284,7 +286,7 @@ bool TransformationGUI_TranslationDlg::ClickOnApply()
|
||||
|
||||
initName();
|
||||
|
||||
myObjects.length(0);
|
||||
myObjects.clear();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setText("");
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
@ -301,123 +303,58 @@ bool TransformationGUI_TranslationDlg::ClickOnApply()
|
||||
void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
|
||||
myObjects = getSelected( TopAbs_SHAPE, -1 );
|
||||
if ( !myObjects.isEmpty() ) {
|
||||
QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
else {
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myObjects.length(0);
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
|
||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
|
||||
myVector = GEOM::GEOM_Object::_nil();
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit3)
|
||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
QString aName;
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
|
||||
if (aNbSel < 1)
|
||||
return;
|
||||
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myObjects);
|
||||
if (!myObjects.length())
|
||||
return;
|
||||
else {
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
// here we do not switch to the next field, because multiple objects can be selected
|
||||
/*
|
||||
if (getConstructorId() == 1) {
|
||||
if (myPoint1->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
else if (getConstructorId() == 2) {
|
||||
if (myVector->_is_nil())
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aSelList.Extent() != 1)
|
||||
return;
|
||||
|
||||
// nbSel == 1
|
||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
||||
|
||||
if ( CORBA::is_nil(aSelectedObject) )
|
||||
return;
|
||||
|
||||
aName = GEOMBase::GetName(aSelectedObject);
|
||||
|
||||
// Get Selected object if selected subshape
|
||||
TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2 ) ?
|
||||
TopAbs_EDGE : TopAbs_VERTEX;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
|
||||
TopoDS_Shape aShape;
|
||||
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||
{
|
||||
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
|
||||
aNeedType = TopAbs_EDGE;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
aSelMgr->GetIndexes(aSelList.First(), aMap);
|
||||
if (aMap.Extent() == 1)
|
||||
{
|
||||
int anIndex = aMap(1);
|
||||
if (aNeedType == TopAbs_EDGE)
|
||||
aName += QString(":edge_%1").arg(anIndex);
|
||||
else
|
||||
aName += QString(":vertex_%1").arg(anIndex);
|
||||
|
||||
//Find SubShape Object in Father
|
||||
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
|
||||
|
||||
if (aFindedObject->_is_nil()) { // Object not found in study
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
|
||||
QString aName = GEOMBase::GetName( aSelectedObject.get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
||||
if ( getConstructorId() == 1 ) {
|
||||
myPoint1 = aSelectedObject;
|
||||
if ( !myPoint2 )
|
||||
GroupPoints->PushButton3->click();
|
||||
else if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if ( getConstructorId() == 2 ) {
|
||||
myVector = aSelectedObject;
|
||||
if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) {
|
||||
myPoint2 = aSelectedObject;
|
||||
if ( myObjects.isEmpty() )
|
||||
GroupPoints->PushButton1->click();
|
||||
else if ( !myPoint1 )
|
||||
GroupPoints->PushButton2->click();
|
||||
}
|
||||
}
|
||||
else {
|
||||
aSelectedObject = aFindedObject;
|
||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
||||
if ( getConstructorId() == 1 ) myPoint1.nullify();
|
||||
else myVector.nullify();
|
||||
}
|
||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) {
|
||||
myPoint2.nullify();
|
||||
}
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
}
|
||||
else // Global Selection
|
||||
{
|
||||
if (aShape.ShapeType() != aNeedType) {
|
||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||
aName = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) {
|
||||
myPoint1 = aSelectedObject;
|
||||
if (!myPoint1->_is_nil() && myPoint2->_is_nil())
|
||||
GroupPoints->PushButton3->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
|
||||
myVector = aSelectedObject;
|
||||
if (!myVector->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
|
||||
myPoint2 = aSelectedObject;
|
||||
if (!myPoint2->_is_nil() && !myObjects.length())
|
||||
GroupPoints->PushButton1->click();
|
||||
}
|
||||
}
|
||||
|
||||
// clear selection
|
||||
/* disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));*/
|
||||
// here commented, because multiple objects can be selected IPAL 21437
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
@ -477,19 +414,6 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if (send == GroupPoints->LineEdit1) {
|
||||
myEditCurrentArgument = send;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
@ -537,28 +461,25 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool TransformationGUI_TranslationDlg::isValid (QString& msg)
|
||||
{
|
||||
int aConstructorId = getConstructorId();
|
||||
|
||||
switch (aConstructorId) {
|
||||
bool ok = false;
|
||||
switch (getConstructorId()) {
|
||||
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 myObjects.length() > 0 && ok;
|
||||
}
|
||||
ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) &&
|
||||
GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) &&
|
||||
GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) &&
|
||||
!myObjects.isEmpty();
|
||||
break;
|
||||
case 1:
|
||||
return myObjects.length() > 0 && !(myPoint1->_is_nil() || myPoint2->_is_nil());
|
||||
ok = myPoint1 && myPoint2 && !myObjects.isEmpty();
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
bool ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
|
||||
return myObjects.length() > 0 && !(myVector->_is_nil()) && ok;
|
||||
}
|
||||
ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) &&
|
||||
myVector && !myObjects.isEmpty();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -587,9 +508,9 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
aParameters<<GroupPoints->SpinBox3->text();
|
||||
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
|
||||
anObj = anOper->TranslateDXDYDZCopy(myObjects[i].get(), dx, dy, dz);
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
@ -598,9 +519,9 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateDXDYDZ(myObjects[i], dx, dy, dz);
|
||||
anObj = anOper->TranslateDXDYDZ(myObjects[i].get(), dx, dy, dz);
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
@ -616,17 +537,17 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
case 1:
|
||||
{
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
|
||||
anObj = anOper->TranslateTwoPointsCopy(myObjects[i].get(), myPoint1.get(), myPoint2.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
|
||||
anObj = anOper->TranslateTwoPoints(myObjects[i].get(), myPoint1.get(), myPoint2.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -639,13 +560,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
QStringList aParameters;
|
||||
aParameters<<GroupPoints->SpinBox3->text();
|
||||
bool byDistance = GroupPoints->CheckBox1->isChecked();
|
||||
createPathPreview( myVector );
|
||||
createPathPreview( myVector.get() );
|
||||
|
||||
if (byDistance) {
|
||||
double aDistance = GroupPoints->SpinBox3->value();
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
|
||||
anObj = anOper->TranslateVectorDistance(myObjects[i].get(), myVector.get(), aDistance, toCreateCopy);
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
@ -658,17 +579,17 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
|
||||
}
|
||||
else {
|
||||
if (toCreateCopy) {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateVectorCopy(myObjects[i], myVector);
|
||||
anObj = anOper->TranslateVectorCopy(myObjects[i].get(), myVector.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
for (int i = 0; i < myObjects.count(); i++) {
|
||||
myCurrObject = myObjects[i];
|
||||
anObj = anOper->TranslateVector(myObjects[i], myVector);
|
||||
anObj = anOper->TranslateVector(myObjects[i].get(), myVector.get());
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
@ -694,7 +615,7 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t
|
||||
// and we need to point the first argument directly
|
||||
GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
|
||||
anArgs->length(1);
|
||||
anArgs[0] = myCurrObject;
|
||||
anArgs[0] = myCurrObject.copy();
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
|
||||
/*theFindMethod=*/GEOM::FSM_Transformed,
|
||||
/*theInheritFirstArg=*/true,
|
||||
@ -706,18 +627,18 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t
|
||||
// function : CreateCopyModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::CreateCopyModeChanged (bool isCreateCopy)
|
||||
void TransformationGUI_TranslationDlg::CreateCopyModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
|
||||
mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckBox2->isChecked());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateDistanceChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::ActivateDistanceChanged (bool theEnable)
|
||||
void TransformationGUI_TranslationDlg::ActivateDistanceChanged()
|
||||
{
|
||||
GroupPoints->SpinBox3->setEnabled(theEnable);
|
||||
GroupPoints->SpinBox3->setEnabled( GroupPoints->CheckBox1->isChecked() );
|
||||
displayPreview();
|
||||
}
|
||||
|
||||
@ -729,20 +650,17 @@ void TransformationGUI_TranslationDlg::addSubshapesToStudy()
|
||||
{
|
||||
bool toCreateCopy = IsPreview() || GroupPoints->CheckBox2->isChecked();
|
||||
if (toCreateCopy) {
|
||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myPoint1;
|
||||
objMap[GroupPoints->LineEdit3->text()] = myPoint2;
|
||||
GEOMBase::PublishSubObject( myPoint1.get() );
|
||||
GEOMBase::PublishSubObject( myPoint2.get() );
|
||||
break;
|
||||
case 2:
|
||||
objMap[GroupPoints->LineEdit2->text()] = myVector;
|
||||
GEOMBase::PublishSubObject( myVector.get() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
addSubshapesToFather(objMap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -750,7 +668,7 @@ void TransformationGUI_TranslationDlg::addSubshapesToStudy()
|
||||
// function : createPathPreview
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_TranslationDlg::createPathPreview ( GEOM::GEOM_Object_var thePath )
|
||||
void TransformationGUI_TranslationDlg::createPathPreview ( GEOM::GEOM_Object_ptr thePath )
|
||||
{
|
||||
if ( IsPreview() ) {
|
||||
TopoDS_Shape aShape;
|
||||
|
@ -27,7 +27,8 @@
|
||||
#ifndef TRANSFORMATIONGUI_TRANSLATIONDLG_H
|
||||
#define TRANSFORMATIONGUI_TRANSLATIONDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_3Sel3Spin2Check;
|
||||
|
||||
@ -55,12 +56,12 @@ protected:
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
void createPathPreview( GEOM::GEOM_Object_var );
|
||||
void createPathPreview( GEOM::GEOM_Object_ptr );
|
||||
|
||||
private:
|
||||
GEOM::ListOfGO myObjects;
|
||||
GEOM::GEOM_Object_var myCurrObject;
|
||||
GEOM::GEOM_Object_var myVector, myPoint1, myPoint2;
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
GEOM::GeomObjPtr myCurrObject;
|
||||
GEOM::GeomObjPtr myVector, myPoint1, myPoint2;
|
||||
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
@ -71,14 +72,13 @@ private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ConstructorsClicked( int );
|
||||
void ValueChangedInSpinBox();
|
||||
void CreateCopyModeChanged( bool );
|
||||
void CreateCopyModeChanged();
|
||||
void SetDoubleSpinBoxStep( double );
|
||||
void ActivateDistanceChanged( bool );
|
||||
void ActivateDistanceChanged();
|
||||
};
|
||||
|
||||
#endif // TRANSFORMATIONGUI_TRANSLATIONDLG_H
|
||||
|
Loading…
Reference in New Issue
Block a user