1 //------------------------------------------------------------------------------------------------------------
2 // Class definition include
3 //------------------------------------------------------------------------------------------------------------
7 //------------------------------------------------------------------------------------------------------------
8 // Generated events declaration and definition
9 //------------------------------------------------------------------------------------------------------------
11 * How to catch generated event: EVT_COMMAND(ID_CONTAINER_WINDOW_LISTENER, wxEVT_TYPE_EVENT, ContainerClass :: determinedEventFor)
13 BEGIN_DECLARE_EVENT_TYPES()
14 DECLARE_EVENT_TYPE( wxEVT_ADDED_POINT, -1 )
15 DECLARE_EVENT_TYPE( wxEVT_REMOVED_POINT, -1 )
16 DECLARE_EVENT_TYPE( wxEVT_MOVED_POINT, -1 )
17 DECLARE_EVENT_TYPE( wxEVT_CHANGED_POINT, -1 )
18 DECLARE_EVENT_TYPE( wxEVT_ON_COLOR_BAR, -1 )
19 END_DECLARE_EVENT_TYPES()
22 DEFINE_EVENT_TYPE( wxEVT_ADDED_POINT )
23 DEFINE_EVENT_TYPE( wxEVT_REMOVED_POINT )
24 DEFINE_EVENT_TYPE( wxEVT_MOVED_POINT )
25 DEFINE_EVENT_TYPE( wxEVT_CHANGED_POINT )
26 DEFINE_EVENT_TYPE( wxEVT_ON_COLOR_BAR )
28 //------------------------------------------------------------------------------------------------------------
29 // Class implementation
30 //------------------------------------------------------------------------------------------------------------
31 /** file pColorBar.cxx */
32 IMPLEMENT_CLASS(pColorBar, wxScrolledWindow)
34 //------------------------------------------------------------------------------------------------------------
35 // Handled events table
36 //------------------------------------------------------------------------------------------------------------
37 BEGIN_EVENT_TABLE(pColorBar, wxScrolledWindow)
38 EVT_PAINT( pColorBar :: onPaint)
39 EVT_SIZE ( pColorBar :: OnSize )
40 EVT_MOTION ( pColorBar :: onMouseMove)
41 EVT_RIGHT_DOWN( pColorBar :: onShowPopupMenu)
42 EVT_LEFT_DCLICK( pColorBar :: onLeftButtonDClick)
43 EVT_LEFT_DOWN( pColorBar :: onLeftClicDown)
44 EVT_LEFT_UP( pColorBar :: onLeftClickUp)
45 EVT_MENU( cntID_DEL_COLOR_POINT, pColorBar :: onDeleteColorPoint)
46 EVT_MENU( cntID_ADD_COLOR_POINT, pColorBar :: onAddColorPoint)
47 EVT_MENU( cntID_CHANGE_COLOR_POINT, pColorBar :: onChangeColourSelectedPoint)
48 EVT_MENU( cntID_TRIANGLES_UP, pColorBar :: onTrianglesUp_Figure)
49 EVT_MENU( cntID_TRIANGLES_DOWN, pColorBar :: onTrianglesDown_Figure)
50 EVT_MENU( cntID_TRIANGLES_LEFT, pColorBar :: onTrianglesLeft_Figure)
51 EVT_MENU( cntID_TRIANGLES_RIGHT, pColorBar :: onTrianglesRight_Figure)
52 EVT_MENU( cntID_RECTANGLES, pColorBar :: onRectangles_Figure)
53 EVT_MENU( cntID_DEGRADE_CONTROL, pColorBar :: onDegradeControl)
54 EVT_MIDDLE_UP( pColorBar :: onShowPopupMenu )
55 EVT_RIGHT_UP ( pColorBar :: onShowPopupMenu )
58 //------------------------------------------------------------------------------------------------------------
59 // Constructors & Destructors
60 //------------------------------------------------------------------------------------------------------------
63 * Creates a colorBar instance
64 * param *parent Container event listener window
65 * param _w Width of the color bar drawing area
66 * param _h Height of the color bar drawing area
67 * param _bar_orientation VERTICAL (false) or HORIZONTAL (true) direction to set
69 pColorBar :: pColorBar (wxWindow *parent, int _w, int _h, bool _bar_orientation)
70 :wxScrolledWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
72 _logicalBar = new LogicalColorBar();
73 colourParent = GetParent()->GetBackgroundColour();
80 // Setting the default represented values
81 setDegradeState(true);
82 setStaticLimitsTo(false);
84 accumTemporalPoints = 0;
87 avaliablePointToMove = -1;
89 movingPointIndex = -1;
90 movingNodePoint = NULL;
91 realX_vertical_line = -1;
92 guideLineColor = wxColour(255,0,0);
95 figure = new pFigure( RECTANGLE, FIGURE_WIDTH, bar_height, -2, _bar_orientation );
96 setOrientation ( _bar_orientation );
98 // Appending menu items to the pop-menu
99 c_popmenu.Append( cntID_ADD_COLOR_POINT, _T("Add color point"), _T("Adds a color point in the clicked point"));
100 c_popmenu.Append( cntID_DEL_COLOR_POINT, _T("Delete color point"), _T("Deletes the color point at the clicked point"));
101 c_popmenu.Append( cntID_CHANGE_COLOR_POINT, _T("Change color"), _T("Changes the color at the clicked point"));
102 c_popmenu.Append ( cntID_DEGRADE_CONTROL, _T("Turn off degrade"), _T("Turns on/off the degrade"),wxITEM_SEPARATOR);
104 changesMenu = new wxMenu;
105 changesMenu->AppendCheckItem ( cntID_TRIANGLES_UP, _T("Triangles up"),_T("Sets triangles up figure"));
106 changesMenu->AppendCheckItem ( cntID_TRIANGLES_DOWN, _T("Triangles down"),_T("Sets triangles down figure"));
107 changesMenu->AppendCheckItem ( cntID_TRIANGLES_LEFT, _T("Triangles left"),_T("Sets triangles left figure"));
108 changesMenu->AppendCheckItem ( cntID_TRIANGLES_RIGHT, _T("Triangles right"),_T("Sets triangles right figure"));
109 changesMenu->AppendCheckItem ( cntID_RECTANGLES, _T("Rectangles"),_T("Sets rectangle figure"));
110 c_popmenu.Append(cntID_CHANGE_FIGURE, _T("Change figure"),changesMenu, _T("Changes the figure of the color points"));
111 changesMenu->Check (cntID_TRIANGLES_UP, true);
114 pColorBar :: ~pColorBar()
118 //------------------------------------------------------------------------------------------------------------
119 // Color bar proccessed events methods implementation
120 //------------------------------------------------------------------------------------------------------------
122 void pColorBar :: OnSize ( wxSizeEvent &WXUNUSED(event) )
124 wxRect rectTotal = GetClientRect();
127 setWidth( rectTotal.GetWidth() - deviceEndMargin );
131 setWidth( rectTotal.GetHeight() - deviceEndMargin);
136 * Reacts to the mouse movement inside the color bar for moving the clicked color point in the x-axis.
137 * Informs the result of the handled event like a wxCommandEvent wxEVT_MOVED_COL_POINT if a point was moved.
138 * param event The mouse actioned event
140 void pColorBar :: onMouseMove ( wxMouseEvent& event )
142 if(!event.LeftIsDown())
143 avaliablePointToMove = -1;
145 if (acceptedClick && activeState && _logicalBar->getCount()>0)
147 bool movedPoint = false;
148 wxPoint point = event.GetPosition();
149 double realClicked = getOrientation() ? convertToRealValue(point.x) : convertToRealValue(point.y);
150 bool rangeToMove = realClicked<=maxX_represented_Tshow && realClicked>=minX_represented_Tshow;//getOrientation() ? (point.x >=deviceStart_x && point.x<=bar_width+deviceStart_x-deviceEndMargin ) : ( point.y>=deviceStart_y && point.y<=bar_width+deviceStart_x-deviceEndMargin);
151 if ( rangeToMove && acceptedClick && showedColorPoints.size()>0 )
153 if ( movingPointIndex == -1 )
155 startNode_show = showedColorPoints.front();
156 lastNode_show = showedColorPoints.back();
158 //int numberEdges = figure->getNumberEdges(); // JPRx
159 //wxPoint points [4]; // JPRx
162 for (a=0; a<showedColorPoints.size() && movingPointIndex==-1 ; a++ )
164 pColorPoint * nodePoint = showedColorPoints[a];
165 int point_pixelX = convertToPixelValue(nodePoint -> getRealX());
166 point_pixelX+= deviceStart_x;
167 if ( getOrientation() )
168 movingPointIndex = (figure ->isPointInside (point_pixelX,point.x))? a : -1;
170 movingPointIndex = (figure ->isPointInside (point_pixelX,point.y))? a : -1;
172 if(movingPointIndex != -1)
174 movingNodePoint = nodePoint;
175 if(avaliablePointToMove ==-1)
176 avaliablePointToMove = movingPointIndex;
180 if (event.LeftIsDown() && movingNodePoint && movingPointIndex!=-1 && avaliablePointToMove==movingPointIndex)
182 bool hasPrevPoint = movingPointIndex > 0;
183 bool hasNextPoint = movingPointIndex < showedColorPoints.size()-1;
185 pColorPoint * prevPoint = hasPrevPoint? showedColorPoints[movingPointIndex-1]: NULL;
186 pColorPoint * nextPoint = hasNextPoint ? showedColorPoints[movingPointIndex+1]: NULL;
188 if ( hasPrevPoint && prevPoint!=NULL )
190 if ( hasNextPoint && nextPoint!=NULL )
192 double previousValue = prevPoint->getRealX();
193 double nextValue = nextPoint->getRealX();
194 movedPoint = prevPoint->isTemporalColor() ?
195 ( nextPoint->isTemporalColor() ? (realClicked>=previousValue)&&(realClicked<=nextValue) : (realClicked>=previousValue)&&(realClicked<nextValue))
196 :(realClicked>previousValue)&&(realClicked<nextValue);
198 avaliablePointToMove = movingPointIndex;
199 if(!movedPoint && realClicked<previousValue)
201 realClicked = previousValue+1;
204 else if(!movedPoint && realClicked>nextValue)
206 realClicked = nextValue-1;
215 double previousValue = prevPoint->getRealX();
216 movedPoint = prevPoint->isTemporalColor() ?
217 ( realClicked>=previousValue ) && ( realClicked<= maxX_represented_Tshow )
218 : ( realClicked>previousValue ) && ( realClicked<= maxX_represented_Tshow );
220 avaliablePointToMove = movingPointIndex;
221 if(!movedPoint && realClicked<previousValue)
223 realClicked = prevPoint->isTemporalColor()? previousValue: previousValue+1;
226 else if (!movedPoint && realClicked>=maxX_represented_Tshow)
228 realClicked = maxX_represented_Tshow;
236 if ( hasNextPoint && nextPoint!=NULL )
240 // Is the first point
241 double nextValue = nextPoint->getRealX();
242 movedPoint = ( nextPoint->isTemporalColor() ? (realClicked<=nextValue) && ( realClicked>= minX_represented_Tshow )
243 :( realClicked<nextValue ) && ( realClicked>= minX_represented_Tshow ));
246 avaliablePointToMove = movingPointIndex;
247 if(!movedPoint && realClicked>nextValue)
249 realClicked = nextPoint->isTemporalColor() ? nextValue : nextValue-1;
252 else if (!movedPoint && realClicked<=minX_represented_Tshow)
254 realClicked = minX_represented_Tshow;
261 //Is the only point in the color bar
262 movedPoint = ( realClicked<= maxX_represented_Tshow ) && ( realClicked>= minX_represented_Tshow );
264 avaliablePointToMove = movingPointIndex;
265 if (!movedPoint && realClicked<=minX_represented_Tshow)
267 realClicked = minX_represented_Tshow;
270 else if(!movedPoint && realClicked>=maxX_represented_Tshow)
272 realClicked = maxX_represented_Tshow;
279 bool movingTempStart = movingNodePoint->getRealX() == startNode_show->getRealX() && movingNodePoint->isTemporalColor();
280 bool movingTempEnd = movingNodePoint->getRealX()== lastNode_show->getRealX() && movingNodePoint->isTemporalColor();
281 if( movingTempStart || movingTempEnd )
285 // Inform movedPoint event
288 movingNodePoint->setRealX ( realClicked );
289 RefreshForce();//Refresh to show the point is moved
290 createAndSendEvent(wxEVT_MOVED_POINT);
294 movingPointIndex = -1;
295 //Creating a general event of mouse move to actualize views
296 createAndSendEvent( wxEVT_ON_COLOR_BAR );
301 movingPointIndex = -1;
302 //Creating a general event of mouse move to actualize views
303 createAndSendEvent( wxEVT_ON_COLOR_BAR );
305 if ( movingPointIndex ==-1 )
307 RefreshForce();//Refresh to show the point is not selected anymore
312 void pColorBar :: Refresh(bool eraseBackground , const wxRect* rect )
314 wxScrolledWindow::Refresh(false);
319 * Reacts to the event of drawing the bar and draws it
320 * param &WXUNUSED(event) The correspondig wxPaintEvent actioned event
322 void pColorBar :: onPaint ( wxPaintEvent &WXUNUSED(event) )
325 if ( getOrientation() ) // HORIZONTAL
328 temp_dc.SelectObject( * colorBar_Bitmap );
329 wxPaintDC dc( this );
331 // dc.Blit(deviceStart_x, deviceStart_y, bar_width+deviceStart_x, bar_height+deviceStart_y, &temp_dc, deviceStart_x, deviceStart_y);
333 dc.Blit(deviceStart_x, deviceStart_y, bar_width/*-deviceEndMargin*/, bar_height, &temp_dc, 0, 0);
335 // Bitmap for posible needed information to be shown
337 temp_dc.SelectObject( * information_Bitmap );
338 dc.Blit(0,bar_height, width, height, &temp_dc, 0, height);
344 temp_dc.SelectObject( * colorBar_Bitmap );
345 wxPaintDC dc( this );
346 // dc.Blit(deviceStart_y,deviceStart_x, bar_height+deviceStart_y, bar_width+deviceStart_x, &temp_dc, deviceStart_y, deviceStart_x);
348 dc.Blit(deviceStart_y,deviceStart_x, bar_height, bar_width-deviceEndMargin, &temp_dc, 0, 0);
349 // Bitmap for posible needed information to be shown
351 temp_dc.SelectObject( * information_Bitmap );
352 dc.Blit(0,bar_width, height, width, &temp_dc, 0, width );
354 temp_dc.SelectObject(wxNullBitmap);
359 * Reacts to the cntID_ADD_COLOR_POINT wxCommandEvent and adds a color degrade point to the color bar.
360 * Informs the result of the handled event like a wxCommandEvent wxEVT_ADDED_COL_POINT if the point was inserted succesfully.
361 * param & anEvent The wxCommandEvent actioned event
363 void pColorBar :: onAddColorPoint ( wxCommandEvent& anEvent )
365 bool addedPoint = false;
366 double real_x = getOrientation() ? convertToRealValue( clickedX ) : convertToRealValue( clickedY );;
367 wxColour selectedColor = getSelectedColour();
370 addedPoint = addColorPoint (real_x, selectedColor);
372 // Inform addedPoint event
376 createAndSendEvent( wxEVT_ADDED_POINT );
381 * Reacts to the cntID_DEL_COLOR_POINT wxCommandEvent and deletes a color degrade point of the color bar.
382 * Informs the result of the handled event like a wxCommandEvent wxEVT_REMOVED_COL_POINT if the point was succesfully removed.
383 * param & anEvent The wxCommandEvent actioned event
385 void pColorBar :: onDeleteColorPoint ( wxCommandEvent& anEvent )
387 bool deletedPoint = false;
388 double real_x = getOrientation() ? convertToRealValue( clickedX ) : convertToRealValue( clickedY );
389 deletedPoint = deleteColorPoint(real_x);
390 // Inform deletedPoint event
394 createAndSendEvent( wxEVT_REMOVED_POINT );
399 * Reacts to the cntID_CHANGE_COLOR_POINT wxCommandEvent and changes the assigned color to the selected color degrade point of the color bar.
400 * Informs the result of the handled event like a wxCommandEvent wxEVT_CHANGED_POINT if the point was succesfully removed.
401 * param & anEvent The wxCommandEvent actioned event
403 void pColorBar :: onChangeColourSelectedPoint ( wxCommandEvent& anEvent )
405 bool changedColour = false;
406 changedColour = getOrientation() ? changeColor( clickedX ) : changeColor( clickedY );
407 // Inform deletedPoint event
411 createAndSendEvent( wxEVT_CHANGED_POINT );
415 * Reacts to the cntID_TRIANGLES_UP wxCommandEvent and changes the assigned figure to -triangles up- for the color points of the color bar.
416 * param & anEvent The wxCommandEvent actioned event
418 void pColorBar :: onTrianglesUp_Figure ( wxCommandEvent& anEvent )
420 if( !changesMenu->IsChecked(cntID_TRIANGLES_UP) )
423 changesMenu->Check (cntID_TRIANGLES_UP, true);
424 changesMenu->Check (cntID_TRIANGLES_DOWN, false);
425 changesMenu->Check (cntID_TRIANGLES_LEFT, false);
426 changesMenu->Check (cntID_TRIANGLES_RIGHT, false);
427 changesMenu->Check (cntID_RECTANGLES, false);
431 * Reacts to the cntID_TRIANGLES_DOWN wxCommandEvent and changes the assigned figure to -triangles down- for the color points of the color bar.
432 * param & anEvent The wxCommandEvent actioned event
434 void pColorBar :: onTrianglesDown_Figure ( wxCommandEvent& anEvent )
436 if( !changesMenu->IsChecked(cntID_TRIANGLES_DOWN) )
439 changesMenu->Check (cntID_TRIANGLES_UP, false);
440 changesMenu->Check (cntID_TRIANGLES_DOWN, true);
441 changesMenu->Check (cntID_TRIANGLES_LEFT, false);
442 changesMenu->Check (cntID_TRIANGLES_RIGHT, false);
443 changesMenu->Check (cntID_RECTANGLES, false);
447 * Reacts to the cntID_TRIANGLES_LEFT wxCommandEvent and changes the assigned figure to -triangles left- for the color points of the color bar.
448 * param & anEvent The wxCommandEvent actioned event
450 void pColorBar :: onTrianglesLeft_Figure ( wxCommandEvent& anEvent )
452 if( !changesMenu->IsChecked(cntID_TRIANGLES_LEFT) )
455 changesMenu->Check (cntID_TRIANGLES_UP, false);
456 changesMenu->Check (cntID_TRIANGLES_DOWN, false);
457 changesMenu->Check (cntID_TRIANGLES_LEFT, true);
458 changesMenu->Check (cntID_TRIANGLES_RIGHT, false);
459 changesMenu->Check (cntID_RECTANGLES, false);
463 * Reacts to the cntID_TRIANGLES_RIGHT wxCommandEvent and changes the assigned figure to -triangles right- for the color points of the color bar.
464 * param & anEvent The wxCommandEvent actioned event
466 void pColorBar :: onTrianglesRight_Figure ( wxCommandEvent& anEvent )
468 if( !changesMenu->IsChecked(cntID_TRIANGLES_RIGHT) )
471 changesMenu->Check (cntID_TRIANGLES_UP, false);
472 changesMenu->Check (cntID_TRIANGLES_DOWN, false);
473 changesMenu->Check (cntID_TRIANGLES_LEFT, false);
474 changesMenu->Check (cntID_TRIANGLES_RIGHT, true);
475 changesMenu->Check (cntID_RECTANGLES, false);
479 * Reacts to the cntID_RECTANGLES wxCommandEvent and changes the assigned figure to -rectangles- for the color points of the color bar.
480 * param & anEvent The wxCommandEvent actioned event
482 void pColorBar :: onRectangles_Figure ( wxCommandEvent& anEvent )
484 if( !changesMenu->IsChecked(cntID_TRIANGLES_RIGHT) )
486 changeFigure (RECTANGLE);// RECTANGLE = 4
487 changesMenu->Check (cntID_TRIANGLES_UP, false);
488 changesMenu->Check (cntID_TRIANGLES_DOWN, false);
489 changesMenu->Check (cntID_TRIANGLES_LEFT, false);
490 changesMenu->Check (cntID_TRIANGLES_RIGHT, false);
491 changesMenu->Check (cntID_RECTANGLES, true);
496 * Reacts to the cntID_DEGRADE_CONTROL wxCommandEvent and turns on/off the degrade in the color bar.
497 * param & anEvent The wxCommandEvent actioned event
499 void pColorBar :: onDegradeControl ( wxCommandEvent& anEvent )
501 bool degrade = getDegradeState();
502 wxString nextAction_text;
505 nextAction_text = _T("Turn on degrade");
506 setDegradeState (false);
510 nextAction_text = _T("Turn off degrade");
511 setDegradeState (true);
513 c_popmenu.SetLabel ( cntID_DEGRADE_CONTROL, nextAction_text );
517 * Reacts to the wxEVT_RIGHT_DCLICK wxMouseEvent and adds a color degrade point to the color bar.
518 * Informs the result of the handled event like a wxCommandEvent wxEVT_ADDED_COL_POINT if the point was succesfully inserted.
519 * param & event The wxMouseEvent actioned event
521 void pColorBar :: onLeftButtonDClick (wxMouseEvent& event)
525 bool addedPoint = false;
526 wxPoint point = event.GetPosition();
527 bool posiblePoint = false;
528 if( getOrientation() )
530 posiblePoint = point.x>=deviceStart_x && point.y<= (bar_height + deviceStart_y);
534 posiblePoint = point.x>=deviceStart_y && point.x<= (bar_height+deviceStart_y) && point.y>deviceStart_x;
539 double real_x = getOrientation() ? convertToRealValue( point.x ) : convertToRealValue( point.y );
540 wxColour selectedColor = getSelectedColour();
543 addedPoint = addColorPoint (real_x, selectedColor);
545 // Inform addedPoint event
548 //RefreshForce(); Is all ready refreshed on the adition of the point method
549 createAndSendEvent( wxEVT_ADDED_POINT );
555 void pColorBar ::onLeftClicDown(wxMouseEvent& event )
557 acceptedClick = true;
560 void pColorBar ::onLeftClickUp(wxMouseEvent& event )
562 movingPointIndex = -1;
563 acceptedClick = false;
566 * Shows the popup menu
568 void pColorBar :: onShowPopupMenu (wxMouseEvent &event)
572 if(showedColorPoints.empty())
574 c_popmenu.Enable(cntID_DEL_COLOR_POINT, false);
578 c_popmenu.Enable(cntID_DEL_COLOR_POINT, true);
580 bool setClickedValues = false;
581 if( getOrientation() )
583 setClickedValues = event.GetX()>=deviceStart_x && event.GetY()<= (bar_height + deviceStart_y);
587 setClickedValues = event.GetX()>=deviceStart_y && event.GetX()<= (bar_height+deviceStart_y) && event.GetY()>deviceStart_x;
589 if (setClickedValues)
591 setClickedX ( event.GetX() );
592 setClickedY ( event.GetY() );
594 PopupMenu( &c_popmenu, event.GetX(), event.GetY());
598 //------------------------------------------------------------------------------------------------------------
599 // Other methods implementation
600 //------------------------------------------------------------------------------------------------------------
603 * Method that reinitiates attributes of the color bar to the given points
604 * param minRealValue The minimum represented value (real value)
605 * param maxRealValue The maximum represented value (real value)
607 void pColorBar :: reinitiateColorBar(double minRealValue, double maxRealValue)
610 _logicalBar -> clearPoints();
611 showedColorPoints.clear();
613 movingPointIndex = -1;
614 realX_vertical_line = -1;
616 accumTemporalPoints = 0;
617 viewingRange = false;
618 setDegradeState(true);
619 setRepresentedValues(minRealValue, maxRealValue);
623 * Method that reinitiates attributes of the color bar and set the points given by parameter
624 * param pointsVector The the vector of the new points, the color points must have at least two points.
626 void pColorBar :: reinitiateColorBarTo (std::vector<pColorPoint *> pointsVector)
628 _logicalBar -> clearPoints();
629 _logicalBar -> setColorPoints(pointsVector);
630 showedColorPoints.clear();
632 movingPointIndex = -1;
633 realX_vertical_line = -1;
635 accumTemporalPoints = 0;
636 viewingRange = false;
637 setDegradeState(true);
639 double minRealValue = _logicalBar -> getMinValue();
640 double maxRealvalue = _logicalBar -> getMaxValue();
642 setRepresentedValues(minRealValue, maxRealvalue);
646 * Method that sets a copy of the points of the color bar to the given pointer parameter
647 * param pointsList The list for getting the points
649 void pColorBar :: getPointsListWithTemps (std::vector<pColorPoint*> &pointsVector)
652 for (int a =0; a<showedColorPoints.size() ; a++)
654 cPoint = showedColorPoints[a];
655 pColorPoint* copyPoint = new pColorPoint(cPoint->getRealX(), cPoint->getColor( ), (cPoint->isTemporalColor()));
656 pointsVector.push_back(copyPoint);
661 * Method that sets a copy of the points of the color bar to the given pointer parameter, and sets the default values to the needeed attributes, it doesn't
662 * includes the teporal points created
663 * param pointsList The list for getting the points
666 void pColorBar :: getAddedColorsPointsList (std::vector<pColorPoint*> &pointsVector)
669 for (int a =0; a<_logicalBar->getCount(); a++)
671 cPoint = _logicalBar ->getPointAtIndex(a);
672 pColorPoint* copyPoint = new pColorPoint(cPoint->getRealX(), cPoint->getColor( ), (cPoint->isTemporalColor()));
673 pointsVector.push_back(copyPoint);
679 * Adds a color degrade point to the color bar.
680 * param xRealValue The real xValue of the point
681 * param theColour The assigned color for the point
682 * param temporalStart Indicates if the inserted point is the temporal startShowing point
683 * param temporalEnd Indicates if the inserted point is the temporal startShowing point
684 * return Returns true if the point was succesfully inserted.
686 bool pColorBar :: addColorPoint (double xRealValue, wxColour theColour/*, bool temporalStart, bool temporalEnd*/)
688 bool addedPoint = false;
689 addedPoint = _logicalBar->addColorPoint(xRealValue,theColour);
697 * Delets a color degrade point to the color bar.
698 * param xRealValue The real xValue of the point to delete
699 * return Returns true if the point was succesfully inserted.
701 bool pColorBar :: deleteColorPoint (double xRealValue)
703 pColorPoint* actualPoint;
704 bool deletedPoint = false;
705 for (int a =0; a<showedColorPoints.size() && !deletedPoint; a++)
707 actualPoint = showedColorPoints[a];
708 int actualX = (int)actualPoint -> getRealX();
709 bool isInsideActual = figure -> isPointInside (convertToPixelValue(actualX), convertToPixelValue(xRealValue));
710 if( actualX == xRealValue || isInsideActual)
713 deletedPoint = _logicalBar->deleteColorPoint(actualPoint -> getRealX());
722 * Changes the color degrade point color value.
723 * Informs the result of the handled event like a wxCommandEvent wxEVT_CHANGED_COLOR_POINT if the point changed its colour.
724 * param clickedValue The x-coord pixel value of the point to which the color change interests
725 * return Returns true if the color point was succesfully updated.
727 bool pColorBar :: changeColor ( int clickedValue )
729 bool colourUpdated = false;
730 double xRealValue = convertToRealValue( clickedValue );
731 pColorPoint* actualPoint;
732 for (int a =0; a<showedColorPoints.size() && !colourUpdated; a++)
734 actualPoint = showedColorPoints[a];
735 int actualX = (int)actualPoint -> getRealX();
736 bool isInsideActual = figure -> isPointInside (convertToPixelValue(actualX), clickedValue);
737 if( actualX == xRealValue || isInsideActual)
739 wxColour newColour = getSelectedColour();
742 actualPoint -> setColor(newColour);
743 colourUpdated = true;
749 return colourUpdated;
753 * Repaints the color bar in horizontal direction mode
755 void pColorBar :: repaintView( )
758 temp_dc.SelectObject( * colorBar_Bitmap );
759 temp_dc.SetBrush(wxBrush( colourParent ,wxSOLID ));
760 temp_dc.SetPen(wxPen( colourParent,1,wxSOLID ));
761 if (getOrientation())
763 temp_dc.DrawRectangle(0, 0, bar_width, bar_height);
764 temp_dc.SetPen(wxPen( wxColour(167,165,191),1,wxSOLID ));
765 temp_dc.DrawRectangle(0, 0, bar_width-deviceEndMargin, bar_height);
769 temp_dc.DrawRectangle(0, 0, bar_height, bar_width);
770 temp_dc.SetPen(wxPen( wxColour(167,165,191),1,wxSOLID ));
771 temp_dc.DrawRectangle(0, 0, bar_height, bar_width-deviceEndMargin);
773 //wxPoint figPoints[4]; // JPRx
775 if( _logicalBar -> getCount() >0)
777 updatePointsToDraw();
779 int numberEdges = figure->getNumberEdges();
781 figure->getVertexPoints(points);
782 figure ->setVertexPoints (points);
784 int maxValue = showedColorPoints.size();
785 pColorPoint * iniPoint;
786 pColorPoint * endPoint;
787 wxColor intialColor, finalColor;
788 for (int a=0; a<maxValue; a++)
790 iniPoint = showedColorPoints[a];
791 int ini_pixelX = convertToPixelValue(iniPoint -> getRealX());
792 intialColor = iniPoint -> getColor();
798 endPoint = showedColorPoints[a+1];
799 int end_pixelX = convertToPixelValue(endPoint -> getRealX());
800 finalColor = endPoint -> getColor();
802 int rectangle_width = end_pixelX - ini_pixelX;
804 //*************************************************************************************
805 int initial_r = intialColor.Red();
806 int final_r = finalColor.Red() ;
807 int initial_g = intialColor.Green();
808 int final_g= finalColor.Green();
809 int initial_b = intialColor.Blue();
810 int final_b= finalColor.Blue();
812 float m_scope_r = (float)(final_r-initial_r)/rectangle_width;
813 float m_scope_g = (float)(final_g-initial_g)/rectangle_width;
814 float m_scope_b = (float)(final_b-initial_b)/rectangle_width;
816 int next_r = initial_r;
817 int next_g = initial_g;
818 int next_b = initial_b;
820 float nxt_r = (float)next_r;
821 float nxt_g = (float)next_g;
822 float nxt_b = (float)next_b;
824 for (int Xi =ini_pixelX; Xi<= end_pixelX; Xi++)
826 temp_dc.SetBrush(wxBrush( wxColour(next_r, next_g, next_b),wxSOLID ));
827 temp_dc.SetPen(wxPen( wxColour(next_r, next_g, next_b),1,wxSOLID ));
828 if( getOrientation() )
829 temp_dc.DrawLine(Xi, 0, Xi, bar_height);
831 temp_dc.DrawLine(0, Xi, bar_height, Xi);
833 nxt_r = (m_scope_r + nxt_r);
834 nxt_g = (m_scope_g + nxt_g);
835 nxt_b = (m_scope_b + nxt_b);
837 next_r = (int)(nxt_r);
838 next_g = (int)(nxt_g);
839 next_b = (int)(nxt_b);
843 if( movingPointIndex!=-1 && movingNodePoint!=NULL )
845 if ( !(movingNodePoint -> isTemporalColor()) )
847 if( movingNodePoint==iniPoint && movingPointIndex!=-1 )
849 temp_dc.SetBrush(wxBrush( wxColour(5,36,180), wxSOLID ));
850 temp_dc.SetPen(wxPen( wxColour(239,239,239), 1, wxSOLID ));
851 if (getOrientation())
852 temp_dc.DrawPolygon(numberEdges, points, ini_pixelX, 0);
854 temp_dc.DrawPolygon(numberEdges, points, 0, ini_pixelX);
858 temp_dc.SetBrush(wxBrush( intialColor, wxSOLID ));
859 if(iniPoint->isTemporalColor())
860 temp_dc.SetPen(wxPen( intialColor, 1, wxSOLID ));
862 temp_dc.SetPen(wxPen( wxColour(0,0,0), 1, wxSOLID ));
863 if (getOrientation())
864 temp_dc.DrawPolygon(numberEdges, points, ini_pixelX, 0);
866 temp_dc.DrawPolygon(numberEdges, points, 0, ini_pixelX);
872 if ( !(iniPoint -> isTemporalColor()) )
874 temp_dc.SetBrush(wxBrush( intialColor, wxSOLID ));
875 temp_dc.SetPen(wxPen( wxColour(0,0,0), 1, wxSOLID ));
876 if (getOrientation())
877 temp_dc.DrawPolygon(numberEdges, points, ini_pixelX, 0);
879 temp_dc.DrawPolygon(numberEdges, points, 0, ini_pixelX);
883 if (realX_vertical_line!=-1)
885 temp_dc.SetPen(wxPen( guideLineColor,1,wxDOT ));
886 int pixelX_guide = convertToPixelValue(realX_vertical_line);
887 if (getOrientation())
888 temp_dc.DrawLine(pixelX_guide, 0, pixelX_guide, bar_height);
890 temp_dc.DrawLine(0, pixelX_guide, bar_height, pixelX_guide);
896 * Forces the refresh view of the color bar
898 void pColorBar :: RefreshForce ()
904 * Draws the color bar with its degrades
905 * param recentlyChangedOrientation indicates if the orientation has been changed before calling this method
907 void pColorBar :: drawColorBar (bool recentlyChangedOrientation)
909 wxRect rectTotal = GetClientRect();
910 if (recentlyChangedOrientation)
912 if ( getOrientation() ) // HORIZONTAL
914 //SetSize(width, height );
915 wxWindow::SetSize( width, height );
916 //SetSize( rectTotal.GetWidth(), rectTotal.GetHeight() );
917 setWidth(GetClientRect().GetWidth()- deviceEndMargin);
918 //setHeight(GetClientRect().GetHeight());
920 colorBar_Bitmap = new wxBitmap( bar_width+1280, bar_height+1280 );
921 //information_Bitmap = new wxBitmap( width-bar_width, height-bar_height );
925 wxWindow::SetSize( height, width );
926 //SetSize( rectTotal.GetHeight(), rectTotal.GetWidth() );
927 setWidth(GetClientRect().GetHeight()- deviceEndMargin);
928 //setHeight(GetClientRect().GetWidth());
930 //SetWindowStyle( wxNO_FULL_REPAINT_ON_RESIZE );
931 colorBar_Bitmap = new wxBitmap( bar_height+1280, bar_width+1280 );
932 //information_Bitmap = new wxBitmap( height-bar_height, width-bar_width );
938 * Changes the figure of the color points according to the parameter
939 * param figureOrientation Is the corresponding number for identifying the figure
940 * RECTANGLE = 4,TRIANGLE LEFT = -4, TRIANGLE RIGHT = -6, TRIANGLE UP = -8, TRIANGLE DOWN = -2
942 void pColorBar :: changeFigure(int figureOrientation)
944 if ( figureOrientation<1 ) //The figure is a a rotated triangle
946 changePointsFigure_Edges(3);
947 figure -> setFigureOrientation ( figureOrientation );
950 else //The figure is a rectangle
952 changePointsFigure_Edges(4);
958 * Changes the figure used for the degreade color points to the indicated one by parameter
959 * param figEdges Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE)
961 void pColorBar :: changePointsFigure_Edges(int figEdges)
963 figure->setNumberEdges( figEdges);
967 * Gets the constant that represents the figure used for the degreade color points
968 * return figureEdges Is the constant that represents the figure number of edges (TRIANGLE | RECTANGLE)
970 int pColorBar :: getPointsFigure_Edges ()
972 return (figure -> getNumberEdges());
976 * Sets the height of the drawing bar area
977 * param _h The height to set
979 void pColorBar :: setHeight (int _h)
982 bar_height = height-gapY;
986 * Sets the height of the drawing bar area
987 * return _h The height to get
989 int pColorBar :: getHeight()
995 * Sets the width of the drawing bar area
996 * param _w The width to set
998 void pColorBar :: setWidth (int _w)
1001 bar_width = width-gapX;
1005 * Gets the width of the drawing bar area
1006 * param width The width to get
1008 int pColorBar :: getWidth ()
1014 * Sets the height of the containing rectangle bar
1015 * param _h The height to set
1017 void pColorBar :: setBarHeight (int _h)
1023 * Gets the height of the containing rectangle bar
1024 * return bar_height The height to get
1026 int pColorBar :: getBarHeight()
1032 * Sets the width of the containing rectangle bar
1033 * param _w The width to set
1035 void pColorBar :: setBarWidth (int _w)
1041 * Gets the width of the containing rectangle bar
1042 * return bar_width The width to get
1044 int pColorBar :: getBarWidth ()
1050 * Sets the orientation of the color bar
1051 * param _orientation The orientation to set VERTICAL = false, HORIZONTAL = true
1053 void pColorBar :: setOrientation (bool _orientation)
1055 _logicalBar -> setOrientation(_orientation);
1056 figure -> setBarOrientation (_orientation);
1060 * Gets the orientation of the color bar
1061 * return bar_orientation The bar orientation assigned
1063 bool pColorBar :: getOrientation ()
1065 return _logicalBar->getOrientation();
1069 * Sets the collection of color points
1070 * param _points The new points to set, each one of data type pColorPoint ( xValue, wxColour_assigned)
1072 void pColorBar :: setPoints (std::vector<pColorPoint *> _points)
1074 _logicalBar->clearPoints();
1075 showedColorPoints.clear();
1076 _logicalBar->setColorPoints(_points);
1077 //posible needed to update
1081 * Gets the last clickedX pixel coord inside the bar.
1082 * return clickedX The x-coord pixel value
1084 int pColorBar :: getClickedX()
1090 * Sets the last clickedX pixel coord inside the bar.
1091 * param xCoordPixel The x-coord value to set
1093 void pColorBar :: setClickedX(int xCoordPixel)
1095 clickedX = xCoordPixel;
1099 * Gets the last clickedY pixel coord inside the bar.
1100 * return clickedY The y-coord pixel value
1102 int pColorBar :: getClickedY()
1108 * Sets the last clickedY pixel coord inside the bar.
1109 * param yCoordPixel The y-coord pixel value to set
1111 void pColorBar :: setClickedY(int yCoordPixel)
1113 clickedY = yCoordPixel;
1117 * Gets the real x value for a given x-pixel value using the rule real_x = minX_represented_Tshow + ((x_Pixel * (maxX_represented_Tshow - minX_represented_Tshow) ) / bar_width)
1118 * param x_Pixel The pixel value to convert into real value with respect to the x scale
1119 * return realX The real-x value corresponding to the xPixel
1121 double pColorBar :: convertToRealValue ( int x_Pixel )
1124 int newPixel = x_Pixel*(bar_width - deviceEndMargin - deviceStart_x)/(bar_width) ;
1125 return newPixel*(maxX_represented_Tshow - minX_represented_Tshow)/(bar_width);
1127 return minX_represented_Tshow + ((x_Pixel-deviceStart_x) * (maxX_represented_Tshow - minX_represented_Tshow) ) /( bar_width-deviceEndMargin);
1131 * Gets the x-pixel value for a given x_real value using the rule x_pixel = ((x_real - minX_represented_Tshow) * bar_width)/(maxX_represented_Tshow - minX_represented_Tshow)
1132 * param x_Pixel The pixel value to convert into real value with respect to the x scale
1133 * return realX The real-x value corresponding to the xPixel
1135 int pColorBar :: convertToPixelValue (double x_real )
1137 return (int)( ((x_real - minX_represented_Tshow) * (bar_width-deviceEndMargin))/(maxX_represented_Tshow - minX_represented_Tshow) );
1141 * Gets the selected color and updates the state of the okSelectedColor
1142 * return selectedColor Is the selected rbg color
1144 wxColour pColorBar :: getSelectedColour()
1146 okSelectedColor = false;
1149 wxColourDialog dialog( GetParent(), &data);
1151 if ( dialog.ShowModal() == wxID_OK )
1153 col = dialog.GetColourData().GetColour();
1154 okSelectedColor = true;
1160 * Sets the represented minimum and maximunm values
1161 * param minRealValue The minimum represented value (real value)
1162 * param maxRealValue The maximum represented value (real value)
1164 void pColorBar :: setRepresentedValues ( double minRealValue, double maxRealValue )
1166 temporalMinXToShow = (int)minRealValue;
1167 temporalMaxXToShow = (int)maxRealValue;
1169 minX_represented_Tshow = (int)minRealValue;
1170 maxX_represented_Tshow = (int)maxRealValue;
1171 _logicalBar->setMinValue(minX_represented_Tshow);
1172 _logicalBar->setMaxValue(maxX_represented_Tshow);
1176 * Gets the data of the last point moving in a pColorPoint copy
1177 * return pointData Is a pColorPoint with the data of las moved color
1179 pColorPoint * pColorBar :: getLastMovedColorPoint()
1181 pColorPoint * dataPoint = new pColorPoint ( 0, wxColor (0,0,0), false);
1182 if (movingNodePoint)
1184 dataPoint ->setColor(movingNodePoint->getColor());
1185 dataPoint ->setRealX(movingNodePoint->getRealX());
1191 * Sets the gap values for the color bar bitmap
1192 * param gap_x Gap in x
1193 * param gap_y Gap in y
1195 void pColorBar :: setGapValues (int gap_x, int gap_y)
1202 * Sets the degrade state of the color bar
1203 * param newState The degrade stare to set
1205 void pColorBar :: setDegradeState(bool newState)
1207 doingDegrade = newState;
1211 * Gets the degrade state of the color bar
1212 * return doingDegrade is the actual degrade state of the bar
1214 bool pColorBar :: getDegradeState()
1216 return doingDegrade;
1220 * Sets the visible range of the bar and repaints the bar according to it, the min value must be less than the max value.
1221 * param minToShow Is the minimum value to show in the colorbar
1222 * param maxToShow Is the maximum value to show in the colorbar
1224 void pColorBar :: setVisibleRange(int minToShow, int maxToShow)
1226 minX_represented_Tshow = minToShow;
1227 maxX_represented_Tshow = maxToShow;
1228 viewingRange = true;
1233 * Sets the state of static or not for the limit color points
1234 * pamar areStatic Is the state to set for the limits
1236 void pColorBar :: setStaticLimitsTo(bool areStatic)
1238 staticLimits = areStatic;
1242 * Gets the state of static or not for the limit color points
1243 * return staticLimits Is the state for limits
1245 bool pColorBar :: getStaticLimits()
1247 return staticLimits;
1251 * Sets the device start drawing left-superior (pixel) start point and draws automatically the color bar
1252 * param deviceStart_x Pixel start for x-coord
1253 * param deviceStart_y Pixel start for y-coord
1255 void pColorBar :: setDeviceBlitStart ( wxCoord devStart_x, wxCoord devStart_y )
1257 deviceStart_x = devStart_x;
1258 deviceStart_y = devStart_y;
1259 if (getOrientation())
1260 width += deviceStart_x;
1262 height += deviceStart_y;
1267 * Clears the temporal color points of the list
1269 void pColorBar :: clearTemporalColors()
1276 * param activeNow The new state
1278 void pColorBar :: setActiveStateTo (bool activeNow)
1280 activeState = activeNow;
1284 * Gets the active state of the bar
1285 * return isActive The actual state
1287 bool pColorBar :: isActive()
1293 * Gets the real-x value to draw a vertical line
1294 * return realX_vertical_line The real x value for the vertical line
1296 int pColorBar :: getRealX_vertical_line()
1298 return realX_vertical_line;
1302 * Sets the real-x value to draw a vertical line
1303 * param realX_vertical_line The new real x value for the vertical line
1305 void pColorBar :: setRealX_vertical_line(int newReal_x)
1307 realX_vertical_line = newReal_x;
1311 * Sets the new device (deviceEndMargin) value form the end of this panel to the end of the drawing area in the device
1312 * param newDeviceEnd_pixels The new pixel value to asign to the right(horizontal view), underneath(vertical view) margin in pixels
1314 void pColorBar :: setDeviceEndMargin(int newDeviceEnd_pixels)
1316 deviceEndMargin = newDeviceEnd_pixels;
1319 void pColorBar :: createAndSendEvent(WXTYPE theEventType)
1321 wxCommandEvent cevent( theEventType, GetId() );
1322 cevent.SetEventObject( this );
1323 GetEventHandler()->ProcessEvent( cevent );
1328 Returns the number of points that the bar color has
1330 int pColorBar::getColorPointsSize()
1332 return _logicalBar->getCount();
1336 Get the RGB values of the color point that is in the
1337 index given with respecto to the
1339 void pColorBar::getDataAt(int index, double& x,int& red,int& green,int& blue)
1341 //******************************
1342 _logicalBar->getDataAt(index, x, red, green, blue);
1346 * Sets the guide line color
1347 * param theNwGuideLineColor The color to set to the guideLineColor
1349 void pColorBar :: setGuideLineColour(wxColour theNwGuideLineColor)
1351 guideLineColor = theNwGuideLineColor;
1355 * Gets the guide line color
1356 * return guideLineColor The color of the guideLine
1358 wxColour pColorBar :: getGuideLineColour()
1360 return guideLineColor;
1364 * Sets the guide line color
1365 * param theNwGuideLineColor The color to set to the guideLineColor
1367 void pColorBar :: setBackGroundColour(wxColour theNwBackColor)
1369 colourParent = theNwBackColor;
1373 * Gets the guide line color
1374 * return guideLineColor The color of the guideLine
1376 wxColour pColorBar :: getBackGroundColour()
1378 return colourParent;
1382 * Gets the min value of the color bar
1384 double pColorBar :: getMinValue()
1386 return (double)minX_represented_Tshow;
1390 * Gets the max value of the color bar
1392 double pColorBar :: getMaxValue()
1394 return (double)maxX_represented_Tshow;
1398 void pColorBar :: updatePointsToDraw()
1400 accumTemporalPoints = 0;
1401 if (_logicalBar->getCount()>0)
1403 showedColorPoints.clear();
1405 int startIndex, endIndex;
1406 _logicalBar -> getPointersToRangeLimits( showedColorPoints, startIndex, endIndex, minX_represented_Tshow, maxX_represented_Tshow );
1408 int internalCount = _logicalBar->getCount();
1409 std::deque <pColorPoint*>::iterator iterStart = showedColorPoints.begin( );
1410 std::deque <pColorPoint*>::iterator iterEnd = showedColorPoints.end( );
1412 int pixelTmpStart = convertToPixelValue (minX_represented_Tshow);
1413 int pixelTmpEnd = convertToPixelValue (maxX_represented_Tshow);
1414 int initial_r, final_r, initial_g, final_g, initial_b, final_b, rectangle_width;
1415 double realINI, realEND;
1417 bool includeTempStart = false;
1418 bool includeTempEnd = false;
1419 //-----------------Adding the first visible point of the list
1420 if(showedColorPoints.size()>0)
1422 includeTempStart = (int)(showedColorPoints.front()->getRealX())>minX_represented_Tshow ;
1423 includeTempEnd = (int)(showedColorPoints.back()->getRealX())<maxX_represented_Tshow ;
1424 if( startIndex >= 0 )
1426 if( startIndex == 0 )
1428 //The temporal showing point for the start should have the same color of the initial point in range at startIndex
1429 _logicalBar -> getDataAt( startIndex, realINI, initial_r, initial_g, initial_b );
1430 realINI = minX_represented_Tshow;
1431 _logicalBar -> getDataAt( startIndex, realEND, final_r, final_g, final_b );
1433 else if( startIndex > 0 )
1435 _logicalBar -> getDataAt( startIndex-1, realINI, initial_r, initial_g, initial_b );
1436 _logicalBar -> getDataAt( startIndex, realEND, final_r, final_g, final_b );
1439 if( includeTempStart )
1441 int ini_pixelX = convertToPixelValue( realINI );
1442 int end_pixelX = convertToPixelValue( realEND );
1444 rectangle_width = end_pixelX - ini_pixelX;
1446 float m_scope_r = (float)(final_r-initial_r)/rectangle_width;
1447 float m_scope_g = (float)(final_g-initial_g)/rectangle_width;
1448 float m_scope_b = (float)(final_b-initial_b)/rectangle_width;
1451 float bRed = initial_r - m_scope_r*pixelTmpStart;
1452 float bGreen = initial_g - m_scope_g*pixelTmpStart;
1453 float bBlue = initial_b - m_scope_b*pixelTmpStart;
1455 showedColorPoints.push_front( new pColorPoint ( minX_represented_Tshow, wxColour( (m_scope_r*pixelTmpStart)+bRed, (m_scope_g*pixelTmpStart)+bGreen, (m_scope_b*pixelTmpStart)+bBlue ), true));
1457 accumTemporalPoints ++;
1460 if( includeTempEnd && minX_represented_Tshow < maxX_represented_Tshow )
1462 if( internalCount>0 )
1464 if( endIndex == internalCount-1 )
1466 _logicalBar -> getDataAt( endIndex, realINI, initial_r, initial_g, initial_b );
1467 _logicalBar -> getDataAt( endIndex, realEND, final_r, final_g, final_b );
1468 realEND = maxX_represented_Tshow;
1472 _logicalBar -> getDataAt( endIndex, realINI, initial_r, initial_g, initial_b );
1473 _logicalBar -> getDataAt( endIndex+1, realEND, final_r, final_g, final_b );
1476 int ini_pixelX = convertToPixelValue( realINI );
1477 int end_pixelX = convertToPixelValue( realEND );
1479 rectangle_width = end_pixelX - ini_pixelX;
1481 float m_scope_r = (float)(final_r-initial_r)/rectangle_width;
1482 float m_scope_g = (float)(final_g-initial_g)/rectangle_width;
1483 float m_scope_b = (float)(final_b-initial_b)/rectangle_width;
1485 float bRed = initial_r - m_scope_r*pixelTmpEnd;
1486 float bGreen = initial_g - m_scope_g*pixelTmpEnd;
1487 float bBlue = initial_b - m_scope_b*pixelTmpEnd;
1488 showedColorPoints.push_back( new pColorPoint ( maxX_represented_Tshow, wxColour( ( m_scope_r*pixelTmpEnd)+bRed, (m_scope_g*pixelTmpEnd)+bGreen, (m_scope_b*pixelTmpEnd)+bBlue ), true));
1489 accumTemporalPoints ++;
1495 if(_logicalBar->getCount()>0)
1497 if ( minX_represented_Tshow > _logicalBar->getMaxAddedValue() )
1499 endIndex = _logicalBar->getCount()-1;
1501 else if ( maxX_represented_Tshow < _logicalBar->getMinAddedValue() )
1506 _logicalBar -> getDataAt( endIndex, realINI, initial_r, initial_g, initial_b );
1507 _logicalBar -> getDataAt( endIndex, realEND, final_r, final_g, final_b );
1509 realINI = minX_represented_Tshow;
1510 realEND = maxX_represented_Tshow;
1512 showedColorPoints.push_back( new pColorPoint ( realINI, wxColour( initial_r, initial_g, initial_b ), true));
1513 accumTemporalPoints ++;
1514 showedColorPoints.push_back( new pColorPoint ( realEND, wxColour( initial_r, initial_g, initial_b ), true));
1515 accumTemporalPoints ++;
1520 if ( !showedColorPoints.empty() )
1522 startNode_show = showedColorPoints.front();
1523 lastNode_show = showedColorPoints.back();