pLogicalFunction.h

Go to the documentation of this file.
00001 
00002 #ifndef __pLogicalFunction_h__
00003 #define __pLogicalFunction_h__
00004 
00005 // ----------------------------------------------------------------------------
00006 // WX headers inclusion.
00007 // For compilers that support precompilation, includes <wx/wx.h>.
00008 // ----------------------------------------------------------------------------
00009 
00010 #include <wx/wxprec.h>
00011 #ifdef __BORLANDC__
00012 #pragma hdrstop
00013 #endif
00014 #ifndef WX_PRECOMP
00015 #include <wx/wx.h>
00016 #endif
00017 
00018 
00019 //----------------------------------------------------------------------------
00020 // Includes
00021 //----------------------------------------------------------------------------
00022 
00023 #include "pFunctionPoint.h"
00024 #include <iostream>
00025 #include <fstream>
00026 #include <string>
00027 
00028 
00029 
00030 class pLogicalFunction;
00031 //----------------------------------------------------------------------------
00032 // Class definition
00033 //----------------------------------------------------------------------------
00034 #define MAX_POINTS 50
00035 
00036 //if your are going to change se sensible region  you have to change MOVE in pPlotterLayer
00037 #define SENSIBLE_REGION 5
00038 
00039 
00040 class pLogicalFunction: public wxObject
00041 {
00042 public:
00043 
00044         //----------------------------------------------------------------------------
00045         // Constructors
00046         //----------------------------------------------------------------------------
00047         pLogicalFunction( );
00048 
00049         ~pLogicalFunction( );
00050         
00054         /*virtual void Rewind()
00055         {
00056                 node = realPoints.GetFirst();
00057         }
00058         */
00059         
00065         /*virtual bool GetNextXY(double & x, double & y) 
00066         {
00067                 if(node)
00068                 {
00069                         pFunctionPoint* p=(pFunctionPoint*)node->GetData();
00070                         x=p->getRealX();
00071                         y=p->getRealY();
00072                         node=node->GetNext();
00073                         return true;
00074                 }
00075                 return false;
00076         }
00077         */
00078 
00083         /*virtual*/
00084         void GetPoints(wxList &points)
00085         {
00086                 points = realPoints;
00087         }  
00088         /*
00089         * 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  
00090         * x1-validPointRange<x<x1+validPointRange y1-validPointRange<y<y1+validPointRange
00091         */
00092         int validPointOnFunction(wxPoint realPoint);
00093 
00094         //returns the index in the list of the point  
00095         int getIndexOf(wxPoint realpoint);
00096 
00097         /*
00098         * This metohd returns the node of the point that is the movingPointIndex position in the list of points.
00099         * @param: int movingPointIndex, Is the index value of the searched node.
00100         * @return: Return a pointer to the node corresponding to the index value by parameter.
00101         */
00102         wxNode* GetPointAt( int movingPointIndex);
00103 
00104         /*
00105         * Includes a point between two existing points of the this function. The new point (x,y) was not defined when the function was created.
00106         *@ return Returns true is the point was succcesfully added to the funcion.
00107         */
00108         bool AddNewPoint(int x,int y);
00109 
00113         bool AddPoint(int aX, int aY,bool order=true);
00114 
00118         bool DeletePoint(int aX, int aY);
00119 
00123         bool changePoint(wxPoint newCoords, int movingIndexPoint);
00124 
00129         //bool hasPoint(wxPoint aAPoint);
00130 
00134         double * getX_RealValues();
00135 
00139         double* getY_RealValues();
00140         /*
00141         * This method orders the list of points taking into account that the last appended node in the list (realPoint) is the only one disordered.
00142         * @return Returns true if the last point included has a valid value for x and was ordered, according to the definition of function.
00143         */
00144         bool orderPoints();
00145 
00153         //wxNode * findPreviousNodeTo( int realX, int realY );
00154 
00155         /*
00156          * sets the start point of the function
00157          */
00158         void  setStartPoints();
00159 
00160         /*
00161          * sets the end point of the function
00162          */
00163         void setEndPoints();
00164 
00165         /*
00166          * set the max value in x and y between all the points of the function
00167          */
00168         void setMaxPoints();
00169 
00170 
00171         /*
00172          * set the min value in x and y between all the points of the function
00173          */
00174         void setMinPoints();
00175         /*
00176          * Set Up startPoint, endPoint, maxY,maxX points        
00177         */
00178         void setUp();
00179 
00180 
00181         //set if the function has to draw the points  
00182         //void SetShowPoints(bool showPoints);
00183 
00184         //get the paramater showPointsF
00185         //bool getShowPoints();
00186 
00187         //-----------------------
00188         // Persistence
00189         //-----------------------
00190 
00191         /*
00192          Save the points of the function
00193         */
00194         void save(wxString fileName);
00195         /*
00196          Load the points of a function 
00197         */
00198         void load(wxString fileName);
00199 
00200         //----------------------------
00201         //Getters and Setters
00202         //----------------------------
00203 
00204         void setStartX(double aStartX);
00205 
00206         double getStartX();
00207 
00208         void setStartY(double aStartY);
00209 
00210         double getStartY();
00211 
00212         void setEndX(double aEndX);
00213 
00214         double getEndX();
00215 
00216         void setEndY(double aEndY);
00217 
00218         double getEndY();
00219 
00220         void setScaleX(double aScaleX);
00221 
00222         double getScaleX();
00223 
00224         void setScaleY(double aScaleY);
00225 
00226         double getScaleY();
00227 
00228         void setMinX(double aMinX);
00229 
00230         double getMinX();
00231 
00232         void setMinY(double aMinY);
00233 
00234         double getMinY();
00235 
00236         void setMaxX(double aMaxX);
00237 
00238         double getMaxX();
00239 
00240         void setMaxY(double aMaxY);
00241 
00242         double getMaxY();
00243 
00244         void setOffsetX(double aOffsetX);
00245 
00246         double getOffsetX();
00247 
00248         void setOffsetY(double aOffsetY);
00249 
00250         double getOffsetY();
00251 
00252         void setType(int aType);
00253 
00254         int getType();
00255 
00256         int getValidPointRange();
00257 
00258         void setValidPointRange(int theRange);
00259 
00263         bool deletePointAt(int index);
00264         /*
00265         * Returns the number of points that the function
00266         * has
00267         */
00268         int getSizePoints();
00269 
00270         void getDirection(bool &dir);
00271 
00272 
00273 
00274 private:
00275 
00279         double _startX;
00283         double _startY;
00287         double _endX;
00291         double _endY;
00295         double _scaleX;
00299         double _scaleY;
00303         double _minX;
00307         double _minY;
00311         double _maxX;
00312 
00316         double _maxY;
00317 
00321         double _offsetX;
00325         double _offsetY;
00329         int _type;
00333         wxList realPoints;
00334 
00338         double x_Values[MAX_POINTS];
00342         double y_Values[MAX_POINTS];
00346         //wxNode* node;
00347         
00351         int validPointRange;
00352 
00357         bool leftToRigthDef;
00358 
00362         //bool drawing;
00363 
00364 
00365         DECLARE_CLASS (pLogicalFunction)
00366 };
00367 
00368 #endif
00369 
00370 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1