X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSPlot2d%2FSPlot2d_ViewModel.cxx;h=677a6ac51decd36cca31e98a787a5957b12739ac;hb=5d44d2f6ea60a50bbbc593f2b45a6075fe9e5154;hp=620f74e914d312cdec67bf04bf7e42ead4f64ef5;hpb=c4b058d18583af7f94042eb55d4b933dd222d2e6;p=modules%2Fgui.git diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index 620f74e91..677a6ac51 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -47,31 +47,6 @@ #include #include -//ASL: Temporary commented in order to avoir dependency on SALOMEDS - -//#include "SALOMEDSClient.hxx" -//#include "SALOMEDS_StudyManager.hxx" - -// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. -// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from -// SALOMEDS::StudyManager - no linkage with SalomeApp. - -/*static _PTR(Study) getStudyDS() -{ - SALOMEDSClient_Study* aStudy = NULL; - _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() ); - - // get id of SUIT_Study, if it's a SalomeApp_Study, it will return - // id of its underlying SALOMEDS::Study - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - if ( !app ) return _PTR(Study)(aStudy); - SUIT_Study* stud = app->activeStudy(); - if ( !stud ) return _PTR(Study)(aStudy); - const int id = stud->id(); // virtual method, must return SALOMEDS_Study id - // get SALOMEDS_Study with this id from StudyMgr - return aMgr->GetStudyByID( id ); -} */ - /*! Constructor */ @@ -110,7 +85,7 @@ void SPlot2d_Viewer::rename( const Handle(SALOME_InteractiveObject)& IObject, } if( aCurve && aCurve->hasTableIO() && aCurve->getTableIO()->isSame( IObject ) ) - aCurve->getTableIO()->setName( newName.toLatin1() ); + aCurve->getTableIO()->setName( newName.toUtf8() ); } aViewFrame->updateTitles(); } @@ -127,7 +102,7 @@ void SPlot2d_Viewer::renameAll( const Handle(SALOME_InteractiveObject)& IObj, co { const QVector& wnds = vm->getViews(); - for ( uint i = 0; i < wnds.size(); i++ ) + for ( int i = 0; i < wnds.size(); i++ ) { Plot2d_ViewWindow* pwnd = dynamic_cast( wnds.at( i ) ); rename( IObj, name, pwnd->getViewFrame() ); @@ -400,24 +375,38 @@ SUIT_ViewWindow* SPlot2d_Viewer::createView( SUIT_Desktop* theDesktop ) SLOT: called when action "Legend Clicked" is activated. override "onLegendClicked" method from Plot2d_ViewModel. */ -void SPlot2d_Viewer::onClicked( const QVariant& itemInfo, int index ) +void SPlot2d_Viewer::onClicked( const QVariant& itemInfo, int /*index*/ ) { Plot2d_ViewFrame* aViewFrame = getActiveViewFrame(); if(aViewFrame == NULL) return; QwtPlotItem* plotItem = aViewFrame->getPlot()->infoToItem( itemInfo ); - bool isAnalytical = false; + bool isCurveSelected = false; + CurveDict aCurves = aViewFrame->getCurves(); + for( CurveDict::Iterator it = aCurves.begin(); it != aCurves.end(); ++it ) + { + if(plotItem == it.key()) { + isCurveSelected = true; + it.value()->setSelected(true); + } else { + it.value()->setSelected(false); + } + } + AnalyticalCurveList curves = aViewFrame->getAnalyticalCurves(); foreach ( Plot2d_AnalyticalCurve* curve, curves ) { if(plotItem == curve->plotItem()) { - isAnalytical = true; + isCurveSelected = true; curve->setSelected(true); } else { curve->setSelected(false); } } - if(isAnalytical) { + if(isCurveSelected) { + for( CurveDict::Iterator it = aCurves.begin(); it != aCurves.end(); ++it ) + aViewFrame->updateCurve( it.value() ); + myDeselectAnalytical = false; emit clearSelected(); aViewFrame->updateAnalyticalCurves(); @@ -426,7 +415,6 @@ void SPlot2d_Viewer::onClicked( const QVariant& itemInfo, int index ) } Plot2d_Object* anObject = aViewFrame->getPlotObject(plotItem); - if(anObject) { // Highlight object in Object Browser