#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+
#include <qlabel.h>
+#include <qcheckbox.h>
#include "GEOMImpl_Types.hxx"
Group3Pnts2->PushButton2->setPixmap(image2);
Group3Pnts2->PushButton3->setPixmap(image2);
- Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE"));
+ Group3Pnts2->CheckButton1->setText(tr("GEOM_REVERSE"));
Layout1->addWidget( Group3Pnts, 2, 0 );
Layout1->addWidget( Group3Pnts2, 2, 0 );
/* init variables */
myEditCurrentArgument = Group3Pnts->LineEdit1;
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
- Group3Pnts2->radioButton4->setChecked(FALSE);
+ Group3Pnts2->CheckButton1->setChecked(FALSE);
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
+ connect(Group3Pnts2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_ARC" ));
ConstructorsClicked( 0 );
{
case 0:
{
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
Group3Pnts->show();
resize(0, 0);
}
case 1:
{
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
Group3Pnts->hide();
resize(0, 0);
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
switch (getConstructorId())
{
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ // Get Selected object if selected subshape
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap(1);
+ aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
+
switch (getConstructorId())
{
case 0:
{
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
}
case 1:
{
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = aSelectedObject;
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
case 1:
{
bool Sense;
- (Group3Pnts2->radioButton4->isChecked()) ? Sense = true : Sense = false;
+ (Group3Pnts2->CheckButton1->isChecked()) ? Sense = true : Sense = false;
if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) )
{
anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->
{
displayPreview();
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_ArcDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+ break;
+ case 1:
+ objMap[Group3Pnts2->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <qlabel.h>
-#include "GEOMImpl_Types.hxx"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+
+//#include <GEOMImpl_ILocalOperations.hxx>
+
+//#include "GEOMImpl_Types.hxx"
#include "utilities.h"
//=================================================================================
// class : BasicGUI_CircleDlg()
-// purpose : Constructs a BasicGUI_CircleDlg which is a child of 'parent', with the
+// purpose : Constructs a BasicGUI_CircleDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
GroupPntVecR = new DlgRef_2Sel1Spin(this, "GroupPntVecR");
GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
-
+
GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT"));
GroupPntVecR->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPntVecR->TextLabel3->setText(tr("GEOM_RADIUS"));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
-
+
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPntVecR->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntVecR->SpinBox_DX, SLOT(SetStep(double)));
-
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupPntVecR->SpinBox_DX, SLOT(SetStep(double)));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_CIRCLE" ) );
//=================================================================================
void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId )
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 );
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+
+ disconnect(aSelMgr, 0, this, 0);
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
- switch ( constructorId )
+ switch (constructorId)
{
- case 0:
- {
- Group3Pnts->hide();
- GroupCenter2Pnts->hide();
- resize(0, 0);
- GroupPntVecR->show();
-
- myEditCurrentArgument = GroupPntVecR->LineEdit1;
- GroupPntVecR->LineEdit1->setText("");
- GroupPntVecR->LineEdit2->setText("");
- break;
- }
+ case 0:
+ {
+ Group3Pnts->hide();
+ GroupCenter2Pnts->hide();
+ resize(0, 0);
+ GroupPntVecR->show();
+
+ myEditCurrentArgument = GroupPntVecR->LineEdit1;
+ GroupPntVecR->LineEdit1->setText("");
+ GroupPntVecR->LineEdit2->setText("");
+ break;
+ }
case 1:
{
GroupPntVecR->hide();
Group3Pnts->LineEdit2->setText("");
Group3Pnts->LineEdit3->setText("");
break;
- }
- case 2:
- {
- GroupPntVecR->hide();
- Group3Pnts->hide();
- resize( 0, 0 );
- GroupCenter2Pnts->show();
-
- myEditCurrentArgument = GroupCenter2Pnts->LineEdit1;
- GroupCenter2Pnts->LineEdit1->setText("");
- GroupCenter2Pnts->LineEdit2->setText("");
- GroupCenter2Pnts->LineEdit3->setText("");
- break;
- }
+ }
+ case 2:
+ {
+ GroupPntVecR->hide();
+ Group3Pnts->hide();
+ resize( 0, 0 );
+ GroupCenter2Pnts->show();
+
+ myEditCurrentArgument = GroupCenter2Pnts->LineEdit1;
+ GroupCenter2Pnts->LineEdit1->setText("");
+ GroupCenter2Pnts->LineEdit2->setText("");
+ GroupCenter2Pnts->LineEdit3->setText("");
+ break;
+ }
}
-
+
myEditCurrentArgument->setFocus();
- globalSelection( GEOM_POINT );
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ connect(aSelMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
}
//=================================================================================
return false;
initName();
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
return true;
}
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void BasicGUI_CircleDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
void BasicGUI_CircleDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
-
- if ( IObjectCount() != 1 )
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aList;
+ aSelMgr->selectedObjects(aList);
+
+ if (aList.Extent() != 1)
{
- if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = GEOM::GEOM_Object::_nil();
+ if (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == Group3Pnts->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == Group3Pnts->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == Group3Pnts->LineEdit3) myPoint3 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupCenter2Pnts->LineEdit1) myPoint4 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupCenter2Pnts->LineEdit2) myPoint5 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupCenter2Pnts->LineEdit3) myPoint6 = GEOM::GEOM_Object::_nil();
return;
}
// nbSel == 1
+ Handle(SALOME_InteractiveObject) anIO = aList.First();
+
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
- {
-
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
- if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject;
- else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject;
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
- else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = aSelectedObject;
- else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = aSelectedObject;
- else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = aSelectedObject;
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
+ {
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ // If selected Vertex or Edge on the some Shape Get selection Subshape
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPntVecR->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(anIO, aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ 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 = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 == GroupPntVecR->LineEdit1) myPoint = aSelectedObject;
+ else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir = aSelectedObject;
+ else if (myEditCurrentArgument == Group3Pnts->LineEdit1) myPoint1 = aSelectedObject;
+ else if (myEditCurrentArgument == Group3Pnts->LineEdit2) myPoint2 = aSelectedObject;
+ else if (myEditCurrentArgument == Group3Pnts->LineEdit3) myPoint3 = aSelectedObject;
+ else if (myEditCurrentArgument == GroupCenter2Pnts->LineEdit1) myPoint4 = aSelectedObject;
+ else if (myEditCurrentArgument == GroupCenter2Pnts->LineEdit2) myPoint5 = aSelectedObject;
+ else if (myEditCurrentArgument == GroupCenter2Pnts->LineEdit3) myPoint6 = aSelectedObject;
}
displayPreview();
}
else if ( send == GroupCenter2Pnts->PushButton1 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit1;
else if ( send == GroupCenter2Pnts->PushButton2 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit2;
else if ( send == GroupCenter2Pnts->PushButton3 ) myEditCurrentArgument = GroupCenter2Pnts->LineEdit3;
-
+
myEditCurrentArgument->setFocus();
-
- if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
- globalSelection( GEOM_LINE );
- else
- globalSelection( GEOM_POINT );
+
+ if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ }
+ else {
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ }
SelectionIntoArgument();
}
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_CircleDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- globalSelection( GEOM_POINT );
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- // myGeomGUI->SetState( 0 );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() );
}
-
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
double BasicGUI_CircleDlg::getRadius() const
{
- switch ( getConstructorId() )
- {
- case 0 :
- return GroupPntVecR->SpinBox_DX->GetValue();
- }
+ switch (getConstructorId())
+ {
+ case 0:
+ return GroupPntVecR->SpinBox_DX->GetValue();
+ }
+ return 0.;
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool BasicGUI_CircleDlg::isValid( QString& msg )
+bool BasicGUI_CircleDlg::isValid(QString& msg)
{
const int id = getConstructorId();
if ( id == 0 )
// function : execute
// purpose :
//=================================================================================
-bool BasicGUI_CircleDlg::execute( ObjectList& objects )
+bool BasicGUI_CircleDlg::execute(ObjectList& objects)
{
bool res = false;
-
+
GEOM::GEOM_Object_var anObj;
-
- switch ( getConstructorId() )
+
+ switch (getConstructorId())
{
- cout << "constructior ID = " << getConstructorId() << endl;
- case 0 :
- anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
+ case 0:
+ anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->
+ MakeCirclePntVecR(myPoint, myDir, getRadius());
res = true;
break;
- case 1 :
- anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 );
+ case 1:
+ anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->
+ MakeCircleThreePnt(myPoint1, myPoint2, myPoint3);
res = true;
break;
- case 2 :
- anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleCenter2Pnt( myPoint4, myPoint5, myPoint6 );
+ case 2:
+ anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->
+ MakeCircleCenter2Pnt(myPoint4, myPoint5, myPoint6);
res = true;
break;
}
-
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
- else cout << "Execute Object is NULL!" << endl;
-
+
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+ else {
+ MESSAGE("Execute Object is NULL!");
+ }
+
return res;
}
// function : closeEvent
// purpose :
//=================================================================================
-void BasicGUI_CircleDlg::closeEvent( QCloseEvent* e )
+void BasicGUI_CircleDlg::closeEvent (QCloseEvent* e)
{
- GEOMBase_Skeleton::closeEvent( e );
+ GEOMBase_Skeleton::closeEvent(e);
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_CircleDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
+ objMap[GroupPntVecR->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+ break;
+ case 2:
+ objMap[GroupCenter2Pnts->LineEdit1->text()] = myPoint4;
+ objMap[GroupCenter2Pnts->LineEdit2->text()] = myPoint5;
+ objMap[GroupCenter2Pnts->LineEdit3->text()] = myPoint6;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
virtual void closeEvent( QCloseEvent* e );
+ virtual void addSubshapesToStudy();
private:
void Init();
DlgRef_2Sel1Spin* GroupPntVecR;
DlgRef_3Sel_QTD* Group3Pnts;
DlgRef_3Sel_QTD* GroupCenter2Pnts;
+
private slots:
void ClickOnOk();
void ClickOnCancel();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
#include "LightApp_SelectionMgr.h"
#include <qlabel.h>
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include "GEOMImpl_Types.hxx"
using namespace std;
myPoints = new GEOM::ListOfGO();
myPoints->length( 0 );
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_CURVE" ) );
return -1;
}
+
//=================================================================================
/*! function : removeUnnecessaryPnt()
* purpose : Remove unnecessary points from list \a theOldPoints
myEditCurrentArgument->setText("");
Standard_Boolean aRes = Standard_False;
- int i = 0;
int IOC = IObjectCount();
- bool is_append = myPoints->length() < IOC; // if true - add point, else remove
- myPoints->length( IOC ); // this length may be greater than number of objects,
+ // bool is_append = myPoints->length() < IOC; // if true - add point, else remove
+ // myPoints->length( IOC ); // this length may be greater than number of objects,
// that will actually be put into myPoints
- for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() )
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+
+ int anIndex;
+ TopoDS_Shape aShape;
+ TColStd_IndexedMapOfInteger aMapIndexes;
+ GEOM::GEOM_Object_var anObject;
+ std::list<GEOM::GEOM_Object_var> aList;
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected, QString::null, false );
+
+ for ( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
{
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes );
+
if ( !CORBA::is_nil( aSelectedObject ) && aRes )
{
- //TopoDS_Shape aPointShape;
- //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) )
- int pos = isPointInList(myOrderedSel,aSelectedObject);
- if(is_append && pos==-1)
- myOrderedSel.push_back(aSelectedObject);
- myPoints[i++] = aSelectedObject;
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ aSelMgr->GetIndexes( anIt.Value(), aMapIndexes );
+
+ if ( aMapIndexes.Extent() > 0 )
+ {
+ for (int ii=1; ii <= aMapIndexes.Extent(); ii++) {
+ anIndex = aMapIndexes(ii);
+ QString aName = GEOMBase::GetName( aSelectedObject );
+ aName = aName + ":vertex_" + QString::number( anIndex );
+ anObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ //Find Object in study
+ _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) );
+ bool inStudy = false;
+ for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator(obj)); iit->More(); iit->Next()) {
+ _PTR(SObject) child (iit->Value());
+ QString aChildName = child->GetName();
+ if (aChildName == aName) {
+ inStudy = true;
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value());
+ anObject = GEOM::GEOM_Object::_narrow( corbaObj );
+ }
+ }
+
+ if (!inStudy)
+ GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
+ anObject, aName, aSelectedObject);
+
+ int pos = isPointInList(myOrderedSel, anObject);
+ if (pos==-1) {
+ myOrderedSel.push_back(anObject);
+ }
+ // if (!inStudy)
+ aList.push_back(anObject);
+ }
+ } else { // aMap.Extent() == 0
+ int pos = isPointInList(myOrderedSel,aSelectedObject);
+ if(pos==-1)
+ myOrderedSel.push_back(aSelectedObject);
+ aList.push_back(aSelectedObject);
+ }
+ }
}
}
- myPoints->length( i ); // this is the right length, smaller of equal to the previously set
+ myPoints->length( aList.size() );
+
+ int k=0;
+ for (list<GEOM::GEOM_Object_var>::iterator j=aList.begin();j!=aList.end();j++)
+ myPoints[k++] = *j;
+
if(IOC == 0)
myOrderedSel.clear();
else
- removeUnnecessaryPnt(myOrderedSel,myPoints);
-
- if(myOrderedSel.size() == myPoints->length()){
- int k=0;
- for (list<GEOM::GEOM_Object_var>::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++)
- myPoints[k++] = *j;
- } else {
- //cout << "ERROR: Ordered sequence size != selection sequence size! ("<<myOrderedSel.size()<<"!="<<myPoints->length()<<")"<<endl;
- }
- if ( i )
- GroupPoints->LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
+ removeUnnecessaryPnt(myOrderedSel, myPoints);
+
+ // if ( myOrderedSel.size() == myPoints->length() ) {
+ myPoints->length( myOrderedSel.size() );
+ k=0;
+ for (list<GEOM::GEOM_Object_var>::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++)
+ myPoints[k++] = *j;
+ // }
+
+ if ( myPoints->length() > 0 )
+ GroupPoints->LineEdit1->setText( QString::number( myPoints->length() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
displayPreview();
}
void BasicGUI_CurveDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- // myGeomGUI->SetState( 0 );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
ConstructorsClicked( getConstructorId() );
}
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
{
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
myPoint = myDir = GEOM::GEOM_Object::_nil();
- // myGeomGUI->SetState( 0 );
-
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_ELLIPSE" ) );
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
-
+ //globalSelection(GEOM_POINT);
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+
return true;
}
}
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ Handle(SALOME_InteractiveObject) anIO = firstIObject();
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ // Get Selected object if selected subshape
+ TopoDS_Shape aShape;
+
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(anIO, 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 = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject;
}
void BasicGUI_EllipseDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_POINT );
if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
myEditCurrentArgument->setFocus();
+ globalSelection(); // close local contexts, if any
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- globalSelection( GEOM_LINE );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
else
- globalSelection( GEOM_POINT );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
SelectionIntoArgument();
}
void BasicGUI_EllipseDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit2->setText( "" );
myPoint = myDir = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_POINT );
+ //globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
//=================================================================================
GEOMBase_Skeleton::closeEvent( e );
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_EllipseDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
virtual void closeEvent( QCloseEvent* e );
+ virtual void addSubshapesToStudy();
private :
void Init();
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2P")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_SELECT")));
+ QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2F")));
setCaption(tr("GEOM_LINE_TITLE"));
+ QGroupBox* aFrame = new QGroupBox( 1, Qt::Horizontal, this );
+ aFrame->setInsideMargin( 0 );
+ aFrame->setFrameStyle( QFrame::NoFrame );
+
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_LINE"));
RadioButton1->setPixmap(image0);
- RadioButton2->close(TRUE);
+ RadioButton2->setPixmap(image2);
RadioButton3->close(TRUE);
- GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints");
+ GroupPoints = new DlgRef_2Sel_QTD( aFrame, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1"));
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints->PushButton2->setPixmap(image1);
-
GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true );
- Layout1->addWidget(GroupPoints, 2, 0);
+ GroupFaces = new DlgRef_2Sel_QTD( aFrame, "GroupFaces");
+ GroupFaces->GroupBox1->setTitle(tr("GEOM_FACES"));
+ GroupFaces->TextLabel1->setText(tr("GEOM_FACE_I").arg("1"));
+ GroupFaces->TextLabel2->setText(tr("GEOM_FACE_I").arg("2"));
+ GroupFaces->PushButton1->setPixmap(image1);
+ GroupFaces->PushButton2->setPixmap(image1);
+ GroupFaces->LineEdit1->setReadOnly( true );
+ GroupFaces->LineEdit2->setReadOnly( true );
+
+ Layout1->addWidget(aFrame, 2, 0);
/***************************************************************/
setHelpFileName("create_line_page.html");
Init();
}
-
//=================================================================================
// function : ~BasicGUI_LineDlg()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
void BasicGUI_LineDlg::Init()
{
/* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
-
- myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
-
- // myGeomGUI->SetState( 0 );
- globalSelection( GEOM_POINT );
+ //myEditCurrentArgument = GroupPoints->LineEdit1;
+ //myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
+ //globalSelection(); // close local contexts, if any
+ //localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+ connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupFaces->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupFaces->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupFaces->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupFaces->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(0);
initName( tr("GEOM_LINE") );
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void BasicGUI_LineDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
//=================================================================================
bool BasicGUI_LineDlg::ClickOnApply()
{
+
if ( !onAccept() )
return false;
-
+
initName();
+ ConstructorsClicked(getConstructorId());
return true;
}
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
+{
+ switch ( constructorId )
+ {
+ case 0:
+ {
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ myEditCurrentArgument->setText("");
+ myPoint1 = GEOM::GEOM_Object::_nil();
+ myPoint2 = GEOM::GEOM_Object::_nil();
+ GroupPoints->show();
+ GroupFaces->hide();
+ break;
+ }
+ case 1:
+ {
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+
+ myEditCurrentArgument = GroupFaces->LineEdit1;
+ myEditCurrentArgument->setText("");
+ myFace1 = GEOM::GEOM_Object::_nil();
+ myFace2 = GEOM::GEOM_Object::_nil();
+ GroupPoints->hide();
+ GroupFaces->show();
+ break;
+ }
+ }
+
+ updateGeometry();
+ resize(minimumSize());
+ SelectionIntoArgument();
+}
//=================================================================================
// function : SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
+ if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = GEOM::GEOM_Object::_nil();
return;
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupFaces->LineEdit1 ||
+ myEditCurrentArgument == GroupFaces->LineEdit2)
+ aNeedType = TopAbs_FACE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap( 1 );
+ if (aNeedType == TopAbs_FACE)
+ aName += QString(":face_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
+ else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = aSelectedObject;
+ else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = aSelectedObject;
}
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
QPushButton* send = (QPushButton*)sender();
if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
+ else if ( send == GroupFaces->PushButton1 ) myEditCurrentArgument = GroupFaces->LineEdit1;
+ else if ( send == GroupFaces->PushButton2 ) myEditCurrentArgument = GroupFaces->LineEdit2;
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
+ else if ( send == GroupFaces->LineEdit1 ) myEditCurrentArgument = GroupFaces->LineEdit1;
+ else if ( send == GroupFaces->LineEdit2 ) myEditCurrentArgument = GroupFaces->LineEdit2;
else return;
GEOMBase_Skeleton::LineEditReturnPressed();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_LineDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- // myGeomGUI->SetState( 0 );
- globalSelection( GEOM_POINT );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- myEditCurrentArgument = GroupPoints->LineEdit1;
- myEditCurrentArgument->setFocus();
-
- GroupPoints->LineEdit1->setText( "" );
- GroupPoints->LineEdit2->setText( "" );
- myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
void BasicGUI_LineDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
//=================================================================================
bool BasicGUI_LineDlg::isValid( QString& msg )
{
- return !myPoint1->_is_nil() && !myPoint2->_is_nil();
+ const int id = getConstructorId();
+ if ( id == 0 )
+ return !myPoint1->_is_nil() && !myPoint2->_is_nil();
+ else if ( id == 1 )
+ return !myFace1->_is_nil() && !myFace2->_is_nil();
+ return false;
}
//=================================================================================
//=================================================================================
bool BasicGUI_LineDlg::execute( ObjectList& objects )
{
- GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 );
+ bool res = false;
+ GEOM::GEOM_Object_var anObj;
+ switch ( getConstructorId() )
+ {
+ case 0 :
+ {
+ anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 );
+ res = true;
+ break;
+ }
+ case 1 :
+ {
+ anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoFaces( myFace1, myFace2 );
+ res = true;
+ break;
+ }
+ }
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
- return true;
+
+ return res;
}
//=================================================================================
GEOMBase_Skeleton::closeEvent( e );
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_LineDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+ switch ( getConstructorId() )
+ {
+ case 0 :
+ objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+ break;
+ case 1 :
+ objMap[GroupFaces->LineEdit1->text()] = myFace1;
+ objMap[GroupFaces->LineEdit2->text()] = myFace2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual bool execute( ObjectList& objects );
virtual void closeEvent( QCloseEvent* e );
+ virtual void addSubshapesToStudy();
private :
void Init();
GEOM::GEOM_Object_var myPoint1;
GEOM::GEOM_Object_var myPoint2;
+ GEOM::GEOM_Object_var myFace1;
+ GEOM::GEOM_Object_var myFace2;
DlgRef_2Sel_QTD* GroupPoints;
+ DlgRef_2Sel_QTD* GroupFaces;
private slots:
void ClickOnOk();
void ActivateThisDialog();
void DeactivateActiveDialog();
-
+ void ConstructorsClicked(int constructorId);
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
Init();
}
-
//=================================================================================
// function : ~BasicGUI_MarkerDlg()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
initName( tr( "LCS_NAME" ) );
ConstructorsClicked( 0 );
-
//@
/*
QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
{
if ( myConstructorId == constructorId && myConstructorId == 0 )
{
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
activate( GEOM_MARKER );
displayPreview();
myConstructorId = constructorId;
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch (constructorId)
- {
- case 0:
+ {
+ case 0:
{
Group1->hide();
Group2->hide();
resize(0, 0);
aMainGrp->show();
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
activate( GEOM_MARKER );
break;
}
- case 1:
- {
- Group2->hide();
- aMainGrp->hide();
- //PAL6669: resize(0, 0);
- Group1->show();
-
- globalSelection( GEOM_ALLGEOM );
- myEditCurrentArgument = Group1->LineEdit1;
- Group1->LineEdit1->setText("");
- break;
- }
- case 2:
- {
- aMainGrp->hide();
- Group1->show();
- //PAL6669: resize(0, 0);
- Group2->show();
-
- globalSelection( GEOM_POINT );
- myEditCurrentArgument = Group2->LineEdit1;
- Group2->LineEdit1->setText("");
- Group2->LineEdit2->setText("");
- Group2->LineEdit3->setText("");
- break;
- }
+ case 1:
+ {
+ Group2->hide();
+ aMainGrp->hide();
+ //PAL6669: resize(0, 0);
+ Group1->show();
+
+ globalSelection( GEOM_ALLGEOM );
+ myEditCurrentArgument = Group1->LineEdit1;
+ Group1->LineEdit1->setText("");
+ break;
+ }
+ case 2:
+ {
+ aMainGrp->hide();
+ Group1->show();
+ //PAL6669: resize(0, 0);
+ Group2->show();
+
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ myEditCurrentArgument = Group2->LineEdit1;
+ Group2->LineEdit1->setText("");
+ Group2->LineEdit2->setText("");
+ Group2->LineEdit3->setText("");
+ break;
}
+ }
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(onSelectionDone()));
onSelectionDone();
}
//=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone0()
{
- if ( IObjectCount() == 1 )
+ if (IObjectCount() == 1)
{
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
- GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+ GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- if ( aRes && !aSelectedObj->_is_nil() )
+ if (aRes && !aSelectedObj->_is_nil())
{
TopoDS_Shape aShape;
- if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ if (GEOMBase::GetShape(aSelectedObj, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{
// Existing LCS selected
- if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE )
+ if (aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE)
{
- TopoDS_Face aFace = TopoDS::Face( aShape );
- Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
+ TopoDS_Face aFace = TopoDS::Face(aShape);
+ Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aFace));
- if ( !aPlane.IsNull() )
+ if (!aPlane.IsNull())
{
gp_Ax3 anAx3 = aPlane->Pln().Position();
gp_Pnt aLoc = anAx3.Location();
else
{
TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( anIO, aMap );
- if ( aMap.Extent() == 1 )
+ aSelMgr->GetIndexes(anIO, aMap);
+ if (aMap.Extent() == 1) // Local Selection
{
- int anIndex = aMap( 1 );
+ int anIndex = aMap(1);
TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
- aSelMgr->clearSelected();
+ TopExp::MapShapes(aShape, aShapes);
+ aShape = aShapes.FindKey(anIndex);
+ aSelMgr->clearSelected(); // ???
}
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+ if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
{
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() );
displayPreview();
}
-
//=================================================================================
// function : onSelectionDone()
// purpose : Called when selection as changed or other case
//=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone()
{
- if ( getConstructorId() == 0 ) {
+ if (getConstructorId() == 0) {
onSelectionDone0();
return;
}
myEditCurrentArgument->setText("");
- QString aName;
- if ( IObjectCount() == 1 ) {
+ if (IObjectCount() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
- GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+ GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
- if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
- aName = GEOMBase::GetName( aSelectedObj );
+ if (!CORBA::is_nil(aSelectedObj) && aRes) {
+ QString aName = GEOMBase::GetName(aSelectedObj);
- if ( getConstructorId() == 1 ) { // by shape position
+ if (getConstructorId() == 1) { // by shape position
// Get shape's position
CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz, Yx,Yy,Yz;
Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0;
myData[ DY2 ]->SetValue( Yy );
myData[ DZ2 ]->SetValue( Yz );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
- else if ( getConstructorId() == 2 ) { // by point and two vectors
+ else if (getConstructorId() == 2) { // by point and two vectors
TopoDS_Shape aShape;
- if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
- GEOM::short_array anIndexes;
+ if (GEOMBase::GetShape(aSelectedObj, aShape, TopAbs_SHAPE))
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
+ if (myEditCurrentArgument == Group2->LineEdit1)
+ aNeedType = TopAbs_VERTEX;
TColStd_IndexedMapOfInteger aMap;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- aSelMgr->GetIndexes( anIO, aMap );
+ aSelMgr->GetIndexes(anIO, aMap);
+
+ if (!aMap.IsEmpty()) {
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString("_edge_%1").arg(anIndex);
+ else
+ aName += QString("_vertex_%1").arg(anIndex);
- if ( !aMap.IsEmpty() ) {
- int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
+ TopExp::MapShapes(aShape, aShapes);
+ aShape = aShapes.FindKey(anIndex);
}
if (myEditCurrentArgument == Group2->LineEdit1) {
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else {
myData[ X ]->SetValue( 0 );
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
- gp_Dir aDir(gp_Vec(aP1, aP2));
+ gp_Dir aDir (gp_Vec(aP1, aP2));
myData[ DX1 ]->SetValue( aDir.X() );
myData[ DY1 ]->SetValue( aDir.Y() );
myData[ DZ1 ]->SetValue( aDir.Z() );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else {
myData[ DX1 ]->SetValue( 0 );
myData[ DX2 ]->SetValue( aDir.X() );
myData[ DY2 ]->SetValue( aDir.Y() );
myData[ DZ2 ]->SetValue( aDir.Z() );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else {
myData[ DX2 ]->SetValue( 0 );
{
QPushButton* send = (QPushButton*)sender();
- if(send == Group1->PushButton1) {
+ if (send == Group1->PushButton1) {
myEditCurrentArgument = Group1->LineEdit1;
globalSelection( GEOM_ALLGEOM );
}
- else if(send == Group2->PushButton1) {
+ else if (send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1;
- globalSelection( GEOM_POINT );
+ //globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
- else if(send == Group2->PushButton2) {
+ else if (send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2;
- globalSelection( GEOM_LINE );
+ //globalSelection( GEOM_LINE );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
- else if(send == Group2->PushButton3) {
+ else if (send == Group2->PushButton3) {
myEditCurrentArgument = Group2->LineEdit3;
- globalSelection( GEOM_LINE );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
void BasicGUI_MarkerDlg::onActivate()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(onSelectionDone()));
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
{
- GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(
- getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
- myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
- myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
+ GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(getOperation())->
+ MakeMarker(myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
+ myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
+ myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue());
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <TColStd_MapOfInteger.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_PLANE" ) );
//=================================================================================
void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
- switch ( constructorId )
+ switch (constructorId)
{
- case 0: /* plane from a point and a direction (vector, edge...) */
- {
- Group3Pnts->hide();
- GroupFace->hide();
- resize(0, 0);
- GroupPntDir->show();
-
- myEditCurrentArgument = GroupPntDir->LineEdit1;
- GroupPntDir->LineEdit1->setText(tr(""));
- GroupPntDir->LineEdit2->setText(tr(""));
-
- /* for the first argument */
- globalSelection( GEOM_POINT );
- break;
- }
- case 1: /* plane from 3 points */
- {
- GroupPntDir->hide();
- GroupFace->hide();
- resize(0, 0);
- Group3Pnts->show();
-
- myEditCurrentArgument = Group3Pnts->LineEdit1;
- Group3Pnts->LineEdit1->setText("");
- Group3Pnts->LineEdit2->setText("");
- Group3Pnts->LineEdit3->setText("");
-
- /* for the first argument */
- globalSelection( GEOM_POINT );
- break;
- }
- case 2: /* plane from a planar face selection */
- {
- GroupPntDir->hide();
- Group3Pnts->hide();
- resize(0, 0);
- GroupFace->show();
-
- myEditCurrentArgument = GroupFace->LineEdit1;
- GroupFace->LineEdit1->setText(tr(""));
-
- /* for the first argument */
- //globalSelection( GEOM_PLANE );
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_PLANE );
- aMap.Add( GEOM_MARKER );
- globalSelection( aMap );
- break;
- }
+ case 0: /* plane from a point and a direction (vector, edge...) */
+ {
+ Group3Pnts->hide();
+ GroupFace->hide();
+ resize(0, 0);
+ GroupPntDir->show();
+
+ myEditCurrentArgument = GroupPntDir->LineEdit1;
+ GroupPntDir->LineEdit1->setText(tr(""));
+ GroupPntDir->LineEdit2->setText(tr(""));
+
+ /* for the first argument */
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ break;
+ }
+ case 1: /* plane from 3 points */
+ {
+ GroupPntDir->hide();
+ GroupFace->hide();
+ resize(0, 0);
+ Group3Pnts->show();
+
+ myEditCurrentArgument = Group3Pnts->LineEdit1;
+ Group3Pnts->LineEdit1->setText("");
+ Group3Pnts->LineEdit2->setText("");
+ Group3Pnts->LineEdit3->setText("");
+
+ /* for the first argument */
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ break;
}
+ case 2: /* plane from a planar face selection */
+ {
+ GroupPntDir->hide();
+ Group3Pnts->hide();
+ resize(0, 0);
+ GroupFace->show();
+
+ myEditCurrentArgument = GroupFace->LineEdit1;
+ GroupFace->LineEdit1->setText(tr(""));
+
+ /* for the first argument */
+ //globalSelection( GEOM_PLANE );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_PLANE );
+ aMap.Add( GEOM_MARKER );
+ globalSelection( aMap );
+ break;
+ }
+ }
myEditCurrentArgument->setFocus();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil();
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPntDir->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+ else if (myEditCurrentArgument == GroupFace->LineEdit1)
+ aNeedType = TopAbs_FACE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString(":edge_%1").arg(anIndex);
+ else if (aNeedType == TopAbs_FACE)
+ aName += QString(":face_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
void BasicGUI_PlaneDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_POINT );
if ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1;
else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2;
myEditCurrentArgument->setFocus();
- if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
- globalSelection( GEOM_LINE );
- else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
- //globalSelection( GEOM_PLANE );
+ if (myEditCurrentArgument == GroupPntDir->LineEdit2) {
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ }
+ else if (myEditCurrentArgument == GroupFace->LineEdit1) {
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER );
globalSelection( aMap );
}
- else
- globalSelection( GEOM_POINT );
+ else { // 3 Pnts
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ }
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_PlaneDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- // myGeomGUI->SetState( 0 );
-
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
void BasicGUI_PlaneDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
GEOMBase_Skeleton::closeEvent( e );
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_PlaneDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPntDir->LineEdit1->text()] = myPoint;
+ objMap[GroupPntDir->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+ objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+ objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+ break;
+ case 2:
+ objMap[GroupFace->LineEdit1->text()] = myFace;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <TopTools_IndexedMapOfShape.hxx>
#include <qapplication.h>
+
using namespace std;
+
//=================================================================================
// class : BasicGUI_PointDlg()
-// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
+// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_EDGE")));
QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF")));
+ QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_LINES")));
setCaption(tr("GEOM_POINT_TITLE"));
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image3);
RadioButton3->setPixmap(image1);
+ RadioButton4->show();
+ RadioButton4->setPixmap(image4);
GroupXYZ = new DlgRef_3Spin( aFrame, "GroupXYZ" );
GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES"));
GroupRefPoint->TextLabel3->setText(tr("GEOM_DY"));
GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ"));
+ GroupLineIntersection = new DlgRef_2Sel_QTD (aFrame, "GroupLineIntersection");
+ GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION"));
+ GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1"));
+ GroupLineIntersection->PushButton1->setPixmap(image2);
+ GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
+ GroupLineIntersection->PushButton2->setPixmap(image2);
+
Layout1->addWidget( aFrame, 2, 0 );
/***************************************************************/
myY->setPalette( aPal );
myZ->setPalette( aPal );
- setHelpFileName("create_point_page.html");
-
+ // setHelpFileName("create_point_page.html");
+ setHelpFileName("point.htm");
+
Init();
}
-
//=================================================================================
// function : ~BasicGUI_PointDlg()
// purpose : Destructor
{
}
-
//=================================================================================
// function : Init()
// purpose :
{
GroupOnCurve->LineEdit1->setReadOnly( true );
GroupRefPoint->LineEdit1->setReadOnly( true );
+ GroupLineIntersection->LineEdit1->setReadOnly( true );
+ GroupLineIntersection->LineEdit2->setReadOnly( true );
myEdge = GEOM::GEOM_Object::_nil();
myRefPoint = GEOM::GEOM_Object::_nil();
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
-
+
/* min, max, step and decimals for spin boxes */
GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupOnCurve->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupLineIntersection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupLineIntersection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupLineIntersection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(GroupLineIntersection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double)));
-
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupOnCurve->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupXYZ->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupXYZ->SpinBox_DY, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupXYZ->SpinBox_DZ, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupRefPoint->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupRefPoint->SpinBox_DY, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double)));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
initName( tr("GEOM_VERTEX") );
-
+
ConstructorsClicked( 0 );
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
-{
- switch ( constructorId )
+void BasicGUI_PointDlg::ConstructorsClicked (int constructorId)
+{
+ globalSelection(); // close local contexts, if any
+
+ switch (constructorId)
{
case 0:
{
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupRefPoint->hide();
GroupOnCurve->hide();
-
+ GroupLineIntersection->hide();
GroupXYZ->show();
-
myCoordGrp->hide();
break;
}
myEditCurrentArgument->setText("");
myRefPoint = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_POINT );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupXYZ->hide();
GroupOnCurve->hide();
-
GroupRefPoint->show();
-
+ GroupLineIntersection->hide();
myCoordGrp->show();
break;
}
myEditCurrentArgument->setText("");
myEdge = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_EDGE );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
GroupXYZ->hide();
GroupRefPoint->hide();
-
GroupOnCurve->show();
-
+ GroupLineIntersection->hide();
myCoordGrp->show();
break;
}
+ case 3:
+ {
+ myEditCurrentArgument = GroupLineIntersection->LineEdit1;
+ GroupLineIntersection->LineEdit1->setText("");
+ GroupLineIntersection->LineEdit2->setText("");
+ myLine1 = GEOM::GEOM_Object::_nil();
+ myLine2 = GEOM::GEOM_Object::_nil();
+
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+
+ GroupXYZ->hide();
+ GroupRefPoint->hide();
+ GroupOnCurve->hide();
+ GroupLineIntersection->show();
+ myCoordGrp->hide();
+ break;
+ }
}
myX->setText( "" );
SelectionIntoArgument();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void BasicGUI_PointDlg::ClickOnOk()
{
- if ( onAccept() )
+ if (onAccept())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool BasicGUI_PointDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
-
+
initName();
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
return true;
}
-
//=================================================================================
// function : ClickOnCancel()
// purpose :
GEOMBase_Skeleton::ClickOnCancel();
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed (for constructors not using local context)
{
const int id = getConstructorId();
- if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 )
+ if ((id == 1 || id == 2) && myEditCurrentArgument != 0)
{
myEditCurrentArgument->setText("");
myX->setText( "" );
myRefPoint = myEdge = GEOM::GEOM_Object::_nil();
}
- if ( IObjectCount() == 1 )
+ if (IObjectCount() == 1)
{
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- if ( id == 0 )
- {
- // get CORBA reference to data object
- TopoDS_Shape aShape = myGeomGUI->GetShapeReader().GetShape
- ( myGeomGUI->GetGeomGen(), aSelectedObject );
- if ( aShape.IsNull() )
- return;
+ QString aName = GEOMBase::GetName(aSelectedObject);
- if ( aShape.ShapeType() != TopAbs_VERTEX )
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (id == 2 || id == 3)
+ aNeedType = TopAbs_EDGE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
{
- TColStd_IndexedMapOfInteger aMap;
- LightApp_Application* anApp =
- (LightApp_Application*)(SUIT_Session::session()->activeApplication());
- anApp->selectionMgr()->GetIndexes( anIO, aMap );
-
- if ( aMap.Extent() == 1 )
- {
- int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
-
- if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
- return;
- }
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString(":edge_%1").arg(anIndex);
else
- return;
+ aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 = "";
+ if (id == 0) return;
+ }
+ }
+ }
+ if (id == 0)
+ {
+ if (aShape.IsNull()) return;
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() );
GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() );
}
- else if ( id == 1 )
+ else if (id == 1)
{
myRefPoint = aSelectedObject;
- GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+ GroupRefPoint->LineEdit1->setText(aName);
}
- else if ( id == 2 )
+ else if (id == 2)
{
myEdge = aSelectedObject;
- GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+ GroupOnCurve->LineEdit1->setText(aName);
+ }
+ else if (id == 3)
+ {
+ if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
+ myLine1 = aSelectedObject;
+ myEditCurrentArgument->setText(aName);
+ }
+ else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
+ myLine2 = aSelectedObject;
+ myEditCurrentArgument->setText(aName);
+ }
}
}
}
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void BasicGUI_PointDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
- if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 )
- {
- myEditCurrentArgument = send;
- GEOMBase_Skeleton::LineEditReturnPressed();
- }
+ if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 ||
+ send == GroupLineIntersection->LineEdit1 || send == GroupLineIntersection->LineEdit2 )
+ {
+ myEditCurrentArgument = send;
+ GEOMBase_Skeleton::LineEditReturnPressed();
+ }
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void BasicGUI_PointDlg::SetEditCurrentArgument()
{
+ globalSelection(); // close local contexts, if any
+
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_POINT); // to break previous local selection
if ( send == GroupRefPoint->PushButton1 )
{
GroupRefPoint->LineEdit1->setFocus();
myEditCurrentArgument = GroupRefPoint->LineEdit1;
-
- globalSelection( GEOM_POINT );
+
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if ( send == GroupOnCurve->PushButton1 )
{
GroupOnCurve->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnCurve->LineEdit1;
-
- globalSelection( GEOM_EDGE );
+
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
-}
+ else if ( send == GroupLineIntersection->PushButton1 )
+ {
+ GroupLineIntersection->LineEdit1->setFocus();
+ myEditCurrentArgument = GroupLineIntersection->LineEdit1;
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ }
+ else if ( send == GroupLineIntersection->PushButton2 )
+ {
+ GroupLineIntersection->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupLineIntersection->LineEdit2;
+
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ }
+}
//=================================================================================
// function : enterEvent()
ActivateThisDialog();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
ConstructorsClicked( getConstructorId() );
}
-
//=================================================================================
// function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active
GEOMBase_Skeleton::DeactivateActiveDialog();
}
-
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
return !myRefPoint->_is_nil();
else if ( id == 2 )
return !myEdge->_is_nil();
+ else if ( id == 3)
+ return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
return false;
}
double x = GroupXYZ->SpinBox_DX->GetValue();
double y = GroupXYZ->SpinBox_DY->GetValue();
double z = GroupXYZ->SpinBox_DZ->GetValue();
-
+
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x,y,z );
res = true;
break;
double dx = GroupRefPoint->SpinBox_DX->GetValue();
double dy = GroupRefPoint->SpinBox_DY->GetValue();
double dz = GroupRefPoint->SpinBox_DZ->GetValue();
-
+
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
MakePointWithReference( myRefPoint, dx, dy, dz );
res = true;
MakePointOnCurve( myEdge, getParameter() );
res = true;
break;
+ case 3 :
+ anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
+ MakePointOnLinesIntersection( myLine1, myLine2 );
+ res = true;
+ break;
}
if ( getConstructorId() == 1 || getConstructorId() == 2 )
myZ->setText( "" );
}
}
-
+
if ( !anObj->_is_nil() )
{
//printf( "--> a valid point is created\n" );
{
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_PointDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ break;
+ case 1:
+ objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
+ break;
+ case 2:
+ objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
+ break;
+ case 3:
+ objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
+ objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel1Spin.h"
#include "DlgRef_3Spin.h"
+#include "DlgRef_2Sel_QTD.h"
#include "DlgRef_1Sel3Spin.h"
class QLineEdit;
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
GEOM::GEOM_Object_var myEdge;
GEOM::GEOM_Object_var myRefPoint;
+ GEOM::GEOM_Object_var myLine1;
+ GEOM::GEOM_Object_var myLine2;
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
DlgRef_1Sel1Spin* GroupOnCurve;
+ DlgRef_2Sel_QTD* GroupLineIntersection;
QGroupBox* myCoordGrp;
QLineEdit* myX;
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr("GEOM_VECTOR") );
//=================================================================================
void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId )
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myPoint1 = GEOM::GEOM_Object::_nil();
myPoint2 = GEOM::GEOM_Object::_nil();
switch (constructorId)
- {
+ {
case 0:
- {
- GroupDimensions->hide();
- resize(0, 0);
- GroupPoints->show();
-
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setText("");
- GroupPoints->LineEdit2->setText("");
-
- globalSelection( GEOM_POINT );
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- break;
- }
+ {
+ GroupDimensions->hide();
+ resize(0, 0);
+ GroupPoints->show();
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
+
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ break;
+ }
case 1:
- {
- GroupPoints->hide();
- resize( 0, 0 );
- GroupDimensions->show();
-
- double dx( 0. ), dy( 0. ), dz( 0. );
- GroupDimensions->SpinBox_DX->SetValue( dx );
- GroupDimensions->SpinBox_DY->SetValue( dy );
- GroupDimensions->SpinBox_DZ->SetValue( dz );
+ {
+ GroupPoints->hide();
+ resize( 0, 0 );
+ GroupDimensions->show();
- GroupDimensions->CheckBox1->setChecked( FALSE );
- break;
- }
+ double dx( 0. ), dy( 0. ), dz( 0. );
+ GroupDimensions->SpinBox_DX->SetValue( dx );
+ GroupDimensions->SpinBox_DY->SetValue( dy );
+ GroupDimensions->SpinBox_DZ->SetValue( dz );
+
+ GroupDimensions->CheckBox1->setChecked( FALSE );
+ break;
}
+ }
displayPreview();
}
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint1 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myPoint2 = GEOM::GEOM_Object::_nil();
return;
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+
+ int anIndex = aMap(1);
+ aName += QString(":vertex_%1").arg(anIndex);
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
+
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
}
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
GEOMBase_Skeleton::LineEditReturnPressed();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_VectorDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
void BasicGUI_VectorDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
return res;
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_VectorDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private :
void Init();
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <TColStd_MapOfInteger.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
// QT Includes
#include <qcheckbox.h>
}
case 1:
{
- globalSelection( GEOM_LINE );
+ //globalSelection( GEOM_LINE );
+ GEOM::GEOM_Object_var anObj;
+ localSelection( anObj, TopAbs_EDGE );
Group1->hide();
Group3->hide();
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText("");
- Group2->LineEdit2->setText("");
+ Group2->LineEdit2->setText("");
myVectX = GEOM::GEOM_Object::_nil();
myVectZ = GEOM::GEOM_Object::_nil();
void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
+ QString aName;
const int id = getConstructorId();
- if ( IObjectCount() != 1 ) {
- if(id == 0)
+ if (IObjectCount() != 1) {
+ if (id == 0)
myFace = GEOM::GEOM_Object::_nil();
- else if(id == 1) {
+ else if (id == 1) {
if (myEditCurrentArgument == Group2->LineEdit1)
myVectX = GEOM::GEOM_Object::_nil();
else if (myEditCurrentArgument == Group2->LineEdit2)
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
- if(!aRes || CORBA::is_nil( aSelectedObject ))
+ if (!aRes || CORBA::is_nil(aSelectedObject))
return;
- if(myEditCurrentArgument == Group1->LineEdit1)
+ aName = GEOMBase::GetName(aSelectedObject);
+
+ if (myEditCurrentArgument == Group1->LineEdit1)
myFace = aSelectedObject;
- else if(myEditCurrentArgument == Group2->LineEdit1)
- myVectX = aSelectedObject;
- else if(myEditCurrentArgument == Group2->LineEdit2)
- myVectZ = aSelectedObject;
+ else if (myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit2)
+ {
+ if ( aRes && !aSelectedObject->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ if ( aMap.Extent() == 1 )
+ {
+ int anIndex = aMap( 1 );
+ aName = aName + ":edge_" + QString::number( anIndex );
+
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ if(myEditCurrentArgument == Group2->LineEdit1)
+ myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ else
+ myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else {
+ if (myEditCurrentArgument == Group2->LineEdit1)
+ myVectX = aSelectedObject;
+ else
+ myVectZ = aSelectedObject;
+ }
+ aSelMgr->clearSelected();
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText( aName );
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
-
updateWPlane();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- if(send == Group1->PushButton1) {
+ if (send == Group1->PushButton1) {
myEditCurrentArgument = Group1->LineEdit1;
globalSelection( GEOM_PLANE );
}
- else if(send == Group2->PushButton1) {
+ else if (send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1;
- globalSelection( GEOM_LINE );
+ GEOM::GEOM_Object_var anObj;
+ localSelection( anObj, TopAbs_EDGE );
}
- else if(send == Group2->PushButton2) {
+ else if (send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2;
- globalSelection( GEOM_LINE );
+ GEOM::GEOM_Object_var anObj;
+ localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : onReverse()
// purpose :
updateWPlane();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
ConstructorsClicked( getConstructorId() );
}
-
//=================================================================================
// function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active
//=================================================================================
void BasicGUI_WorkingPlaneDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void BasicGUI_WorkingPlaneDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
GEOMBase_Skeleton::closeEvent( e );
}
-
//=================================================================================
// function : updateWPlane
// purpose :
showError( "Wrong shape selected (has to be a planar face)" );
return false;
}
-
- } else if (id == 1) { // by two vectors (Ox & Oz)
+ }
+ else if (id == 1) { // by two vectors (Ox & Oz)
if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) {
if(!showPreview)
showError( "Two vectors have to be selected" );
}
myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX);
-
- } else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX)
+ }
+ else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX)
gp_Ax2 anAx2;
if (aOriginType == 1) anAx2 = gp::XOY();
else if (aOriginType == 0) anAx2 = gp::ZOX();
myWPlane = gp_Ax3(anAx2);
-
- } else {
+ }
+ else {
return false;
}
-
+
if (myReverseCB->isChecked())
- {
- myWPlane.YReverse();
- myWPlane.ZReverse();
- }
-
+ {
+ myWPlane.YReverse();
+ myWPlane.ZReverse();
+ }
+
if (showPreview)
- {
- GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() );
- GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(),
- myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
- myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() );
- displayPreview(anObj);
- }
+ {
+ GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations(getStudyId());
+ GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker
+ (myWPlane.Location().X() , myWPlane.Location().Y() , myWPlane.Location().Z(),
+ myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
+ myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z());
+ displayPreview(anObj);
+ }
return true;
}
+
/****************************************************************************
-** Form implementation generated from reading ui file 'UIFiles/DlgRef_3Sel1Check_QTD.ui'
+** Form implementation generated from reading ui file 'DlgRef_3Sel1Check_QTD.ui'
**
-** Created: Wed Feb 21 10:49:18 2007
+** Created: Mon Oct 29 18:14:59 2007
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qlabel.h>
-#include <qradiobutton.h>
+#include <qcheckbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
- GroupBox1Layout->addWidget( LineEdit1, 0, 2 );
+ GroupBox1Layout->addMultiCellWidget( LineEdit1, 0, 0, 2, 3 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
- GroupBox1Layout->addWidget( LineEdit2, 1, 2 );
+ GroupBox1Layout->addMultiCellWidget( LineEdit2, 1, 1, 2, 3 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" );
- GroupBox1Layout->addWidget( LineEdit3, 2, 2 );
+ GroupBox1Layout->addMultiCellWidget( LineEdit3, 2, 2, 2, 3 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
GroupBox1Layout->addWidget( TextLabel3, 2, 0 );
+ Spacer3 = new QSpacerItem( 16, 721, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ GroupBox1Layout->addItem( Spacer3, 4, 3 );
- radioButton4 = new QRadioButton( GroupBox1, "radioButton4" );
+ CheckButton1 = new QCheckBox( GroupBox1, "CheckButton1" );
- GroupBox1Layout->addMultiCellWidget( radioButton4, 3, 3, 0, 1 );
- Spacer3 = new QSpacerItem( 16, 721, QSizePolicy::Minimum, QSizePolicy::Expanding );
- GroupBox1Layout->addItem( Spacer3, 4, 2 );
+ GroupBox1Layout->addMultiCellWidget( CheckButton1, 3, 3, 0, 2 );
DlgRef_3Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 );
languageChange();
- resize( QSize(490, 878).expandedTo(minimumSizeHint()) );
+ resize( QSize(403, 441).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
// tab order
TextLabel2->setText( tr( "TL2" ) );
PushButton3->setText( QString::null );
TextLabel3->setText( tr( "TL3" ) );
- radioButton4->setText( tr( "radioButton4" ) );
+ CheckButton1->setText( tr( "CheckButton1" ) );
}
/****************************************************************************
-** Form interface generated from reading ui file 'UIFiles/DlgRef_3Sel1Check_QTD.ui'
+** Form interface generated from reading ui file 'DlgRef_3Sel1Check_QTD.ui'
**
-** Created: Wed Feb 21 10:48:39 2007
+** Created: Mon Oct 29 18:14:59 2007
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
class QPushButton;
class QLineEdit;
class QLabel;
-class QRadioButton;
+class QCheckBox;
class GEOM_DLGREF_EXPORT DlgRef_3Sel1Check_QTD : public QWidget
{
QPushButton* PushButton3;
QLineEdit* LineEdit3;
QLabel* TextLabel3;
- QRadioButton* radioButton4;
+ QCheckBox* CheckButton1;
protected:
QGridLayout* DlgRef_3Sel1Check_QTDLayout;
<rect>
<x>0</x>
<y>0</y>
- <width>490</width>
- <height>878</height>
+ <width>403</width>
+ <height>441</height>
</rect>
</property>
<property name="sizePolicy">
<string></string>
</property>
</widget>
- <widget class="QLineEdit" row="0" column="2">
+ <widget class="QLineEdit" row="0" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit1</cstring>
</property>
<string></string>
</property>
</widget>
- <widget class="QLineEdit" row="1" column="2">
+ <widget class="QLineEdit" row="1" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit2</cstring>
</property>
<string></string>
</property>
</widget>
- <widget class="QLineEdit" row="2" column="2">
+ <widget class="QLineEdit" row="2" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>LineEdit3</cstring>
</property>
<string>TL3</string>
</property>
</widget>
- <widget class="QRadioButton" row="3" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>radioButton4</cstring>
- </property>
- <property name="text">
- <string>radioButton4</string>
- </property>
- </widget>
- <spacer row="4" column="2">
+ <spacer row="4" column="3">
<property name="name">
<cstring>Spacer3</cstring>
</property>
</size>
</property>
</spacer>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>CheckButton1</cstring>
+ </property>
+ <property name="text">
+ <string>CheckButton1</string>
+ </property>
+ </widget>
</grid>
</widget>
</grid>
#uic -o DlgRef_3Check_QTD.h DlgRef_3Check_QTD.ui
#uic -o DlgRef_3Check_QTD.cxx -impl DlgRef_3Check_QTD.h DlgRef_3Check_QTD.ui
-uic -o DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
-uic -o DlgRef_4Sel1Spin2Check_QTD.cxx -impl DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+#uic -o DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+#uic -o DlgRef_4Sel1Spin2Check_QTD.cxx -impl DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+#uic -o DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+#uic -o DlgRef_4Sel1Spin2Check_QTD.cxx -impl DlgRef_4Sel1Spin2Check_QTD.h DlgRef_4Sel1Spin2Check_QTD.ui
+
+#uic -o DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui
+#uic -o DlgRef_2Sel3Spin2Rb_QTD.cxx -impl DlgRef_2Sel3Spin2Rb_QTD.h DlgRef_2Sel3Spin2Rb_QTD.ui
+
+uic -o DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui
+uic -o DlgRef_3Sel1Check_QTD.cxx -impl DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui>>>>>>> 1.6.2.3
return result ;
}
+//================================================================================
+// function : MakeFilletR1R2()
+// purpose : Create a cylinder topology
+//================================================================================
+GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilletR1R2( GEOM::GEOM_Shape_ptr shape,
+ CORBA::Double radius1,
+ CORBA::Double radius2,
+ CORBA::Short ShapeType,
+ const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID )
+ throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ GEOM::GEOM_Shape_var result;
+ TopoDS_Shape tds ;
+
+ const TopoDS_Shape aShape = GetTopoShape(shape) ;
+ if( aShape.IsNull() ) {
+ THROW_SALOME_CORBA_EXCEPTION("Shape is null", SALOME::BAD_PARAM);
+ }
+
+ BRepFilletAPI_MakeFillet fill(aShape);
+
+ try {
+ /* case all */
+ if(ListOfID.length() == 0) {
+ TopExp_Explorer Exp ( aShape, TopAbs_EDGE );
+ for (Exp; Exp.More(); Exp.Next()) {
+ TopoDS_Edge E =TopoDS::Edge(Exp.Current());
+ fill.Add(E);
+ }
+ for (int i = 1;i<=fill.NbContours();i++) {
+#if OCC_VERSION_MAJOR >= 5
+ fill.SetRadius(radius1,radius2,i,i);
+#else
+ fill.SetRadius(radius1,radius2,i);
+#endif
+ }
+ tds = fill.Shape();
+
+ } else {
+
+ /* case selection */
+ for ( unsigned int ind = 0; ind < ListOfID.length(); ind++ ) {
+ TopoDS_Shape ss ;
+ if( GetShapeFromIndex( aShape, (TopAbs_ShapeEnum)ShapeType, ListOfID[ind], ss ) ) {
+ TopoDS_Edge E = TopoDS::Edge(ss) ;
+ fill.Add( E );
+ }
+ }
+ for (int i = 1;i<=fill.NbContours();i++) {
+#if OCC_VERSION_MAJOR >= 5
+ fill.SetRadius(radius1,radius2,i,i);
+#else
+ fill.SetRadius(radius1,radius2,i);
+#endif
+ }
+ tds = fill.Shape();
+ }
+ }
+ catch(Standard_Failure) {
+ THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeFilletR1R2", SALOME::BAD_PARAM);
+ }
+
+ if (tds.IsNull()) {
+ THROW_SALOME_CORBA_EXCEPTION("Make Fillet aborted", SALOME::BAD_PARAM);
+ }
+ result = CreateObject(tds);
+ InsertInLabelOneArgument(aShape, shape, tds, result, myCurrentOCAFDoc) ;
+
+ return result ;
+}
//================================================================================
// function : MakeChamfer
return result ;
}
+//================================================================================
+// function : MakeChamferAD
+// purpose : Create a Chamfer topology by Lenght & Angle
+//================================================================================
+GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeChamferAD( GEOM::GEOM_Shape_ptr shape,
+ CORBA::Double d,
+ CORBA::Double angle,
+ CORBA::Short ShapeType,
+ const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID )
+ throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ GEOM::GEOM_Shape_var result;
+ TopoDS_Shape tds ;
+
+ const TopoDS_Shape aShape = GetTopoShape(shape) ;
+ if( aShape.IsNull() ) {
+ THROW_SALOME_CORBA_EXCEPTION("Shape is null", SALOME::BAD_PARAM);
+ }
+
+ BRepFilletAPI_MakeChamfer MC(aShape);
+
+ try {
+ /* case all */
+ TopTools_IndexedDataMapOfShapeListOfShape M;
+ TopExp::MapShapesAndAncestors(aShape,TopAbs_EDGE,TopAbs_FACE,M);
+ if(ListOfID.length() == 0) {
+ for (int i = 1;i<=M.Extent();i++) {
+ TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
+ TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
+ if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
+ MC.AddDA(d,angle,E,F);
+ }
+ tds = MC.Shape();
+
+ } else {
+
+ /* case selection */
+ for ( unsigned int ind = 0; ind < ListOfID.length(); ind++ ) {
+ TopoDS_Shape ss ;
+ if( GetShapeFromIndex( aShape, (TopAbs_ShapeEnum)ShapeType, ListOfID[ind], ss ) ) {
+ TopoDS_Edge E = TopoDS::Edge( ss ) ;
+ TopoDS_Face F = TopoDS::Face(M.FindFromKey(E).First());
+ if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
+ MC.AddDA(d,angle,E,F);
+ }
+ }
+ tds = MC.Shape();
+ }
+ }
+ catch(Standard_Failure) {
+ THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeChamferAD", SALOME::BAD_PARAM);
+ }
+
+ if (tds.IsNull()) {
+ THROW_SALOME_CORBA_EXCEPTION("Make ChamferAD aborted", SALOME::BAD_PARAM);
+ }
+ result = CreateObject(tds);
+ InsertInLabelOneArgument(aShape, shape, tds, result, myCurrentOCAFDoc) ;
+ return result ;
+}
+
//=================================================================================
// function : CheckShape()
// purpose :
showError();
}
else {
+ addSubshapesToStudy(); // add Subshapes if local selection
const int nbObjs = objects.size();
int aNumber = 1;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
return true;
}
+//================================================================
+// Function : findObjectInFather
+// Purpose : It should return an object if its founded in study or
+// return Null object if the object is not founded
+//================================================================
+GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather, const char* theName)
+{
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+ string IOR = GEOMBase::GetIORFromObject( theFather );
+ _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR ) );
+
+ bool inStudy = false;
+ GEOM::GEOM_Object_var aReturnObject;
+ for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator( SObj )); iit->More() && !inStudy; iit->Next()) {
+ _PTR(SObject) child (iit->Value());
+ QString aChildName = child->GetName();
+ if (aChildName == theName) {
+ inStudy = true;
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value());
+ aReturnObject = GEOM::GEOM_Object::_narrow( corbaObj );
+ }
+ }
+ if (inStudy)
+ return aReturnObject._retn();
+ return GEOM::GEOM_Object::_nil();
+}
+//================================================================
+// Function : addSubshapesToStudy
+// Purpose : Virtual method to add subshapes if needs
+//================================================================
+void GEOMBase_Helper::addSubshapesToStudy()
+{
+ //Impemented in Dialogs, called from Accept method
+}
+
+//================================================================
+// Function : addSubshapesToFather
+// Purpose : Method to add Father Subshapes to Study if it`s not exist
+//================================================================
+void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap )
+{
+ //GetStudyDS
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+
+ GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() );
+
+ for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ )
+ {
+ if ( !anOp->_is_nil() ) {
+ GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.data() );
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key() );
+
+ //Add Object to study if its not exist
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() )
+ GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
+ it.data(), it.key(), aFatherObj );
+ }
+ else {
+ //cout << " anOperations is NULL! " << endl;
+ }
+ }
+}
+
-
-
\ No newline at end of file
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#include <qstring.h>
+#include <qmap.h>
#include <list>
// as a top-level object.
virtual const char* getNewObjectName() const;
+ virtual void addSubshapesToStudy();
+
+ GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const char* theName );
+ //This Metod to find SubObject in theFather Object by Name (theName)
+
+ void addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap );
void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
bool IsPreview() {return isPreview;}
--- /dev/null
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : GEOMBase_aWarningDlg.cxx
+// Author : Dmitry Matveitchev
+// Module : GEOM
+// $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOMBase/GEOMBase_aWarningDlg.cxx
+
+#include "GEOMBase_aWarningDlg.h"
+#include <stdio.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qvalidator.h>
+#include <qstring.h>
+#include <qscrollview.h>
+
+#ifndef WNT
+using namespace std;
+#endif
+
+GEOMBase_aWarningDlg::GEOMBase_aWarningDlg( QWidget* parent, const char* name, const QString theText, int theNum )
+ :QDialog( parent, name )
+{
+ if(!name)
+ setName( "Warning" );
+ if ( theNum < 15 )
+ resize(296, (120 + (14*theNum)) );
+ else
+ resize(296, 300);
+ setCaption(name); /* appears on the title bar */
+ setSizeGripEnabled(TRUE);
+
+ QGridLayout* topLayout = new QGridLayout(this);
+ topLayout->setSpacing(6);
+ topLayout->setMargin(11);
+
+ QGroupBox* mainGrp = new QGroupBox(this, "mainGrp");
+ mainGrp->setColumnLayout(0, Qt::Vertical);
+ mainGrp->layout()->setSpacing(0);
+ mainGrp->layout()->setMargin(0);
+
+ QGridLayout* mainGrpLayout = new QGridLayout(mainGrp->layout());
+ mainGrpLayout->setAlignment(Qt::AlignTop);
+ mainGrpLayout ->setSpacing(6);
+ mainGrpLayout->setMargin(11);
+ topLayout->addWidget(mainGrp, 0, 0);
+
+ QLabel* TextLabel = new QLabel(mainGrp, "TextLabel");
+ TextLabel->setText( QObject::tr( "GEOM_REALLY_DELETE" ).arg( theNum ) );
+ mainGrpLayout->addWidget(TextLabel, 0, 0);
+
+ QScrollView* viewer = new QScrollView (mainGrp, "viewer");
+ viewer->setResizePolicy( QScrollView::AutoOneFit );
+ QLabel* TextLabel1 = new QLabel(viewer, "TextLabel1");
+ TextLabel1->setText( theText );
+ TextLabel1->setAlignment(Qt::AlignTop);
+ viewer->addChild(TextLabel1);
+ mainGrpLayout->addWidget(viewer, 1, 0);
+
+ //Create Buttons
+
+ QGroupBox* btnGrp = new QGroupBox(this, "btnGrp");
+ btnGrp->setColumnLayout(0, Qt::Vertical);
+ btnGrp->layout()->setSpacing(0);
+ btnGrp->layout()->setMargin(0);
+ QGridLayout* btnGrpLayout = new QGridLayout(btnGrp->layout());
+ btnGrpLayout->setAlignment(Qt::AlignTop);
+ btnGrpLayout->setSpacing(6);
+ btnGrpLayout->setMargin(11);
+ topLayout->addWidget(btnGrp, 1, 0);
+
+ /* No button */
+ myButtonOk = new QPushButton(btnGrp, "buttonOk");
+ myButtonOk->setText(tr("GEOM_BUT_YES"));
+ myButtonOk->setAutoDefault(TRUE);
+ btnGrpLayout->addWidget(myButtonOk, 0, 0);
+
+ btnGrpLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+ /* Yes button */
+ myButtonCancel = new QPushButton(btnGrp, "buttonCancel");
+ myButtonCancel->setText(tr("GEOM_BUT_NO"));
+ myButtonCancel->setAutoDefault(TRUE);
+ myButtonCancel->setDefault(TRUE);
+ btnGrpLayout->addWidget(myButtonCancel, 0, 2);
+
+ /* signals and slots connections */
+ connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+
+//======================================================================================
+// function : ~GEOMBase_aWarningDlg() destructor
+// purpose : Destroys the object and frees any allocated resources
+//======================================================================================
+GEOMBase_aWarningDlg::~GEOMBase_aWarningDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+
+
--- /dev/null
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : GEOMBase_aWarningDlg.h
+// Author : Dmitry Matveitchev
+// Module : GEOM
+// $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOMBase/GEOMBase_aWarningDlg.h
+
+#ifndef GEOMBase_aWarningDLG_H
+#define GEOMBase_aWarningDLG_H
+
+#include <qdialog.h>
+#include <qwidget.h>
+
+class QString;
+class QPushButton;
+
+//=================================================================================
+// class : GEOMBase_aWarningDlg
+// purpose :
+//=================================================================================
+class GEOMBase_aWarningDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ GEOMBase_aWarningDlg( QWidget* parent, const char* name, QString theText, int nb );
+ ~GEOMBase_aWarningDlg();
+
+private:
+ QPushButton* myButtonOk;
+ QPushButton* myButtonCancel;
+
+};
+
+#endif
GEOMBase_Skeleton.h \
GEOMBase_Helper.h \
GEOM_Operation.h \
+ GEOMBase_aWarningDlg.h \
GEOM_GEOMBase.hxx
dist_libGEOMBase_la_SOURCES = \
GEOMBase_Skeleton.cxx \
GEOMBase_aParameterDlg.cxx \
GEOMBase_Helper.cxx \
+ GEOMBase_aWarningDlg.cxx \
GEOM_Operation.cxx
MOC_FILES = \
GEOMBase_Skeleton_moc.cxx \
+ GEOMBase_aWarningDlg_moc.cxx \
GEOMBase_aParameterDlg_moc.cxx
nodist_libGEOMBase_la_SOURCES= \
msgid "ICON_DLG_LINE_2P"
msgstr "line2points.png"
+#LineDlg
+msgid "ICON_DLG_LINE_2F"
+msgstr "line2faces.png"
+
#LineDlg
msgid "ICON_DLG_LINE_EDGE"
msgstr "lineedge.png"
msgid "ICON_DLG_POINT_EDGE"
msgstr "pointonedge.png"
+#PoinDlg
+msgid "ICON_DLG_POINT_LINES"
+msgstr "point_line_intersection.png"
+
#ArcDlg
msgid "ICON_DLG_ARC"
msgstr "arc.png"
msgid "GEOM_POINT_I"
msgstr "Point %1"
+#Face i
+msgid "GEOM_FACE_I"
+msgstr "Face %1"
+
#Arguments
msgid "GEOM_ARGUMENTS"
msgstr "Arguments"
msgid "GEOM_REVERSE"
msgstr "Reverse"
+#Bothway
+msgid "GEOM_BOTHWAY"
+msgstr "Both Directions"
+
#Reverse U
msgid "GEOM_REVERSE_U"
msgstr "Reverse U"
msgid "GEOM_LINE"
msgstr "Line"
+#Line 1
+msgid "GEOM_LINE1"
+msgstr "Line 1"
+
+#Line 2
+msgid "GEOM_LINE2"
+msgstr "Line 2"
+
#Plane
msgid "GEOM_PLANE"
msgstr "Plane"
Handle(AIS_InteractiveContext) ic = vw->getAISContext();
// "entry - list_of_int" map for LOCAL selection
+#ifndef WNT
NCollection_DataMap<TCollection_AsciiString, TColStd_IndexedMapOfInteger> indexesMap;
+#else
+ NCollection_DataMap<Standard_CString, TColStd_IndexedMapOfInteger> indexesMap;
+#endif
QMap<QString,int> globalSelMap; // only Key=entry from this map is used. value(int) is NOT used at all.
SelectMgr_IndexedMapOfOwner ownersmap; // map of owners to be selected
msgid "ICON_DLG_LINE_2P"
msgstr "line2points.png"
+#LineDlg
+msgid "ICON_DLG_LINE_2F"
+msgstr "line2faces.png"
+
#LineDlg
msgid "ICON_DLG_LINE_EDGE"
msgstr "lineedge.png"
msgid "ICON_DLG_POINT_EDGE"
msgstr "pointonedge.png"
+#PoinDlg
+msgid "ICON_DLG_POINT_LINES"
+msgstr "point_line_intersection.png"
+
#ArcDlg
msgid "ICON_DLG_ARC"
msgstr "arc.png"
#: GeometryGUI.cxx:3854
msgid "GEOM_REALLY_DELETE"
-msgstr "Do you really want to delete object(s) ?"
+msgstr "Do you really want to delete this %1 object(s):"
#
#==============================================================================
msgid "GEOM_POINT_I"
msgstr "Point %1"
+#Face i
+msgid "GEOM_FACE_I"
+msgstr "Face %1"
+
#Arguments
msgid "GEOM_ARGUMENTS"
msgstr "Arguments"
msgid "GEOM_REVERSE"
msgstr "Reverse"
+#Bothway
+msgid "GEOM_BOTHWAY"
+msgstr "Both Directions"
+
#Reverse U
msgid "GEOM_REVERSE_U"
msgstr "Reverse U"
msgid "GEOM_LINE"
msgstr "Line"
+#Line 1
+msgid "GEOM_LINE1"
+msgstr "Line 1"
+
+#Line 2
+msgid "GEOM_LINE2"
+msgstr "Line 2"
+
#Plane
msgid "GEOM_PLANE"
msgstr "Plane"
msgid "GEOM_REF_POINT"
msgstr "Point with reference"
+msgid "GEOM_LINE_INTERSECTION"
+msgstr "Point On Lines Intersection"
+
#
#==============================================================================
#
msgstr "Shading"
msgid "TOP_DISPLAY_ALL"
-msgstr "Display all"
+msgstr "Show all"
msgid "MEN_DISPLAY_ALL"
-msgstr "Display all"
+msgstr "Show all"
msgid "STB_DISPLAY_ALL"
-msgstr "Display all"
+msgstr "Show all"
msgid "TOP_ERASE_ALL"
-msgstr "Erase all"
+msgstr "Hide all"
msgid "MEN_ERASE_ALL"
-msgstr "Erase all"
+msgstr "Hide all"
msgid "STB_ERASE_ALL"
-msgstr "Erase all"
+msgstr "Hide all"
msgid "TOP_DISPLAY"
msgstr "Show"
msgstr "Show object(s)"
msgid "TOP_DISPLAY_ONLY"
-msgstr "Display only"
+msgstr "Show only"
msgid "MEN_DISPLAY_ONLY"
-msgstr "Display only"
+msgstr "Show only"
msgid "STB_DISPLAY_ONLY"
-msgstr "Display only"
+msgstr "Show only"
msgid "TOP_ERASE"
msgstr "Hide"
if ( (libs = getenv( "LD_LIBRARY_PATH" )) ) {
QStringList dirList = QStringList::split( ":", libs, false ); // skip empty entries
#else
- if( ( libs = getenv( "PATH" ) ) ) {
- QStringList dirList = QStringList::split( ";", libs, false ); // skip empty entries
+ if ( (libs = getenv( "PATH" )) ) {
+ QStringList dirList = QStringList::split( ";", libs, false ); // skip empty entries
#endif
for( int i = dirList.count()-1; i >= 0; i-- ) {
QString dir = dirList[ i ];
return aPrism;
}
+//=============================================================================
+/*!
+ * MakePrismVecH2Ways
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_Object) theBase,
+ Handle(GEOM_Object) theVec,
+ double theH)
+{
+ SetErrorCode(KO);
+
+ if (theBase.IsNull() || theVec.IsNull()) return NULL;
+
+ //Add a new Prism object
+ Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+
+ //Add a new Prism function for creation a Prism relatively to vector
+ Handle(GEOM_Function) aFunction =
+ aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_VEC_H_2WAYS);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
+
+ GEOMImpl_IPrism aCI (aFunction);
+
+ Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
+ Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
+
+ if (aRefBase.IsNull() || aRefVec.IsNull()) return NULL;
+
+ aCI.SetBase(aRefBase);
+ aCI.SetVector(aRefVec);
+ aCI.SetH(theH);
+
+ //Compute the Prism value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ //SetErrorCode("Prism driver failed");
+ SetErrorCode("Extrusion can not be created, check input data");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH2Ways("
+ << theBase << ", " << theVec << ", " << theH << ")";
+
+ SetErrorCode(OK);
+ return aPrism;
+}
+
//=============================================================================
/*!
* MakePrismTwoPnt
return aPrism;
}
+//=============================================================================
+/*!
+ * MakePrismTwoPnt2Ways
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways
+ (Handle(GEOM_Object) theBase,
+ Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2)
+{
+ SetErrorCode(KO);
+
+ if (theBase.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
+
+ //Add a new Prism object
+ Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
+
+ //Add a new Prism function for creation a Prism relatively to two points
+ Handle(GEOM_Function) aFunction =
+ aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_TWO_PNT_2WAYS);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
+
+ GEOMImpl_IPrism aCI (aFunction);
+
+ Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
+ Handle(GEOM_Function) aRefPnt1 = thePoint1->GetLastFunction();
+ Handle(GEOM_Function) aRefPnt2 = thePoint2->GetLastFunction();
+
+ if (aRefBase.IsNull() || aRefPnt1.IsNull() || aRefPnt2.IsNull()) return NULL;
+
+ aCI.SetBase(aRefBase);
+ aCI.SetFirstPoint(aRefPnt1);
+ aCI.SetLastPoint(aRefPnt2);
+
+ //Compute the Prism value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ //SetErrorCode("Prism driver failed");
+ SetErrorCode("Extrusion can not be created, check input data");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism2Ways("
+ << theBase << ", " << thePoint1 << ", " << thePoint2 << ")";
+
+ SetErrorCode(OK);
+ return aPrism;
+}
+
//=============================================================================
/*!
return aRevolution;
}
+//=============================================================================
+/*!
+ * MakeRevolutionAxisAngle2Ways
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways
+ (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theAxis, double theAngle)
+{
+ SetErrorCode(KO);
+
+ if (theBase.IsNull() || theAxis.IsNull()) return NULL;
+
+ //Add a new Revolution object
+ Handle(GEOM_Object) aRevolution = GetEngine()->AddObject(GetDocID(), GEOM_REVOLUTION);
+
+ //Add a new Revolution function for creation a revolution relatively to axis
+ Handle(GEOM_Function) aFunction =
+ aRevolution->AddFunction(GEOMImpl_RevolutionDriver::GetID(), REVOLUTION_BASE_AXIS_ANGLE_2WAYS);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_RevolutionDriver::GetID()) return NULL;
+
+ GEOMImpl_IRevolution aCI (aFunction);
+
+ Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
+ Handle(GEOM_Function) aRefAxis = theAxis->GetLastFunction();
+
+ if (aRefBase.IsNull() || aRefAxis.IsNull()) return NULL;
+
+ aCI.SetBase(aRefBase);
+ aCI.SetAxis(aRefAxis);
+ aCI.SetAngle(theAngle);
+
+ //Compute the Revolution value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Revolution driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution2Ways("
+ << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
+
+ SetErrorCode(OK);
+ return aRevolution;
+}
//=============================================================================
/*!
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) theVec, double theH);
+ Standard_EXPORT Handle(GEOM_Object) MakePrismVecH2Ways (Handle(GEOM_Object) theBase,
+ Handle(GEOM_Object) theVec, double theH);
+
Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) thePoint1,
Handle(GEOM_Object) thePoint2);
+ Standard_EXPORT Handle(GEOM_Object) MakePrismTwoPnt2Ways (Handle(GEOM_Object) theBase,
+ Handle(GEOM_Object) thePoint1,
+ Handle(GEOM_Object) thePoint2);
+
Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) thePath);
Handle(GEOM_Object) theAxis,
double theAngle);
+ Standard_EXPORT Handle(GEOM_Object) MakeRevolutionAxisAngle2Ways (Handle(GEOM_Object) theBase,
+ Handle(GEOM_Object) theAxis,
+ double theAngle);
+
Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
Standard_EXPORT Handle(GEOM_Object) MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter);
return aPoint;
}
+//=============================================================================
+/*!
+ * MakePointOnLinesIntersection
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection
+ (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2)
+{
+ SetErrorCode(KO);
+
+ if (theLine1.IsNull() || theLine2.IsNull()) return NULL;
+
+ //Add a new Point object
+ Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
+
+ //Add a new Point function for creation a point relativley another point
+ Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
+
+ GEOMImpl_IPoint aPI (aFunction);
+
+ Handle(GEOM_Function) aRef1 = theLine1->GetLastFunction();
+ Handle(GEOM_Function) aRef2 = theLine2->GetLastFunction();
+ if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
+
+ aPI.SetLine1(aRef1);
+ aPI.SetLine2(aRef2);
+
+ //Compute the point value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Point driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnLinesIntersection("
+ << theLine1 << ", " << theLine2 << ")";
+
+ SetErrorCode(OK);
+ return aPoint;
+}
+
//=============================================================================
/*!
* MakeTangentOnCurve
return aLine;
}
+//=============================================================================
+/*!
+ * MakeLineTwoFaces
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces
+ (Handle(GEOM_Object) theFace1, Handle(GEOM_Object) theFace2)
+{
+ SetErrorCode(KO);
+
+ if (theFace1.IsNull() || theFace2.IsNull()) return NULL;
+
+ //Add a new Line object
+ Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE);
+
+ //Add a new Line function
+ Handle(GEOM_Function) aFunction =
+ aLine->AddFunction(GEOMImpl_LineDriver::GetID(), LINE_TWO_FACES);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_LineDriver::GetID()) return NULL;
+
+ GEOMImpl_ILine aPI (aFunction);
+
+ Handle(GEOM_Function) aRef1 = theFace1->GetLastFunction();
+ Handle(GEOM_Function) aRef2 = theFace2->GetLastFunction();
+ if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
+
+ aPI.SetFace1(aRef1);
+ aPI.SetFace2(aRef2);
+
+ //Compute the Line value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Line driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoFaces("
+ << theFace1 << ", " << theFace2 << ")";
+
+ SetErrorCode(OK);
+ return aLine;
+}
//=============================================================================
/*!
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve,
double theParameter);
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnLinesIntersection
+ (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
+
// Vector
Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ);
Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2);
+ Standard_EXPORT Handle(GEOM_Object) MakeLineTwoFaces (Handle(GEOM_Object) theFace1,
+ Handle(GEOM_Object) theFace2);
+
Standard_EXPORT Handle(GEOM_Object) MakeLine (Handle(GEOM_Object) thePnt,
Handle(GEOM_Object) theDir);
return aCircle;
}
-
//=============================================================================
/*!
* MakeCirclePntVecR
#include "GEOM_Function.hxx"
-#define LINE_ARG_PNT1 1
-#define LINE_ARG_PNT2 2
+#define LINE_ARG_PNT1 1
+#define LINE_ARG_PNT2 2
+#define LINE_ARG_FACE1 3
+#define LINE_ARG_FACE2 4
class GEOMImpl_ILine
{
void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_PNT1, theRef); }
void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_PNT2, theRef); }
+ void SetFace1(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_FACE1, theRef); }
+ void SetFace2(Handle(GEOM_Function) theRef) { _func->SetReference(LINE_ARG_FACE2, theRef); }
Handle(GEOM_Function) GetPoint1() { return _func->GetReference(LINE_ARG_PNT1); }
Handle(GEOM_Function) GetPoint2() { return _func->GetReference(LINE_ARG_PNT2); }
+ Handle(GEOM_Function) GetFace1() { return _func->GetReference(LINE_ARG_FACE1); }
+ Handle(GEOM_Function) GetFace2() { return _func->GetReference(LINE_ARG_FACE2); }
private:
#define ARG_PARAM 5
#define ARG_CURVE 6
+#define ARG_LINE1 7
+#define ARG_LINE2 8
class GEOMImpl_IPoint
{
Handle(GEOM_Function) GetRef() { return _func->GetReference(ARG_REF); }
void SetCurve(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_CURVE, theRef); }
+ void SetLine1(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_LINE1, theRef); }
+ void SetLine2(Handle(GEOM_Function) theRef) { _func->SetReference(ARG_LINE2, theRef); }
Handle(GEOM_Function) GetCurve() { return _func->GetReference(ARG_CURVE); }
+ Handle(GEOM_Function) GetLine1() { return _func->GetReference(ARG_LINE1); }
+ Handle(GEOM_Function) GetLine2() { return _func->GetReference(ARG_LINE2); }
void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); }
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
-
+#include <BRepAlgoAPI_Section.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_MapOfShape.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
}
aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape();
+ } else if (aType == LINE_TWO_FACES) {
+ Handle(GEOM_Function) aRefFace1 = aPI.GetFace1();
+ Handle(GEOM_Function) aRefFace2 = aPI.GetFace2();
+ TopoDS_Shape aShape1 = aRefFace1->GetValue();
+ TopoDS_Shape aShape2 = aRefFace2->GetValue();
+ if (aShape1.ShapeType() != TopAbs_FACE ||
+ aShape2.ShapeType() != TopAbs_FACE) {
+ Standard_ConstructionError::Raise("Wrong arguments: two faces must be given");
+ }
+ if (aShape1.IsSame(aShape2)) {
+ Standard_ConstructionError::Raise("The end faces must be different");
+ }
+ BRepAlgoAPI_Section E (aShape1, aShape2, Standard_False);
+ E.Approximation(Standard_True);
+ E.Build();
+ if (!E.IsDone()) {
+ Standard_ConstructionError::Raise("Line can not be performed on the given faces");
+ }
+ else
+ {
+ TopExp_Explorer Exp (E, TopAbs_EDGE);
+ if ( Exp.More() ){
+ aShape = Exp.Current();
+ Exp.Next();
+ }
+ else
+ {
+ Standard_ConstructionError::Raise("Faces not have intersection line");
+ aShape = E.Shape();
+ }
+ if ( Exp.More() )
+ aShape = E.Shape();
+ }
+
} else if (aType == LINE_PNT_DIR) {
Handle(GEOM_Function) aRefPnt = aPI.GetPoint1();
Handle(GEOM_Function) aRefDir = aPI.GetPoint2();
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
-
+#include <BRepExtrema_DistShapeShape.hxx>
+#include <Precision.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
aP = aFP + (aLP - aFP) * aPI.GetParameter();
aPnt = aCurve->Value(aP);
- } else {
+ } else if (aType == POINT_LINES_INTERSECTION) {
+ Handle(GEOM_Function) aRef1 = aPI.GetLine1();
+ Handle(GEOM_Function) aRef2 = aPI.GetLine2();
+
+ TopoDS_Shape aRefShape1 = aRef1->GetValue();
+ TopoDS_Shape aRefShape2 = aRef2->GetValue();
+
+ if (aRefShape1.ShapeType() != TopAbs_EDGE || aRefShape2.ShapeType() != TopAbs_EDGE ) {
+ Standard_TypeMismatch::Raise
+ ("Creation Point On Lines Intersection Aborted : Line shape is not an edge");
+ }
+ //Calculate Lines Intersection Point
+ BRepExtrema_DistShapeShape dst (aRefShape1, aRefShape2);
+ if (dst.IsDone())
+ {
+ gp_Pnt P1, P2;
+ for (int i = 1; i <= dst.NbSolution(); i++) {
+ P1 = dst.PointOnShape1(i);
+ P2 = dst.PointOnShape2(i);
+ Standard_Real Dist = P1.Distance(P2);
+ if ( Dist <= Precision::Confusion() )
+ aPnt = P1;
+ else
+ Standard_TypeMismatch::Raise ("Lines not have an Intersection Point");
+ }
+ }
+ }
+ else {
return 0;
}
#include <GEOM_Function.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
//=======================================================================
TopoDS_Shape aShape;
- if (aType == PRISM_BASE_VEC_H) {
+ if (aType == PRISM_BASE_VEC_H || aType == PRISM_BASE_VEC_H_2WAYS) {
Handle(GEOM_Function) aRefBase = aCI.GetBase();
Handle(GEOM_Function) aRefVector = aCI.GetVector();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
}
if (aV.Magnitude() > Precision::Confusion()) {
aV.Normalize();
+ if (aType == PRISM_BASE_VEC_H_2WAYS) {
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslation( (-aV) * aCI.GetH() );
+ BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False);
+ aShapeBase = aTransformation.Shape();
+ aCI.SetH( aCI.GetH()*2 );
+ }
aShape = BRepPrimAPI_MakePrism(aShapeBase, aV * aCI.GetH(), Standard_False).Shape();
}
}
}
- } else if (aType == PRISM_BASE_TWO_PNT) {
+ } else if (aType == PRISM_BASE_TWO_PNT || aType == PRISM_BASE_TWO_PNT_2WAYS) {
Handle(GEOM_Function) aRefBase = aCI.GetBase();
Handle(GEOM_Function) aRefPnt1 = aCI.GetFirstPoint();
Handle(GEOM_Function) aRefPnt2 = aCI.GetLastPoint();
if (!V1.IsNull() && !V2.IsNull()) {
gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
if (aV.Magnitude() > gp::Resolution()) {
+ if (aType == PRISM_BASE_TWO_PNT_2WAYS)
+ {
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslation(-aV);
+ BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False);
+ aShapeBase = aTransformation.Shape();
+ aV = aV * 2;
+ }
aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape();
}
}
#include <GEOM_Function.hxx>
#include <BRepPrimAPI_MakeRevol.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
-
+#include <gp_Trsf.hxx>
#include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
TopoDS_Shape aShape;
- if (aType == REVOLUTION_BASE_AXIS_ANGLE) {
+ if (aType == REVOLUTION_BASE_AXIS_ANGLE || aType == REVOLUTION_BASE_AXIS_ANGLE_2WAYS) {
Handle(GEOM_Function) aRefBase = aCI.GetBase();
Handle(GEOM_Function) aRefAxis = aCI.GetAxis();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
Standard_ConstructionError::Raise("Vertex to be rotated is too close to Revolution Axis");
}
}
-
+ double anAngle = aCI.GetAngle();
gp_Ax1 anAxis (BRep_Tool::Pnt(V1), aV);
- BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, aCI.GetAngle(), Standard_False);
+ if (aType == REVOLUTION_BASE_AXIS_ANGLE_2WAYS)
+ {
+ gp_Trsf aTrsf;
+ aTrsf.SetRotation(anAxis, ( -anAngle ));
+ BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False);
+ aShapeBase = aTransformation.Shape();
+ anAngle = anAngle * 2;
+ }
+ BRepPrimAPI_MakeRevol MR (aShapeBase, anAxis, anAngle, Standard_False);
if (!MR.IsDone()) MR.Build();
if (!MR.IsDone()) StdFail_NotDone::Raise("Revolution algorithm has failed");
aShape = MR.Shape();
#define EXPORT_SHAPE 1
#define IMPORT_SHAPE 1
-#define POINT_XYZ 1
-#define POINT_XYZ_REF 2
-#define POINT_CURVE_PAR 3
-//#define POINT_FACE_PAR 4
+#define POINT_XYZ 1
+#define POINT_XYZ_REF 2
+#define POINT_CURVE_PAR 3
+#define POINT_LINES_INTERSECTION 4
+//#define POINT_FACE_PAR 5
#define VECTOR_TWO_PNT 1
#define VECTOR_DX_DY_DZ 2
#define PLANE_THREE_PNT 3
#define PLANE_TANGENT_FACE 4
-#define LINE_TWO_PNT 1
-#define LINE_PNT_DIR 2
+#define LINE_TWO_PNT 1
+#define LINE_PNT_DIR 2
+#define LINE_TWO_FACES 3
#define TRANSLATE_TWO_POINTS 1
#define TRANSLATE_VECTOR 2
#define SPHERE_R 1
#define SPHERE_PNT_R 2
-#define PRISM_BASE_VEC_H 1
-#define PRISM_BASE_TWO_PNT 2
+#define PRISM_BASE_VEC_H 1
+#define PRISM_BASE_TWO_PNT 2
+#define PRISM_BASE_VEC_H_2WAYS 3
+#define PRISM_BASE_TWO_PNT_2WAYS 4
-#define REVOLUTION_BASE_AXIS_ANGLE 1
+#define REVOLUTION_BASE_AXIS_ANGLE 1
+#define REVOLUTION_BASE_AXIS_ANGLE_2WAYS 2
#define PIPE_BASE_PATH 1
#define PIPE_DIFFERENT_SECTIONS 2
#include "GeometryGUI.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
+#include "GEOMBase_aWarningDlg.h"
+
#include "GEOM_Operation.h"
#include "GEOM_Displayer.h"
return;
}
// VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish
-
- if ( SUIT_MessageBox::warn2( app->desktop(),
- QObject::tr( "GEOM_WRN_WARNING" ),
- QObject::tr( "GEOM_REALLY_DELETE" ),
- QObject::tr( "GEOM_BUT_YES" ),
- QObject::tr( "GEOM_BUT_NO" ), 1, 0, 0 ) != 1 )
- return;
+ QString aNameList;
+ int nbSel = 0;
+ //Get Main Objects Names
+ Handle(SALOME_InteractiveObject) anIObject;
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() )
+ {
+ QString aName = It.Value()->getName();
+ if ( aName != "" && aName.ref(0) != '*') {
+ aNameList.append(" - " + aName + "\n");
+ nbSel++;
+ }
+ anIObject = It.Value();
+ }
+ // Append Child Names of Last Selected Object
+ _PTR(SObject) obj ( aStudy->FindObjectID( anIObject->getEntry() ) );
+ for (_PTR(ChildIterator) iit (aStudy->NewChildIterator(obj)); iit->More(); iit->Next()) {
+ _PTR(SObject) child (iit->Value());
+ QString aName = child->GetName();
+ if (aName != "" && aName.ref(0) != '*') {
+ aNameList.append(" - " + aName + "\n");
+ nbSel++;
+ //append childs child
+ for (_PTR(ChildIterator) iitt(aStudy->NewChildIterator(child)); iitt->More(); iitt->Next()) {
+ _PTR(SObject) childchild(iitt->Value());
+ QString aName = childchild->GetName();
+ if (aName != "" && aName.ref(0) != '*') {
+ aNameList.append(" - " + aName + "\n");
+ nbSel++;
+ for (_PTR(ChildIterator) itt(aStudy->NewChildIterator(childchild)); itt->More(); itt->Next())
+ {
+ _PTR(SObject) childs(itt->Value());
+ QString aName = childs->GetName();
+ if (aName != "" && aName.ref(0) != '*') {
+ aNameList.append(" - " + aName + "\n");
+ nbSel++;
+ }
+ }
+ }
+ }
+ }
+ } //end of child append
+
+ GEOMBase_aWarningDlg* Dialog = new GEOMBase_aWarningDlg( app->desktop(), QObject::tr( "GEOM_WRN_WARNING" ), aNameList, nbSel);
+ int r = Dialog->exec();
+
+ if (!r)
+ return;
// QAD_Operation* op = new SALOMEGUI_ImportOperation(.....);
// op->start();
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakePrismVecH2Ways
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
+ (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
+ CORBA::Double theH)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
+ (theBase->GetStudyID(), theBase->GetEntry());
+ Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
+ (theVec->GetStudyID(), theVec->GetEntry());
+
+ if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
+
+ //Create the Prism
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakePrismTwoPnt
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakePrismTwoPnt2Ways
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
+ (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
+ return aGEOMObject._retn();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
+ (theBase->GetStudyID(), theBase->GetEntry());
+ Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
+ (thePoint1->GetStudyID(), thePoint1->GetEntry());
+ Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
+ (thePoint2->GetStudyID(), thePoint2->GetEntry());
+
+ if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
+ return aGEOMObject._retn();
+
+ //Create the Prism
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakePipe
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeRevolutionAxisAngle2Ways
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
+ (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngle)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
+ (theBase->GetStudyID(), theBase->GetEntry());
+ Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
+ (theAxis->GetStudyID(), theAxis->GetEntry());
+
+ if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
+
+ //Create the Revolution
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeFilling
GEOM::GEOM_Object_ptr theVec,
CORBA::Double theH);
+ GEOM::GEOM_Object_ptr MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Double theH);
+
GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
+
GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath);
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theAngle);
+ GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngle);
+
GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter);
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakePointOnLinesIntersection
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection
+ (GEOM::GEOM_Object_ptr theLine1, GEOM::GEOM_Object_ptr theLine2)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theLine1 == NULL || theLine2 == NULL) return aGEOMObject._retn();
+
+ //Get the reference Lines
+
+ Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
+ (theLine1->GetStudyID(), theLine1->GetEntry());
+ Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
+ (theLine2->GetStudyID(), theLine2->GetEntry());
+ if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
+
+ //Create the point
+
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakePointOnLinesIntersection(aRef1, aRef2);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakePointOnCurve
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeLineTwoFaces
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces
+ (GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn();
+
+ //Get the reference points
+
+ Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
+ (theFace1->GetStudyID(), theFace1->GetEntry());
+ Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
+ (theFace2->GetStudyID(), theFace2->GetEntry());
+ if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
+
+ //Create the Line
+
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeLineTwoFaces(aRef1, aRef2);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
//=============================================================================
/*!
GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theParameter);
+ GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1,
+ GEOM::GEOM_Object_ptr theLine2);
+
GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2);
+ GEOM::GEOM_Object_ptr MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1,
+ GEOM::GEOM_Object_ptr theFace2);
+
GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3,
return anObj;
}
+//=============================================================================
+// MakePointOnLinesIntersection:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1,
+ GEOM::GEOM_Object_ptr theRefLine2)
+{
+ beginService( " GEOM_Superv_i::MakePointOnLinesIntersection" );
+ MESSAGE("GEOM_Superv_i::MakePointOnLinesIntersection");
+ getBasicOp();
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnLinesIntersection(theRefLine1, theRefLine2);
+ endService( " GEOM_Superv_i::MakePointOnLinesIntersection" );
+ return anObj;
+}
+
//=============================================================================
// MakeTangentOnCurve:
//=============================================================================
return anObj;
}
+//=============================================================================
+// MakeLineTwoFaces:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1,
+ GEOM::GEOM_Object_ptr theFace2)
+{
+ beginService( " GEOM_Superv_i::MakeLineTwoFaces");
+ MESSAGE("GEOM_Superv_i::MakeLineTwoFaces");
+ getBasicOp();
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakeLineTwoFaces(theFace1, theFace2);
+ endService( " GEOM_Superv_i::MakeLineTwoFaces");
+ return anObj;
+}
+
//=============================================================================
// MakePlaneThreePnt:
//=============================================================================
return anObj;
}
+//=============================================================================
+// MakePrismVecH2Ways:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Double theH)
+{
+ beginService( " GEOM_Superv_i::MakePrismVecH2Ways" );
+ MESSAGE("GEOM_Superv_i::MakePrismVecH2Ways");
+ get3DPrimOp();
+ GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePrismVecH2Ways(theBase, theVec, theH);
+ endService( " GEOM_Superv_i::MakePrismVecH2Ways" );
+ return anObj;
+}
//=============================================================================
// MakePrismTwoPnt:
return anObj;
}
+//=============================================================================
+// MakePrismTwoPnt2Ways:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2)
+{
+ beginService( " GEOM_Superv_i::MakePrismTwoPnt2Ways" );
+ MESSAGE("GEOM_Superv_i::MakePrismTwoPnt2Ways");
+ get3DPrimOp();
+ GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2);
+ endService( " GEOM_Superv_i::MakePrismTwoPnt2Ways" );
+ return anObj;
+}
+
//=============================================================================
// MakePipe:
//=============================================================================
return anObj;
}
+//=============================================================================
+// MakeRevolutionAxisAngle:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngle)
+{
+ beginService( " GEOM_Superv_i::MakeRevolutionAxisAngle2Ways" );
+ MESSAGE("GEOM_Superv_i::MakeRevolutionAxisAngle2Ways");
+ get3DPrimOp();
+ GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle);
+ endService( " GEOM_Superv_i::MakeRevolutionAxisAngle2Ways" );
+ return anObj;
+}
+
//=============================================================================
// MakeFilling:
//=============================================================================
CORBA::Double theZ);
GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theParameter);
+ GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1,
+ GEOM::GEOM_Object_ptr theRefLine2);
GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX,
GEOM::GEOM_Object_ptr thePnt2);
GEOM::GEOM_Object_ptr MakeLineTwoPnt (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2);
+ GEOM::GEOM_Object_ptr MakeLineTwoFaces (GEOM::GEOM_Object_ptr theFace1,
+ GEOM::GEOM_Object_ptr theFace2);
GEOM::GEOM_Object_ptr MakePlaneThreePnt (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3,
GEOM::GEOM_Object_ptr MakePrismVecH (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr theVec,
CORBA::Double theH);
+ GEOM::GEOM_Object_ptr MakePrismVecH2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Double theH);
GEOM::GEOM_Object_ptr MakePrismTwoPnt (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath);
GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theAngle);
+ GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle2Ways (GEOM::GEOM_Object_ptr theBase,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngle);
GEOM::GEOM_Object_ptr MakeFilling (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theMinDeg, CORBA::Long theMaxDeg,
CORBA::Double theTol2D, CORBA::Double theTol3D,
#Create base geometry 2D
Line = geompy.MakeLineTwoPnt(p0, pxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
Line1 = geompy.MakeLine(pz, vxy) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+ Line2 = geompy.MakeLineTwoPnt(pxyz, pz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
Plane = geompy.MakePlane(pz, vxyz, trimsize) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Plane1 = geompy.MakePlaneThreePnt(px, pz, p200, trimsize) #(4 Doubles)->GEOM_Object_ptr
#Test point on curve creation
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ #Test point on lines intersection
+ pLine = geompy.MakeVertexOnLinesIntersection( Line1, Line2 )
+
#Create base geometry 3D
Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
Box1 = geompy.MakeBoxDXDYDZ(10, 20, 30) #(3 Doubles)->GEOM_Object_ptr
#ShapeList for Sewing
S = geompy.MakeRotation(Face, vxy, angle1)
+
+ #Test Line on Faces Intersection
+ Line3 = geompy.MakeLineTwoFaces( prism1_faces[0], prism1_faces[1]) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
#Create advanced objects
Copy = geompy.MakeCopy(Box) #(GEOM_Object_ptr)->GEOM_Object_ptr
IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
Chamfer3 = geompy.MakeChamferEdges(Prism, d1, d2,
IDlist_e) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
- Chamfer4 = geompy.MakeChamferFacesAD(Prism, d1, 0.2,
+ Chamfer4 = geompy.MakeChamferFacesAD(Prism, d1, 20. * math.pi / 180.,
IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
-
#Create Patterns
MultiTrans1D = geompy.MakeMultiTranslation1D(Fillet, vz, step1, nbtimes1)
MultiTrans2D = geompy.MakeMultiTranslation2D(Fillet, vz, step1, nbtimes1, vy, step2, nbtimes2)
id_pz = geompy.addToStudy(pz, "Vertex Z")
id_pxyz = geompy.addToStudy(pxyz, "Vertex XYZ")
id_p200 = geompy.addToStudy(p200, "Vertex 200")
+ id_pLine = geompy.addToStudy(pLine, "Vertex on Lines Intersection")
id_vx = geompy.addToStudy(vx, "Vector X")
id_vy = geompy.addToStudy(vy, "Vector Y")
id_Line = geompy.addToStudy(Line, "Line")
id_Line1 = geompy.addToStudy(Line1, "Line by point and vector")
+ id_Line3 = geompy.addToStudy(Line3, "Line on Two Faces Intersection")
id_Plane = geompy.addToStudy(Plane, "Plane")
id_Plane1 = geompy.addToStudy(Plane1, "Plane by 3 points")
id_Fillet = geompy.addToStudy(Fillet, "Fillet")
id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2")
+
id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer on Edge")
id_Chamfer2 = geompy.addToStudy(Chamfer2, "Chamfer on Faces")
id_Chamfer3 = geompy.addToStudy(Chamfer3, "Chamfer on Edges")
print "MakePointOnCurve : ", BasicOp.GetErrorCode()
return anObj
+def MakeVertexOnLinesIntersection(line1,line2):
+ anObj = BasicOp.MakePointOnLinesIntersection(line1,line2)
+ if BasicOp.IsDone() == 0:
+ print "MakePointOnLinesIntersection : ", BasicOp.GetErrorCode()
+ return anObj
+
def MakeVectorDXDYDZ(dx,dy,dz):
anObj = BasicOp.MakeVectorDXDYDZ(dx,dy,dz)
if BasicOp.IsDone() == 0:
print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
return anObj
+def MakeLineTwoFaces(f1, f2):
+ anObj = BasicOp.MakeLineTwoFaces(f1,f2)
+ if BasicOp.IsDone() == 0:
+ print "MakeLineTwoFaces : ", BasicOp.GetErrorCode()
+ return anObj
+
def MakePlane(p1,v1,trimsize):
anObj = BasicOp.MakePlanePntVec(p1,v1,trimsize)
if BasicOp.IsDone() == 0:
print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
return anObj
+def MakePrism2Ways(baseShape,point1,point2):
+ anObj = PrimOp.MakePrismTwoPnt2Ways(baseShape,point1,point2)
+ if PrimOp.IsDone() == 0:
+ print "MakePrismTwoPnt2Ways : ", PrimOp.GetErrorCode()
+ return anObj
+
def MakePrismVecH(baseShape,vector,height):
anObj = PrimOp.MakePrismVecH(baseShape,vector,height)
if PrimOp.IsDone() == 0:
print "MakePrismVecH : ", PrimOp.GetErrorCode()
return anObj
+def MakePrismVecH2Ways(baseShape,vector,height):
+ anObj = PrimOp.MakePrismVecH2Ways(baseShape,vector,height)
+ if PrimOp.IsDone() == 0:
+ print "MakePrismVecH2Ways : ", PrimOp.GetErrorCode()
+ return anObj
+
def MakePipe(baseShape,pathShape):
anObj = PrimOp.MakePipe(baseShape,pathShape)
if PrimOp.IsDone() == 0:
print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
return anObj
+def MakeRevolution2Ways(aShape,axis,angle):
+ anObj = PrimOp.MakeRevolutionAxisAngle2Ways(aShape,axis,angle)
+ if PrimOp.IsDone() == 0:
+ print "MakeRevolutionAxisAngle2Ways : ", PrimOp.GetErrorCode()
+ return anObj
+
# -----------------------------------------------------------------------------
# Create base shapes
# -----------------------------------------------------------------------------
globals()[k]=getattr(geom,k)
del k
from geompyDC import ShapeType,GEOM,kind, info
+
#include <qlabel.h>
#include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#if OCC_VERSION_MAJOR >= 5
initName(tr("GEOM_PIPE"));
- globalSelection( GEOM_ALLSHAPES );
+ // globalSelection( GEOM_ALLSHAPES );
}
return;
myBase = aSelectedObject;
+ myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
myOkBase = true;
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
myOkPath = false;
- if(!GEOMBase::GetShape(aSelectedObject, S) ||
- !(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) )
+ if( !GEOMBase::GetShape(aSelectedObject, S) )
return;
+
+ QString aName = GEOMBase::GetName( aSelectedObject );
- myPath = aSelectedObject;
- myOkPath = true;
+ if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase)
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ 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 == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ myOkPath = true;
+ }
+ else { // get Object from study
+ myPath = aFindedObject;
+ myOkPath = true;
+ }
+ }
+ else {
+ myOkPath = true;
+ if (S.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOkPath = false;
+ }
+ myPath = aSelectedObject;
+ }
+ }
+ myEditCurrentArgument->setText( aName );
}
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
}
void GenerationGUI_PipeDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
+ globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument = GroupPoints->LineEdit1;
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
+ globalSelection();
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
SelectionIntoArgument();
}
return true;
}
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_PipeDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit2->text()] = myPath;
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include <qcheckbox.h>
RadioButton3->close(TRUE);
RadioButton1->setChecked(true);
+ myBothway = myBothway2 = false;
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
- GroupPoints->CheckButton1->hide();
GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
GroupPoints->TextLabel1->setText(tr("GEOM_BASE"));
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPoints->PushButton2->setPixmap(image1);
GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true );
+ GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
+ GroupPoints->CheckButton1->setChecked(myBothway);
GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
- GroupPoints2 = new DlgRef_3Sel_QTD(this, "GroupPoints2");
+ GroupPoints2 = new DlgRef_3Sel1Check_QTD(this, "GroupPoints2");
GroupPoints2->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV_2P"));
GroupPoints2->TextLabel1->setText(tr("GEOM_BASE"));
GroupPoints2->TextLabel2->setText(tr("GEOM_POINT_I").arg("1"));
GroupPoints2->PushButton1->setPixmap(image1);
GroupPoints2->PushButton2->setPixmap(image1);
GroupPoints2->PushButton3->setPixmap(image1);
+ GroupPoints2->CheckButton1->setText(tr("GEOM_BOTHWAY"));
+ GroupPoints2->CheckButton1->setChecked(myBothway2);
Layout1->addWidget(GroupPoints, 2, 0);
Layout1->addWidget(GroupPoints2, 2, 0);
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
+ connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
-
connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway2()));
connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
// nbSel == 1
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_ptr aSelectedObject =
+ GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if (!testResult)
return;
+ bool myOk = true;
+ TopoDS_Shape aShape;
+ QString aName = GEOMBase::GetName( aSelectedObject );
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ 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 == GEOM::GEOM_Object::_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 {
+ if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOk = false;
+ }
+ }
+ }
+
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myBase = aSelectedObject;
myOkBase = true;
}
- else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
+ myOkVec = true;
myVec = aSelectedObject;
- myOkVec = true;
}
-
- myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+ myEditCurrentArgument->setText( aName );
}
else // getConstructorId()==1 - extrusion using 2 points
{
if (!testResult || CORBA::is_nil( aSelectedObject ))
return;
+ QString aName = GEOMBase::GetName( aSelectedObject );
+ TopoDS_Shape aShape;
+ bool myOk = true;
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ if (aMap.Extent() == 1)
+ {
+ int anIndex = aMap(1);
+ aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject;
+ }
+ else
+ {
+ if ((aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2) ||
+ (aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3))
+ {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOk = false;
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
+
if (myEditCurrentArgument == GroupPoints2->LineEdit1) {
myBase = aSelectedObject;
myOkBase = true;
}
- else if (myEditCurrentArgument == GroupPoints2->LineEdit2) {
- myPoint1 = aSelectedObject;
+ else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
myOkPnt1 = true;
+ myPoint1 = aSelectedObject;
}
- else if (myEditCurrentArgument == GroupPoints2->LineEdit3) {
- myPoint2 = aSelectedObject;
+ else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) {
myOkPnt2 = true;
+ myPoint2 = aSelectedObject;
}
-
- myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
}
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void GenerationGUI_PrismDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_ALLSHAPES );
if (send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_ALLSHAPES );
}
else if (send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if (send == GroupPoints2->PushButton1) {
GroupPoints2->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints2->LineEdit1;
- globalSelection( GEOM_ALLSHAPES );
}
else if (send == GroupPoints2->PushButton2) {
GroupPoints2->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints2->LineEdit2;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if (send == GroupPoints2->PushButton3) {
GroupPoints2->LineEdit3->setFocus();
myEditCurrentArgument = GroupPoints2->LineEdit3;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
myEditCurrentArgument->setFocus();
//=================================================================================
double GenerationGUI_PrismDlg::getHeight() const
{
- return GroupPoints->SpinBox_DX->GetValue();
+ return GroupPoints->SpinBox_DX->GetValue();
}
//=================================================================================
bool GenerationGUI_PrismDlg::isValid( QString& )
{
if (getConstructorId() == 0)
- // by vector and height
- return (myOkBase && myOkVec);
-
- // by two points
- return (myOkBase && myOkPnt1 && myOkPnt2);
+ return (myOkBase && myOkVec); // by vector and height
+ else
+ return (myOkBase && myOkPnt1 && myOkPnt2); // by two points
}
//=================================================================================
{
case 0:
{
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
- MakePrismVecH(myBase, myVec, getHeight());
+ if (!myBothway)
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismVecH(myBase, myVec, getHeight());
+ else
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismVecH2Ways(myBase, myVec, getHeight() );
break;
}
case 1:
{
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ if (!myBothway2)
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismTwoPnt(myBase, myPoint1, myPoint2);
+ else
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
+ MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2);
break;
}
}
double anOldValue = GroupPoints->SpinBox_DX->GetValue();
GroupPoints->SpinBox_DX->SetValue( -anOldValue );
}
+
+//=================================================================================
+// function : onBothway()
+// purpose :
+//=================================================================================
+void GenerationGUI_PrismDlg::onBothway()
+{
+ bool anOldValue = myBothway;
+ myBothway = !anOldValue;
+ GroupPoints->CheckButton2->setEnabled(!myBothway);
+ displayPreview();
+}
+
+void GenerationGUI_PrismDlg::onBothway2()
+{
+ bool anOldValue = myBothway2;
+ myBothway2 = !anOldValue;
+ displayPreview();
+}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_PrismDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myVec;
+ break;
+ case 1:
+ objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
+ objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
#include "GEOMBase_Skeleton.h"
#include "DlgRef_2Sel1Spin2Check.h"
-#include "DlgRef_3Sel_QTD.h"
+#include "DlgRef_3Sel1Check_QTD.h"
//=================================================================================
// class : GenerationGUI_PrismDlg
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
bool myOkVec;
bool myOkPnt1;
bool myOkPnt2;
+ bool myBothway;
+ bool myBothway2;
DlgRef_2Sel1Spin2Check* GroupPoints;
- DlgRef_3Sel_QTD* GroupPoints2; // for second layout for extrusion using 2 points
+ DlgRef_3Sel1Check_QTD* GroupPoints2; // for second layout for extrusion using 2 points
private slots:
void ClickOnOk();
void SetEditCurrentArgument();
void ValueChangedInSpinBox();
void onReverse();
+ void onBothway();
+ void onBothway2();
};
#endif // DIALOGBOX_PRISM_H
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <gp_Lin.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepPrimAPI_MakeRevol.hxx>
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
+ myBothway = false;
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
- GroupPoints->CheckButton1->hide();
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
GroupPoints->PushButton2->setPixmap(image1);
GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true );
+ GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
Layout1->addWidget(GroupPoints, 2, 0);
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
+ QString aName = GEOMBase::GetName( aSelectedObject );
if (!testResult)
return;
myOkBase = true;
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
- myAxis = aSelectedObject;
- myOkAxis = true;
+ if ( testResult && !aSelectedObject->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ 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 == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ myOkAxis = true;
+ }
+ else {
+ myAxis = aFindedObject;
+ myOkAxis = true;
+ }
+ }
+ else {
+ myOkAxis = true;
+ if (aShape.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ myOkAxis = false;
+ }
+ myAxis = aSelectedObject;
+ }
+ }
+ }
}
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+ myEditCurrentArgument->setText( aName );
displayPreview();
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
SelectionIntoArgument();
}
{
GEOM::GEOM_Object_var anObj;
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
- getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 );
+ if (!myBothway)
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
+ getOperation() )->MakeRevolutionAxisAngle( myBase, myAxis, getAngle() * PI180 );
+ else
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
+ getOperation() )->MakeRevolutionAxisAngle2Ways( myBase, myAxis, getAngle() * PI180 );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
double anOldValue = GroupPoints->SpinBox_DX->GetValue();
GroupPoints->SpinBox_DX->SetValue( -anOldValue );
}
+
+//=================================================================================
+// function : onBothway()
+// purpose :
+//=================================================================================
+void GenerationGUI_RevolDlg::onBothway()
+{
+ bool anOldValue = myBothway;
+ myBothway = !anOldValue;
+ GroupPoints->CheckButton2->setEnabled(!myBothway);
+ displayPreview();
+}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_RevolDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit2->text()] = myAxis;
+
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private :
void Init();
GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */
bool myOkBase;
bool myOkAxis;
+ bool myBothway;
DlgRef_2Sel1Spin2Check* GroupPoints;
void SetEditCurrentArgument();
void ValueChangedInSpinBox();
void onReverse();
+ void onBothway();
};
#endif // DIALOGBOX_REVOLUTION_H
myMainName->setReadOnly( true );
myMainName->setEnabled( myMode == CreateGroup );
- mySelSubBtn = new QPushButton( tr( "SELECT_SUB_SHAPES" ), aFrame );
+ mySelSubBtn = new QRadioButton (tr( "SELECT_SUB_SHAPES" ), aFrame );
mySelAllBtn = new QPushButton( tr( "SELECT_ALL" ), aFrame );
myAddBtn = new QPushButton( tr( "ADD" ), aFrame );
myRemBtn = new QPushButton( tr( "REMOVE" ), aFrame );
void GroupGUI_GroupDlg::Init()
{
// san -- TODO: clear selected sub-shapes...
-
+ mySelSubBtn->setChecked( true );
if ( myMode == CreateGroup ) {
initName( tr( "GROUP_PREFIX" ) );
connect( myIdList, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
activateSelection();
+ // activate subshapes selection if Main Shape is Selected
+ if ( !CORBA::is_nil( myMainObj ) ) {
+ myEditCurrentArgument = 0;
+ activateSelection();
+ updateState();
+ }
}
//=================================================================================
if ( send == mySelBtn )
myEditCurrentArgument = myMainName;
- else if ( send == mySelSubBtn || send == mySelAllBtn )
+ else if ( (QRadioButton*)sender() == mySelSubBtn || send == mySelAllBtn )
myEditCurrentArgument = 0;
activateSelection();
if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) {
myMainObj = anObj;
myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
- updateState();
+ // activate subshapes selection by default
+ myEditCurrentArgument = 0;
+ activateSelection();
+ updateState();
return;
}
}
break;
}
}
-
if ( !isAdd ) {
aMapIndex.Clear();
break;
class QGroupBox;
class QLineEdit;
class QListBox;
+class QRadioButton;
//=================================================================================
// class : GroupGUI_GroupDlg
QGroupBox* GroupMedium;
QPushButton* mySelBtn;
QLineEdit* myMainName;
- QPushButton* mySelSubBtn;
+ QRadioButton* mySelSubBtn;
QPushButton* mySelAllBtn;
QPushButton* myAddBtn;
QPushButton* myRemBtn;
myGrp3->show();
myGrp4->hide();
mySpinBox[ SpinBox31 ]->SetValue( D1 );
- mySpinBox[ SpinBox32 ]->SetValue( D2 );
+ mySpinBox[ SpinBox32 ]->SetValue( D2 );
mySpinBox[ SpinBox33 ]->SetValue( D );
mySpinBox[ SpinBox34 ]->SetValue( Angle );
break;
myGrp1->hide();
myGrp2->hide();
myGrp3->hide();
- myGrp4->show();
+ myGrp4->show();
mySpinBox[ SpinBox41 ]->SetValue( D1 );
mySpinBox[ SpinBox42 ]->SetValue( D2 );
mySpinBox[ SpinBox43 ]->SetValue( D );
myEditCurrentArgument == mySelName[ Faces ] ) )
localSelection( myShape, TopAbs_FACE );
else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] )
- localSelection( myShape, TopAbs_EDGE );
+ localSelection( myShape, TopAbs_EDGE );
else
{
TColStd_MapOfInteger aMap;
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
anArray->length( myFaces.Extent() );
for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
- anArray[ i - 1 ] = myFaces( i );
+ anArray[ i - 1 ] = myFaces( i );
if ( flag )
anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeChamferFaces( myShape,
anArray );
}
else if ( anId == 3 )
- { GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+ {
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
anArray->length( myEdges.Extent() );
for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )
anArray[ i - 1 ] = myEdges( i );
return true;
}
-
-
-// GEOM GEOMGUI : GUI for Geometry component\r
-//\r
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
-//\r
-//\r
-//\r
-// File : OperationGUI_ChamferDlg.h\r
-// Author : Damien COQUERET\r
-// Module : GEOM\r
-\r
-#ifndef DIALOGBOX_CHAMFER_H\r
-#define DIALOGBOX_CHAMFER_H\r
-\r
-#include "GEOMBase_Skeleton.h"\r
-#include <TColStd_IndexedMapOfInteger.hxx>\r
-\r
-class DlgRef_SpinBox;\r
-\r
-//=================================================================================\r
-// class : OperationGUI_ChamferDlg\r
-// purpose :\r
-//=================================================================================\r
-class OperationGUI_ChamferDlg : public GEOMBase_Skeleton\r
-{ \r
- Q_OBJECT\r
-\r
- enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces, MainObj4, Edges};\r
- enum { SpinBox1,\r
- SpinBox21, SpinBox22, SpinBox23, SpinBox24, \r
- SpinBox31, SpinBox32, SpinBox33, SpinBox34,\r
- SpinBox41, SpinBox42, SpinBox43, SpinBox44 };\r
- enum { RadioButton21, RadioButton22,\r
- RadioButton31, RadioButton32,\r
- RadioButton41, RadioButton42 };\r
-public:\r
- OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent);\r
- virtual ~OperationGUI_ChamferDlg();\r
-\r
-protected:\r
- // redefined from GEOMBase_Helper\r
- virtual GEOM::GEOM_IOperations_ptr createOperation();\r
- virtual bool isValid( QString& msg );\r
- virtual bool execute( ObjectList& objects ); \r
-\r
-private slots:\r
- void ClickOnOk();\r
- bool ClickOnApply();\r
- void ActivateThisDialog();\r
- void LineEditReturnPressed();\r
- void RadioButtonPressed();\r
- void SelectionIntoArgument();\r
- void SetEditCurrentArgument();\r
- void ValueChangedInSpinBox( double newValue );\r
- void ConstructorsClicked( int constructorId );\r
-\r
-private:\r
- void Init();\r
- void enterEvent( QEvent* e );\r
- void reset();\r
- void createSelWg( const QString&, QPixmap&, QWidget*, const int );\r
- int getConstructorId() const;\r
- void activateSelection();\r
- void enableWidgets();\r
-\r
-private:\r
- int myConstructorId;\r
-\r
- GEOM::GEOM_Object_var myShape; \r
- QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 )\r
- TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )\r
- TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges)\r
- \r
- QFrame* myGrp1;\r
- QFrame* myGrp2;\r
- QFrame* myGrp3;\r
- QFrame* myGrp4;\r
-\r
- QMap< int, QPushButton* > mySelBtn;\r
- QMap< int, QLineEdit* > mySelName;\r
- QMap< int, DlgRef_SpinBox* > mySpinBox;\r
- QMap< int, QRadioButton* > myRadioButton;\r
-};\r
-\r
-#endif // DIALOGBOX_CHAMFER_H\r
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : OperationGUI_ChamferDlg.h
+// Author : Damien COQUERET
+// Module : GEOM
+
+#ifndef DIALOGBOX_CHAMFER_H
+#define DIALOGBOX_CHAMFER_H
+
+#include "GEOMBase_Skeleton.h"
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+class DlgRef_SpinBox;
+
+//=================================================================================
+// class : OperationGUI_ChamferDlg
+// purpose :
+//=================================================================================
+class OperationGUI_ChamferDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+ enum { MainObj1, MainObj2, Face1, Face2, MainObj3, Faces, MainObj4, Edges};
+ enum { SpinBox1,
+ SpinBox21, SpinBox22, SpinBox23, SpinBox24,
+ SpinBox31, SpinBox32, SpinBox33, SpinBox34,
+ SpinBox41, SpinBox42, SpinBox43, SpinBox44 };
+ enum { RadioButton21, RadioButton22,
+ RadioButton31, RadioButton32,
+ RadioButton41, RadioButton42 };
+public:
+ OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent);
+ virtual ~OperationGUI_ChamferDlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& msg );
+ virtual bool execute( ObjectList& objects );
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void LineEditReturnPressed();
+ void RadioButtonPressed();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void ValueChangedInSpinBox( double newValue );
+ void ConstructorsClicked( int constructorId );
+
+private:
+ void Init();
+ void enterEvent( QEvent* e );
+ void reset();
+ void createSelWg( const QString&, QPixmap&, QWidget*, const int );
+ int getConstructorId() const;
+ void activateSelection();
+ void enableWidgets();
+
+private:
+ int myConstructorId;
+
+ GEOM::GEOM_Object_var myShape;
+ QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 )
+ TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )
+ TColStd_IndexedMapOfInteger myEdges; // indexes of edges from fourth tab (Edges)
+
+ QFrame* myGrp1;
+ QFrame* myGrp2;
+ QFrame* myGrp3;
+ QFrame* myGrp4;
+
+ QMap< int, QPushButton* > mySelBtn;
+ QMap< int, QLineEdit* > mySelName;
+ QMap< int, DlgRef_SpinBox* > mySpinBox;
+ QMap< int, QRadioButton* > myRadioButton;
+};
+
+#endif // DIALOGBOX_CHAMFER_H
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_BOX" ) );
ConstructorsClicked(0);
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
-
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
switch (constructorId)
{
case 0:
{
- globalSelection( GEOM_POINT );
+ // globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
-
+
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText("");
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
displayPreview();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed
//=================================================================================
void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
-
+
myEditCurrentArgument->setText("");
-
+
if (IObjectCount() != 1)
- {
- if (myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint1 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2)
- myPoint2 = GEOM::GEOM_Object::_nil();
- return;
- }
+ {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myPoint1 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myPoint2 = GEOM::GEOM_Object::_nil();
+ return;
+ }
// nbSel == 1
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
-
- if(!testResult || CORBA::is_nil( aSelectedObject ))
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
+
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
-
- if(myEditCurrentArgument == GroupPoints->LineEdit1)
+
+ TopoDS_Shape aShape;
+ QString aName = GEOMBase::GetName(aSelectedObject);
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap( 1 );
+ aName.append( ":vertex_" + QString::number( anIndex ) );
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
+
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint1 = aSelectedObject;
- else if(myEditCurrentArgument == GroupPoints->LineEdit2)
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myPoint2 = aSelectedObject;
-
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
-
+
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
-
+
if(send == GroupPoints->PushButton1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else if(send == GroupPoints->PushButton2)
myEditCurrentArgument = GroupPoints->LineEdit2;
-
- globalSelection( GEOM_POINT );
-
+
+ // globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void PrimitiveGUI_BoxDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
ConstructorsClicked( getConstructorId() );
}
{
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_BoxDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+ if ( getConstructorId() == 0 )
+ {
+ objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_CONE" ) );
//=================================================================================
void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId)
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch(constructorId)
{
case 0 :
{
- globalSelection( GEOM_POINT );
+ // globalSelection( GEOM_POINT );
+ globalSelection(); // to break prvious local selection
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
GroupPoints->LineEdit2->setText(tr(""));
myPoint = myDir = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
//=================================================================================
void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
- if(IObjectCount() != 1)
- {
- if(myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2)
- myDir = GEOM::GEOM_Object::_nil();
- return;
- }
+ if (IObjectCount() != 1)
+ {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myPoint = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myDir = GEOM::GEOM_Object::_nil();
+ return;
+ }
/* nbSel == 1 */
Standard_Boolean testResult = Standard_False;
if(!testResult || CORBA::is_nil( aSelectedObject ))
return;
+ TopoDS_Shape aShape;
+ QString aName = GEOMBase::GetName( aSelectedObject );
+
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), aMap );
+ if (aMap.Extent() == 1)
+ {
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName.append(":edge_" + QString::number(anIndex));
+ else
+ aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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
+ {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
+
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
-
-
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
+ globalSelection( GEOM_POINT ); // to break prvious local selection
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ globalSelection( GEOM_LINE );// to break prvious local selection
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void PrimitiveGUI_ConeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- ConstructorsClicked( getConstructorId() );
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(getConstructorId());
+}
//=================================================================================
// function : DeactivateActiveDialog()
return GroupDimensions->SpinBox_DZ->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_ConeDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_CYLINDER" ) );
//=================================================================================
void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId)
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
- switch(constructorId)
+ switch (constructorId)
{
case 0 :
{
- globalSelection( GEOM_POINT );
+ globalSelection( GEOM_POINT ); // to break previous local selection
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupDimensions->hide();
resize(0, 0);
GroupPoints->LineEdit2->setText(tr(""));
myPoint = myDir = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
//=================================================================================
void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
myEditCurrentArgument->setText("");
-
- if(IObjectCount() != 1)
- {
- if(myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2)
- myDir = GEOM::GEOM_Object::_nil();
- return;
- }
-
+
+ if (IObjectCount() != 1)
+ {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myPoint = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myDir = GEOM::GEOM_Object::_nil();
+ return;
+ }
+
/* nbSel == 1 */
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
-
- if(!testResult || CORBA::is_nil( aSelectedObject ))
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
+
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
-
+
+ QString aName = GEOMBase::GetName(aSelectedObject);
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName.append(":edge_" + QString::number(anIndex));
+ else
+ aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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)
myPoint = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
-
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
-
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- if(send == GroupPoints->PushButton1) {
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
+ globalSelection( GEOM_POINT ); // to break previous local selection
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
- else if(send == GroupPoints->PushButton2) {
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ globalSelection( GEOM_LINE ); // to break previous local selection
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void PrimitiveGUI_CylinderDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- ConstructorsClicked( getConstructorId() );
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(getConstructorId());
+}
//=================================================================================
// function : enterEvent()
return 0;
}
-
//=================================================================================
// function : getHeight()
// purpose :
return GroupDimensions->SpinBox_DY->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_CylinderDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
Init();
}
-
//=================================================================================
// function : ~PrimitiveGUI_SphereDlg()
// purpose : Destroys the object and frees any allocated resources
/* no need to delete child widgets, Qt does it all for us */
}
-
//=================================================================================
// function : Init()
// purpose :
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_SPHERE"));
ConstructorsClicked(0);
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
+void PrimitiveGUI_SphereDlg::ConstructorsClicked (int constructorId)
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
-
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
switch (constructorId)
{
case 0:
{
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
GroupPoints->LineEdit1->setText("");
myPoint = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
displayPreview();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
return true;
}
-
-
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void PrimitiveGUI_SphereDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
-
+
myEditCurrentArgument->setText("");
-
- if(IObjectCount() != 1)
- {
- myPoint = GEOM::GEOM_Object::_nil();
- return;
- }
-
+
+ if (IObjectCount() != 1)
+ {
+ myPoint = GEOM::GEOM_Object::_nil();
+ return;
+ }
+
/* nbSel == 1 ! */
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
-
- if (!testResult || CORBA::is_nil( aSelectedObject ))
+ GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
+
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
-
+
+ QString aName = GEOMBase::GetName(aSelectedObject);
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap( 1 );
+ aName.append( ":vertex_" + QString::number( anIndex ) );
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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 = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
myPoint = aSelectedObject;
- myEditCurrentArgument->setText( GEOMBase::GetName( myPoint ) );
-
+
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- if(send == GroupPoints->PushButton1) {
+ if (send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
SelectionIntoArgument();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void PrimitiveGUI_SphereDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- ConstructorsClicked( getConstructorId() );
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(getConstructorId());
+}
//=================================================================================
// function : DeactivateActiveDialog()
GEOMBase_Skeleton::DeactivateActiveDialog();
}
-
//=================================================================================
// function : enterEvent()
// purpose :
ActivateThisDialog();
}
-
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
displayPreview();
}
-
//=================================================================================
// function : createOperation
// purpose :
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
}
-
//=================================================================================
// function : isValid
// purpose :
// function : execute
// purpose :
//=================================================================================
-bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
+bool PrimitiveGUI_SphereDlg::execute (ObjectList& objects)
{
bool res = false;
-
+
GEOM::GEOM_Object_var anObj;
- switch ( getConstructorId() )
+ switch (getConstructorId())
{
- case 0 :
+ case 0:
{
- if ( !CORBA::is_nil( myPoint ) ) {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
+ if (!CORBA::is_nil(myPoint)) {
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
+ MakeSpherePntR(myPoint, getRadius());
res = true;
}
break;
}
- case 1 :
+ case 1:
{
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
+ MakeSphereR(getRadius());
res = true;
break;
}
}
-
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
-
+
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+
return res;
}
//=================================================================================
void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e )
{
- //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
-
-
//=================================================================================
// function : getRadius()
// purpose :
return GroupDimensions->SpinBox_DX->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_SphereDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
- connect(myGeomGUI->getApp()->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_TORUS" ) );
ConstructorsClicked(0);
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
+void PrimitiveGUI_TorusDlg::ConstructorsClicked (int constructorId)
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
{
case 0:
{
- globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupDimensions->hide();
resize(0, 0);
//=================================================================================
void PrimitiveGUI_TorusDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
bool PrimitiveGUI_TorusDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
//=================================================================================
void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
myEditCurrentArgument->setText("");
/* nbSel == 1 */
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
- if (!testResult || CORBA::is_nil( aSelectedObject ))
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
+ QString aName = GEOMBase::GetName(aSelectedObject);
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(firstIObject(), aMap);
+ if (aMap.Extent() == 1) // Local Selection
+ {
+ int anIndex = aMap(1);
+ if (aNeedType == TopAbs_EDGE)
+ aName.append(":edge_" + QString::number(anIndex));
+ else
+ aName.append(":vertex_" + QString::number(anIndex));
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_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)
myPoint = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_POINT ); // to break previous local selection
if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ GEOM::GEOM_Object_var anObj;
+ localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
}
-
//=================================================================================
// function : isValid
// purpose :
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
}
-
//=================================================================================
// function : execute
// purpose :
return res;
}
-
//=================================================================================
// function : getRadius1()
// purpose :
return 0;
}
-
//=================================================================================
// function : getRadius2()
// purpose :
return GroupDimensions->SpinBox_DY->GetValue();
return 0;
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_TorusDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit1->text()] = myPoint;
+ objMap[GroupPoints->LineEdit2->text()] = myDir;
+ break;
+ case 1:
+ return;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qcheckbox.h>
#include <qlabel.h>
return;
}
Standard_Boolean testResult = Standard_False;
- myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+ myArgument = aSelectedObject;
if(!testResult || CORBA::is_nil( myArgument ))
return;
- aName = GEOMBase::GetName( myArgument );
+
+ aName = GEOMBase::GetName( aSelectedObject );
+
+ if ( testResult && !aSelectedObject->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (getConstructorId() == 1)
+ aNeedType = TopAbs_EDGE;
+ else if (getConstructorId() == 2)
+ aNeedType = TopAbs_FACE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), 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(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ myArgument = aFindedObject; // get Object from study
+ }
+ else {
+ if (aShape.ShapeType() != aNeedType) {
+ myArgument = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+ }
}
myEditCurrentArgument->setText( aName );
void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection();
if(send == GroupPoints->PushButton1){
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection();
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
{
case 0:
{
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break;
}
case 1:
{
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
break;
}
case 2:
{
this->GroupBoxName->setEnabled(isCreateCopy);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+ }
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qcheckbox.h>
#include <qlabel.h>
if (!testResult || CORBA::is_nil(aSelectedObject) || !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)
- myVector = aSelectedObject;
-
- myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+ myEditCurrentArgument == GroupDimensions->LineEdit2) {
+ if ( testResult && !aSelectedObject->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+
+
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), 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 == GEOM::GEOM_Object::_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 );
displayPreview();
}
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_ALLSHAPES );
if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_ALLSHAPES );
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton1) {
myEditCurrentArgument = GroupDimensions->LineEdit1;
- globalSelection( GEOM_ALLSHAPES );
}
else if(send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2;
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include "GEOMImpl_Types.hxx"
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !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)
- myVectorU = aSelectedObject;
- else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
- myVectorV = aSelectedObject;
+ myEditCurrentArgument == GroupDimensions->LineEdit2 ||
+ myEditCurrentArgument == GroupDimensions->LineEdit3 ) {
+ if ( testResult && !aSelectedObject->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), 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 == GEOM::GEOM_Object::_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( GEOMBase::GetName( aSelectedObject ) );
+ myEditCurrentArgument->setText( aName );
displayPreview();
}
void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection( GEOM_ALLSHAPES );
if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_ALLSHAPES );
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton1) {
myEditCurrentArgument = GroupDimensions->LineEdit1;
- globalSelection( GEOM_ALLSHAPES );
}
else if(send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2;
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton3) {
myEditCurrentArgument = GroupDimensions->LineEdit3;
- globalSelection( GEOM_LINE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
+{
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ switch (getConstructorId())
+ {
+ case 0:
+ objMap[GroupPoints->LineEdit2->text()] = myVectorU;
+ break;
+ case 1:
+ objMap[GroupDimensions->LineEdit2->text()] = myVectorU;
+ objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
+ break;
+ }
+ addSubshapesToFather( objMap );
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qcheckbox.h>
#include <qlabel.h>
if(!testResult || CORBA::is_nil( aSelectedObject ))
return;
+ aName = GEOMBase::GetName( aSelectedObject );
+ 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;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), 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 == GEOM::GEOM_Object::_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 {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
myAxis = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
else if(myEditCurrentArgument == GroupPoints->LineEdit5)
myPoint2 = aSelectedObject;
- aName = GEOMBase::GetName( aSelectedObject );
}
myEditCurrentArgument->setText( aName );
void TransformationGUI_RotationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection();
if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection();
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- getConstructorId() == 0 ? globalSelection( GEOM_LINE ) :
- globalSelection( GEOM_POINT );
+ if (getConstructorId() == 0)
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ else
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if (send == GroupPoints->PushButton4)
{
myEditCurrentArgument = GroupPoints->LineEdit4;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if (send == GroupPoints->PushButton5)
{
myEditCurrentArgument = GroupPoints->LineEdit5;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
myEditCurrentArgument->setFocus();
double anOldValue = GroupPoints->SpinBox_DX->GetValue();
GroupPoints->SpinBox_DX->SetValue( -anOldValue );
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+ break;
+ case 1:
+ objMap[GroupPoints->LineEdit2->text()] = myCentPoint;
+ objMap[GroupPoints->LineEdit4->text()] = myPoint1;
+ objMap[GroupPoints->LineEdit5->text()] = myPoint2;
+ break;
+ }
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private:
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include <qcheckbox.h>
return;
}
Standard_Boolean testResult = Standard_False;
- myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+ aName = GEOMBase::GetName( aSelectedObject );
+
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), 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 == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected();
+ }
+ else
+ aSelectedObject = aFindedObject; // get Object from study
+ }
+ else {
+ if (aShape.ShapeType() != TopAbs_VERTEX) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+
+ myPoint = aSelectedObject;
+
if(!testResult || CORBA::is_nil( myPoint ))
return;
- aName = GEOMBase::GetName( myPoint );
+
}
myEditCurrentArgument->setText( aName );
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection();
if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection();
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
myEditCurrentArgument->setFocus();
{
this->GroupBoxName->setEnabled(isCreateCopy);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_ScaleDlg::addSubshapesToStudy()
+{
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+ if (toCreateCopy) {
+ QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+ objMap[GroupPoints->LineEdit2->text()] = myPoint;
+
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
-
+ virtual void addSubshapesToStudy();
virtual void closeEvent( QCloseEvent* e );
private :
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
#include <qlabel.h>
#include <qcheckbox.h>
if (!testResult || CORBA::is_nil( aSelectedObject ))
return;
+ TopoDS_Shape aShape;
+ aName = GEOMBase::GetName( aSelectedObject );
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
+ aNeedType = TopAbs_EDGE;
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes( firstIObject(), 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 == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else
+ aSelectedObject = aFindedObject;
+ } else // Global Selection
+ {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
myPoint1 = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
myVector = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit3)
myPoint2 = aSelectedObject;
-
- aName = GEOMBase::GetName( aSelectedObject );
}
myEditCurrentArgument->setText( aName );
void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
+ globalSelection();
if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection();
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
- getConstructorId() == 1 ? globalSelection( GEOM_POINT ) :
- globalSelection( GEOM_LINE );
+ if (getConstructorId() == 1)
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ else
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if (send == GroupPoints->PushButton3) {
myEditCurrentArgument = GroupPoints->LineEdit3;
- globalSelection( GEOM_POINT );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
myEditCurrentArgument->setFocus();
{
GroupBoxName->setEnabled(isCreateCopy);
}
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_TranslationDlg::addSubshapesToStudy()
+{
+ bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->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;
+ break;
+ case 2:
+ objMap[GroupPoints->LineEdit2->text()] = myVector;
+ break;
+ }
+ addSubshapesToFather( objMap );
+ }
+}
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
+ virtual void addSubshapesToStudy();
private:
void Init();