4 // --------------------------------------------------------------------------------------------
5 // WX headers inclusion.
6 // For compilers that support precompilation, includes <wx/wx.h>.
7 // --------------------------------------------------------------------------------------------
18 //--------------------------------------------------------------------------------------------
20 //--------------------------------------------------------------------------------------------
22 #include "pColorBar.h"
23 #include "mBarRange.h"
25 #include "pFunctionPoint.h"
26 #include "pGraphicalFunction.h"
27 #include "pPlotterLayer.h"
28 #include "pPlotterWindow.h"
29 #include "pPlotterScaleY.h"
30 #include "pPlotterScaleX.h"
34 //-------------------------------------------------------------------------------------------------------------
36 //-------------------------------------------------------------------------------------------------------------
37 /** Command IDs used by pColorPoint */
39 //--------------------------------------------------------------------------------------------
41 //--------------------------------------------------------------------------------------------
44 * Represents the integrated plotter that consists of the a drawing area, and control bars (min-max bar, degrade bar)
46 /** @file pPlotter.h */
47 class pPlotter : public wxPanel{
51 //------------------------------------------------------------------------------------------------------------
52 // Constructors & Destructors
53 //------------------------------------------------------------------------------------------------------------
55 * Creates an integrated plotter instance
56 * @param *parent Container window
58 pPlotter (wxWindow *parent,int nWidth, int nHeight);
62 //----------------------------------------------------------------------------------------
64 //----------------------------------------------------------------------------------------
66 // Plotter received events
67 void onChangeFunction (wxCommandEvent& event);
68 void onAddedPoint_Plotter (wxCommandEvent& event);
69 void onRemovedPoint_Plotter (wxCommandEvent& event);
70 void onMovePoint_Plotter (wxCommandEvent& event);
71 void onGuideLines (wxCommandEvent& event);
73 // Color bar received events
74 void onAdded_ColorPoint ( wxCommandEvent& event );
75 void onRemoved_ColorPoint ( wxCommandEvent& event );
76 void onMoved_ColorPoint( wxCommandEvent& event );
77 void onChanged_ColorPoint( wxCommandEvent& event );
78 void onColorBar( wxCommandEvent& event );
80 // Min-Max Barrange received events
81 void onBarrange(wxCommandEvent& event);
82 void onActualChange_Bar(wxCommandEvent& event);
83 void onStartChange_Bar(wxCommandEvent& event);
84 void onEndChange_Bar(wxCommandEvent& event);
85 void onSelectionEnd(wxCommandEvent& event);
86 void onMovedBar(wxCommandEvent& event);
89 * Method for sending a text message to the container window
90 * @param theText Is the text of the message
92 void sendTMessage(wxString theText);
95 wxWindow* initialize(wxWindow *parent);
98 * Sets the text message
99 * @param nMessage Is the text message to set
101 void setTextMessage(wxString nMessage);
104 * Gets the text message
105 * @param text Is the actual text message
107 wxString getTextMessage();
109 * Creates and returns a graphical funcion according to the indicated vectors.
111 pGraphicalFunction* getFunctionForVectors( double* vectorX, int sizeX,double * vectorY, int sizeY );
113 * Add a function to the plotter
114 * when the function doesnt come from window
116 int addFunction(pGraphicalFunction * function);
122 Get a function in the plotter given the index
124 pGraphicalFunction* getFunction(int index);
127 if the user resize the window
129 void OnSize( wxSizeEvent &WXUNUSED(event) );
131 Get a function in the plotter given the index
133 //pGraphicalFunction* getFunction(int index);
136 move the functions that the user wants to move
137 and that were setted in functionsToMove
138 @param porcentageMinX:the porcentage that the minShowed
139 of the funcntions have to be move
140 @param porcentageMaxX:the porcentage that the maxShowed
141 of the funcntions have to be move
144 void moveFunctions(float porcentageMinX,float porcentageMaxX);
147 Adds function to move with the bar min max
149 int addFunctionToMove(pGraphicalFunction * function);
151 Set the bars according to the actual function
156 * deletes the function from the plotter
158 //bool deleteFunction(pGraphicalFunction* function);
161 //--------------------
163 //---------------------
166 Returns the number of points that the bar color has
168 int getColorPointsSize();
171 Get the RGB values of the color point that is in the
174 void getBarColorDataAt(int index,double&x,int& red,int& green,int& blue);
177 returns true if the point was succesfully added
178 PRE: 0<=red<=255 0<=green<=255 0<=blue<=255
180 bool addColorPoint (int x,int red,int green, int blue);
182 void eraseColorPoints();
185 //--------------------
187 //---------------------
188 float getMaxShowedPorcentage();
189 float getMinShowedPorcentage();
190 float getActualShowedPorcentage();
191 //--------------------
192 // plotter Information
193 //---------------------
194 void setActual(pGraphicalFunction* nActual);
197 //----------------------------
198 //Handling Options Menu
199 //----------------------------
201 if any parameter is true, is going to be remove from the popUp menu
203 void setPopUpMenu(bool startD,bool stopD,bool smooth,bool line, bool zoomIn,
204 bool zoomOut,bool showPoints,bool noShowPoints,bool changeColor, bool addP,
205 bool delPoint,bool load,bool save);
209 ** Returns two vectors, the grey level of the point and its value, the value is between [0,1]
211 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value, int histogramsize);
214 ** Returns two vectors, the grey level of the point and its value, the red, green
215 ** and blue value is between [0,1]
217 void GetValuesColorPointsFunction(std::vector<double>& greylevel,
218 std::vector<double>& red,
219 std::vector<double>& green,
220 std::vector<double>& blue);
222 //----------------------------------------------------------------------------------------
223 // Attributes declration
224 //----------------------------------------------------------------------------------------
228 * Represents the plotter widget drawing area
230 pPlotterWindow *m_plot;
232 * Represents the color bar instance
234 pColorBar *color_bar;
236 * Represents the barrange instance
240 * Represents the pointer to the actual funtion in the unified plotter
242 pGraphicalFunction* actualFunction;
245 * Represents the text message
250 * Declaring the existence of the class
252 DECLARE_CLASS (pPlotter)
254 * Declaring the use of events
256 DECLARE_EVENT_TABLE()