- myEditCurrentArgument->setText("");
-
- Standard_Boolean aRes = Standard_False;
- 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,
- // that will actually be put into myPoints
-
- 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 )
- {
- 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( 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();