NPAL 16768 (Definition of Vector form Edge)

This commit is contained in:
dmv 2007-11-28 08:18:23 +00:00
parent fd882cffc9
commit b86f9dd299
15 changed files with 546 additions and 74 deletions

View File

@ -33,8 +33,17 @@
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <qlabel.h>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
#include "GEOMImpl_Types.hxx"
#include "GEOM_Object.hxx"
#include "GEOM_Engine.hxx"
@ -293,13 +302,39 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
// nbSel == 1
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
Handle(SALOME_InteractiveObject) anIO = firstIObject();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, 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 == GroupPntVecR->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( anIO, aMap );
if ( aMap.Extent() == 1 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myDir = aSelectedObject;
}
}
}
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
@ -330,8 +365,12 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument()
myEditCurrentArgument->setFocus();
if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
globalSelection( GEOM_LINE );
if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
{
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else
globalSelection( GEOM_POINT );
SelectionIntoArgument();

View File

@ -35,6 +35,13 @@
#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"
@ -314,7 +321,32 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject;
else if ( myEditCurrentArgument == GroupPntDir->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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myDir = aSelectedObject;
}
}
}
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
@ -342,8 +374,11 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
myEditCurrentArgument->setFocus();
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
globalSelection( GEOM_LINE );
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
//globalSelection( GEOM_PLANE );
TColStd_MapOfInteger aMap;

View File

@ -43,6 +43,9 @@
#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>
@ -209,7 +212,9 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId)
}
case 1:
{
globalSelection( GEOM_LINE );
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
Group1->hide();
Group3->hide();
@ -285,6 +290,7 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply()
void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aName;
const int id = getConstructorId();
if ( IObjectCount() != 1 ) {
@ -306,14 +312,45 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
if(!aRes || CORBA::is_nil( aSelectedObject ))
return;
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
aName = aName + " Edge_" + QString::number( anIndex );
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( GEOMBase::GetName( aSelectedObject ) );
myEditCurrentArgument->setText( aName );
updateWPlane();
}
@ -333,11 +370,15 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
}
else if(send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1;
globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
//globalSelection( GEOM_LINE );
}
else if(send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2;
globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
//globalSelection( GEOM_LINE );
}
myEditCurrentArgument->setFocus();

View File

@ -36,6 +36,11 @@
#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
@ -128,7 +133,7 @@ void GenerationGUI_PipeDlg::Init()
initName(tr("GEOM_PIPE"));
globalSelection( GEOM_ALLSHAPES );
// globalSelection( GEOM_ALLSHAPES );
}
@ -199,12 +204,33 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
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;
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( S, aShapes );
S = aShapes.FindKey( anIndex );
if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) {
myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
myOkPath = true;
aSelMgr->clearSelected();
}
}
else if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) {
myPath = aSelectedObject;
myOkPath = true;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
@ -223,10 +249,13 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_ALLSHAPES );
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
SelectionIntoArgument();
}

View File

@ -33,6 +33,13 @@
#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>
@ -287,10 +294,33 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
myOkBase = true;
}
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
myVec = aSelectedObject;
myOkVec = 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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myVec = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myVec = aSelectedObject;
myOkVec = true;
}
}
}
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
}
else // getConstructorId()==1 - extrusion using 2 points
@ -372,7 +402,9 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
else if (send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else if (send == GroupPoints2->PushButton1) {
GroupPoints2->LineEdit1->setFocus();

View File

@ -33,6 +33,13 @@
#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>
@ -229,8 +236,32 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myAxis = aSelectedObject;
myOkAxis = true;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
@ -254,7 +285,9 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument()
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
SelectionIntoArgument();
}

View File

@ -331,15 +331,6 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
aSelMgr->selectedSubOwners(aMap);
if (aMap.size() == 1)
aMapIndex = aMap.begin().data();
if (aMap.size() == 0) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) {
localSelection( anObj, getShapeType() );
}
}
}
}

View File

@ -33,6 +33,13 @@
#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"
@ -269,10 +276,32 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myDir = aSelectedObject;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
}
@ -292,7 +321,9 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();

View File

@ -33,6 +33,13 @@
#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"
@ -265,11 +272,32 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myDir = aSelectedObject;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
}
@ -288,7 +316,9 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();

View File

@ -33,6 +33,13 @@
#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"
@ -257,9 +264,32 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myDir = aSelectedObject;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
}
@ -295,7 +325,9 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();

View File

@ -33,6 +33,13 @@
#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>
@ -229,10 +236,33 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
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 );
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
}
}
aName = GEOMBase::GetName( aSelectedObject );
}
myEditCurrentArgument->setText( aName );
@ -279,7 +309,9 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
}
case 1:
{
globalSelection( GEOM_LINE );
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
break;
}
case 2:

View File

@ -33,6 +33,13 @@
#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>
@ -285,9 +292,32 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
myEditCurrentArgument == GroupDimensions->LineEdit1)
myBase = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2)
myVector = 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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myVector = aSelectedObject;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview();
@ -308,7 +338,9 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton1) {
myEditCurrentArgument = GroupDimensions->LineEdit1;
@ -316,7 +348,9 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
}
else if(send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();

View File

@ -33,6 +33,13 @@
#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"
@ -302,10 +309,39 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
aSelMgr->clearSelected();
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
else
myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
}
else
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aSelectedObject;
else
myVectorU = aSelectedObject;
}
}
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
@ -327,7 +363,9 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton1) {
myEditCurrentArgument = GroupDimensions->LineEdit1;
@ -335,11 +373,15 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
}
else if(send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton3) {
myEditCurrentArgument = GroupDimensions->LineEdit3;
globalSelection( GEOM_LINE );
// globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();

View File

@ -33,6 +33,13 @@
#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>
@ -262,8 +269,31 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
if(!testResult || CORBA::is_nil( aSelectedObject ))
return;
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
myAxis = aSelectedObject;
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myAxis = aSelectedObject;
}
}
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
myCentPoint = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit4)
@ -293,8 +323,13 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
}
else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
getConstructorId() == 0 ? globalSelection( GEOM_LINE ) :
globalSelection( GEOM_POINT );
if (getConstructorId() == 0) {
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else
globalSelection( GEOM_POINT );
}
else if (send == GroupPoints->PushButton4)
{

View File

@ -33,6 +33,13 @@
#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>
@ -278,8 +285,32 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
myPoint1 = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
myVector = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
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 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
else
myVector = aSelectedObject;
}
}
}
else if (myEditCurrentArgument == GroupPoints->LineEdit3)
myPoint2 = aSelectedObject;
@ -320,8 +351,13 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
}
else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
getConstructorId() == 1 ? globalSelection( GEOM_POINT ) :
globalSelection( GEOM_LINE );
if (getConstructorId() == 1)
globalSelection( GEOM_POINT );
else {
//globalSelection( GEOM_LINE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
}
else if (send == GroupPoints->PushButton3) {
myEditCurrentArgument = GroupPoints->LineEdit3;