]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx
0eed1ed66fa2c6317cfc4e3f626cac72e757a2fe
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / pGraphicalFunction.cxx
1
2 //----------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------
5 #include "pGraphicalFunction.h"
6 #include "math.h"
7 #include <iostream>
8 #include <fstream>
9 #include <string>
10 #include <vector>
11
12 // ----------------------------------------------------------------------------
13 // WX headers inclusion.
14 // For compilers that support precompilation, includes <wx/wx.h>.
15 // ----------------------------------------------------------------------------
16
17 #ifndef WX_PRECOMP
18 #include <wx/wx.h>
19 #endif
20
21 //----------------------------------------------------------------------------
22 // Class implementation
23 //----------------------------------------------------------------------------
24
25 IMPLEMENT_CLASS(pGraphicalFunction, pPlotterLayer)
26
27 pGraphicalFunction:: pGraphicalFunction(wxString name, int flags)
28 {
29         SetName(name);
30         showPointsF = false;
31         validPointRange = 5;
32         logicFunction = new pLogicalFunction ();
33         fromWindow=false;
34         factorZoom=1;
35         drawing=false;
36         editable=true;
37         ifActual=false;
38         zoomIn=false;
39         setOffsetX(0);
40         setOffsetY(0);
41         initialDrawingPoint=NULL;
42         finalDrawingPoint=NULL;
43         //type=1 means that is going to be a piecewise function
44         _type=1;
45         xKSpline=NULL;
46         yKSpline=NULL;
47         offsetPixelX=0;
48         offsetPixelY=0;
49         xTraslation=0;
50         mType=DEFAULT;
51 }
52
53 /**
54 * Is the destructor!!!
55 */
56 pGraphicalFunction :: ~ pGraphicalFunction ()
57 {
58         
59 }
60
61 //set if the function has to draw the points
62 void pGraphicalFunction::SetShowPoints(bool showPoints)
63 {
64         showPointsF = showPoints;
65 }
66 //get the paramater showPointsF
67 bool pGraphicalFunction::getShowPoints()
68 {
69         return showPointsF;
70 }
71 /*
72  * Set Up startPoint, endPoint, maxY,maxX points        
73 */
74 void pGraphicalFunction::setUp()
75 {
76         logicFunction->setUp();
77         setMaxX(logicFunction->getMaxX());
78         setMinX(logicFunction->getMinX());
79         setMaxY(logicFunction->getMaxY());
80         setMinY(logicFunction->getMinY());
81         setStartX(logicFunction->getStartX());
82         setEndX(logicFunction->getEndX());
83         setStartY(logicFunction->getStartY());
84         setEndY(logicFunction->getEndY());
85         
86 }
87
88 /*
89 * validate if the function has that point in a sensible area returning the index where the point was found or -1 if is in not part of the function: define the sensible area is  
90 * x1-validPointRange<x<x1+validPointRange y1-validPointRange<y<y1+validPointRange
91 */
92 int pGraphicalFunction::validPointOnFunction(wxPoint realPoint)
93 {
94         return (logicFunction -> validPointOnFunction (realPoint));
95 }
96 /*
97 * returns the index in the list of the point 
98 */
99 int pGraphicalFunction::getIndexOf(wxPoint realpoint)
100 {
101         return logicFunction -> getIndexOf( realpoint );        
102 }
103
104 /*
105 * This metohd returns the node of the point that is the movingPointIndex position in the list of points.
106 * @param: int movingPointIndex, Is the index value of the searched node. 
107 * @return: Return a pointer to the node corresponding to the index value by parameter.
108 */
109 wxNode* pGraphicalFunction::GetPointAt( int movingPointIndex )
110 {
111         return logicFunction -> GetPointAt ( movingPointIndex );        
112 }
113 /*
114  * Set the scales of the function in x and y
115  * 
116  */
117 void pGraphicalFunction::setScales()
118 {
119         //int dx= logicFunction->getMaxX()-logicFunction->getMinX();
120         //int dy= logicFunction->getMaxY()-logicFunction->getMinY();
121         int dx= maxShowedX-minShowedX;
122         int dy= maxShowedY-minShowedY;
123         
124         
125         if(dx!=0 && dy!=0)
126         {
127                 double scaleX=(((float)(screenX-100))/dx)*factorZoom;
128                 double scaleY=(((float)(screenY-50))/dy)*factorZoom;
129                 setScaleX(scaleX);
130                 setScaleY(scaleY);
131                 logicFunction->setScaleX(scaleX);
132                 logicFunction->setScaleY(scaleY);
133
134         }
135 }
136 /*
137 * Includes a point between two existing points of this function. The new point (x,y) was not defined when the function was created.
138 * @return Returns true is the point was succcesfully added to the funcion.
139 */
140 bool pGraphicalFunction:: AddNewPoint(int x,int y)
141 {
142         bool added= logicFunction -> AddNewPoint ( x, y );
143         if(!fromWindow)
144          setUp();
145         else
146         {
147                 logicFunction->setEndPoints();
148                 logicFunction->setStartPoints();
149         }
150         return added;
151 }
152
153 /*
154 * This tries to Add a point to the function if possible it returns true.
155 * @pre: The list of existing points is ordered.
156 * @param: int aX, The x value of the point.
157 * @param: int aY, The y value of the point.
158 * @param: return Returns TRUE if the point was succesfuly included in the realPoints list.
159 */
160 bool pGraphicalFunction::AddPoint(int aX, int aY,bool order) 
161 {       
162         printf("EED %p pGraphicalFunction::AddPoint %p (%d %d) \n", this, logicFunction, aX, aY);       
163         bool added=false;
164         if (logicFunction!=NULL){
165                 added=logicFunction -> AddPoint( aX, aY,order );
166                 if(!fromWindow)
167                         setUp();
168                 else
169                 {
170                         logicFunction->setEndPoints();
171                         logicFunction->setStartPoints();
172                 } // if fromWindow
173         } // if logicFunction
174         return added;
175 }
176
177 /**
178 * deletes the point given by the  user  from the collection of logical points of the function
179 * is not used
180 */
181
182 bool pGraphicalFunction::DeletePoint(int aX, int aY) 
183 {
184         bool added= logicFunction -> DeletePoint( aX, aY );     
185         if(!fromWindow)
186          setUp();
187         else
188         {
189                 logicFunction->setEndPoints();
190                 logicFunction->setStartPoints();
191         }
192         return added;
193 }
194
195 /**
196 * deletes a point of the functio given its index
197 */
198 bool pGraphicalFunction::deletePointAt(int index)
199 {
200         bool added=logicFunction -> deletePointAt( index );
201         if(!fromWindow)
202          setUp();
203         else
204         {
205                 logicFunction->setEndPoints();
206                 logicFunction->setStartPoints();
207         }
208         return added;
209 }
210
211 /**
212 * Change de coordinates of the given index point to the newCoords, if it is possible and return the result of the invoked action. 
213 * @retun Return TRUE if it was possible to do the change. A valid change is when the new x value of the point is still between the previous and next point, when condition.
214 */
215 bool pGraphicalFunction::changePoint(wxPoint newCoords, int movingIndexPoint) 
216 {
217         bool added= (logicFunction -> changePoint( newCoords, movingIndexPoint ));
218         if(!fromWindow)
219          setUp();
220         else
221         {
222                 logicFunction->setEndPoints();
223                 logicFunction->setStartPoints();
224         }
225         return added;
226 }
227 /**
228 * Evaluates if the given point belongs to the function.
229 */
230 /*
231 bool pGraphicalFunction::hasPoint(wxPoint aPoint) 
232 {
233         return logicFunction -> hasPoint( aPoint );     
234 }
235 */
236
237 /**
238 * Returns the real x values of the control points of the function. It dont includes the points calculated by interpolation.
239 */
240 double* pGraphicalFunction::getX_RealValues() 
241 {
242         return (logicFunction -> getX_RealValues( ));   
243 }
244
245 /**
246 * Returns the real y values of the control points of the function. It dont includes the points calculated by interpolation.
247 */
248 double * pGraphicalFunction::getY_RealValues() 
249 {  
250
251         return (logicFunction -> getY_RealValues());    
252 }
253
254 //----------------------------------
255 // Asking if it has a point (x,y)
256 //----------------------------------
257
258 /*
259 * returns true if the point is along the function
260 * false otherway
261 */
262 bool pGraphicalFunction:: isInFunction(int x, int y)
263 {
264         wxNode* before;
265         wxNode* next;
266         pFunctionPoint* point= new pFunctionPoint(x,y);
267         bool inLine;
268         before=getBefore(point);
269
270         if(before && before->GetNext())
271         {
272                 next = before->GetNext();
273                 //next = (before->GetNext())->GetNext();
274                 inLine= isInLine((pFunctionPoint*)before->GetData(),(pFunctionPoint*)next->GetData(),point);
275         }
276         else 
277                 inLine=false;
278         return inLine;
279 }
280 /*
281 * give us the point that is in the function and is exactly before
282 * the point we are giving
283 */
284 wxNode* pGraphicalFunction:: getBefore(pFunctionPoint* point)
285 {
286         int minDiference=10000000;
287         wxNode* node=logicFunction->GetPointAt(0);
288         wxNode* before=NULL;
289         while(node)
290         {
291                 pFunctionPoint* before1=(pFunctionPoint*)node->GetData();
292                 int beforeX=before1->getRealX();
293                 int pointX=point->getRealX();
294                 if(beforeX<pointX)
295                 {
296                   int minDiference1=pointX-beforeX;
297                   if(minDiference1<minDiference)
298                   {
299                           minDiference=minDiference1;
300                           before=node;
301                   }
302                 }
303                 node=node->GetNext();
304         }
305         return before;
306 }
307 /*
308 * Returns true if the point is in the line
309 */
310 bool pGraphicalFunction::isInLine(pFunctionPoint* before,pFunctionPoint* next, pFunctionPoint* point)
311 {
312         int x1,x2,x,y1,y2,y;
313         
314         x1=(float)before->getRealX();
315         x2=(float)next->getRealX();
316         y1=(float)before->getRealY();
317         y2=(float)next->getRealY();
318         x=(float)point->getRealX();
319         y=(float)point->getRealY();
320
321         
322         float d1= (float)sqrt(pow(float(x1-x),2)+ pow(float(y1-y),2));
323         float d2= (float)sqrt(pow(float(x2-x),2)+ pow(float(y2-y),2));
324         float d=(float)sqrt(pow(float(x2-x1),2)+ pow(float(y2-y1),2));
325         if(d1+d2<=(d*1.1) && d1<=d && d2<=d)
326                 return true;
327         return false;
328 }
329 /**
330 * give us the value of y in the line define by the arguments
331 */
332 double pGraphicalFunction::interpolateY(double m, int x1,int y1,int x)
333 {
334         return m*(x-x1)+y1;
335 }
336
337 //----------------------------
338 //NEW METHODS
339 //----------------------------
340
341 //----------------------------
342 // Spline Methods
343 //----------------------------
344
345
346         /*
347         * clear the spline vectors
348         */
349         void pGraphicalFunction:: clearSplineVectors()
350         {
351                 xSpline.clear();
352                 ySpline.clear();
353         }
354
355         /*
356         Initiliaze xSpline and ySpline vectors
357         */
358         void pGraphicalFunction:: initializeSplines()
359         {
360                 if(xKSpline==NULL)
361                         xKSpline = vtkKochanekSpline::New();
362                 if(yKSpline==NULL)
363                         yKSpline= vtkKochanekSpline::New();
364                 addSplinesPoints();
365
366         }
367
368         /*
369         Add the (x,y) points of the function to the 
370         spline
371         */
372         void pGraphicalFunction::addSplinesPoints()
373         {
374                 xKSpline->RemoveAllPoints();
375                 yKSpline->RemoveAllPoints();
376                 wxNode *node= logicFunction->GetPointAt(0);
377                 pFunctionPoint* p;
378                 int i=0;
379                 while(node)
380                 {
381                         p=(pFunctionPoint*)node->GetData();
382                         xKSpline->AddPoint(i,p->getRealX());
383                         yKSpline->AddPoint(i,p->getRealY());
384                         i++;
385                         node=node->GetNext();
386                 }
387         }
388         /*
389          This Method adds the point calculated by
390          the splines to the vectors
391         */
392         void pGraphicalFunction:: initializeSplineVectors()
393         {
394                 double x=0,y=0,t,delta;
395                 int i,np,nps;
396                 //realPoints.DeleteC  
397
398                 np = logicFunction->getSizePoints();
399                 nps = 100;
400                 delta=( double ) ( np ) / ( double ) ( nps );
401                 for( i = 0; i < nps; i++ )
402                 {
403                   t = delta * (double)i;
404                   GetSplinePoint(t,x,y);
405                   xSpline.push_back(x);
406                   ySpline.push_back(y);
407                 }
408         }
409         /*
410          get the spline point for t, in xKSpline and yKSpline
411         */
412         void pGraphicalFunction::GetSplinePoint(double t, double &x, double &y)
413         {
414                 if (logicFunction->getSizePoints()==0)
415                 {
416                         x = 0;
417                         y = 0;
418                 }
419                 if (logicFunction->getSizePoints()>=2)
420                 {
421                         x = xKSpline->Evaluate(t);
422                         y = yKSpline->Evaluate(t);
423                 }
424         }
425
426 //------------------------------
427 // Zoom Methods
428 //------------------------------
429
430 /**
431 This method set the initial point and the final point of drawing
432 according with the width of the square around the point clicked
433 @param clickedX
434 @param clickedY
435 @param width: width of the square
436 Note: all the parameters are pixels
437 Pre: screenX, screenY, zoom are set! with the actual data.
438 DEPRECATED!
439 */
440 void pGraphicalFunction::zooming(int clickedX,int clickedY,int width)
441 {
442         int xS,yS,x1,x2,y1,y2;
443         setScales();
444         xS=clickedX/_scaleX+_offsetX;
445         yS=clickedY/_scaleY+_offsetY;
446         //square
447         x1=(clickedX-width)/_scaleX+_offsetX;
448         x2=(clickedX+width)/_scaleX+_offsetX;
449         y1=(clickedY-width)/_scaleY+_offsetY;
450         y2=(clickedY+width)/_scaleY+_offsetY;
451
452         int numberPoints=getSizePoints();
453         pFunctionPoint* point;
454         wxNode* p;
455         bool inSquare=false,first=false;
456         
457         //if the user made a zoom
458         if(zoomIn)
459         {
460                 int i;
461                 for(i=0; i<numberPoints;i++)
462                 {
463                         p=logicFunction->GetPointAt(i);
464                         point=(pFunctionPoint*)p->GetData();
465                         int rx=point->getRealX();
466                         int ry=point->getRealY();
467                         inSquare= rx>=x1 && rx<=x2; //&& ry>=y1 && ry<=y2;
468                         if(inSquare)
469                         {
470                                 if(!first)
471                                 {
472                                         initialDrawingPoint=point;
473                                         _offsetX=rx;
474                                         _offsetY=ry;
475                                         first=true;
476                                 }
477                                 finalDrawingPoint=point;
478                         }
479                 }
480         }       
481         else
482         {
483                 //We extend the range of vision in x and y,20 and 10 respectively
484                 if((_offsetX-20)>=0)
485                 {
486                         _offsetX=_offsetX-20;
487                 }
488                 else
489                         _offsetX=0;
490                 if((_offsetY-10)>=0)
491                 {
492                         _offsetY=_offsetY-10;
493                 }
494                 else
495                         _offsetY=0;
496         }
497 }
498
499         /*
500         This method sets the offsets according with the point 
501         clicked on the window
502         @param offx: x-value of the point clicked
503         @param offx: y-value of the point clicked
504         Note: all the parameters are pixels
505         Pre: screenX, screenY are set! with the actual data.
506         Pos: Sets the value of minXshowed,minYshowed 
507         */
508         void pGraphicalFunction::setOffsets(int offx,int offy)
509         {
510                 int xS,yS;
511
512                 setScales();
513                 
514                 xS=(offx-offsetPixelX)/_scaleX+_offsetX + minShowedX;
515                 yS=(offy-offsetPixelY)/_scaleY+_offsetY+ minShowedY;
516                 
517                 setOffsetX(xS);
518                 setOffsetY(yS);
519                         
520                 //setMinShowedX(xS);
521                 //setMinShowedY(yS);
522
523                 setOffsetPixelX(offx);
524                 setOffsetPixelY(offy);
525                 //setMinShowed();
526         }
527         /*
528         *  This method sets the minShowedX 
529         *  and the minShowedY, accordig to the offset in
530         *  x-axis and y-axis respectively
531         *  pre: _offsetX>=0,_offsetY>=0
532         *               screenX and screenY are set with the actual size of the window
533         *               scaleX and scaleY are set to the actual size of the window
534         * DEPRECATED!
535         */
536         void pGraphicalFunction::setMinShowed()
537         {
538                 bool firstX=false,firstY=false;
539                 
540                 wxNode* node=logicFunction->GetPointAt(0);
541                 pFunctionPoint* p;
542
543                 //float middleWX=(((float)(screenX-100))/2)/scaleX; // JPRx
544                 //float middleWY=(((float)(screenY-50))/2)/scaleY; // JPRx
545                 
546                 //node=node->GetNext(); 
547                 while(node)
548                 {
549                         p=(pFunctionPoint*)node->GetData();
550                         int px=p->getRealX();
551                         int py=p->getRealY();
552                         int x=(px-_offsetX);//+middleWX;
553                         int y=(py-_offsetY);//+middleWY;
554                         if(!firstX && x>=0)
555                         {
556                                 firstX=true;
557                                 setMinShowedX(px);
558                         }
559                         if(!firstY && y>=0)
560                         {
561                                 firstY=true;
562                                 setMinShowedY(py);
563                         }       
564                         node=node->GetNext();
565                 }
566         }
567
568 //-----------------------
569 // Persistence
570 //-----------------------
571
572 /*
573  Save the points of the function
574 */
575 void pGraphicalFunction::save(wxString fileName)
576 {
577         
578         logicFunction->save(fileName);
579
580 }
581 /*
582  Load the points of a function 
583 */
584 void pGraphicalFunction::load(wxString fileName)
585 {
586         logicFunction->load(fileName);
587         logicFunction->setUp();
588         setMaxShowedX(logicFunction->getMaxX());
589         setMinShowedX(logicFunction->getMinX());
590         setMaxShowedY(logicFunction->getMaxY());
591         setMinShowedY(logicFunction->getMinY());
592 }
593         
594 //--------------------------
595 //GETTERS AND SETTERS
596 //---------------------------
597 /**
598 * actual
599 */
600 void pGraphicalFunction::setActual(bool act)
601 {
602   ifActual=act;
603 }
604 bool pGraphicalFunction:: getActual()
605 {
606         return ifActual;
607 }
608 /**
609 * SCALE WAY
610 * DEFECT_SCALE 1
611 * MAX_SCALE 2
612 * USER_SCALE 3
613 */
614 void pGraphicalFunction::setScaleWay(int typeS)
615 {
616   scaleWay=typeS;
617 }
618
619 int pGraphicalFunction:: getScaleWay()
620 {
621  return scaleWay;
622 }
623
624
625 /*
626 * SCREEN
627 */
628 void pGraphicalFunction::setScreenX(int scrX)
629 {
630   this->screenX=scrX;
631 }
632 int pGraphicalFunction::getScreenX()
633 {
634   return this->screenX;
635 }
636 void pGraphicalFunction::setScreenY(int scrY)
637 {
638   this->screenY=scrY;
639 }
640 int pGraphicalFunction::getScreenY()
641 {
642   return this->screenY;
643 }
644
645
646 /*
647 * STARTS
648 */
649 void pGraphicalFunction::setStartX(double aStartX) {
650         
651         logicFunction->setStartX(aStartX);
652         this->_startX =logicFunction->getStartX();
653 }
654
655 double pGraphicalFunction::getStartX() 
656 {
657         return logicFunction->getStartX();
658 }
659
660 void pGraphicalFunction::setStartY(double aStartY) 
661 {
662         logicFunction->setStartY(aStartY);
663         this->_startY = aStartY;
664 }
665
666 double pGraphicalFunction::getStartY() {
667         return logicFunction->getStartY();
668 }
669 /*
670 * ENDs
671 */
672 void pGraphicalFunction::setEndX(double aEndX) 
673 {
674         logicFunction->setEndX(aEndX);
675         this->_endX = aEndX;
676 }
677
678 double pGraphicalFunction::getEndX() {
679         return logicFunction->getEndX();
680 }
681
682 void pGraphicalFunction::setEndY(double aEndY) {
683         logicFunction->setEndY(aEndY);
684         this->_endY = aEndY;
685 }
686
687 double pGraphicalFunction::getEndY() {
688         return logicFunction->getEndY();
689 }
690 /*
691  * SCALES
692  */
693 void pGraphicalFunction::setScaleX(double aScaleX) 
694 {
695         logicFunction->setScaleX(aScaleX);
696         this->_scaleX = aScaleX;
697 }
698
699 double pGraphicalFunction::getScaleX() 
700 {
701         return this->_scaleX;
702 }
703
704 void pGraphicalFunction::setScaleY(double aScaleY) 
705 {
706         logicFunction->setScaleY(aScaleY);
707         this->_scaleY = aScaleY;
708 }
709
710 double pGraphicalFunction::getScaleY() {
711         return this->_scaleY;
712 }
713 /*
714  * Mins
715  */
716 void pGraphicalFunction::setMinX(double aMinX) 
717 {
718         logicFunction->setMinX(aMinX);
719         this->_minX = aMinX;
720 }
721
722 double pGraphicalFunction::getMinX() 
723 {
724         return logicFunction->getMinX();
725 }
726
727 void pGraphicalFunction::setMinY(double aMinY) 
728 {
729         logicFunction->setMinY(aMinY);
730         this->_minY = aMinY;
731 }
732
733 double pGraphicalFunction::getMinY() {
734         return logicFunction->getMinY();
735 }
736 /*
737  * MAXS
738  */
739 void pGraphicalFunction::setMaxX(double aMaxX) 
740 {
741         logicFunction->setMaxX(aMaxX);
742         this->_maxX = aMaxX;
743 }
744
745 double pGraphicalFunction::getMaxX() 
746 {
747         return logicFunction->getMaxX();
748 }
749
750 void pGraphicalFunction::setMaxY(double aMaxY) 
751 {
752         logicFunction->setMaxY(aMaxY);
753         this->_maxY = aMaxY;
754 }
755
756 double pGraphicalFunction::getMaxY() {
757         return logicFunction->getMaxY();
758 }
759
760 /*
761  * OFFSETS
762  */
763 void pGraphicalFunction::setOffsetX(double aOffsetX) 
764 {
765         logicFunction->setOffsetX(aOffsetX);
766         this->_offsetX = aOffsetX;
767 }
768
769 double pGraphicalFunction:: getOffsetX() 
770 {
771         
772         return this->_offsetX;
773 }
774
775 void pGraphicalFunction:: setOffsetY(double aOffsetY) 
776 {
777         logicFunction->setOffsetY(aOffsetY);
778         this->_offsetY = aOffsetY;
779 }
780
781 double pGraphicalFunction:: getOffsetY() {
782         return this->_offsetY;
783 }
784
785 /*
786  * TYPE
787  */
788 void pGraphicalFunction:: setType(int aType) 
789 {
790         logicFunction->setType(aType);
791         this->_type = aType;
792 }
793
794 int pGraphicalFunction :: getType() {
795         return this->_type;
796 }
797
798 /*
799  * validPoint
800  */
801 int pGraphicalFunction :: getValidPointRange()
802 {
803         return validPointRange;
804 }
805
806 void pGraphicalFunction :: setValidPointRange(int theRange)
807 {
808         logicFunction->setValidPointRange(theRange);
809         validPointRange = theRange;
810 }
811 /*
812 * Returns the number of points that the function
813 * has
814 */
815 int pGraphicalFunction :: getSizePoints()
816 {
817         return logicFunction->getSizePoints();
818 }
819
820 /*
821 * Sets the color points of the function by teh given parameter
822 * @param colorVector Is the color points vector to set
823 */
824 void pGraphicalFunction :: setColorPoints(std::vector<pColorPoint *> &colorVector)
825 {
826         f_colorPoints.clear();
827         int i = 0;      
828         while(i<(int)(colorVector.size()))
829         {
830                 f_colorPoints.push_back(colorVector[i]);                
831                 i++;
832         }
833 }
834
835 /*
836 * Gets the color points of the function in the given parameter
837 * @param colorVector Is the color points list to get the points
838 */
839 void pGraphicalFunction :: getColorPoints(std::vector<pColorPoint *> &colorVector)
840 {
841         int i = 0;      
842         while(i<(int)(f_colorPoints.size()))
843         {
844                 pColorPoint * originaslPoint = f_colorPoints[i];
845                 pColorPoint * copyPoint = new pColorPoint(originaslPoint->getRealX(), originaslPoint->getColor(), originaslPoint->isTemporalColor());
846                 colorVector.push_back(copyPoint);               
847                 i++;
848         }
849 }
850
851