//---------------------------------------------------
void PlotterView::Process()
{
+
+ if (firsttime==true)
+ {
+ firsttime=false;
+ std::vector<double> inX;
+
+ // avoid 'taking address of temporary '
+ //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
+ if (bbGetInputInX().size()==0)
+ {
+ int i,size=bbGetInputInY().size();
+ for(i=0;i<size;i++)
+ {
+ inX.push_back((double)i);
+ }
+ } else {
+
+ inX = bbGetInputInX();
+ }
+ std::vector<double> inY = bbGetInputInY();
+ pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
+ mwxwidget->addFunction(pGF);
+ }
+
+
+
+ pGraphicalFunction *pGF = mwxwidget->getFunction(0);
+ int i,sizePoints = pGF->getSizePoints();
+ for (i=0; i<sizePoints;i++)
+ {
+ pGF->deletePointAt(i);
+ }
+
+ double px;
+ sizePoints=bbGetInputInY().size();
+ for (i=0; i<sizePoints;i++)
+ {
+ if (i<bbGetInputInX().size())
+ {
+ px=bbGetInputInX()[i];
+ } else {
+ px=i;
+ }
+ pGF->AddNewPoint( px, bbGetInputInY()[i] );
+ printf ("EED PlotterView::Process %f %f\n", px, bbGetInputInY()[i]);
+ }
}
+
//---------------------------------------------------
void PlotterView::CreateWidget(wxWindow* parent)
{
mwxwidget->AddLayer(new pPlotterScaleX());
mwxwidget->AddLayer(new pPlotterScaleY());
- std::vector<double> inX;
-
- // avoid 'taking address of temporary '
- //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
- if (bbGetInputInX().size()==0)
- {
- int i,size=bbGetInputInY().size();
- for(i=0;i<size;i++)
- {
- inX.push_back((double)i);
- }
- } else {
-
- inX = bbGetInputInX();
- }
-
- std::vector<double> inY = bbGetInputInY();
-
- pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
- mwxwidget->addFunction(pGF);
- bbtkDebugDecTab("Core",9);
+ bbtkDebugDecTab("Core",9);
bbSetOutputWidget( mwxwidget );
}
void PlotterView::bbUserSetDefaultValues()
{
mwxwidget = NULL;
+ firsttime=true;
}
//-----------------------------------------------------------------