]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx
TransferFunctionfinish
[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 /**
55 * Is the destructor!!!
56 */
57 pGraphicalFunction :: ~ pGraphicalFunction ()
58 {
59         
60 }
61
62 //set if the function has to draw the points
63 void pGraphicalFunction::SetShowPoints(bool showPoints)
64 {
65         showPointsF = showPoints;
66 }
67 //get the paramater showPointsF
68 bool pGraphicalFunction::getShowPoints()
69 {
70         return showPointsF;
71 }
72 /*
73  * Set Up startPoint, endPoint, maxY,maxX points        
74 */
75 void pGraphicalFunction::setUp()
76 {
77         logicFunction->setUp();
78         setMaxX(logicFunction->getMaxX());
79         setMinX(logicFunction->getMinX());
80         setMaxY(logicFunction->getMaxY());
81         setMinY(logicFunction->getMinY());
82         setStartX(logicFunction->getStartX());
83         setEndX(logicFunction->getEndX());
84         setStartY(logicFunction->getStartY());
85         setEndY(logicFunction->getEndY());
86         
87 }
88
89 /*
90 * 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  
91 * x1-validPointRange<x<x1+validPointRange y1-validPointRange<y<y1+validPointRange
92 */
93 int pGraphicalFunction::validPointOnFunction(wxPoint realPoint)
94 {
95         return (logicFunction -> validPointOnFunction (realPoint));
96 }
97 /*
98 * returns the index in the list of the point 
99 */
100 int pGraphicalFunction::getIndexOf(wxPoint realpoint)
101 {
102         return logicFunction -> getIndexOf( realpoint );        
103 }
104
105 /*
106 * This metohd returns the node of the point that is the movingPointIndex position in the list of points.
107 * @param: int movingPointIndex, Is the index value of the searched node. 
108 * @return: Return a pointer to the node corresponding to the index value by parameter.
109 */
110 wxNode* pGraphicalFunction::GetPointAt( int movingPointIndex )
111 {
112         return logicFunction -> GetPointAt ( movingPointIndex );        
113 }
114 /*
115  * Set the scales of the function in x and y
116  * 
117  */
118 void pGraphicalFunction::setScales()
119 {
120         //int dx= logicFunction->getMaxX()-logicFunction->getMinX();
121         //int dy= logicFunction->getMaxY()-logicFunction->getMinY();
122         int dx= maxShowedX-minShowedX;
123         int dy= maxShowedY-minShowedY;
124         
125         
126         if(dx!=0 && dy!=0)
127         {
128                 double scaleX=(((float)(screenX-100))/dx)*factorZoom;
129                 double scaleY=(((float)(screenY-50))/dy)*factorZoom;
130                 setScaleX(scaleX);
131                 setScaleY(scaleY);
132                 logicFunction->setScaleX(scaleX);
133                 logicFunction->setScaleY(scaleY);
134
135         }
136 }
137 /*
138 * Includes a point between two existing points of this function. The new point (x,y) was not defined when the function was created.
139 * @return Returns true is the point was succcesfully added to the funcion.
140 */
141 bool pGraphicalFunction:: AddNewPoint(int x,int y)
142 {
143         bool added= logicFunction -> AddNewPoint ( x, y );
144         if(!fromWindow)
145          setUp();
146         else
147         {
148                 logicFunction->setEndPoints();
149                 logicFunction->setStartPoints();
150         }
151         return added;
152 }
153
154 /*
155 * This tries to Add a point to the function if possible it returns true.
156 * @pre: The list of existing points is ordered.
157 * @param: int aX, The x value of the point.
158 * @param: int aY, The y value of the point.
159 * @param: return Returns TRUE if the point was succesfuly included in the realPoints list.
160 */
161 bool pGraphicalFunction::AddPoint(int aX, int aY,bool order) 
162 {       
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
290         while(node)
291         {
292                 pFunctionPoint* before1=(pFunctionPoint*)node->GetData();
293                 int beforeX=before1->getRealX();
294                 int pointX=point->getRealX();
295                 if(beforeX<pointX)
296                 {
297                   int minDiference1=pointX-beforeX;
298                   if(minDiference1<minDiference)
299                   {
300                           minDiference=minDiference1;
301                           before=node;
302                   }
303                 }
304                 node=node->GetNext();
305         }
306         return before;
307 }
308 /*
309 * Returns true if the point is in the line
310 */
311 bool pGraphicalFunction::isInLine(pFunctionPoint* before,pFunctionPoint* next, pFunctionPoint* point)
312 {
313         int x1,x2,x,y1,y2,y;
314         
315         x1=(float)before->getRealX();
316         x2=(float)next->getRealX();
317         y1=(float)before->getRealY();
318         y2=(float)next->getRealY();
319         x=(float)point->getRealX();
320         y=(float)point->getRealY();
321
322         
323         float d1= (float)sqrt(pow(float(x1-x),2)+ pow(float(y1-y),2));
324         float d2= (float)sqrt(pow(float(x2-x),2)+ pow(float(y2-y),2));
325         float d=(float)sqrt(pow(float(x2-x1),2)+ pow(float(y2-y1),2));
326         if(d1+d2<=(d*1.1) && d1<=d && d2<=d)
327                 return true;
328         return false;
329 }
330 /**
331 * give us the value of y in the line define by the arguments
332 */
333 double pGraphicalFunction::interpolateY(double m, int x1,int y1,int x)
334 {
335         return m*(x-x1)+y1;
336 }
337
338 //----------------------------
339 //NEW METHODS
340 //----------------------------
341
342 //----------------------------
343 // Spline Methods
344 //----------------------------
345
346
347         /*
348         * clear the spline vectors
349         */
350         void pGraphicalFunction:: clearSplineVectors()
351         {
352                 xSpline.clear();
353                 ySpline.clear();
354         }
355
356         /*
357         Initiliaze xSpline and ySpline vectors
358         */
359         void pGraphicalFunction:: initializeSplines()
360         {
361                 if(xKSpline==NULL)
362                         xKSpline = vtkKochanekSpline::New();
363                 if(yKSpline==NULL)
364                         yKSpline= vtkKochanekSpline::New();
365                 addSplinesPoints();
366
367         }
368
369         /*
370         Add the (x,y) points of the function to the 
371         spline
372         */
373         void pGraphicalFunction::addSplinesPoints()
374         {
375                 xKSpline->RemoveAllPoints();
376                 yKSpline->RemoveAllPoints();
377                 wxNode *node= logicFunction->GetPointAt(0);
378                 pFunctionPoint* p;
379                 int i=0;
380                 while(node)
381                 {
382                         p=(pFunctionPoint*)node->GetData();
383                         xKSpline->AddPoint(i,p->getRealX());
384                         yKSpline->AddPoint(i,p->getRealY());
385                         i++;
386                         node=node->GetNext();
387                 }
388         }
389         /*
390          This Method adds the point calculated by
391          the splines to the vectors
392         */
393         void pGraphicalFunction:: initializeSplineVectors()
394         {
395                 double x=0,y=0,t,delta;
396                 int i,np,nps;
397                 //realPoints.DeleteC  
398
399                 np = logicFunction->getSizePoints();
400                 nps = 200;
401                 delta=( double ) ( np ) / ( double ) ( nps );
402                 for( i = 0; i < nps; i++ )
403                 {
404                   t = delta * (double)i;
405                   GetSplinePoint(t,x,y);
406                   xSpline.push_back(x);
407                   ySpline.push_back(y);
408                 }
409         }
410         /*
411          get the spline point for t, in xKSpline and yKSpline
412         */
413         void pGraphicalFunction::GetSplinePoint(double t, double &x, double &y)
414         {
415                 if (logicFunction->getSizePoints()==0)
416                 {
417                         x = 0;
418                         y = 0;
419                 }
420                 if (logicFunction->getSizePoints()>=2)
421                 {
422                         x = xKSpline->Evaluate(t);
423                         y = yKSpline->Evaluate(t);
424                 }
425         }
426
427 //------------------------------
428 // Zoom Methods
429 //------------------------------
430
431 /**
432 This method set the initial point and the final point of drawing
433 according with the width of the square around the point clicked
434 @param clickedX
435 @param clickedY
436 @param width: width of the square
437 Note: all the parameters are pixels
438 Pre: screenX, screenY, zoom are set! with the actual data.
439 DEPRECATED!
440 */
441 void pGraphicalFunction::zooming(int clickedX,int clickedY,int width)
442 {
443         int xS,yS,x1,x2,y1,y2;
444         setScales();
445         xS=clickedX/_scaleX+_offsetX;
446         yS=clickedY/_scaleY+_offsetY;
447         //square
448         x1=(clickedX-width)/_scaleX+_offsetX;
449         x2=(clickedX+width)/_scaleX+_offsetX;
450         y1=(clickedY-width)/_scaleY+_offsetY;
451         y2=(clickedY+width)/_scaleY+_offsetY;
452
453         int numberPoints=getSizePoints();
454         pFunctionPoint* point;
455         wxNode* p;
456         bool inSquare=false,first=false;
457         
458         //if the user made a zoom
459         if(zoomIn)
460         {
461                 int i;
462                 for(i=0; i<numberPoints;i++)
463                 {
464                         p=logicFunction->GetPointAt(i);
465                         point=(pFunctionPoint*)p->GetData();
466                         int rx=point->getRealX();
467                         int ry=point->getRealY();
468                         inSquare= rx>=x1 && rx<=x2; //&& ry>=y1 && ry<=y2;
469                         if(inSquare)
470                         {
471                                 if(!first)
472                                 {
473                                         initialDrawingPoint=point;
474                                         _offsetX=rx;
475                                         _offsetY=ry;
476                                         first=true;
477                                 }
478                                 finalDrawingPoint=point;
479                         }
480                 }
481         }       
482         else
483         {
484                 //We extend the range of vision in x and y,20 and 10 respectively
485                 if((_offsetX-20)>=0)
486                 {
487                         _offsetX=_offsetX-20;
488                 }
489                 else
490                         _offsetX=0;
491                 if((_offsetY-10)>=0)
492                 {
493                         _offsetY=_offsetY-10;
494                 }
495                 else
496                         _offsetY=0;
497         }
498 }
499
500         /*
501         This method sets the offsets according with the point 
502         clicked on the window
503         @param offx: x-value of the point clicked
504         @param offx: y-value of the point clicked
505         Note: all the parameters are pixels
506         Pre: screenX, screenY are set! with the actual data.
507         Pos: Sets the value of minXshowed,minYshowed 
508         */
509         void pGraphicalFunction::setOffsets(int offx,int offy)
510         {
511                 int xS,yS;
512
513                 setScales();
514                 
515                 xS=(offx-offsetPixelX)/_scaleX+_offsetX + minShowedX;
516                 yS=(offy-offsetPixelY)/_scaleY+_offsetY+ minShowedY;
517                 
518                 setOffsetX(xS);
519                 setOffsetY(yS);
520                         
521                 //setMinShowedX(xS);
522                 //setMinShowedY(yS);
523
524                 setOffsetPixelX(offx);
525                 setOffsetPixelY(offy);
526                 //setMinShowed();
527         }
528         /*
529         *  This method sets the minShowedX 
530         *  and the minShowedY, accordig to the offset in
531         *  x-axis and y-axis respectively
532         *  pre: _offsetX>=0,_offsetY>=0
533         *               screenX and screenY are set with the actual size of the window
534         *               scaleX and scaleY are set to the actual size of the window
535         * DEPRECATED!
536         */
537         void pGraphicalFunction::setMinShowed()
538         {
539                 bool firstX=false,firstY=false;
540                 
541                 wxNode* node=logicFunction->GetPointAt(0);
542                 pFunctionPoint* p;
543
544                 //float middleWX=(((float)(screenX-100))/2)/scaleX; // JPRx
545                 //float middleWY=(((float)(screenY-50))/2)/scaleY; // JPRx
546                 
547                 //node=node->GetNext(); 
548                 while(node)
549                 {
550                         p=(pFunctionPoint*)node->GetData();
551                         int px=p->getRealX();
552                         int py=p->getRealY();
553                         int x=(px-_offsetX);//+middleWX;
554                         int y=(py-_offsetY);//+middleWY;
555                         if(!firstX && x>=0)
556                         {
557                                 firstX=true;
558                                 setMinShowedX(px);
559                         }
560                         if(!firstY && y>=0)
561                         {
562                                 firstY=true;
563                                 setMinShowedY(py);
564                         }       
565                         node=node->GetNext();
566                 }
567         }
568
569 //-----------------------
570 // Persistence
571 //-----------------------
572
573 /*
574  Save the points of the function
575 */
576 void pGraphicalFunction::save(wxString fileName)
577 {
578         
579         logicFunction->save(fileName);
580
581 }
582 /*
583  Load the points of a function 
584 */
585 void pGraphicalFunction::load(wxString fileName)
586 {
587         logicFunction->load(fileName);
588         logicFunction->setUp();
589         setMaxShowedX(logicFunction->getMaxX());
590         setMinShowedX(logicFunction->getMinX());
591         setMaxShowedY(logicFunction->getMaxY());
592         setMinShowedY(logicFunction->getMinY());
593 }
594         
595 //--------------------------
596 //GETTERS AND SETTERS
597 //---------------------------
598 /**
599 * actual
600 */
601 void pGraphicalFunction::setActual(bool act)
602 {
603   ifActual=act;
604 }
605 bool pGraphicalFunction:: getActual()
606 {
607         return ifActual;
608 }
609 /**
610 * SCALE WAY
611 * DEFECT_SCALE 1
612 * MAX_SCALE 2
613 * USER_SCALE 3
614 */
615 void pGraphicalFunction::setScaleWay(int typeS)
616 {
617   scaleWay=typeS;
618 }
619
620 int pGraphicalFunction:: getScaleWay()
621 {
622  return scaleWay;
623 }
624
625
626 /*
627 * SCREEN
628 */
629 void pGraphicalFunction::setScreenX(int scrX)
630 {
631   this->screenX=scrX;
632 }
633 int pGraphicalFunction::getScreenX()
634 {
635   return this->screenX;
636 }
637 void pGraphicalFunction::setScreenY(int scrY)
638 {
639   this->screenY=scrY;
640 }
641 int pGraphicalFunction::getScreenY()
642 {
643   return this->screenY;
644 }
645
646
647 /*
648 * STARTS
649 */
650 void pGraphicalFunction::setStartX(double aStartX) {
651         
652         logicFunction->setStartX(aStartX);
653         this->_startX =logicFunction->getStartX();
654 }
655
656 double pGraphicalFunction::getStartX() 
657 {
658         return logicFunction->getStartX();
659 }
660
661 void pGraphicalFunction::setStartY(double aStartY) 
662 {
663         logicFunction->setStartY(aStartY);
664         this->_startY = aStartY;
665 }
666
667 double pGraphicalFunction::getStartY() {
668         return logicFunction->getStartY();
669 }
670 /*
671 * ENDs
672 */
673 void pGraphicalFunction::setEndX(double aEndX) 
674 {
675         logicFunction->setEndX(aEndX);
676         this->_endX = aEndX;
677 }
678
679 double pGraphicalFunction::getEndX() {
680         return logicFunction->getEndX();
681 }
682
683 void pGraphicalFunction::setEndY(double aEndY) {
684         logicFunction->setEndY(aEndY);
685         this->_endY = aEndY;
686 }
687
688 double pGraphicalFunction::getEndY() {
689         return logicFunction->getEndY();
690 }
691 /*
692  * SCALES
693  */
694 void pGraphicalFunction::setScaleX(double aScaleX) 
695 {
696         logicFunction->setScaleX(aScaleX);
697         this->_scaleX = aScaleX;
698 }
699
700 double pGraphicalFunction::getScaleX() 
701 {
702         return this->_scaleX;
703 }
704
705 void pGraphicalFunction::setScaleY(double aScaleY) 
706 {
707         logicFunction->setScaleY(aScaleY);
708         this->_scaleY = aScaleY;
709 }
710
711 double pGraphicalFunction::getScaleY() {
712         return this->_scaleY;
713 }
714 /*
715  * Mins
716  */
717 void pGraphicalFunction::setMinX(double aMinX) 
718 {
719         logicFunction->setMinX(aMinX);
720         this->_minX = aMinX;
721 }
722
723 double pGraphicalFunction::getMinX() 
724 {
725         return logicFunction->getMinX();
726 }
727
728 void pGraphicalFunction::setMinY(double aMinY) 
729 {
730         logicFunction->setMinY(aMinY);
731         this->_minY = aMinY;
732 }
733
734 double pGraphicalFunction::getMinY() {
735         return logicFunction->getMinY();
736 }
737 /*
738  * MAXS
739  */
740 void pGraphicalFunction::setMaxX(double aMaxX) 
741 {
742         logicFunction->setMaxX(aMaxX);
743         this->_maxX = aMaxX;
744 }
745
746 double pGraphicalFunction::getMaxX() 
747 {
748         return logicFunction->getMaxX();
749 }
750
751 void pGraphicalFunction::setMaxY(double aMaxY) 
752 {
753         logicFunction->setMaxY(aMaxY);
754         this->_maxY = aMaxY;
755 }
756
757 double pGraphicalFunction::getMaxY() {
758         return logicFunction->getMaxY();
759 }
760
761 /*
762  * OFFSETS
763  */
764 void pGraphicalFunction::setOffsetX(double aOffsetX) 
765 {
766         logicFunction->setOffsetX(aOffsetX);
767         this->_offsetX = aOffsetX;
768 }
769
770 double pGraphicalFunction:: getOffsetX() 
771 {
772         
773         return this->_offsetX;
774 }
775
776 void pGraphicalFunction:: setOffsetY(double aOffsetY) 
777 {
778         logicFunction->setOffsetY(aOffsetY);
779         this->_offsetY = aOffsetY;
780 }
781
782 double pGraphicalFunction:: getOffsetY() {
783         return this->_offsetY;
784 }
785
786 /*
787  * TYPE
788  */
789 void pGraphicalFunction:: setType(int aType) 
790 {
791         logicFunction->setType(aType);
792         this->_type = aType;
793 }
794
795 int pGraphicalFunction :: getType() {
796         return this->_type;
797 }
798
799 /*
800  * validPoint
801  */
802 int pGraphicalFunction :: getValidPointRange()
803 {
804         return validPointRange;
805 }
806
807 void pGraphicalFunction :: setValidPointRange(int theRange)
808 {
809         logicFunction->setValidPointRange(theRange);
810         validPointRange = theRange;
811 }
812 /*
813 * Returns the number of points that the function
814 * has
815 */
816 int pGraphicalFunction :: getSizePoints()
817 {
818         return logicFunction->getSizePoints();
819 }
820
821 /*
822 * Sets the color points of the function by teh given parameter
823 * @param colorVector Is the color points vector to set
824 */
825 void pGraphicalFunction :: setColorPoints(std::vector<pColorPoint *> &colorVector)
826 {
827         f_colorPoints.clear();
828         int i = 0;      
829         while(i<(int)(colorVector.size()))
830         {
831                 f_colorPoints.push_back(colorVector[i]);                
832                 i++;
833         }
834 }
835
836 /*
837 * Gets the color points of the function in the given parameter
838 * @param colorVector Is the color points list to get the points
839 */
840 void pGraphicalFunction :: getColorPoints(std::vector<pColorPoint *> &colorVector)
841 {
842         int i = 0;      
843         while(i<(int)(f_colorPoints.size()))
844         {
845                 pColorPoint * originaslPoint = f_colorPoints[i];
846                 pColorPoint * copyPoint = new pColorPoint(originaslPoint->getRealX(), originaslPoint->getColor(), originaslPoint->isTemporalColor());
847                 colorVector.push_back(copyPoint);               
848                 i++;
849         }
850 }
851
852