pPlotter.h

Go to the documentation of this file.
00001 #ifndef __pPlotter_h__
00002 #define __pPlotter_h__
00003 
00004 // --------------------------------------------------------------------------------------------
00005 // WX headers inclusion.
00006 // For compilers that support precompilation, includes <wx/wx.h>.
00007 // --------------------------------------------------------------------------------------------
00008 
00009 #include <wx/wxprec.h>
00010 #ifdef __BORLANDC__
00011 #pragma hdrstop
00012 #endif
00013 #ifndef WX_PRECOMP
00014 #include <wx/wx.h>
00015 #endif
00016 
00017 
00018 //--------------------------------------------------------------------------------------------
00019 // Includes
00020 //--------------------------------------------------------------------------------------------
00021 
00022 #include "pColorBar.h"
00023 #include "mBarRange.h"
00024 #include "mathplot.h"
00025 #include "pFunctionPoint.h"
00026 #include "pGraphicalFunction.h"
00027 #include "pPlotterLayer.h"
00028 #include "pPlotterWindow.h"
00029 #include "pPlotterScaleY.h"
00030 #include "pPlotterScaleX.h"
00031 #include <iostream>
00032 #include <vector>
00033 
00034 //-------------------------------------------------------------------------------------------------------------
00035 // Enum declarations
00036 //-------------------------------------------------------------------------------------------------------------
00039 //--------------------------------------------------------------------------------------------
00040 // Class definition
00041 //--------------------------------------------------------------------------------------------
00042 
00043 /*
00044 * Represents the integrated plotter that consists of the a drawing area, and control bars (min-max bar, degrade bar)
00045 */
00047 class pPlotter : public wxPanel{
00048 
00049 public:
00050 
00051         //------------------------------------------------------------------------------------------------------------
00052         // Constructors & Destructors
00053         //------------------------------------------------------------------------------------------------------------
00054         /*
00055         * Creates an integrated plotter instance 
00056         * @param *parent Container window
00057         */
00058         pPlotter (wxWindow *parent,int nWidth, int nHeight);
00059 
00060         ~pPlotter ();
00061 
00062     //----------------------------------------------------------------------------------------
00063         // Methods definition
00064         //----------------------------------------------------------------------------------------
00065 
00066         // Plotter received events      
00067         void            onChangeFunction (wxCommandEvent& event);
00068         void            onAddedPoint_Plotter (wxCommandEvent& event);
00069         void            onRemovedPoint_Plotter (wxCommandEvent& event);
00070         void            onMovePoint_Plotter (wxCommandEvent& event);
00071         void            onGuideLines (wxCommandEvent& event);
00072 
00073         // Color bar received events
00074         void            onAdded_ColorPoint ( wxCommandEvent& event );
00075         void            onRemoved_ColorPoint ( wxCommandEvent& event );
00076         void            onMoved_ColorPoint( wxCommandEvent& event );
00077         void            onChanged_ColorPoint( wxCommandEvent& event );
00078         void            onColorBar( wxCommandEvent& event );
00079 
00080         // Min-Max Barrange received events
00081         void         onBarrange(wxCommandEvent& event);
00082         void         onActualChange_Bar(wxCommandEvent& event);
00083         void         onStartChange_Bar(wxCommandEvent& event);
00084         void         onEndChange_Bar(wxCommandEvent& event);
00085         void         onSelectionEnd(wxCommandEvent& event);
00086         void         onMovedBar(wxCommandEvent& event);
00087 
00088         /*
00089         * Method for sending a text message to the container window
00090         * @param theText Is the text of the message
00091         */
00092         void             sendTMessage(wxString theText);
00093 
00094         // Other methods
00095         wxWindow*       initialize(wxWindow *parent);
00096 
00097         /*
00098         * Sets the text message
00099         * @param nMessage Is the text message to set
00100         */
00101         void setTextMessage(wxString nMessage);
00102 
00103         /*
00104         * Gets the text message
00105         * @param text Is the actual text message 
00106         */
00107         wxString getTextMessage();
00111         pGraphicalFunction* getFunctionForVectors( double* vectorX, int sizeX,double * vectorY, int sizeY );
00116         int addFunction(pGraphicalFunction * function);
00117         /*
00118          Set Type
00119         */
00120         void setType(int t);
00121         /*
00122          Get a function in the plotter given the index
00123         */
00124         pGraphicalFunction* getFunction(int index);
00125         
00126         /*
00127                 if the user resize the window   
00128         */
00129         void OnSize( wxSizeEvent &WXUNUSED(event) );
00130         /*
00131          Get a function in the plotter given the index
00132         */
00133         //pGraphicalFunction* getFunction(int index);
00134         
00135         /*
00136           move the functions that the user wants to move
00137           and that were setted in functionsToMove
00138           @param porcentageMinX:the porcentage that the minShowed
00139           of the funcntions have to be move
00140           @param porcentageMaxX:the porcentage that the maxShowed
00141           of the funcntions have to be move
00142 
00143         */
00144         void moveFunctions(float porcentageMinX,float porcentageMaxX);
00145 
00146         /*
00147          Adds  function to move with the bar min max
00148         */
00149         int addFunctionToMove(pGraphicalFunction * function);
00150         /*
00151         Set the bars according to the actual function 
00152         */
00153 
00154         void setAll();
00155         /*
00156         * deletes the function from the plotter
00157         */
00158         //bool deleteFunction(pGraphicalFunction* function);
00159 
00160         
00161         //--------------------
00162         // Color information
00163         //---------------------
00164 
00168         int getColorPointsSize();
00169 
00170         /*
00171          Get the RGB values of the color point that is in the
00172          index given
00173         */
00174         void getBarColorDataAt(int index,double&x,int& red,int& green,int& blue);
00175         /*
00176          add a color Point 
00177          returns true if the point was succesfully added
00178          PRE: 0<=red<=255 0<=green<=255 0<=blue<=255
00179         */
00180         bool addColorPoint (int x,int red,int green, int blue);
00181 
00182         void eraseColorPoints();
00183 
00184                 
00185         //--------------------
00186         // bar Information
00187         //---------------------
00188         float getMaxShowedPorcentage();
00189         float getMinShowedPorcentage(); 
00190         float getActualShowedPorcentage();      
00191         //--------------------
00192         // plotter Information
00193         //---------------------
00194         void setActual(pGraphicalFunction* nActual);
00195         void update();
00196         
00197         //----------------------------
00198         //Handling Options Menu
00199         //----------------------------
00200         /*
00201         if any parameter is true, is going to be remove from the popUp menu
00202         */
00203         void setPopUpMenu(bool startD,bool stopD,bool smooth,bool line, bool zoomIn,
00204                                           bool zoomOut,bool showPoints,bool noShowPoints,bool changeColor, bool addP,
00205                                           bool delPoint,bool load,bool save);
00206 
00207 
00211         void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value, int histogramsize);
00212 
00217         void GetValuesColorPointsFunction(std::vector<double>& greylevel,
00218                                                                         std::vector<double>& red,
00219                                                                         std::vector<double>& green,
00220                                                                         std::vector<double>& blue);
00221         
00222         //----------------------------------------------------------------------------------------
00223         // Attributes declration
00224         //----------------------------------------------------------------------------------------
00225 private: 
00226 
00227         /*
00228         * Represents the plotter widget drawing area
00229         */
00230         pPlotterWindow  *m_plot;
00231         /*
00232         * Represents the color bar instance
00233         */
00234         pColorBar       *color_bar;
00235         /*
00236         * Represents the barrange instance
00237         */
00238         mBarRange       *barrange;
00239         /*
00240         * Represents the pointer to the actual funtion in the unified plotter
00241         */
00242         pGraphicalFunction* actualFunction;
00243 
00244         /*
00245         * Represents the text message 
00246         */
00247         wxString text;
00248 
00249         /*
00250         * Declaring the existence of the class
00251         */
00252         DECLARE_CLASS (pPlotter)
00253         /*
00254         * Declaring the use of events
00255         */
00256         DECLARE_EVENT_TABLE()
00257 };
00258 
00259 #endif
00260 
00261 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1