- myEditCurrentArgument->setText( "" );
-
- SalomeApp_Application* app = myGeomGUI->getApp();
- 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;
- LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- SALOME_ListIO selected;
- aSelMgr->selectedObjects(selected, QString::null, false);
-
- int IOC = selected.Extent();
- // 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 (selected); anIt.More(); anIt.Next()) {
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
- if (!CORBA::is_nil(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;
- _PTR(ChildIterator) iit( aDStudy->NewChildIterator( obj ) );
- for (; iit->More() && !inStudy; iit->Next()) {
- _PTR(SObject) child( iit->Value() );
- QString aChildName = child->GetName().c_str();
- 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.toLatin1().data(), aSelectedObject );
-
- int pos = isPointInList( myOrderedSel, anObject );
- if ( pos == -1 ) {
- myOrderedSel.push_back( anObject );
- }
- // if (!inStudy)
- aList.push_back(anObject);
- }
- }
- else { // aMap.Extent() == 0
- if ( aShape.ShapeType() == TopAbs_VERTEX ) {
- int pos = isPointInList( myOrderedSel, aSelectedObject );
- if ( pos == -1 )
- myOrderedSel.push_back( aSelectedObject );
- aList.push_back( aSelectedObject );
- }
- }
- }
- }
- }
-
- myPoints->length( aList.size() );
-
- int k = 0;
- for ( std::list<GEOM::GEOM_Object_var>::iterator j = aList.begin(); j != aList.end(); j++ )
- myPoints[k++] = *j;
-
- if ( IOC == 0 )
- myOrderedSel.clear();