- 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);
- }
- }
- }
+ 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 );
+ }
+ }
+ }