this, SLOT( plotMousePressed( const QMouseEvent& ) ) );
connect( myPlot, SIGNAL( plotMouseReleased( const QMouseEvent& ) ),
this, SLOT( plotMouseReleased( const QMouseEvent& ) ) );
- //connect( myPlot, SIGNAL( legendClicked( long ) ),
- // this, SLOT( onLegendClicked( long ) ) );
+ connect( myPlot, SIGNAL( legendClicked( long ) ),
+ this, SIGNAL( legendClicked( long ) ) );
/* Initial Setup - get from the preferences */
readPreferences();
}
}
+
/*!
Sets new marker size
*/
void vpModeVerChanged();
void vpCurveChanged();
void contextMenuRequested( QContextMenuEvent *e );
+ void legendClicked(long key);
protected:
Plot2d_Plot2d* myPlot;
#include "Plot2d_ViewManager.h"
#include "Plot2d_ViewModel.h"
#include "Plot2d_ViewWindow.h"
+#include "Plot2d_ViewFrame.h"
/*!
Constructor
{
Plot2d_ViewWindow* view = (Plot2d_ViewWindow*)theView;
connect( view, SIGNAL( cloneView() ), this, SLOT( onCloneView() ) );
+
+ Plot2d_ViewFrame* aViewFrame = view->getViewFrame();
+ Plot2d_Viewer* aViewer = getPlot2dModel();
+ connect( aViewFrame, SIGNAL( legendClicked( long ) ), aViewer, SLOT( onLegendClicked( long ) ) );
}
return res;
}
}
}
+/*
+ SLOT: called when clicked item in the legend from Plot2d_ViewManager
+ */
+void Plot2d_Viewer::onLegendClicked( long key )
+{
+}
+
/*!
Sets view manager
\param mgr - new view manager
void onDumpView();
void onShowToolbar();
virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
+ virtual void onLegendClicked( QwtPlotItem* plotItem );
private:
Plot2d_Prs* myPrs;
libSPlot2d_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) $(QWT_INCLUDES) $(BOOST_CPPFLAGS) \
-I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../Plot2d -I$(srcdir)/../Prs \
- -I$(srcdir)/../OBJECT
+ -I$(srcdir)/../OBJECT -I$(srcdir)/../LightApp -I$(srcdir)/../CAM -I$(srcdir)/../STD
libSPlot2d_la_LDFLAGS=$(QT_MT_LIBS) $(QWT_LIBS) ../SUIT/libsuit.la ../Plot2d/libPlot2d.la ../Prs/libSalomePrs.la
#include "SUIT_Session.h"
#include "SUIT_Application.h"
-//#include "utilities.h"
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_Application.h"
+#include "SALOME_ListIO.hxx"
+
#include "qapplication.h"
#include <qtoolbar.h>
#include <qtoolbutton.h>
Plot2d_Viewer::onCloneView( clonedVF, newVF );
}
+/*!
+ SLOT: called when action "Legend Clicked" is activated.
+ override "onLegendClicked" method from Plot2d_ViewModel.
+*/
+void SPlot2d_Viewer::onLegendClicked( long key )
+{
+ Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
+ if(aViewFrame == NULL) return;
+
+ QIntDict<Plot2d_Curve> aCurves = aViewFrame->getCurves();
+
+ Plot2d_Curve* aCurve = aCurves.find( key );
+ SPlot2d_Curve* aSCurve = dynamic_cast<SPlot2d_Curve*>(aCurve);
+
+ if(aSCurve && aSCurve->hasIO()) {
+ LightApp_Application* anApp = dynamic_cast< LightApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( anApp ) {
+ LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+ if (aSelectionMgr) {
+ SALOME_ListIO aListIO;
+ aListIO.Append( aSCurve->getIO() );
+ aSelectionMgr->setSelectedObjects( aListIO, false );
+ }
+ }
+ }
+}
+
/*!
create SPlot2d_ViewWindow
*/
protected slots:
virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
+ virtual void onLegendClicked( long key );
};