From: ageay Date: Wed, 4 Apr 2012 07:40:55 +0000 (+0000) Subject: Addons for multiaxe-X. X-Git-Tag: V6_5_0a1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=50e7cdc45d18007ae65436315cd07cee37b27a0e;p=modules%2Fgui.git Addons for multiaxe-X. --- diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 2822e6dbf..e0c9dd322 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -270,6 +270,19 @@ void Plot2d_ViewFrame::EraseAll() getObjects( anObjects ); eraseObjects( anObjects, false ); myObjects.clear(); + // Erase all the intermittent segments who connect curves + // (cf displayPlot2dCurveList() and createSegment(() ) + // + { + int nbSeg = myIntermittentSegmentList.size(); + for (int iseg=0; iseg < nbSeg; iseg++) + { + QwtPlotCurve *segment = myIntermittentSegmentList[iseg]; + segment->detach(); // erase in QwtPlot window + delete segment; + } + myIntermittentSegmentList.clear(); + } myPlot->replot(); if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase(); } @@ -624,7 +637,8 @@ void Plot2d_ViewFrame::createCurveTooltips( Plot2d_Curve *curve, * Draw connection segments (intermittent line) between all the curves of a component. */ void Plot2d_ViewFrame::displayPlot2dCurveList( QList< QList > sysCoCurveList, - Plot2d_QwtPlotPicker* picker) + Plot2d_QwtPlotPicker* picker, + bool displayLegend) { //std::cout << "Plot2d_ViewFrame::displayPlot2dCurveList() 1" << std::endl; @@ -668,7 +682,7 @@ void Plot2d_ViewFrame::displayPlot2dCurveList( QList< QList > sys // 2)- Display list curves by a component's curves group // Draw connection segments (intermittent line) between the curves - displayPlot2dCurveList( plot2dCurveCoSysList, nbSystem, picker); + displayPlot2dCurveList( plot2dCurveCoSysList, nbSystem, picker, displayLegend); // 3)- Size of graduations labels and texts under X axis @@ -692,12 +706,13 @@ void Plot2d_ViewFrame::displayPlot2dCurveList( QList< QList > sys */ void Plot2d_ViewFrame::displayPlot2dCurveList( QList curveList, int groupSize, - Plot2d_QwtPlotPicker* picker) + Plot2d_QwtPlotPicker* picker, + bool displayLegend) { //std::cout << "Plot2d_ViewFrame::displayPlot2dCurveList() 2" << std::endl; // Consider the new legend's entries - // (we must remove and put the QwtLegend in the QwtPlot) + // (PB: to update the legend we must remove it and put a new QwtLegend in the QwtPlot) myPlot->insertLegend( (QwtLegend*)NULL); // we remove here, we shall put at the end double X[2]; @@ -834,8 +849,11 @@ void Plot2d_ViewFrame::displayPlot2dCurveList( QList curveList, icur1 = icur2 + 1; } - // Consider the new legend's entries - showLegend( true, true); + if (displayLegend) + { + // Consider the new legend's entries + showLegend( true, true); + } //std::cout << "Ok for Plot2d_ViewFrame::displayPlot2dCurveList() 2" << std::endl; } @@ -857,7 +875,8 @@ Plot2d_Curve* Plot2d_ViewFrame::createPlot2dCurve( QString & title, QColor & lineColor, QwtSymbol::Style markerKind, Plot2d_QwtPlotPicker* picker, - bool toDraw) + bool toDraw, + bool displayLegend) { //std::cout << "Plot2d_ViewFrame::createPlot2dCurve()" << std::endl; @@ -890,6 +909,10 @@ Plot2d_Curve* Plot2d_ViewFrame::createPlot2dCurve( QString & title, // Graphical curve (QwtPlotCurve) in the drawing zone (QwtPlot) myPlot if (toDraw) { + if (!displayLegend) + { + myPlot->insertLegend( (QwtLegend*)NULL); + } displayCurve( plot2dCurve); // plot points marker create associated tooltips @@ -973,6 +996,8 @@ void Plot2d_ViewFrame::createSegment( double *X, double *Y, int nbPoint, aPCurve->setItemAttribute( QwtPlotItem::Legend, false); aPCurve->attach( myPlot); + // To deallocate in EraseAll() + myIntermittentSegmentList.append( aPCurve); } /*! diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index 23bca879a..8f5acac85 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -93,11 +93,13 @@ public: Plot2d_QwtPlotPicker *picker); void displayPlot2dCurveList( QList< QList > sysCoCurveList, - Plot2d_QwtPlotPicker* picker); + Plot2d_QwtPlotPicker* picker, + bool displayLegend); void displayPlot2dCurveList( QList curveList, int groupsize, - Plot2d_QwtPlotPicker* picker); + Plot2d_QwtPlotPicker* picker, + bool displayLegend); Plot2d_Curve* createPlot2dCurve( QString & title, QString & unit, @@ -109,7 +111,8 @@ public: QColor & lineColor, QwtSymbol::Style markerKind, Plot2d_QwtPlotPicker* picker, - bool toDraw); + bool toDraw, + bool displayLegend=true); QColor getPlot2dCurveColor( Plot2d_Curve* plot2dCurve); @@ -310,6 +313,10 @@ protected: Plot2d_NormalizeAlgorithm* myLNormAlgo; Plot2d_NormalizeAlgorithm* myRNormAlgo; bool myIsDefTitle; + private: + // List of intermittent segments to connect curves + // (cf displayPlot2dCurveList() and createSegment(() ) + QList myIntermittentSegmentList; }; class Plot2d_Plot2d : public QwtPlot