m_moveY=true;
m_moveTimeline=true;
m_newPoints=false;
+ activeIndexPlot=-1;
}
void ParameterPlotter::setPointLists(const QList< QPair<QString, QMap< int , QVariant > > >& params,int startframe, int endframe){
maxy=max_y;
setLimits(0,endframe,0,maxy+10);
addPlotObjects(plotobjects);
+
}
void ParameterPlotter::createParametersNew(){
}
}
+void ParameterPlotter::replot(const QString & name){
+ //removeAllPlotObjects();
+ int i=0;
+ bool drawAll=name.isEmpty() || name=="all";
+ activeIndexPlot=-1;
+ foreach (KPlotObject* p,plotObjects() ){
+ p->setShowPoints(drawAll || parameterNameList[i]==name);
+ p->setShowLines(drawAll || parameterNameList[i]==name);
+ if ( parameterNameList[i]==name )
+ activeIndexPlot = i;
+ replacePlotObject(i++,p);
+ }
+}
+
void ParameterPlotter::mousePressEvent ( QMouseEvent * event ) {
- QList<KPlotPoint*> list= pointsUnderPoint (event->pos()-QPoint(leftPadding(), topPadding() ) ) ;
+ //topPadding and other padding can be wrong and this (i hope) will be correctet in newer kde versions
+ QPoint inPlot=event->pos()-QPoint(leftPadding(), topPadding() );
+ QList<KPlotPoint*> list= pointsUnderPoint (inPlot ) ;
if (list.size() > 0){
movepoint=list[0];
oldmousepoint=event->pos();
}else{
- if (m_newPoints){
+ if (m_newPoints && activeIndexPlot>=0){
//setup new points
+ KPlotObject* p=plotObjects()[activeIndexPlot];
+ QList<KPlotPoint*> points=p->points();
+ QList<QPointF> newpoints;
+
+ double newx=inPlot.x()*dataRect().width()/pixRect().width();
+ double newy=(height()-inPlot.y()-bottomPadding()-topPadding() )*dataRect().height()/pixRect().height();
+ bool inserted=false;
+ foreach (KPlotPoint* pt,points){
+ if (pt->x() >newx && !inserted){
+ newpoints.append(QPointF(newx,newy));
+ inserted=true;
+ }
+ newpoints.append(QPointF(pt->x(),pt->y()));
+ }
+ p->clearPoints();
+ foreach (QPointF qf, newpoints ){
+ p->addPoint(qf);
+ }
+ replacePlotObject(activeIndexPlot,p);
}
movepoint=NULL;
}
bool ParameterPlotter::isNewPoints(){
return m_newPoints;
-}
\ No newline at end of file
+}
bool isMoveY();
bool isMoveTimeline();
bool isNewPoints();
+ void replot(const QString& name="");
private:
KPlotPoint* movepoint;
+ int activeIndexPlot;
bool m_moveX,m_moveY,m_moveTimeline,m_newPoints;
QPoint oldmousepoint;
int maxx,maxy;
void createParametersNew();
QList<KPlotObject*> plotobjects;
QList<QColor> colors;
+
protected:
void mouseMoveEvent ( QMouseEvent * event );
void mousePressEvent ( QMouseEvent * event );