if(!testResult || CORBA::is_nil( myArgument ))
return;
+ 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 );
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
+ int id = getConstructorId();
+ if (aNeedType == TopAbs_VERTEX)
+ aName += QString(":vertex_%1").arg(anIndex);
+ else
+ aName += QString(":edge_%1").arg(anIndex);
+
myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
- }
+ }
+ else {
+ if (aShape.ShapeType() != aNeedType) {
+ myArgument = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
}
}
- aName = GEOMBase::GetName( aSelectedObject );
}
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 );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
break;
}
case 2:
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
return;
+ QString aName = GEOMBase::GetName( aSelectedObject );
+
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1)
myBase = aSelectedObject;
{
TopoDS_Shape aShape;
+
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
{
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
+ aName += QString(":edge_%1").arg(anIndex);
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
- else
+ else {
+ if (aShape.ShapeType() != TopAbs_EDGE) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
myVector = aSelectedObject;
+ }
+
}
}
}
- myEditCurrentArgument->setText( GEOMBase::GetName( 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 );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
+ 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 );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
return;
+ QString aName = GEOMBase::GetName( aSelectedObject );
+
if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1)
myBase = aSelectedObject;
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();
+ aName += QString(":edge_%1").arg(anIndex);
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
else
myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
}
- else
+ 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 );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
+ 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 );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if(send == GroupDimensions->PushButton3) {
myEditCurrentArgument = GroupDimensions->LineEdit3;
- // globalSelection( GEOM_LINE );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
myEditCurrentArgument->setFocus();
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 );
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString(":edge_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(anIndex);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
+ else {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
}
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
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;
- if (getConstructorId() == 0) {
- //globalSelection( GEOM_LINE );
- GEOM::GEOM_Object_var anObj;
- localSelection( anObj, TopAbs_EDGE );
- }
+ if (getConstructorId() == 0)
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
else
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
+ aName += QString(":vertex_%1").arg(anIndex);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
+ else {
+ if (aShape.ShapeType() != TopAbs_VERTEX) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
}
myPoint = aSelectedObject;
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;
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 );
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
- }
+ int anIndex = aMap( 1 );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString(":edge_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(anIndex);
+ } else // Global Selection
+ {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
}
if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
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;