X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FAPI_Bilat_Graph2D%2FINC%2Fview%2FGLGraph.h;fp=WCudaMSE%2FAPI_Bilat_Graph2D%2FINC%2Fview%2FGLGraph.h;h=d97a47ea66996d3ce658440633387132e4de927e;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/API_Bilat_Graph2D/INC/view/GLGraph.h b/WCudaMSE/API_Bilat_Graph2D/INC/view/GLGraph.h new file mode 100755 index 0000000..d97a47e --- /dev/null +++ b/WCudaMSE/API_Bilat_Graph2D/INC/view/GLGraph.h @@ -0,0 +1,162 @@ +#ifndef GLGRAPH_H_ +#define GLGRAPH_H_ +#include "envGraph.h" +#include "Displayable_A.h" +#include "Viewport.h" +#include "GraphObserver_I.h" +#include "FigureVisitor.h" +#include "Graph.h" +#include "CurveParametric.h" +#include "CurveAnalytic.h" + +#include "GLFigure.h" +#include "GLGraphRunnable.h" + +#include +using std::map; + +#include +using std::queue; + +#include +#include +//#include +//#include + +using std::mutex; +using std::atomic; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +class CBI_GRAPH GLGraph: public GraphObserver_I, public Displayable_A, public FigureVisitor_I + { + public: + GLGraph(Graph* ptrGraph); + + virtual ~GLGraph(); + + /*--------------------------------------*\ + |* Methodes *| + \*-------------------------------------*/ + + /** + * Override + */ + void init(Panel_A &panel); + + /** + * Override + */ + void reshape(Panel_A &panel, int w, int h); + + /** + * Override + */ + void display(Panel_A &panel); + + /** + * Override + */ + void release(Panel_A &panel); + + /** + * Override + */ + void onFigureAdd(Figure* ptrFigure); + + /** + * Override + */ + void onFigureRemove(Figure* ptrFigure); + + /** + * Override + */ + void update(); + + /** + * Override + * visit create the right GLPolylines + */ + virtual void visit(CurveParametric* ptrPolylines); + + /** + * Override + * visit create the right GLCurve + */ + virtual void visit(CurveAnalytic* ptrCurve); + + private: + void computeViewports(Panel_A &panel); + + int computeTitleHeight(Panel_A &panel); + + void drawGraph(Panel_A &panel); + + void drawTitle(Panel_A &panel); + + void drawLegend(Panel_A &panel); + + void drawGraphCadre(Panel_A &panel); + + void drawGraphGrid(Panel_A &panel); + + void processQueue(Panel_A &panel); + + void updateGL(Panel_A &panel); + + const Font_A* loadFont(FontLoader_A* ptrFontLoader, Title* ptrTitle); + + /*--------------------------------------*\ + |* Get *| + \*-------------------------------------*/ + + public: + + Viewport getPanelViewport() const; + + Viewport getGraphViewport() const; + + Viewport getTitleViewport() const; + + Graph* getGraph() const; + + /*--------------------------------------*\ + |* Attributs *| + \*-------------------------------------*/ + + private: + // Inputs + Graph* ptrGraph; + + // Tools + atomic isNeedUpdate; + map mapFigureGL; + queue queueGLGraphRunnable; + Viewport viewportPanel; //in pixel + Viewport viewportGraph; //in pixel + Viewport viewportTitle; //in pixel + + //Thread safe + mutex mutexQueue; + mutex mutexMapFigure; + + static const int LEFT_MARGIN; + static const int RIGHT_MARGIN; + static const int TOP_MARGIN; + static const int BOTTOM_MARGIN; + static const int GRAPH_MARGIN; + static const float TITLE_V_SPACING; + }; + +#endif + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/