1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "bbmaracasvisuPlotterView.h"
27 #include "bbcreaMaracasVisuPackage.h"
29 #include "pPlotterScaleX.h"
30 #include "pPlotterScaleY.h"
33 namespace bbcreaMaracasVisu
36 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,PlotterView)
37 BBTK_BLACK_BOX_IMPLEMENTATION(PlotterView,bbtk::WxBlackBox);
39 //---------------------------------------------------
40 void PlotterView::Process()
42 // if (firsttime==true)
47 printf("EED PlotterView::Process %d %d \n ", bbGetInputInY().size(),bbGetInputInY2().size());
49 pGraphicalFunction *pGF = mwxwidget->getFunction(0);
50 pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
52 if ( (bbGetInputInY().size()!=0) && (bbGetInputInY2().size()==0) )
54 bbSetInputInY2( bbGetInputInY() );
57 if ( (bbGetInputInY().size()!=0) && (pGF==NULL) )
59 // avoid 'taking address of temporary '
60 //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
62 std::vector<double> inX;
63 if (bbGetInputInX().size()==0)
65 int i,size=bbGetInputInY().size();
68 inX.push_back((double)i);
71 inX = bbGetInputInX();
73 std::vector<double> inY = bbGetInputInY();
76 std::vector<double> inX;
77 std::vector<double> inY;
78 inX.push_back(0); inX.push_back(200);
79 inY.push_back(0); inY.push_back(1);
81 pGF = mwxwidget->getFunctionForVectors( &inX, &inY );
82 mwxwidget->addFunction(pGF);
85 if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL) )
87 // avoid 'taking address of temporary '
88 //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
90 std::vector<double> inX2;
91 if (bbGetInputInX().size()==0)
93 int i,size=bbGetInputInY2().size();
96 inX2.push_back((double)i);
99 inX2 = bbGetInputInX();
100 } // if bbGetInputInX
101 std::vector<double> inY2 = bbGetInputInY();
103 std::vector<double> inX2;
104 std::vector<double> inY2;
105 inX2.push_back(0); inX2.push_back(200);
106 inY2.push_back(0); inY2.push_back(1);
108 pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 );
109 mwxwidget->addFunction(pGF2);
110 } // if bbGetInputInY
117 int i,sizePoints = pGF->getSizePoints();
118 for (i=1; i<sizePoints;i++)
120 pGF->deletePointAt(1); // EED here NOT 0 is 1
124 sizePoints=bbGetInputInY().size();
125 for (i=0; i<sizePoints;i++)
127 if (i<bbGetInputInX().size())
129 px = bbGetInputInX()[i];
133 pGF->AddNewPoint( px, bbGetInputInY()[i] );
141 int i,sizePoints = pGF2->getSizePoints();
142 for (i=0; i<sizePoints;i++)
144 pGF2->deletePointAt(1); // EED here NOT 0 is 1
148 sizePoints=bbGetInputInY2().size();
149 for (i=0; i<sizePoints;i++)
151 if (i<bbGetInputInX().size())
153 px = bbGetInputInX()[i];
157 pGF2->AddNewPoint( px, bbGetInputInY2()[i] );
161 mwxwidget->UpdateAll();
167 //---------------------------------------------------
168 void PlotterView::CreateWidget(wxWindow* parent)
170 bbtkDebugMessageInc("Core",9,"PlotterView::CreateWxWindow()"<<std::endl);
172 mwxwidget = new pPlotterWindow( parent , -1,wxDefaultPosition, wxDefaultSize, 0 );
173 mwxwidget->AddLayer(new pPlotterScaleX());
174 mwxwidget->AddLayer(new pPlotterScaleY());
176 mwxwidget->setMinScrY(0);
177 mwxwidget->setMaxScrY(5000);
180 bbtkDebugDecTab("Core",9);
181 bbSetOutputWidget( mwxwidget );
184 //---------------------------------------------------
185 void PlotterView::bbUserSetDefaultValues()
191 //-----------------------------------------------------------------
192 void PlotterView::bbUserInitializeProcessing()
196 //-----------------------------------------------------------------
197 void PlotterView::bbUserFinalizeProcessing()
201 //-----------------------------------------------------------------
204 // EO namespace bbcreaMaracasVisu