if ( myYMode && object->getMinY() <= 0. )
setVerScaleMode( 0, false );
+ if ( object->isAutoAssign() )
+ object->autoFill( myPlot );
+
if ( hasPlotObject( object ) ) {
updateObject( object, update );
}
else {
- if ( object->isAutoAssign() )
- object->autoFill( myPlot );
QwtPlotItem* anItem = object->createPlotItem();
anItem->attach( myPlot );
myObjects.insert( anItem, object );
fitAll();
}
+
+/*!
+ * Return Plot2d_Object by the QwtPlotItem
+ *
+*/
+Plot2d_Object* Plot2d_ViewFrame::getPlotObject( QwtPlotItem* plotItem ) const {
+
+ ObjectDict::const_iterator it = myObjects.begin();
+ for( ; it != myObjects.end(); ++it ) {
+ if ( it.key() == plotItem ) {
+ return it.value();
+ }
+ }
+ return 0;
+}
+
Plot2d_ScaleDraw::Plot2d_ScaleDraw( char f, int prec )
: QwtScaleDraw(),
myFormat(f),
return QwtScaleDraw::label( value );
}
+
+
QwtPlotCanvas* getPlotCanvas() const;
Plot2d_Curve* getClosestCurve( QPoint, double&, int& ) const;
+
+ Plot2d_Object* getPlotObject( QwtPlotItem* ) const;
protected:
int testOperation( const QMouseEvent& );
QwtPlotItem* getPlotObject( Plot2d_Object* ) const;
bool hasPlotObject( Plot2d_Object* ) const;
+
+
+
+
public slots:
void onViewPan();
void onViewZoom();
#include "SPlot2d_ViewWindow.h"
#include "SPlot2d_Prs.h"
+#include "SPlot2d_Histogram.h"
#include "SUIT_Session.h"
#include "SUIT_Application.h"
#include "SUIT_ViewManager.h"
Plot2d_ViewFrame* aViewFrame = getActiveViewFrame();
if(aViewFrame == NULL) return;
- CurveDict aCurves = aViewFrame->getCurves();
- SPlot2d_Curve* aSCurve;
- CurveDict::Iterator it = aCurves.begin();
- for( ; it != aCurves.end(); ++it )
- {
- if ( it.key() == plotItem ) {
- aSCurve = dynamic_cast<SPlot2d_Curve*>( it.value() );
- break;
+
+ Plot2d_Object* anObject = aViewFrame->getPlotObject(plotItem);
+
+ if(anObject) {
+
+ // Highlight object in Object Browser
+ QString anEntry;
+ if(SPlot2d_Curve* aSCurve = dynamic_cast<SPlot2d_Curve*>(anObject)) {
+ if(aSCurve->hasIO())
+ anEntry = aSCurve->getIO()->getEntry();
+ } else if( SPlot2d_Histogram* aSHisto = dynamic_cast<SPlot2d_Histogram*>(anObject)) {
+ if(aSHisto->hasIO())
+ anEntry = aSHisto->getIO()->getEntry();
}
- }
- // Highlight curve in Object Browser
- if(aSCurve && aSCurve->hasIO()) {
- QString anEntry = aSCurve->getIO()->getEntry();
- emit legendSelected( anEntry );
+
+ if(!anEntry.isEmpty())
+ emit legendSelected( anEntry );
}
}