#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"
// 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;
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();
#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"
{
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;
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;
#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();
void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
+ QString aName;
const int id = getConstructorId();
if ( IObjectCount() != 1 ) {
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();
}
}
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();
#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 );
}
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 ) );
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();
}
#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>
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
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();
#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>
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 ) );
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();
}
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() );
- }
-
- }
}
}
#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 (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();
}
}
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();
#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 (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();
}
}
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();
#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 (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();
}
}
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();
#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 );
+
+ 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 );
}
case 1:
{
- globalSelection( GEOM_LINE );
+ //globalSelection( GEOM_LINE );
+ GEOM::GEOM_Object_var anObj;
+ localSelection( anObj, TopAbs_EDGE );
break;
}
case 2:
#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>
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();
}
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;
}
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();
#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"
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 ) );
}
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;
}
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();
#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;
- 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)
}
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)
{
#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 (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;
}
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;