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)
+ if (bbGetInputInY().size()!=0)
{
- int i,size=bbGetInputInY().size();
- for(i=0;i<size;i++)
+ // avoid 'taking address of temporary '
+ //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
+ std::vector<double> inX;
+ if (bbGetInputInX().size()==0)
{
- inX.push_back((double)i);
- }
- } else {
-
- inX = bbGetInputInX();
- }
- std::vector<double> inY = bbGetInputInY();
- pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
- mwxwidget->addFunction(pGF);
- }
-
-
+ int i,size=bbGetInputInY().size();
+ for(i=0;i<size;i++)
+ {
+ inX.push_back((double)i);
+ } // for
+ } else {
+ inX = bbGetInputInX();
+ } // if bbGetInputInX
+ std::vector<double> inY = bbGetInputInY();
+ pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
+ mwxwidget->addFunction(pGF);
+ } // if bbGetInputInY
+
+ if (bbGetInputInY2().size()!=0)
+ {
+ // avoid 'taking address of temporary '
+ //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
+ std::vector<double> inX2;
+ if (bbGetInputInX().size()==0)
+ {
+ int i,size=bbGetInputInY2().size();
+ for(i=0;i<size;i++)
+ {
+ inX2.push_back((double)i);
+ } // for
+ } else {
+ inX2 = bbGetInputInX();
+ } // if bbGetInputInX
+ std::vector<double> inY2 = bbGetInputInY();
+ pGraphicalFunction *pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 );
+ mwxwidget->addFunction(pGF2);
+ } // if bbGetInputInY
+
+ } // if firsttime
+ // Erasing points
pGraphicalFunction *pGF = mwxwidget->getFunction(0);
- int i,sizePoints = pGF->getSizePoints();
- for (i=0; i<sizePoints;i++)
+ if (pGF!=NULL)
{
- pGF->deletePointAt(i);
- }
-
- double px;
- sizePoints=bbGetInputInY().size();
- for (i=0; i<sizePoints;i++)
+ int i,sizePoints = pGF->getSizePoints();
+ for (i=1; i<sizePoints;i++)
+ {
+ pGF->deletePointAt(1);
+ } // for 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] );
+ }
+ }// if pGF
+
+
+ // Erasing points
+ pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
+ if (pGF2!=NULL)
{
- if (i<bbGetInputInX().size())
+ int i,sizePoints = pGF2->getSizePoints();
+ for (i=0; i<sizePoints;i++)
{
- px=bbGetInputInX()[i];
- } else {
- px=i;
- }
- pGF->AddNewPoint( px, bbGetInputInY()[i] );
- printf ("EED PlotterView::Process %f %f\n", px, bbGetInputInY()[i]);
- }
+ pGF2->deletePointAt(1);
+ } // for i
+ double px;
+ sizePoints=bbGetInputInY2().size();
+ for (i=0; i<sizePoints;i++)
+ {
+ if (i<bbGetInputInX().size())
+ {
+ px = bbGetInputInX()[i];
+ } else {
+ px = i;
+ }
+ pGF2->AddNewPoint( px, bbGetInputInY2()[i] );
+ }
+ }// if pGF
+
+ mwxwidget->setMinScrY(0);
mwxwidget->UpdateAll();
}
mwxwidget = new pPlotterWindow( parent , -1,wxDefaultPosition, wxDefaultSize, 0 );
mwxwidget->AddLayer(new pPlotterScaleX());
mwxwidget->AddLayer(new pPlotterScaleY());
-
+
bbtkDebugDecTab("Core",9);
bbSetOutputWidget( mwxwidget );
}
BBTK_BLACK_BOX_INTERFACE(PlotterView,bbtk::WxBlackBox);
BBTK_DECLARE_INPUT(InX, std::vector<double> );
BBTK_DECLARE_INPUT(InY, std::vector<double> );
+ BBTK_DECLARE_INPUT(InY2, std::vector<double> );
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_CATEGORY("viewer");
BBTK_INPUT(PlotterView,InX,"x vector",std::vector<double>,"");
BBTK_INPUT(PlotterView,InY,"y vector",std::vector<double>,"");
+ BBTK_INPUT(PlotterView,InY2,"y2 vector",std::vector<double>,"");
BBTK_END_DESCRIBE_BLACK_BOX(PlotterView);
}
// EO namespace bbcreaMaracasVisu
{
wxPaintDC dc(this);
dc.GetSize(&m_scrX, &m_scrY);
-printf("EED mpWindow::OnPaint %d %d\n",m_scrX,m_scrY);
//m_scrX=200;
//m_scrY=200;
{
int cx, cy;
GetClientSize( &cx, &cy);
-printf("EED mpWindow::UpdateAll %d %d\n",cx,cy);
- //const int sx = (int)((m_maxX - m_minX) * GetScaleX()); // JPRx
- //const int sy = (int)((m_maxY - m_minY) * GetScaleY()); // JPRx
- //const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); // JPRx
- //const int py = (int)((GetPosY() - m_minY) * GetScaleY() - (cy>>1)); // JPRx
- //SetScrollbars( 1, 1, sx, sy, px, py);
+ const int sx = (int)((m_maxX - m_minX) * GetScaleX()); // JPRx
+ const int sy = (int)((m_maxY - m_minY) * GetScaleY()); // JPRx
+ const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); // JPRx
+ const int py = (int)((GetPosY() - m_minY) * GetScaleY() - (cy>>1)); // JPRx
+ SetScrollbars( 1, 1, sx, sy, px, py);
}
FitInside();