-
-
-
-
-
-
-
-
-// //=================================================================================
-// // function : activateSelection
-// // purpose : Activate selection in accordance with myEditCurrentArgument
-// //=================================================================================
-// void PatternDataSelectionModel::activateSelection()
-// {
-// erasePreview(false);
-//
-// // local selection
-// if (!myObject->_is_nil() && !isAllSubShapes())
-// {
-// GEOM_Displayer* aDisplayer = getDisplayer();
-// SALOME_View* view = GEOM_Displayer::GetActiveView();
-// if (view) {
-// CORBA::String_var aMainEntry = myObject->GetStudyEntry();
-// Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
-// if (view->isVisible(io)) {
-// aDisplayer->Erase(myObject, false, false);
-// myIsHiddenMain = true;
-// }
-// }
-//
-// int prevDisplayMode = aDisplayer->SetDisplayMode(0);
-//
-// SUIT_ViewWindow* aViewWindow = 0;
-// SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
-// if (activeStudy)
-// aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-// if (aViewWindow == 0) return;
-//
-// SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
-// if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
-// aViewManager->getType() != SVTK_Viewer::Type())
-// return;
-//
-// SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
-// SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
-// if (aView == 0) return;
-//
-// //TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myObject);
-//
-// TopTools_IndexedMapOfShape aSubShapesMap;
-// TopExp::MapShapes(myShape, aSubShapesMap);
-// CORBA::String_var aMainEntry = myObject->GetStudyEntry();
-// QString anEntryBase = aMainEntry.in();
-//
-// TopExp_Explorer anExp (myShape, (TopAbs_ShapeEnum)shapeType());
-// for (; anExp.More(); anExp.Next())
-// {
-// TopoDS_Shape aSubShape = anExp.Current();
-// int index = aSubShapesMap.FindIndex(aSubShape);
-// QString anEntry = anEntryBase + QString("_%1").arg(index);
-//
-// SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
-// if (aPrs) {
-// displayPreview(aPrs, true, false); // append, do not update
-// }
-// }
-// aDisplayer->UpdateViewer();
-// aDisplayer->SetDisplayMode(prevDisplayMode);
-// }
-//
-// globalSelection(GEOM_ALLSHAPES);
-// }
-
-
-
-
-// SUIT_DataOwnerPtrList aList;
-// ObjectList::iterator anIter;
-// for ( anIter = objects.begin(); anIter != objects.end(); ++anIter )
-// {
-// QString anEntry = getEntry( *anIter );
-// LightApp_DataOwner* anOwher = new LightApp_DataOwner( anEntry );
-// aList.append( anOwher );
-// }
-//
-// SUIT_Session* session = SUIT_Session::session();
-// SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
-// if ( !app )
-// return false;
-//
-// LightApp_SelectionMgr* aMgr = app->selectionMgr();
-// if ( !aMgr )
-// return false;
-// _getVTKViewWindow()
-// aMgr->setSelecte_getVTKViewWindow()d( aList, false );
-
-
-
-
-
-// SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
-// if (!anActor || !anActor->hasIO())
-// return;
-//
-// Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
-// //mySelectionMgr->clearSelected();
-// //mySelectionMgr->AddIObject(anIO, false);
-// SALOME_ListIO aList;
-// aList.Append(anIO);
-// mySelectionMgr->setSelectedObjects(aList, false);
-//
-// // Remove filter corresponding to the current type from viewer
-// int aType = myTable->GetType();
-// int aFilterId = SMESH::UnknownFilter;
-// if (aType == SMESH::EDGE ) aFilterId = SMESH::EdgeFilter;
-// else if (aType == SMESH::FACE ) aFilterId = SMESH::FaceFilter;
-// else if (aType == SMESH::VOLUME) aFilterId = SMESH::VolumeFilter;
-// Handle(VTKViewer_Filter) aFilter = SMESH::GetFilter(aFilterId);
-// SMESH::RemoveFilter(aFilterId);
-//
-// // get vtk ids
-// TColStd_MapOfInteger aMap;
-// QList<int>::const_iterator anIter;
-// for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) {
-// aMap.Add(*anIter);
-// }
-//
-// // Set new selection
-// activeViewWindow->AddOrRemoveIndex(anIO, aMap, false);
-// if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-// aViewWindow->highlight( anIO, true, true );
-//
-// // insert previously stored filter in viewer if necessary
-// if (!aFilter.IsNull())
-// SMESH::SetFilter(aFilter);
-
-
-
-
-
-
-
-
-
-// //CS_TEST
-// if(SVTK_Selector* aSelector = aView->GetSelector()){
-// const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
-// SALOME_ListIteratorOfListIO anIter(aListIO);
-// for(; anIter.More(); anIter.Next()){
-// Handle(SALOME_InteractiveObject) anIO = anIter.Value();
-// _PTR(Study) aStudy = HEXABLOCKGUI::activeStudy()->studyDS();
-// _PTR(SObject) aSObj = aStudy->FindObjectID( anEntry.toStdString().c_str() );
-// LightApp_DataObject* o = HEXABLOCKGUI::activeStudy()->findObjectByEntry(anEntry.toStdString().c_str());
-// //CS_TEST
-
-
-
-
-
-// void PatternDataSelectionModel::test()
-// {
-// if (myBusy) return;
-// myMeshActor = 0;
-//
-// SALOME_ListIO aList;
-// mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
-//
-// if (aList.Extent() == 1) {
-// Handle(SALOME_InteractiveObject) anIO = aList.First();
-// myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
-// if(myMeshActor){
-// QString aText;
-// if (SMESH::GetNameOfSelectedNodes(activeViewWindow,anIO,aText) == 1) {
-// if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
-// if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
-// myBusy = true;
-// myId->setText(aText);
-// myX->SetValue(aNode->X());
-// myY->SetValue(aNode->Y());
-// myZ->SetValue(aNode->Z());
-// myBusy = false;
-// erasePreview(); // avoid overlapping of a selection and a preview
-// updateButtons();
-// return;
-// }
-// }
-// }
-// }
-// }
-//
-// reset();
-// }
-
-
-// //CS_TEST
-// SUIT_DataOwnerPtrList aOList;
-// LightApp_DataOwner* anOwher = new LightApp_DataOwner( "0:1:1:1:2" );
-// aOList.append( anOwher );
-// _salomeSelectionMgr->setSelected( aOList, false );
-// //CS_TEST
-
-// void PatternDataSelectionModel::highlightGEOM( const QModelIndex & anEltIndex )
-// {
-// std::cout << "PatternDataSelectionModel::highlightGEOM go find ASSOCIATION for"<< anEltIndex.data().toString().toStdString()<<std::endl;
-// // HEXABLOCKGUI::currentDocGView->getViewWindow()
-//
-// QList<DocumentModel::GeomObj> assocList;
-//
-// DocumentModel *docModel = NULL;
-// const QSortFilterProxyModel *pModel = NULL;
-// // const QStandardItemModel *smodel
-// // const QAbstractItemModel *theModel = NULL;
-//
-// pModel = dynamic_cast<const QSortFilterProxyModel *>( model() );
-//
-// std::cout << "pModel "<< pModel << std::endl;
-// if ( pModel ){
-// std::cout << "if ( pModel ){"<< std::endl;
-// docModel = dynamic_cast<DocumentModel*>( pModel->sourceModel() );
-// if ( docModel ){
-// std::cout << "if ( docModel ){"<< std::endl;
-// assocList = docModel->getAssociations( pModel->mapToSource(anEltIndex) );
-// }
-// }
-//
-//
-// _PTR(Study) aStudy = GetActiveStudyDocument();
-// _PTR(SObject) aSChild;
-// CORBA::Object_var aCorbaObj = CORBA::Object::_nil();
-// GEOM::GEOM_Object_var assoc;
-// // foreach( const QString& entry, geomEntries ){
-// // struct GeomObj
-// // {
-// // QString name;
-// // QString entry;
-// // QString brep;
-// // double start;
-// // double end;
-// // };
-//
-// QVariant treeVariant = pModel->mapToSource(anEltIndex).data( HEXA_TREE_ROLE );
-// int eltType;
-// if ( !treeVariant.isValid() ) return;
-// eltType = treeVariant.toInt();
-//
-// // GEOM::GeomObjPtr
-// // GEOM::GEOM_Object_ptr firstLine; //firstLine.nullify();//
-// GEOM::GEOM_Object_var firstLine = GEOM::GEOM_Object::_nil(); //GEOM::GeomObjPtr
-// GEOM::GEOM_Object_var lastLine = GEOM::GEOM_Object::_nil();
-// double firstParameter = 0.2; //CS_TODO
-// double lastParameter = 0.4; //CS_TODO
-//
-// foreach( const DocumentModel::GeomObj& anAssoc, assocList ){
-// std::cout << "FOUND=> " << anAssoc.entry.toStdString() << std::endl;
-// aSChild = aStudy->FindObjectID( anAssoc.entry.toStdString() );
-// aCorbaObj = corbaObj(aSChild);
-// assoc = GEOM::GEOM_Object::_narrow(aCorbaObj);
-//
-// if ( !CORBA::is_nil(assoc) ){
-// std::cout << "geom to highlight =>" << anAssoc.name.toStdString() << std::endl;
-// // objects.push_back(assoc._retn());
-// // if ( eltType == EDGE_TREE ){
-// // if ( CORBA::is_nil(firstLine) ){
-// // firstLine = GEOM::GEOM_Object::_duplicate( assoc._retn() );
-// // }
-// // lastLine = GEOM::GEOM_Object::_duplicate( assoc._retn() );
-// // }
-// displayPreview( assoc._retn(),
-// true, //false, //append,
-// false,//true, //false, //activate,
-// false,//true,//update,
-// 4,//lineWidth,
-// 1,//-1,//displayMode,
-// Quantity_NOC_RED );
-// } else {
-// std::cout << "not a geom =>" << anAssoc.name.toStdString()<< std::endl;
-// }
-// }
-// // std::cout << "CORBA::is_nil(firstLine) =>" << CORBA::is_nil(firstLine) << std::endl;
-// // std::cout << "CORBA::is_nil(lastLine) =>" << CORBA::is_nil(lastLine) << std::endl;
-// // std::cout << "test" << ( !( CORBA::is_nil(firstLine) and !CORBA::is_nil(lastLine) ) ) << std::endl;
-// /*
-// if ( !( CORBA::is_nil(firstLine) and !CORBA::is_nil(lastLine) ) ){
-// GEOM::GEOM_IBasicOperations_var anOper = _geomEngine->GetIBasicOperations( getStudyId() );
-// GEOM::GEOM_Object_var firstPoint = anOper->MakePointOnCurve( firstLine, firstParameter );
-// GEOM::GEOM_Object_var lastPoint = anOper->MakePointOnCurve( lastLine, lastParameter );
-//
-// // std::cout << "firstPoint->_is_nil() =>" << firstPoint->_is_nil() << std::endl;
-// std::cout << "lastPoint->_is_nil() =>" << lastPoint->_is_nil() << std::endl;
-// if ( !( CORBA::is_nil(firstPoint) ) )// !firstPoint->_is_nil() )
-// displayPreview( firstPoint._retn(), true );
-// if ( !( CORBA::is_nil(lastPoint) ) )//if ( !lastPoint->_is_nil() )
-// displayPreview( lastPoint._retn(), true );
-// }*/
-// }
-//